Java Code Examples for com.easemob.util.EMLog#e()
The following examples show how to use
com.easemob.util.EMLog#e() .
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: RecorderVideoActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
@SuppressLint("NewApi") private boolean initCamera() { try { if (frontCamera == 0) { mCamera = Camera.open(CameraInfo.CAMERA_FACING_BACK); } else { mCamera = Camera.open(CameraInfo.CAMERA_FACING_FRONT); } Camera.Parameters camParams = mCamera.getParameters(); mCamera.lock(); mSurfaceHolder = mVideoView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mCamera.setDisplayOrientation(90); } catch (RuntimeException ex) { EMLog.e("video", "init Camera fail " + ex.getMessage()); return false; } return true; }
Example 2
Source File: RecorderVideoActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
public void stopRecording() { if (mediaRecorder != null) { mediaRecorder.setOnErrorListener(null); mediaRecorder.setOnInfoListener(null); try { mediaRecorder.stop(); } catch (IllegalStateException e) { EMLog.e("video", "stopRecording error:" + e.getMessage()); } } releaseRecorder(); if (mCamera != null) { mCamera.stopPreview(); releaseCamera(); } }
Example 3
Source File: RecorderVideoActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
public void sendVideo(View view) { if (TextUtils.isEmpty(localPath)) { EMLog.e("Recorder", "recorder fail please try again!"); return; } msc = new MediaScannerConnection(this, new MediaScannerConnectionClient() { @Override public void onScanCompleted(String path, Uri uri) { System.out.println("scanner completed"); msc.disconnect(); setResult(RESULT_OK, getIntent().putExtra("uri", uri)); finish(); } @Override public void onMediaScannerConnected() { msc.scanFile(localPath, "video/*"); } }); msc.connect(); }
Example 4
Source File: MainActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
/** * 显示帐号在别处登录dialog */ private void showConflictDialog() { isConflictDialogShow = true; MYApplication.getInstance().logout(null); String st = getResources().getString(R.string.Logoff_notification); if (!MainActivity.this.isFinishing()) { // clear up global variables try { if (conflictBuilder == null) conflictBuilder = new android.app.AlertDialog.Builder( MainActivity.this); conflictBuilder.setTitle(st); conflictBuilder.setMessage(R.string.connect_conflict); conflictBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); conflictBuilder = null; finish(); startActivity(new Intent(MainActivity.this, LoginActivity.class)); } }); conflictBuilder.setCancelable(false); conflictBuilder.create().show(); isConflict = true; } catch (Exception e) { EMLog.e(TAG, "---------color conflictBuilder error" + e.getMessage()); } } }
Example 5
Source File: MainActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
/** * 帐号被移除的dialog */ private void showAccountRemovedDialog() { isAccountRemovedDialogShow = true; MYApplication.getInstance().logout(null); String st5 = getResources().getString(R.string.Remove_the_notification); if (!MainActivity.this.isFinishing()) { // clear up global variables try { if (accountRemovedBuilder == null) accountRemovedBuilder = new android.app.AlertDialog.Builder( MainActivity.this); accountRemovedBuilder.setTitle(st5); accountRemovedBuilder.setMessage(R.string.em_user_remove); accountRemovedBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); accountRemovedBuilder = null; finish(); startActivity(new Intent(MainActivity.this, LoginActivity.class)); } }); accountRemovedBuilder.setCancelable(false); accountRemovedBuilder.create().show(); isCurrentAccountRemoved = true; } catch (Exception e) { EMLog.e(TAG, "---------color userRemovedBuilder error" + e.getMessage()); } } }
Example 6
Source File: RecorderVideoActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override public void surfaceCreated(SurfaceHolder holder) { if (mCamera == null) initCamera(); try { mCamera.setPreviewDisplay(mSurfaceHolder); mCamera.startPreview(); handleSurfaceChanged(); } catch (IOException e1) { EMLog.e("video", "start preview fail " + e1.getMessage()); } }
Example 7
Source File: RecorderVideoActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override public void onError(MediaRecorder mr, int what, int extra) { EMLog.e("video", "recording onError:"); stopRecording(); Toast.makeText(this, "Recording error has occurred. Stopping the recording", Toast.LENGTH_SHORT).show(); }
Example 8
Source File: EaseShowBigImageActivity.java From monolog-android with MIT License | 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(); localFilePath = getLocalFilePath(remoteFilePath); final EMCallBack callback = new EMCallBack() { public void onSuccess() { runOnUiThread(new Runnable() { @Override public void run() { 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 (pd != null) { pd.dismiss(); } } }); } public void onError(int error, String msg) { EMLog.e(TAG, "offline file transfer error:" + msg); File file = new File(localFilePath); if (file.exists()&&file.isFile()) { file.delete(); } runOnUiThread(new Runnable() { @Override public void run() { pd.dismiss(); image.setImageResource(default_res); } }); } 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() { pd.setMessage(str2 + progress + "%"); } }); } }; EMChatManager.getInstance().downloadFile(remoteFilePath, localFilePath, headers, callback); }
Example 9
Source File: EaseChatRowVoicePlayClickListener.java From monolog-android with MIT License | 4 votes |
@Override public void onClick(View v) { String st = activity.getResources().getString(R.string.Is_download_voice_click_later); if (isPlaying) { if (playMsgId != null && playMsgId.equals(message.getMsgId())) { currentPlayListener.stopPlayVoice(); return; } currentPlayListener.stopPlayVoice(); } if (message.direct == EMMessage.Direct.SEND) { // for sent msg, we will try to play the voice file directly playVoice(voiceBody.getLocalUrl()); } else { if (message.status == EMMessage.Status.SUCCESS) { File file = new File(voiceBody.getLocalUrl()); if (file.exists() && file.isFile()) playVoice(voiceBody.getLocalUrl()); else EMLog.e(TAG, "file not exist"); } else if (message.status == EMMessage.Status.INPROGRESS) { Toast.makeText(activity, st, Toast.LENGTH_SHORT).show(); } else if (message.status == EMMessage.Status.FAIL) { Toast.makeText(activity, st, Toast.LENGTH_SHORT).show(); new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { EMChatManager.getInstance().asyncFetchMessage(message); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); adapter.notifyDataSetChanged(); } }.execute(); } } }