Exemplo n.º 1
0
  @Override
  protected void initViews() {
    super.initViews();

    // 转发时把输入框的大小稍微设置小一些
    mEditText.setMinimumHeight(DeviceUtils.dp2px(this, 80));
    mEditText.setHint(ResFinder.getString("umeng_comm_write_sth"));
    // 隐藏选择图片的图标
    mGridView.setVisibility(View.GONE);

    // 隐藏话题,地理位置、图片和拍照的图标
    findViewById(ResFinder.getId("umeng_community_loc_layout")).setVisibility(View.GONE);
    findViewById(ResFinder.getId("umeng_comm_loc_layout")).setVisibility(View.GONE);
    findViewById(ResFinder.getId("umeng_comm_topic_layout")).setVisibility(View.GONE);
    findViewById(ResFinder.getId("umeng_comm_take_photo_layout")).setVisibility(View.GONE);
    findViewById(ResFinder.getId("umeng_comm_pick_photo_layout")).setVisibility(View.GONE);
    // 设置转发时,图片跟文本layout可见
    findViewById(ResFinder.getId("umeng_comm_forward_layout")).setVisibility(View.VISIBLE);

    //
    mBottomTabLayout = findViewById(ResFinder.getId("umeng_community_post_tab_bar"));
    int paddingRight = getResources().getDisplayMetrics().widthPixels - DeviceUtils.dp2px(this, 80);
    mBottomTabLayout.setPadding(
        mBottomTabLayout.getPaddingLeft(),
        mBottomTabLayout.getPaddingTop(),
        paddingRight,
        mBottomTabLayout.getPaddingBottom());

    // 显示转发文本的TextView
    mFeedText = (TextView) findViewById(ResFinder.getId("umeng_comm_forward_text"));
    mFeedIcon = (ImageView) findViewById(ResFinder.getId("umeng_comm_forward_img"));
    mTopicTipView.setVisibility(View.GONE); // 转发页面不显示提示话题VIew
  }
 /**
  * </br>
  *
  * @return
  */
 private ViewGroup createPointLinearlayout() {
   LinearLayout pointContainerLayout = new LinearLayout(getContext());
   LinearLayout.LayoutParams params =
       new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
   pointContainerLayout.setLayoutParams(params);
   pointContainerLayout.setOrientation(LinearLayout.HORIZONTAL);
   pointContainerLayout.setGravity(Gravity.CENTER);
   params.gravity = Gravity.CENTER;
   params.topMargin = DeviceUtils.dp2px(getContext(), 15);
   params.bottomMargin = DeviceUtils.dp2px(getContext(), 15);
   return pointContainerLayout;
 }
Exemplo n.º 3
0
  /** 初始化EditView并设置回调</br> */
  private void initEditView() {

    mEditText = (FeedEditText) findViewById(ResFinder.getId("umeng_comm_post_msg_edittext"));
    mEditText.setFocusableInTouchMode(true);
    mEditText.requestFocus();
    mEditText.setMinimumHeight(DeviceUtils.dp2px(this, 150));

    mEditText.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            mEditText.mCursorIndex = mEditText.getSelectionStart();
            mFragmentLatout.setVisibility(View.GONE);
            mTopicButton.setChecked(false);
          }
        });

    mEditText.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (count == 1) {
              String newChar = s.subSequence(start, start + count).toString();
              // 转发时不显示话题
              if (CHAR_WELL.equals(newChar) && !isForwardFeed) {
                showTopicFragment();
              } else if (CHAR_AT.equals(newChar)) {
                showAtFriendsDialog();
              }
            }
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {}
        });
  }
 private void computeBoardHeight() {
   BOARD_HEIGHT = DeviceUtils.dp2px(getContext(), 140);
 }
