@Override
 protected void onPostExecute(BabyInfoList result) {
   // TODO Auto-generated method stub
   super.onPostExecute(result);
   closeProgressDialog();
   if (null != result) {
     if (result.getStatus().equals("0")) {
       list = result.getBabyInfoList();
       if (list == null || list.size() == 0) {
         UIHelper.ToastMessage(context, "您还没有添加宝宝信息");
         // BabyInfoListActivity.this.finish();
         // backAnim();
         return;
       }
       showProgressDialog(context, "", getResources().getString(R.string.load_ing));
       current_position = 0;
       // 加载第一个宝宝的默认信息
       new GetupdateBabyTask()
           .execute(
               list.get(0).getChildId(),
               AppContext.getApp().getUserLoginSharedPre().getUserInfo().getUserId(),
               "");
     } else {
       UIHelper.ToastMessage(context, result.getStatusMessage());
       return;
     }
   } else {
     if (null != e) {
       e.makeToast(context);
     }
     return;
   }
 }
 @Override
 protected void onResume() {
   super.onResume();
   newReplyMsgBadgeView.setTargetView(fl_common_zxhf);
   new GetNewCommentsCountTask(context, newReplyMsgBadgeView)
       .execute(AppContext.getApp().getToken(), Constant.COMMNETTYPE_ZXDT);
 }
 @Override
 protected BabyInfoDetail doInBackground(String... params) {
   babyInfoDetail = null;
   try {
     babyInfoDetail = AppContext.getApp().getupdateBaby(params[0], params[1], params[2]);
   } catch (AppException e) {
     this.e = e;
     e.printStackTrace();
   }
   return babyInfoDetail;
 }
 @Override
 protected BabyInfoList doInBackground(String... params) {
   babyInfoList = null;
   try {
     babyInfoList = AppContext.getApp().getBabyNameList(params[0]);
   } catch (AppException e) {
     this.e = e;
     e.printStackTrace();
   }
   return babyInfoList;
 }
 // 执行这个方法 此方法重新开启一个来执行网络接口读数据的
 // 操作,将得到的结果List<Preferential>,传送给onPostExecute方法
 @Override
 protected Result doInBackground(String... params) {
   Result result = null;
   try {
     result = AppContext.getApp().deleteBaby(params[0], params[1], params[2]);
   } catch (AppException e) {
     // TODO Auto-generated catch block
     this.e = e;
     e.printStackTrace();
   }
   return result;
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_zxdt_teacher);
    context = this;

    initView();
    new GetNewCommentsCountTask(context, newReplyMsgBadgeView)
        .execute(AppContext.getApp().getToken(), Constant.COMMNETTYPE_ZXDT);
    content();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    context = this;
    setContentView(R.layout.myepei_babyinfo);
    options = Options.getListOptions();

    initView();
    // 加载宝宝信息列表
    showProgressDialog(context, "", getResources().getString(R.string.load_ing));
    new GetBabyListTask().execute(AppContext.getApp().getToken());
  }
 @Override
 protected Result doInBackground(String... params) {
   Result result = null;
   try {
     if (Constant.COMMNETTYPE_ZXDT.equals(type)) {
       result = AppContext.getApp().deleteDynamic(params[0], params[1]);
       typeDesc = "动态";
     } else if (Constant.COMMNETTYPE_JTZY.equals(type)) {
       result = AppContext.getApp().deleteHomework(params[0], params[1]);
       typeDesc = "作业";
     } else if (Constant.COMMNETTYPE_ZXDP.equals(type)) {
       result = AppContext.getApp().deleteRemark(params[0], params[1]);
       typeDesc = "点评";
     } else if (Constant.COMMNETTYPE_JZXS.equals(type)) {
       result = AppContext.getApp().deletevoice(params[0], params[1]);
       typeDesc = "心声";
     }
   } catch (AppException e) {
     this.e = e;
     e.printStackTrace();
   }
   return result;
 }
    // 执行这个方法 此方法重新开启一个来执行网络接口读数据的
    // 操作,将得到的结果List<Preferential>,传送给onPostExecute方法
    @Override
    protected DynamicTeacherList doInBackground(String... params) {

      try {
        dynamicTeacherList = AppContext.getApp().getTeacherMyDynamic(params[0], params[1]);

      } catch (AppException e) {
        // TODO Auto-generated catch block
        this.e = e;
        e.printStackTrace();
        dynamicTeacherList = null;
      }
      return dynamicTeacherList;
    }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   // TODO Auto-generated method stub
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == Constant.REQUSTCONDE_BABYINFO_CATLIST
       && resultCode == Constant.REQUSTCONDE_BABYINFO_CATLIST) {
     // 加载宝宝信息列表
     if (current_position >= 0 && current_position <= list.size() - 1) {
       new GetupdateBabyTask()
           .execute(
               list.get(current_position).getChildId(),
               AppContext.getApp().getUserLoginSharedPre().getUserInfo().getUserId(),
               "");
     }
   }
 }
    // 这个方法可以执行UI线程里操作界面的东西,类似于new handler里面的东东
    @Override
    protected void onPostExecute(Result result) {

      super.onPostExecute(result);

      if (result != null) {
        if (result.getStatus().equals("0")) {
          UIHelper.ToastMessage(context, "删除成功", Toast.LENGTH_SHORT);
          // 加载宝宝信息列表
          showProgressDialog(context, "", getResources().getString(R.string.load_ing));
          new GetBabyListTask().execute(AppContext.getApp().getToken());
        } else {
          UIHelper.ToastMessage(context, result.getStatusMessage());
          return;
        }
      } else {
        if (null != e) {
          e.makeToast(context);
        }
        return;
      }
    }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;
    if (null == convertView) {
      holder = new ViewHolder();
      convertView = View.inflate(context, R.layout.list_zxdp_jz_item, null);

      holder.iv_list_common_title_logo =
          (ImageView) convertView.findViewById(R.id.iv_list_common_title_logo);
      holder.tv_list_common_title_teachername =
          (TextView) convertView.findViewById(R.id.tv_list_common_title_teachername);
      holder.tv_list_common_title_orgname =
          (TextView) convertView.findViewById(R.id.tv_list_common_title_orgname);
      holder.tv_list_common_title_time =
          (TextView) convertView.findViewById(R.id.tv_list_common_title_time);
      holder.tv_list_zxdt_jz_item_content =
          (TextView) convertView.findViewById(R.id.tv_list_zxdt_jz_item_content);
      holder.ll_list_common_ssh_zan =
          (LinearLayout) convertView.findViewById(R.id.ll_list_common_ssh_zan);
      holder.ll_list_common_ssh_sc =
          (LinearLayout) convertView.findViewById(R.id.ll_list_common_ssh_sc);
      holder.ll_list_zxdt_jz_item_commentlist =
          (NoScrollListView) convertView.findViewById(R.id.ll_list_zxdt_jz_item_commentlist);
      holder.ll_list_common_ssh_fx =
          (LinearLayout) convertView.findViewById(R.id.ll_list_common_ssh_fx);
      holder.tv_list_common_ssh_commentcount =
          (TextView) convertView.findViewById(R.id.tv_list_common_ssh_commentcount);
      holder.et_list_common_pinglun_reply =
          (EditText) convertView.findViewById(R.id.et_list_zxdt_jz_item_comment_reply);
      holder.btn_list_zxdt_jz_item_comment_send =
          (Button) convertView.findViewById(R.id.btn_list_zxdt_jz_item_comment_send);
      holder.tv_list_common_ssh_sc =
          (TextView) convertView.findViewById(R.id.tv_list_common_ssh_sc);
      holder.ngv_list_zxdt_jz_item_imagelist =
          (NoScrollGridView) convertView.findViewById(R.id.ngv_list_zxdt_jz_item_imagelist);
      holder.tv_list_common_ssh_zan =
          (TextView) convertView.findViewById(R.id.tv_list_common_ssh_zan);
      holder.ll_list_commom_zan = (LinearLayout) convertView.findViewById(R.id.ll_list_commom_zan);
      holder.tv_list_common_zan = (TextView) convertView.findViewById(R.id.tv_list_common_zan);
      holder.tv_list_common_zan_count =
          (TextView) convertView.findViewById(R.id.tv_list_common_zan_count);
      holder.iv_list_common_ssh_zan =
          (ImageView) convertView.findViewById(R.id.iv_list_common_ssh_zan); // 赞图标
      holder.iv_list_common_ssh_sc =
          (ImageView) convertView.findViewById(R.id.iv_list_common_ssh_sc);
      holder.ll_list_zxdp_js_item_starlist =
          (NoScrollListView) convertView.findViewById(R.id.ll_list_zxdp_js_item_starlist);
      holder.ll_list_common_ssh_comment =
          (LinearLayout) convertView.findViewById(R.id.ll_list_common_ssh_comment);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.resetContentAndListener();

    final Remark remark = listItems.get(position);
    showPicture(remark.getUserPhoto(), holder.iv_list_common_title_logo, options);

    if (null != remark.getUserName() && !remark.getUserName().equals("")) {
      holder.tv_list_common_title_teachername.setText(remark.getUserName());
    } else {
      holder.tv_list_common_title_teachername.setText("");
    }
    if (null != remark.getOrgName() && !remark.getOrgName().equals("")) {
      holder.tv_list_common_title_orgname.setText("来自" + remark.getOrgName());
    } else {
      holder.tv_list_common_title_orgname.setText("来自");
    }
    if (null != remark.getSendTime() && !remark.getSendTime().equals("")) {
      holder.tv_list_common_title_time.setText(
          DateUtil.getSimpleChineseDateTimeWithoutSec(remark.getSendTime(), "yyyy-MM-dd HH:mm:ss"));
    } else {
      holder.tv_list_common_title_time.setText("");
    }
    if (remark.getRatingList() != null && remark.getRatingList().size() > 0) {
      ListViewRatingAdapter listViewRatingAdapter =
          new ListViewRatingAdapter(context, remark.getRatingList());
      holder.ll_list_zxdp_js_item_starlist.setVisibility(View.VISIBLE);
      holder.ll_list_zxdp_js_item_starlist.setAdapter(listViewRatingAdapter);
    } else {
      holder.ll_list_zxdp_js_item_starlist.setVisibility(View.GONE);
      //			holder.ll_list_zxdp_js_item_starlist.setAdapter(null);
    }
    if (null != remark.getContent() && !remark.getContent().equals("")) {
      holder.tv_list_zxdt_jz_item_content.setText(remark.getContent());
      holder.tv_list_zxdt_jz_item_content.setOnLongClickListener(
          new OnLongClickListener() {
            @Override
            public boolean onLongClick(View arg0) {
              BaseTools.copyText(context, holder.tv_list_zxdt_jz_item_content.getText().toString());
              return false;
            }
          });
    } else {
      holder.tv_list_zxdt_jz_item_content.setText("");
    }
    if (null != remark.getCommentCount()
        && !remark.getCommentCount().toString().trim().equals("")) {
      holder.tv_list_common_ssh_commentcount.setText("(" + remark.getCommentCount() + ")");
    } else {
      holder.tv_list_common_ssh_commentcount.setText("(0)");
    }
    if (remark.getCurrenUserFav()) {
      holder.tv_list_common_ssh_sc.setText(R.string.dynamic_favorite_yes);
      holder.iv_list_common_ssh_sc.setImageResource(R.drawable.haveshoucang);
    } else {
      holder.tv_list_common_ssh_sc.setText(R.string.dynamic_favorite_no);
      holder.iv_list_common_ssh_sc.setImageResource(R.drawable.shoucang);
    }
    if (remark.getCurrenUserLike()) {
      holder.tv_list_common_ssh_zan.setText(R.string.text_islike_liked);
      holder.iv_list_common_ssh_zan.setImageResource(R.drawable.havelike);
    } else {
      holder.tv_list_common_ssh_zan.setText(R.string.text_islike_like);
      holder.iv_list_common_ssh_zan.setImageResource(R.drawable.like);
    }
    if (remark.getPhotoList() != null && remark.getPhotoList().size() > 0) {
      GridViewImagesAdapter listViewImagesAdapter =
          new GridViewImagesAdapter(context, remark.getPhotoList());
      holder.ngv_list_zxdt_jz_item_imagelist.setVisibility(View.VISIBLE);
      holder.ngv_list_zxdt_jz_item_imagelist.setAdapter(listViewImagesAdapter);
    } else {
      //			holder.ngv_list_zxdt_jz_item_imagelist.setAdapter(null);
      holder.ngv_list_zxdt_jz_item_imagelist.setVisibility(View.GONE);
    }
    holder.ngv_list_zxdt_jz_item_imagelist.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ArrayList<String> imgsUrl = new ArrayList<String>();
            for (Photo photo : remark.getPhotoList()) {
              imgsUrl.add(
                  URLs.URL_IMG_API_HOST + photo.getThumbPath() + "/" + photo.getThumbSaveName());
            }
            Intent intent = new Intent();
            intent.putStringArrayListExtra("infos", imgsUrl);
            intent.putExtra("imgPosition", position);
            intent.setClass(context, ImageShowActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
          }
        });
    if (remark.getLikeList() != null && remark.getLikeList().size() > 0) {
      List<Like> list = remark.getLikeList();
      UserInfo uiserInfo = AppContext.getApp().getUserLoginSharedPre().getUserInfo();
      StringBuffer sBuffer = new StringBuffer();
      for (Like like : list) {
        if (uiserInfo.getUserId().equals(like.getUserId())) {
          holder.tv_list_common_ssh_zan.setText(R.string.text_islike_liked);
          holder.iv_list_common_ssh_zan.setImageResource(R.drawable.havelike);
          remark.setCurrenUserLike(true);

        } else {
          holder.tv_list_common_ssh_zan.setText(R.string.text_islike_like);
          holder.iv_list_common_ssh_zan.setImageResource(R.drawable.like);
          remark.setCurrenUserLike(false);
        }
        sBuffer.append(like.getUserAppe());
        sBuffer.append(",");
      }
      String str = sBuffer.toString();
      if (str.endsWith(",")) {
        str = str.substring(0, str.length() - 1);
      }
      holder.ll_list_commom_zan.setVisibility(View.VISIBLE);
      holder.tv_list_common_zan.setText(str);
      holder.tv_list_common_zan_count.setText(" 共" + list.size() + "人");

    } else {
      holder.ll_list_commom_zan.setVisibility(View.GONE);
    }

    holder.ll_list_common_ssh_zan.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            holder.ll_list_common_ssh_zan.setClickable(false);
            new LikeTask(
                    remark.getLikeList(),
                    context,
                    new TaskCallBack() {
                      @Override
                      public void onTaskFinshed() {
                        remark.setCurrenUserLike(!remark.getCurrenUserLike());
                        holder.ll_list_common_ssh_zan.setClickable(true);
                        ListViewRemarkParentAdapter.this.notifyDataSetChanged();
                      }
                    })
                .execute(
                    AppContext.getApp().getToken(),
                    remark.getRemarkId(),
                    Constant.COMMNETTYPE_ZXDP,
                    remark.getCurrenUserLike() ? "1" : "0"); // 当前已赞,需取消(1),否则不取消(0)
          }
        });
    holder.ll_list_common_ssh_fx.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            String imgUrlString = "";
            if (remark.getPhotoList().size() > 0) {
              imgUrlString = URLs.formatImgURL(remark.getPhotoList().get(0));
            }
            AppContext.getApp()
                .showShare(
                    context,
                    remark.getOrgId(),
                    remark.getRemarkId(),
                    Constant.COMMNETTYPE_ZXDP,
                    remark.getContent(),
                    imgUrlString);
          }
        });
    if (remark.getCommentCount() > 0) {

      final ListViewCommentsAdapter commentsAdapter =
          new ListViewCommentsAdapter(context, remark.getCommentsList());
      holder.ll_list_zxdt_jz_item_commentlist.setAdapter(commentsAdapter);

      holder.ll_list_zxdt_jz_item_commentlist.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

              String userId = AppContext.getApp().getUserLoginSharedPre().getUserInfo().getUserId();
              final Comments comment = (Comments) parent.getAdapter().getItem(position);
              String commentUser = comment.getUserId();
              if (userId != null && userId.equals(commentUser)) {
                ActionSheet.showSheet(
                    context,
                    "",
                    "",
                    new ActionSheet.OnActionSheetSelected() {
                      @Override
                      public void onClick(View view) {
                        if (view.getId() == R.id.actionsheet_content) {
                          new DeleteCommentTask(
                                  context,
                                  new TaskCallBack() {
                                    @Override
                                    public void onTaskFinshed() {
                                      remark.getCommentsList().remove(comment);
                                      ListViewRemarkParentAdapter.this.notifyDataSetChanged();
                                    }
                                  })
                              .execute(AppContext.getApp().getToken(), comment.getCommentID());
                        }
                      }
                    },
                    null);
              } else {
                remark.setReferComment(comment);
                holder.et_list_common_pinglun_reply.requestFocus();
                holder.et_list_common_pinglun_reply.setHint("回复 " + comment.getUserAppe());
                setFocusOn(remark);
              }
            }
          });

    } else {
      holder.ll_list_zxdt_jz_item_commentlist.setAdapter(null);
    }
    holder.ll_list_common_ssh_sc.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            holder.ll_list_common_ssh_sc.setClickable(false);
            new FavTask(
                    context,
                    new TaskCallBack() {
                      @Override
                      public void onTaskFinshed() {
                        remark.setCurrenUserFav(!remark.getCurrenUserFav());
                        holder.ll_list_common_ssh_sc.setClickable(true);
                        ListViewRemarkParentAdapter.this.notifyDataSetChanged();
                      }
                    })
                .execute(
                    AppContext.getApp().getToken(),
                    remark.getRemarkId(),
                    Constant.COMMNETTYPE_ZXDP,
                    remark.getCurrenUserFav() ? "1" : "0");
          }
        });

    // 点击评论按钮,清除评论对象
    holder.ll_list_common_ssh_comment.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            remark.resetInputStatus();
            setFocusOn(remark);
            holder.et_list_common_pinglun_reply.requestFocus();
            holder.et_list_common_pinglun_reply.setText("");
            holder.et_list_common_pinglun_reply.setHint(R.string.text_comment_default_prompt);
          }
        });

    holder.btn_list_zxdt_jz_item_comment_send.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            String contentString = holder.et_list_common_pinglun_reply.getText().toString().trim();

            if (null == contentString || contentString.equals("")) {
              UIHelper.ToastMessage(context, "发送的内容不能为空!");
              return;
            }
            CommentsSend commentsSend = new CommentsSend();
            Comments referComment = remark.getReferComment(); // 引用的comment
            if (null == referComment) {
              commentsSend.setContent(contentString);
              commentsSend.setRefId(remark.getRemarkId());
              commentsSend.setType(Constant.COMMNETTYPE_ZXDP);
              commentsSend.setReplyCommentId("");
              commentsSend.setTargetUserId(remark.getUserId());
              commentsSend.setToken(AppContext.getApp().getToken());
            } else {
              commentsSend.setContent(contentString);
              commentsSend.setRefId(remark.getRemarkId());
              commentsSend.setReplyCommentId(referComment.getCommentID());
              commentsSend.setTargetUserId(remark.getUserId());
              commentsSend.setType(Constant.COMMNETTYPE_ZXDP);
              commentsSend.setToken(AppContext.getApp().getToken());
            }
            holder.et_list_common_pinglun_reply.setText("");
            holder.et_list_common_pinglun_reply.setHint(R.string.text_comment_default_prompt);
            new SendCommentsTask(
                    remark.getCommentsList(),
                    context,
                    new TaskCallBack() {
                      @Override
                      public void onTaskFinshed() {
                        remark.resetInputStatus();
                        ListViewRemarkParentAdapter.this.notifyDataSetChanged();
                      }
                    })
                .execute(commentsSend);
            ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE))
                .hideSoftInputFromWindow(holder.et_list_common_pinglun_reply.getWindowToken(), 0);
          }
        });

    // 获得焦点时保存当前位置
    holder.et_list_common_pinglun_reply.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
              setFocusOn(remark);
            }
            return false;
          }
        });

    // 输入完成时,保存当前的输入内容
    holder.et_list_common_pinglun_reply.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void afterTextChanged(Editable s) {
            String typeingComment = holder.et_list_common_pinglun_reply.getText().toString();
            if (typeingComment.length() > Constant.COMMENT_MAX_LEN) {
              typeingComment = typeingComment.substring(0, Constant.COMMENT_MAX_LEN);
              UIHelper.ToastMessage(context, "输入的内容不能大于" + Constant.COMMENT_MAX_LEN + "个字符");
              holder.et_list_common_pinglun_reply.setText(typeingComment);
            }
            if (remark.isFoucsOn()) {
              remark.setTypeingComment(typeingComment);
            }
          }

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

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}
        });

    // 如果当前动态动态正引用一条评论回复
    if (remark.getReferComment() != null && remark.getReferComment().getUserAppe() != null) {
      holder.et_list_common_pinglun_reply.setHint("回复 " + remark.getReferComment().getUserAppe());
    }

    // 如果有保存的数据,恢复输入未提交的内容
    if (remark.getTypeingComment() != null && !remark.getTypeingComment().equals("")) {
      holder.et_list_common_pinglun_reply.setText(remark.getTypeingComment());
    } else {
      holder.et_list_common_pinglun_reply.setText("");
      holder.et_list_common_pinglun_reply.setHint(R.string.text_comment_default_prompt);
    }

    // 如果是由于输入框输入法键盘导致的页面重绘,直接获取焦点;对于其他导致的重绘,重置各参数
    if (remark.isFoucsOn()) {
      // 如果当前的行下标和点击事件中保存的index一致,手动为EditText设置焦点。
      holder.et_list_common_pinglun_reply.requestFocus();
      if (holder.et_list_common_pinglun_reply.getText().length() > 0) {
        holder.et_list_common_pinglun_reply.setSelection(
            holder.et_list_common_pinglun_reply.getText().length());
      }
    }

    return convertView;
  }
  private void initView() {
    final View view =
        LayoutInflater.from(mContext).inflate(R.layout.suggest_input_window_layout, null);
    setContentView(view);
    setWidth(LayoutParams.MATCH_PARENT);
    setHeight(LayoutParams.MATCH_PARENT);
    setFocusable(true);
    setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    setBackgroundDrawable(AppContext.getApp().getResources().getDrawable(R.color.transparent));

    et_search_text = (EditText) view.findViewById(R.id.et_search_text);
    et_search_text.postDelayed(
        new Runnable() {
          @Override
          public void run() {
            InputMethodManager imm =
                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
          }
        },
        0);

    final ListView ll_suggestions_list = (ListView) view.findViewById(R.id.ll_suggestions_list);

    ll_suggestions_list.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (listItems != null
                && listItems.size() > position
                && onSuggestionCheckedListener != null) {
              suggestionAccepted = true;
              onSuggestionCheckedListener.OnSuggestionChecked(listItems.get(position));
            }
            SuggestInputWindow.this.dismiss();
          }
        });

    final TaskCallBack getSuggestCallBack =
        new TaskCallBack() {
          @Override
          public void onTaskFinshed(BaseBean result) {
            SuggestNameWrapper suggestNameWrapper = (SuggestNameWrapper) result;
            if (suggestNameWrapper != null && "0".equals(suggestNameWrapper.getStatus())) {
              listItems = suggestNameWrapper.getSuggestNameList();
              String[] suggestNames = suggestNameWrapper.getSuggestNames();
              if (suggestNames != null) {
                ll_suggestions_list.setAdapter(new SuggestOrgDrrAdpater(mContext, listItems));
              }
            }
          }
        };

    et_search_text.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

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

          @Override
          public void afterTextChanged(Editable s) {
            if (!keyWord.equals(s.toString())) {
              keyWord = s.toString();
              if (!TextUtils.isEmpty(keyWord)) {
                if ("1".equals(searchType) || !TextUtils.isEmpty(orgId)) {
                  new GetInputSuggestTask(mContext, getSuggestCallBack)
                      .execute(searchType, keyWord, orgId);
                }
              }
            }
          }
        });

    // 如果初始的关键字不为空,调用搜索建议提示
    if (!TextUtils.isEmpty(keyWord)) {
      et_search_text.setText(keyWord);
      et_search_text.setSelection(keyWord.length());
      if ("1".equals(searchType) || !TextUtils.isEmpty(orgId)) {
        new GetInputSuggestTask(mContext, getSuggestCallBack).execute(searchType, keyWord, orgId);
      }
    } else {
      // 如果调用的是搜索课程,并且机构ID不为空,则调用单独的search接口获得课程输入建议
      if ("0".equals(searchType) && !TextUtils.isEmpty(orgId)) {
        new GetSuggestCourseTask(mContext, getSuggestCallBack).execute(orgId);
      }
    }

    view.getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {

              @Override
              public void onGlobalLayout() {
                if (lastWinHeight >= view.getHeight()) {
                  lastWinHeight = view.getHeight();
                }
                // 窗口变小,输入法关闭,调用窗口关闭事件
                else {
                  SuggestInputWindow.this.dismiss();
                }
              }
            });
  }