protected void initView() { ActionBar actionBar = getSupportActionBar(); actionBar.hide(); mSoftManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mUserInfosDao = DBManager.getInstance(LoginActivity.this).getDaoSession().getUserInfosDao(); mLoginImg = (ImageView) findViewById(R.id.de_login_logo); mUserNameEt = (EditText) findViewById(R.id.app_username_et); mPassWordEt = (EditText) findViewById(R.id.app_password_et); mSignInBt = (Button) findViewById(R.id.app_sign_in_bt); mRegister = (TextView) findViewById(R.id.de_login_register); mFogotPassWord = (TextView) findViewById(R.id.de_login_forgot); mImgBackgroud = (ImageView) findViewById(R.id.de_img_backgroud); mFrUserNameDelete = (FrameLayout) findViewById(R.id.fr_username_delete); mFrPasswordDelete = (FrameLayout) findViewById(R.id.fr_pass_delete); mIsShowTitle = (RelativeLayout) findViewById(R.id.de_merge_rel); mLeftTitle = (TextView) findViewById(R.id.de_left); mRightTitle = (TextView) findViewById(R.id.de_right); mUserList = new ArrayList<User>(); mResultList = new ArrayList<ApiResult>(); mSignInBt.setOnClickListener(this); mRegister.setOnClickListener(this); mLeftTitle.setOnClickListener(this); mRightTitle.setOnClickListener(this); mHandler = new Handler(this); mDialog = new LoadingDialog(this); mEditUserNameEt = new EditTextHolder(mUserNameEt, mFrUserNameDelete, null); mEditPassWordEt = new EditTextHolder(mPassWordEt, mFrPasswordDelete, null); mHandler.post( new Runnable() { @Override public void run() { Animation animation = AnimationUtils.loadAnimation(LoginActivity.this, R.anim.translate_anim); mImgBackgroud.startAnimation(animation); } }); }
protected void initView() { mRealTimeBar = (RelativeLayout) this.findViewById(R.id.layout); mRealTimeBar.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (currentLocationStatus == null) currentLocationStatus = RongIMClient.getInstance() .getRealTimeLocationCurrentState(mConversationType, targetId); if (currentLocationStatus == RealTimeLocationConstant.RealTimeLocationStatus .RC_REAL_TIME_LOCATION_STATUS_INCOMING) { final AlterDialogFragment alterDialogFragment = AlterDialogFragment.newInstance("", "加入位置共享", "取消", "加入"); alterDialogFragment.setOnAlterDialogBtnListener( new AlterDialogFragment.AlterDialogBtnListener() { @Override public void onDialogPositiveClick(AlterDialogFragment dialog) { RealTimeLocationConstant.RealTimeLocationStatus status = RongIMClient.getInstance() .getRealTimeLocationCurrentState(mConversationType, targetId); if (status == null || status == RealTimeLocationConstant.RealTimeLocationStatus .RC_REAL_TIME_LOCATION_STATUS_IDLE) { startRealTimeLocation(); } else { joinRealTimeLocation(); } } @Override public void onDialogNegativeClick(AlterDialogFragment dialog) { alterDialogFragment.dismiss(); } }); alterDialogFragment.show(getSupportFragmentManager()); } else { Intent intent = new Intent(RongActivity.this, RealTimeLocationActivity.class); intent.putExtra("conversationType", mConversationType.getValue()); intent.putExtra("targetId", targetId); startActivity(intent); } } }); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.de_actionbar_back); mHandler = new Handler(this); Intent intent = getIntent(); mUserInfosDao = DBManager.getInstance(this).getDaoSession().getUserInfosDao(); if (intent != null && intent.hasExtra("DEMO_COVERSATIONTYPE") && intent.hasExtra("DEMO_TARGETID") && intent.hasExtra("DEMO_COVERSATION")) { if (DemoContext.getInstance() != null) { String conversation = intent.getStringExtra("DEMO_COVERSATION"); targetId = intent.getStringExtra("DEMO_TARGETID"); String conversationType = intent.getStringExtra("DEMO_COVERSATIONTYPE"); openConversationFragment(conversation, targetId, conversationType); } } // push或通知过来 if (intent != null && intent.getData() != null && intent.getData().getScheme().equals("rong") && intent.getData().getQueryParameter("push") != null) { // 通过intent.getData().getQueryParameter("push") 为true,判断是否是push消息 if (DemoContext.getInstance() != null && intent.getData().getQueryParameter("push").equals("true")) { String id = intent.getData().getQueryParameter("pushId"); RongIM.getInstance().getRongIMClient().recordNotificationEvent(id); enterActivity(intent); } } else if (intent != null) { // 程序切到后台,收到消息后点击进入,会执行这里 if (RongIM.getInstance() == null || RongIM.getInstance().getRongIMClient() == null) { if (DemoContext.getInstance() != null) { String token = DemoContext.getInstance().getSharedPreferences().getString("DEMO_TOKEN", "default"); reconnect(token); } } else { enterFragment(intent); } } }