Exemplo n.º 5
0
  @SuppressWarnings("deprecation")
  private void initUIComponents() {
    // 设置Fragment
    addFragment(ResFinder.getId("umeng_comm_user_info_fragment_container"), mPostedFragment);

    // 选中的某个tab时的文字颜色
    mSelectedColor = ResFinder.getColor("umeng_comm_text_topic_light_color");

    // 初始化feed、好友、粉丝、back、设置的listener
    findViewById(ResFinder.getId("umeng_comm_posted_layout")).setOnClickListener(this);
    findViewById(ResFinder.getId("umeng_comm_follow_user_layout")).setOnClickListener(this);
    findViewById(ResFinder.getId("umeng_comm_my_fans_layout")).setOnClickListener(this);
    findViewById(ResFinder.getId("umeng_comm_setting_back")).setOnClickListener(this);

    // 举报用户的Dialog
    mReportDialog = new UserReportDialog(this);
    mReportDialog.setTargetUid(mUser.id);

    Button settingButton = (Button) findViewById(ResFinder.getId("umeng_comm_save_bt"));
    settingButton.setBackgroundDrawable(ResFinder.getDrawable("umeng_comm_more"));
    RelativeLayout.LayoutParams params =
        (RelativeLayout.LayoutParams) settingButton.getLayoutParams();
    params.width = DeviceUtils.dp2px(this, 20);
    params.height = DeviceUtils.dp2px(this, 20);
    params.rightMargin = DeviceUtils.dp2px(getApplicationContext(), 10);
    settingButton.setLayoutParams(params);
    settingButton.setOnClickListener(
        new LoginOnViewClickListener() {

          @Override
          protected void doAfterLogin(View v) {
            mReportDialog.show();
          }
        });
    // 如果是用户自己,则不显示设置菜单按钮【目前菜单只有举报功能,即自己不能举报自己】
    if (mUser.id.equals(CommConfig.getConfig().loginedUser.id)
        || mUser.permisson == Permisson.SUPPER_ADMIN) {
      settingButton.setVisibility(View.GONE);
    }

    TextView titleTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_setting_title"));
    titleTextView.setText(ResFinder.getString("umeng_comm_user_center"));
    //
    mPostedTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_posted_msg_tv"));
    mPostedTv.setTextColor(mSelectedColor);

    //
    mPostedCountTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_posted_count_tv"));
    mPostedCountTv.setTextColor(mSelectedColor);

    mFollowedUserTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_followed_user_tv"));
    mFollowedUserCountTv =
        mViewFinder.findViewById(ResFinder.getId("umeng_comm_follow_user_count_tv"));

    mFansTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_my_fans_tv"));
    mFansCountTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_fans_count_tv"));
    // 昵称
    mUserNameTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_name_tv"));
    mUserNameTv.setText(mUser.name);

    mHeaderImageView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_header"));

    ImgDisplayOption option = ImgDisplayOption.getOptionByGender(mUser.gender);
    mHeaderImageView.setImageUrl(mUser.iconUrl, option);

    // 用户性别
    mGenderImageView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_gender"));

    // 关注按钮
    mFollowToggleButton = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_follow"));
    mFollowToggleButton.setOnClickListener(
        new Listeners.LoginOnViewClickListener() {

          @Override
          protected void doAfterLogin(View v) {
            mFollowToggleButton.setClickable(false);
            // true为选中状态为已关注,此时显示文本为“取消关注”;false代表未关注,此时显示文本为“关注”
            if (mFollowToggleButton.isChecked()) {
              mPresenter.followUser(mResultListener);
            } else {
              mPresenter.cancelFollowUser(mResultListener);
            }
          }
        });

    mAlbumTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_albums_tv"));
    mAlbumTextView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            jumpToActivityWithUid(AlbumActivity.class);
          }
        });
    mTopicTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_topic_tv"));
    mTopicTextView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            jumpToActivityWithUid(FollowedTopicActivity.class);
          }
        });

    // 用户自己(在未登录的情况下,点击设置跳转到登录,此时传递进来的uid是空的情况),隐藏关注按钮,显示设置按钮
    // // 如果是超级管理员且已经关注,则隐藏取消关注按钮
    if (isHideFollowStatus()) {
      mFollowToggleButton.setVisibility(View.GONE);
    }
    initCommentView();
  }