private void initView() { mCustomUserID = getIntent().getStringExtra("CustomUserID"); name = getIntent().getStringExtra("name"); image = getIntent().getStringExtra("image"); bitmap = IMSDKMainPhoto.get(mCustomUserID); mChatView = new IMChatView(IMChatActivitys.this, mCustomUserID); // 为IMChatView实例配置参数 mChatView.setMaxGifCountInMessage(10); mChatView.setUserMainPhotoVisible(true); mChatView.setUserMainPhotoCornerRadius(10); mChatView.setTitleBarVisible(true); mChatView.setTitle(name); // 添加到当前activity setContentView(mChatView); // 添加头像点击事件监听 mChatView.setOnHeadPhotoClickListener( new IMChatView.OnHeadPhotoClickListener() { @Override public void onClick(View v, String customUserID) { Toast.makeText(IMChatActivitys.this, "您点击了" + customUserID, Toast.LENGTH_SHORT).show(); } }); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // 为了实现点击返回键隐藏表情栏 mChatView.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // 为了实现捕获用户选择的图片 mChatView.onActivityResult(requestCode, resultCode, data); }