private void updateImage(String userLogo) {
   int width = AppContext.getDimensionPixelSize(R.dimen.image_width);
   BitmapLoaderManager.getInstance()
       .loadBitmap(
           ImageSizeUtils.get140x140(userLogo),
           mUserLogo,
           width,
           width,
           AppContext.getBitmap(R.drawable.icon_66x66));
 }
 private void updateTextBasedOnPager(int pager) {
   if (pager == 1) {
     mText2.setTextColor(
         AppContext.getAppContext().getResources().getColor(R.color.main_ui_name_color));
     mText1.setTextColor(
         AppContext.getAppContext().getResources().getColor(R.color.detail_middle_textcolor));
   } else {
     mText1.setTextColor(
         AppContext.getAppContext().getResources().getColor(R.color.main_ui_name_color));
     mText2.setTextColor(
         AppContext.getAppContext().getResources().getColor(R.color.detail_middle_textcolor));
   }
 }
Ejemplo n.º 3
0
 private View createTextView(Message item, String mCurrentUid) {
   ViewTag tag;
   View convertView;
   if (!mCurrentUid.equalsIgnoreCase(item.getUid())) {
     convertView =
         LayoutInflater.from(AppContext.getAppContext())
             .inflate(R.layout.chat_room_type_left, null);
   } else {
     convertView =
         LayoutInflater.from(AppContext.getAppContext())
             .inflate(R.layout.chat_room_type_right, null);
   }
   ImageView icon = (ImageView) convertView.findViewById(R.id.chat_room_icon);
   TextView time = (TextView) convertView.findViewById(R.id.chat_room_time);
   TextView content = (TextView) convertView.findViewById(R.id.content);
   tag = new ViewTag(content, time, icon);
   convertView.setTag(tag);
   return convertView;
 }
Ejemplo n.º 4
0
 private View createSystemMsgView(Message item) {
   View convertView =
       LayoutInflater.from(AppContext.getAppContext())
           .inflate(R.layout.chat_room_type_system_msg, null);
   ImageView icon = (ImageView) convertView.findViewById(R.id.chat_room_icon);
   TextView time = (TextView) convertView.findViewById(R.id.chat_room_time);
   TextView content = (TextView) convertView.findViewById(R.id.chat_room_system_msg);
   ViewTag tag = new ViewTag(content, time, icon);
   convertView.setTag(tag);
   return convertView;
 }
 private void onClickChat() {
   String userName = FriendFacade.getInstance().getFriendName(mUid);
   if (userName == null) {
     return;
   }
   Intent i = new Intent(AppContext.getAppContext(), MainUIActivity.class);
   i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   i.putExtra(NotificationFactory.CHAT_ROOM_ID, MessageIdUtils.createRoomId(mUid));
   i.putExtra(NotificationFactory.CHAT_ROOM_NAME, userName != null ? userName : mUid);
   startActivity(i);
 }
Ejemplo n.º 6
0
  private void onQQComplete(Object obj) {
    // 获得的数据是JSON格式的,获得你想获得的内容
    // 如果你不知道你能获得什么,看一下下面的LOG
    QQToken token = mTencent.getQQToken();

    mUserInfo = new QQUserInfo();
    mUserInfo.expireTime = mTencent.getExpiresIn();
    mUserInfo.accessToken = token.getAccessToken();
    mUserInfo.openId = token.getOpenId();

    UserInfo userInfo = new UserInfo(AppContext.getAppContext(), mTencent.getQQToken());
    userInfo.getUserInfo(new BaseApiListener());
  }
Ejemplo n.º 7
0
 private void initLogo(Message item, View view) {
   ViewTag tag = (ViewTag) view.getTag();
   String uid = item.getUid();
   String currentUid = UserInfo.getInstance().getUid();
   int width = AppContext.getDimensionPixelSize(R.dimen.msg_time_size);
   if (currentUid.equalsIgnoreCase(uid)) {
     BitmapLoaderManager.getInstance()
         .loadBitmap(
             ImageSizeUtils.get96x96(UserInfo.getInstance().getUserLogo()),
             tag.icon,
             width,
             width,
             AppContext.getBitmap(R.drawable.icon_96x96));
   } else {
     BitmapLoaderManager.getInstance()
         .loadBitmap(
             ImageSizeUtils.get96x96(FriendFacade.getInstance().getFriendLogo(uid)),
             tag.icon,
             width,
             width,
             AppContext.getBitmap(R.drawable.icon_96x96));
   }
 }
Ejemplo n.º 8
0
  public void login(Context context) {

    // 第一个参数就是上面所说的申请的APPID,第二个是全局的Context上下文,这句话实现了调用QQ登录
    mTencent = Tencent.createInstance(ThirdpartyConstant.QQ_APP_ID, AppContext.getAppContext());

    /**
     * 通过这句代码,SDK实现了QQ的登录,这个方法有三个参数,第一个参数是context上下文,第二个参数SCOPO 是一个String类型的字符串,表示一些权限
     * 官方文档中的说明:应用需要获得哪些API的权限,由“,”分隔。例如:SCOPE = “get_user_info,add_t”;所有权限用“all”
     * 第三个参数,是一个事件监听器,IUiListener接口的实例,这里用的是该接口的实现类
     */
    if (!mTencent.isSessionValid()) {
      mTencent.login((Activity) context, "all", new BaseUiListener());
    }
  }
Ejemplo n.º 9
0
 @Override
 public void onError(UiError error) {
   Toast.makeText(AppContext.getAppContext(), error.errorMessage, Toast.LENGTH_LONG).show();
 }