@Override public void onBackPressed() { Log.d(TAG, "onBackPressed!"); if (RecordVoiceBtnController.mIsPressed) { mChatView.dismissRecordDialog(); mChatView.releaseRecorder(); RecordVoiceBtnController.mIsPressed = false; } if (mChatView.getMoreMenu().getVisibility() == View.VISIBLE) { mChatView.dismissMoreMenu(); } else { mChatController.resetUnreadMsg(); } super.onBackPressed(); }
@Override protected void onResume() { if (!RecordVoiceBtnController.mIsPressed) mChatView.dismissRecordDialog(); String targetID = getIntent().getStringExtra(JChatDemoApplication.TARGET_ID); boolean isGroup = getIntent().getBooleanExtra(JChatDemoApplication.IS_GROUP, false); if (isGroup) { try { long groupID = getIntent().getLongExtra(JChatDemoApplication.GROUP_ID, 0); if (groupID == 0) { JMessageClient.enterGroupConversation(Long.parseLong(targetID)); } else JMessageClient.enterGroupConversation(groupID); } catch (NumberFormatException nfe) { nfe.printStackTrace(); } } else if (null != targetID) { JMessageClient.enterSingleConversaion(targetID); } mChatController.getAdapter().initMediaPlayer(); Log.i(TAG, "[Life cycle] - onResume"); super.onResume(); }