コード例 #1
0
 /** 评论,回复评论时只能输入文字的模式 */
 private void switchTestOnlyMode() {
   if (mInputTextOnly.getVisibility() == View.VISIBLE) {
     mInputTextOnly.setVisibility(View.INVISIBLE);
     mBottom.setVisibility(View.VISIBLE);
     // 隐藏输入法
     InputMethodUtils.hideSoftInput(mContext, mEditText);
     mListView.requestFocus();
   } else {
     mInputTextOnly.setVisibility(View.VISIBLE);
     mBottom.setVisibility(View.INVISIBLE);
     // 显示输入法
     InputMethodUtils.showSoftInputMethod(mContext, mEditText);
     mEditText.requestFocus();
   }
 }
コード例 #2
0
  @Override
  public boolean dispatchTouchEvent(MotionEvent event) {
    // BUG #57535
    // 【发帖】发帖页面键盘弹出后,如果这时点击手机的HOME键、电源键或其他输入键盘上手机自带按钮进入其他页面,再返回到发帖页面,输入键盘会隐藏,小键盘按钮会高亮显示
    if (isOpenComment) {
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        int[] l = {0, 0};
        mEditContent.getLocationInWindow(l);
        int left = l[0], top = l[1];
        int bottom = top + mEditContent.getHeight(), right = left + mEditContent.getWidth();
        System.out.println(
            "left:" + left + "; top:" + top + ";bottom:" + bottom + ";right:" + right);
        if (event.getX() > left
            && event.getX() < right
            && event.getY() > top
            && event.getY() < bottom) {
          mInputBar.showCommonInputBar();
          // return false;
        } else {
          InputMethodUtils.collapseSoftInputMethod(mContext, mEditContent.getWindowToken());
          // return true;
        }
      }
    }

    return super.dispatchTouchEvent(event);
  }
コード例 #3
0
 /** 隐藏输入法 */
 private void hideInput() {
   // BUG #58725 【47997】【论坛】跟帖录音:编辑跟帖,录音点击暂停后点击非跟帖编辑区域,录音图标一直存在
   mInputBar.cancelRecord();
   mBottomInput.setVisibility(View.INVISIBLE);
   mBottom.setVisibility(View.VISIBLE);
   // 隐藏输入法
   InputMethodUtils.hideSoftInput(mContext, mEditContent);
   mListView.requestFocus();
 }
コード例 #4
0
 /** 显示输入法 */
 private void showInput() {
   mBottomInput.setVisibility(View.VISIBLE);
   mBottom.setVisibility(View.INVISIBLE);
   // mInputBar.hideAll();
   mInputBar.showCommonInputBar();
   // 显示输入法
   InputMethodUtils.showSoftInputMethod(mContext, mEditContent);
   mEditContent.requestFocus();
 }
コード例 #5
0
 @Override
 protected void onStart() {
   super.onStart();
   System.out.println("aaaa onStart");
   if (isOpenComment) { // 判断跟帖输入框是否打开
     Log.d("aa", "onStart aaaa:" + mInputBar.getCurrentSelectedTabId());
     if (mInputBar.getCurrentSelectedTabId() != CommonInputBar.TAB_KEYBOARD) {
       // 隐藏输入法
       Log.d("aa", "onStart aaaa隐藏输入法");
       InputMethodUtils.hideSoftInput(mContext, mEditContent);
       // mListView.requestFocus();
     }
   }
 }
コード例 #6
0
  @Override
  public void onClick(View v) {
    int id = v.getId();
    if (id == R.id.rl_post_detail_love) {
      // TODO点赞
      if (!NetUtil.hasNet()) {
        return;
      }
      if (mPraise_done != -1) {
        if (PraiseTask.mPraiseMap.get(mMainId) == null) {
          PraiseTask.mPraiseMap.put(mMainId, 1);
          new PraiseTask(new PraiseEventBean(mMainId, mPraise_num, mPraise_done)).execute();
        } else {
          // 操作请求中,不要频繁点击
          GlobalToast.showToast(R.string.common_donnot_touchme, 0);
        }
      }
    } else if (id == R.id.rl_post_detail_comment) {
      // 评论
      // TODO弹出输入框
      switchMode();
    } else if (id == R.id.rl_input) {
      switchMode();
    } else if (id == R.id.btn_send) {
      mInputBar.cancelRecord();
      // 发表跟帖
      Boolean enable = (Boolean) v.getTag();
      if (mEditContent == null || enable == null || !enable) {
        return;
      } else {
        String temp = mEditContent.getText().toString().replaceAll(" ", "");
        temp = temp.replaceAll("\n", "");
        if (temp.length() == 0) {
          GlobalToast.showToast(R.string.post_content_empty_hit, 0);
          return;
        }
      }
      new FollowTask(mMainId, mInputBar).execute();
      // new SumitTopicTask(mMainPostId, mInputBar).execute();
      // BUG #56254 建议:【47984】【论坛】发布跟帖-网络不可用时,提示失败信息,再点击评论按钮,之前输入的评论还保存
      // clearEditText(mEditContent);
      switchMode();

    } else if (id == R.id.et_input) {
      // 点击输入框
      // fix BUG #57668 建议:【论坛】发表跟帖时,输入框操作会跳动影响使用体验,建议优化
      if (mInputBar.getCurrentSelectedTabId() != CommonInputBar.TAB_KEYBOARD) {
        // mInputBar.setTabSelect(CommonInputBar.TAB_KEYBOARD);
        mInputBar.showCommonInputBar();
      }
      // mInputBar.showCommonInputBar();
    } else if (id == R.id.btn_more) {
      // 点击查看更多跟帖
      // GlobalToast.showToast("全部跟帖", 0);
      UIHelper.showAllFollowActivity(mContext, mMainId, mFollow_num);
    } else if (id == R.id.rl_input_textonly) {
      switchTestOnlyMode();
    } else if (id == R.id.btn_send_text) {
      String text = mEditText.getText().toString();
      Boolean enable = (Boolean) v.getTag();
      if (text == null || enable == null || !enable) {
        return;
      }
      if (!TextUtils.isEmpty(text)) {
        if (replyType == 1) {
          // 评论跟帖
          ReplyFollowInfo info = new ReplyFollowInfo(mReplyFollowInfo.tid, text);
          new MyReplyFollowTask(info).execute();
        } else if (replyType == 2) {
          // 回复评论
          ReplyComment replyComment =
              new ReplyComment(mReplyInfo.oid, mReplyInfo.rid, mReplyInfo.user.uid, text);
          new MyReplyCommentTask(replyComment).execute();
        }
        clearEditText(mEditText);
      }
      switchTestOnlyMode();
    } else if (id == R.id.et_input_text) {
      if (mEditText.isFocused()) {
        //
        // ToastUtils.hideSoftInput(mContext, mEditText);
        // mListView.requestFocus();
      } else {
        InputMethodUtils.showSoftInputMethod(mContext, mEditText);
        mEditText.requestFocus();
      }
    }
  }