예제 #1
0
  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();
          }
        });
  }
예제 #2
0
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   // 为了实现点击返回键隐藏表情栏
   mChatView.onKeyDown(keyCode, event);
   return super.onKeyDown(keyCode, event);
 }
예제 #3
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   // 为了实现捕获用户选择的图片
   mChatView.onActivityResult(requestCode, resultCode, data);
 }