Java Code Examples for com.hyphenate.util.EMLog#d()
The following examples show how to use
com.hyphenate.util.EMLog#d() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EaseChatRowVideo.java From Social with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { EMVideoMessageBody videoBody = (EMVideoMessageBody) message.getBody(); EMLog.d(TAG, "video view is on click"); Intent intent = new Intent(context, EaseShowVideoActivity.class); intent.putExtra("localpath", videoBody.getLocalUrl()); intent.putExtra("secret", videoBody.getSecret()); intent.putExtra("remotepath", videoBody.getRemoteUrl()); if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } activity.startActivity(intent); }
Example 2
Source File: EaseChatRowVideo.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
@Override protected void onBubbleClick() { EMVideoMessageBody videoBody = (EMVideoMessageBody) message.getBody(); EMLog.d(TAG, "video view is on click"); Intent intent = new Intent(context, EaseShowVideoActivity.class); intent.putExtra("localpath", videoBody.getLocalUrl()); intent.putExtra("secret", videoBody.getSecret()); intent.putExtra("remotepath", videoBody.getRemoteUrl()); if (message != null && message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) { try { EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId()); } catch (Exception e) { e.printStackTrace(); } } activity.startActivity(intent); }
Example 3
Source File: EaseVoiceRecorder.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
public int stopRecoding() { if(recorder != null){ isRecording = false; recorder.stop(); recorder.release(); recorder = null; if(file == null || !file.exists() || !file.isFile()){ return EMError.FILE_INVALID; } if (file.length() == 0) { file.delete(); return EMError.FILE_INVALID; } int seconds = (int) (new Date().getTime() - startTime) / 1000; EMLog.d("voice", "voice recording finished. seconds:" + seconds + " file length:" + file.length()); return seconds; } return 0; }
Example 4
Source File: EaseNotifier.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
public synchronized void onNewMesg(List<EMMessage> messages) { if(EMClient.getInstance().chatManager().isSilentMessage(messages.get(messages.size()-1))){ return; } EaseSettingsProvider settingsProvider = EaseUI.getInstance().getSettingsProvider(); if(!settingsProvider.isMsgNotifyAllowed(null)){ return; } // check if app running background if (!EasyUtils.isAppRunningForeground(appContext)) { EMLog.d(TAG, "app is running in backgroud"); sendNotification(messages, false); } else { sendNotification(messages, true); } vibrateAndPlayTone(messages.get(messages.size()-1)); }
Example 5
Source File: EaseNotifier.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
/** * handle the new message * this function can be override * * @param message */ public synchronized void onNewMsg(EMMessage message) { if(EMClient.getInstance().chatManager().isSilentMessage(message)){ return; } EaseSettingsProvider settingsProvider = EaseUI.getInstance().getSettingsProvider(); if(!settingsProvider.isMsgNotifyAllowed(message)){ return; } // check if app running background if (!EasyUtils.isAppRunningForeground(appContext)) { EMLog.d(TAG, "app is running in backgroud"); sendNotification(message, false); } else { sendNotification(message, true); } vibrateAndPlayTone(message); }
Example 6
Source File: CallReceiver.java From Social with Apache License 2.0 | 6 votes |
@Override public void onReceive(Context context, Intent intent) { if ( !EMClient.getInstance().isLoggedInBefore()) return; //拨打方username String from = intent.getStringExtra("from"); //call type String type = intent.getStringExtra("type"); if("video".equals(type)){ //视频通话 Toast.makeText(context,"收到视频聊天请求",Toast.LENGTH_LONG).show(); Log.d("CallReceiver","收到视频聊天请求"); context.startActivity(new Intent(context, VideoCallActivity.class). putExtra("username", from).putExtra("isComingCall", true). addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); }else if ("voice".equals(type)){ //音频通话 context.startActivity(new Intent(context, VoiceeCallActivity.class). putExtra("username", from).putExtra("isComingCall", true). addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } EMLog.d("CallReceiver", "app received a incoming call"); }
Example 7
Source File: EaseNotifier.java From nono-android with GNU General Public License v3.0 | 6 votes |
public synchronized void onNewMesg(List<EMMessage> messages) { if(EMClient.getInstance().chatManager().isSlientMessage(messages.get(messages.size()-1))){ return; } EaseUI.EaseSettingsProvider settingsProvider = EaseUI.getInstance().getSettingsProvider(); if(!settingsProvider.isMsgNotifyAllowed(null)){ return; } // 判断app是否在后台 if (!EasyUtils.isAppRunningForeground(appContext)) { EMLog.d(TAG, "app is running in backgroud"); sendNotification(messages, false); } else { sendNotification(messages, true); } viberateAndPlayTone(messages.get(messages.size() - 1)); }
Example 8
Source File: EaseVoiceRecorder.java From Social with Apache License 2.0 | 6 votes |
public int stopRecoding() { if(recorder != null){ isRecording = false; recorder.stop(); recorder.release(); recorder = null; if(file == null || !file.exists() || !file.isFile()){ return EMError.FILE_INVALID; } if (file.length() == 0) { file.delete(); return EMError.FILE_INVALID; } int seconds = (int) (new Date().getTime() - startTime) / 1000; EMLog.d("voice", "voice recording finished. seconds:" + seconds + " file length:" + file.length()); return seconds; } return 0; }
Example 9
Source File: EaseNotifier.java From nono-android with GNU General Public License v3.0 | 6 votes |
/** * 处理新收到的消息,然后发送通知 * * 开发者可以重载此函数 * this function can be override * * @param message */ public synchronized void onNewMsg(EMMessage message) { if(EMClient.getInstance().chatManager().isSlientMessage(message)){ return; } EaseUI.EaseSettingsProvider settingsProvider = EaseUI.getInstance().getSettingsProvider(); if(!settingsProvider.isMsgNotifyAllowed(message)){ return; } // 判断app是否在后台 if (!EasyUtils.isAppRunningForeground(appContext)) { EMLog.d(TAG, "app is running in backgroud"); sendNotification(message, false); } else { sendNotification(message, true); } viberateAndPlayTone(message); }
Example 10
Source File: EaseNotifier.java From Social with Apache License 2.0 | 6 votes |
/** * 处理新收到的消息,然后发送通知 * * 开发者可以重载此函数 * this function can be override * * @param message */ public synchronized void onNewMsg(EMMessage message) { if(EMClient.getInstance().chatManager().isSlientMessage(message)){ return; } EaseSettingsProvider settingsProvider = EaseUI.getInstance().getSettingsProvider(); if(!settingsProvider.isMsgNotifyAllowed(message)){ return; } // 判断app是否在后台 if (!EasyUtils.isAppRunningForeground(appContext)) { EMLog.d(TAG, "app is running in backgroud"); sendNotification(message, false); } else { sendNotification(message, true); } viberateAndPlayTone(message); }
Example 11
Source File: EaseContactAdapter.java From Social with Apache License 2.0 | 5 votes |
@Override protected synchronized void publishResults(CharSequence constraint, FilterResults results) { userList.clear(); userList.addAll((List<EaseUser>)results.values); EMLog.d(TAG, "publish contacts filter results size: " + results.count); if (results.count > 0) { notiyfyByFilter = true; notifyDataSetChanged(); notiyfyByFilter = false; } else { notifyDataSetInvalidated(); } }
Example 12
Source File: EaseImageUtils.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
public static String getImagePath(String remoteUrl) { String imageName= remoteUrl.substring(remoteUrl.lastIndexOf("/") + 1, remoteUrl.length()); String path =PathUtil.getInstance().getImagePath()+"/"+ imageName; EMLog.d("msg", "image path:" + path); return path; }
Example 13
Source File: EaseContactAdapter.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
@Override protected synchronized void publishResults(CharSequence constraint, FilterResults results) { userList.clear(); userList.addAll((List<EaseUser>)results.values); EMLog.d(TAG, "publish contacts filter results size: " + results.count); if (results.count > 0) { notiyfyByFilter = true; notifyDataSetChanged(); notiyfyByFilter = false; } else { notifyDataSetInvalidated(); } }
Example 14
Source File: EaseShowVideoActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.ease_showvideo_activity); loadingLayout = (RelativeLayout) findViewById(R.id.loading_layout); progressBar = (ProgressBar) findViewById(R.id.progressBar); localFilePath = getIntent().getStringExtra("localpath"); String remotepath = getIntent().getStringExtra("remotepath"); String secret = getIntent().getStringExtra("secret"); EMLog.d(TAG, "show video view file:" + localFilePath + " remotepath:" + remotepath + " secret:" + secret); if (localFilePath != null && new File(localFilePath).exists()) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(localFilePath)), "video/mp4"); startActivity(intent); finish(); } else if (!TextUtils.isEmpty(remotepath) && !remotepath.equals("null")) { EMLog.d(TAG, "download remote video file"); Map<String, String> maps = new HashMap<String, String>(); if (!TextUtils.isEmpty(secret)) { maps.put("share-secret", secret); } downloadVideo(remotepath, maps); } else { } }
Example 15
Source File: EaseImageUtils.java From Social with Apache License 2.0 | 5 votes |
public static String getImagePath(String remoteUrl) { String imageName= remoteUrl.substring(remoteUrl.lastIndexOf("/") + 1, remoteUrl.length()); String path =PathUtil.getInstance().getImagePath()+"/"+ imageName; EMLog.d("msg", "image path:" + path); return path; }
Example 16
Source File: EaseShowBigImageActivity.java From Social with Apache License 2.0 | 4 votes |
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ease_activity_show_big_image); super.onCreate(savedInstanceState); image = (EasePhotoView) findViewById(R.id.image); loadLocalPb = (ProgressBar) findViewById(R.id.pb_load_local); default_res = getIntent().getIntExtra("default_image", R.drawable.ease_default_avatar); Uri uri = getIntent().getParcelableExtra("uri"); String remotepath = getIntent().getExtras().getString("remotepath"); localFilePath = getIntent().getExtras().getString("localUrl"); String secret = getIntent().getExtras().getString("secret"); EMLog.d(TAG, "show big image uri:" + uri + " remotepath:" + remotepath); //本地存在,直接显示本地的图片 if (uri != null && new File(uri.getPath()).exists()) { EMLog.d(TAG, "showbigimage file exists. directly show it"); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); // int screenWidth = metrics.widthPixels; // int screenHeight =metrics.heightPixels; bitmap = EaseImageCache.getInstance().get(uri.getPath()); if (bitmap == null) { EaseLoadLocalBigImgTask task = new EaseLoadLocalBigImgTask(this, uri.getPath(), image, loadLocalPb, ImageUtils.SCALE_IMAGE_WIDTH, ImageUtils.SCALE_IMAGE_HEIGHT); if (android.os.Build.VERSION.SDK_INT > 10) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } else { image.setImageBitmap(bitmap); } } else if (remotepath != null) { //去服务器下载图片 EMLog.d(TAG, "download remote image"); Map<String, String> maps = new HashMap<String, String>(); if (!TextUtils.isEmpty(secret)) { maps.put("share-secret", secret); } downloadImage(remotepath, maps); } else { image.setImageResource(default_res); } image.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
Example 17
Source File: EaseShowBigImageActivity.java From Social with Apache License 2.0 | 4 votes |
/** * 下载图片 * * @param remoteFilePath */ private void downloadImage(final String remoteFilePath, final Map<String, String> headers) { String str1 = getResources().getString(R.string.Download_the_pictures); pd = new ProgressDialog(this); pd.setProgressStyle(ProgressDialog.STYLE_SPINNER); pd.setCanceledOnTouchOutside(false); pd.setMessage(str1); pd.show(); File temp = new File(localFilePath); final String tempPath = temp.getParent() + "/temp_" + temp.getName(); final EMCallBack callback = new EMCallBack() { public void onSuccess() { runOnUiThread(new Runnable() { @Override public void run() { new File(tempPath).renameTo(new File(localFilePath)); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int screenWidth = metrics.widthPixels; int screenHeight = metrics.heightPixels; bitmap = ImageUtils.decodeScaleImage(localFilePath, screenWidth, screenHeight); if (bitmap == null) { image.setImageResource(default_res); } else { image.setImageBitmap(bitmap); EaseImageCache.getInstance().put(localFilePath, bitmap); isDownloaded = true; } if (EaseShowBigImageActivity.this.isFinishing() || EaseShowBigImageActivity.this.isDestroyed()) { return; } if (pd != null) { pd.dismiss(); } } }); } public void onError(int error, String msg) { EMLog.e(TAG, "offline file transfer error:" + msg); File file = new File(tempPath); if (file.exists()&&file.isFile()) { file.delete(); } runOnUiThread(new Runnable() { @Override public void run() { if (EaseShowBigImageActivity.this.isFinishing() || EaseShowBigImageActivity.this.isDestroyed()) { return; } image.setImageResource(default_res); pd.dismiss(); } }); } public void onProgress(final int progress, String status) { EMLog.d(TAG, "Progress: " + progress); final String str2 = getResources().getString(R.string.Download_the_pictures_new); runOnUiThread(new Runnable() { @Override public void run() { if (EaseShowBigImageActivity.this.isFinishing() || EaseShowBigImageActivity.this.isDestroyed()) { return; } pd.setMessage(str2 + progress + "%"); } }); } }; EMClient.getInstance().chatManager().downloadFile(remoteFilePath, tempPath, headers, callback); }
Example 18
Source File: EaseImageUtils.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
public static String getThumbnailImagePath(String thumbRemoteUrl) { String thumbImageName= thumbRemoteUrl.substring(thumbRemoteUrl.lastIndexOf("/") + 1, thumbRemoteUrl.length()); String path =PathUtil.getInstance().getImagePath()+"/"+ "th"+thumbImageName; EMLog.d("msg", "thum image path:" + path); return path; }
Example 19
Source File: EaseImageUtils.java From Social with Apache License 2.0 | 4 votes |
public static String getThumbnailImagePath(String thumbRemoteUrl) { String thumbImageName= thumbRemoteUrl.substring(thumbRemoteUrl.lastIndexOf("/") + 1, thumbRemoteUrl.length()); String path =PathUtil.getInstance().getImagePath()+"/"+ "th"+thumbImageName; EMLog.d("msg", "thum image path:" + path); return path; }
Example 20
Source File: EaseShowBigImageActivity.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ease_activity_show_big_image); super.onCreate(savedInstanceState); image = (EasePhotoView) findViewById(R.id.image); ProgressBar loadLocalPb = (ProgressBar) findViewById(R.id.pb_load_local); default_res = getIntent().getIntExtra("default_image", R.drawable.ease_default_avatar); Uri uri = getIntent().getParcelableExtra("uri"); localFilePath = getIntent().getExtras().getString("localUrl"); String msgId = getIntent().getExtras().getString("messageId"); EMLog.d(TAG, "show big msgId:" + msgId ); //show the image if it exist in local path if (uri != null && new File(uri.getPath()).exists()) { EMLog.d(TAG, "showbigimage file exists. directly show it"); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); // int screenWidth = metrics.widthPixels; // int screenHeight =metrics.heightPixels; bitmap = EaseImageCache.getInstance().get(uri.getPath()); if (bitmap == null) { EaseLoadLocalBigImgTask task = new EaseLoadLocalBigImgTask(this, uri.getPath(), image, loadLocalPb, ImageUtils.SCALE_IMAGE_WIDTH, ImageUtils.SCALE_IMAGE_HEIGHT); if (android.os.Build.VERSION.SDK_INT > 10) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } else { image.setImageBitmap(bitmap); } } else if(msgId != null) { downloadImage(msgId); }else { image.setImageResource(default_res); } image.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); }