Пример #1
0
 private void showSoftInput() {
   if (mContext.getWindow().getAttributes().softInputMode
       == WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
     if (mContext.getCurrentFocus() != null) {
       InputMethodManager imm =
           ((InputMethodManager) mContext.getSystemService(Activity.INPUT_METHOD_SERVICE));
       imm.showSoftInputFromInputMethod(mChatView.getWindowToken(), 0);
     }
   }
 }
Пример #2
0
 @Override
 public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
   flag = false;
   System.out.println(position);
   superId = list.get(position - 1).getCommentId();
   contentEdit.setHint("回复" + list.get(position - 1).getUserName() + ":");
   discussBtn.setText("回复");
   contentEdit.setFocusable(true);
   contentEdit.setFocusableInTouchMode(true);
   contentEdit.requestFocus();
   imm.showSoftInputFromInputMethod(contentEdit.getWindowToken(), 0);
   imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
 }
Пример #3
0
  @SuppressLint("InlinedApi")
  @SuppressWarnings("deprecation")
  private void initView() {
    riderId = getIntent().getStringExtra("riderId");

    imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    activityId = getIntent().getIntExtra("activityId", -1);
    xUtilsUtil = new XUtilsUtil();
    list = new ArrayList<ActivityCommentModel>();
    preferences = getSharedPreferences("userLogin", Context.MODE_PRIVATE);

    backLayout = (LinearLayout) findViewById(R.id.layout_discussactivity_back);

    discussBtn = (Button) findViewById(R.id.btn_discussactivity_discuss);

    contentEdit = (EditText) findViewById(R.id.edt__discussactivity_content);

    discussList = (ListView) findViewById(R.id.list_discussactivity_discuss);
    titleTxt = (TextView) findViewById(R.id.txt_discussactivity_title);
    titleTxt.setText("陪骑评论");

    superId = getIntent().getIntExtra("commentId", -1);
    if (superId != -1) {
      // contentEdit.setHint("回复" + list.get(position).getUserName() +
      // ":");
      contentEdit.setFocusable(true);
      imm.showSoftInputFromInputMethod(contentEdit.getWindowToken(), 0);
      imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
    }
    header = View.inflate(this, R.layout.header, null);
    swipeLayout = (RefreshLayout) findViewById(R.id.swipe_container);
    swipeLayout.setColorScheme(
        android.R.color.holo_blue_bright,
        android.R.color.holo_green_light,
        android.R.color.holo_orange_light,
        android.R.color.holo_red_light);
    discussList.addHeaderView(header);
  }
Пример #4
0
  private View getCustomView() {
    mFontManager = FontManager.getInstance(getActivity().getAssets());

    LayoutInflater inflater =
        (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.fragment_contactus, null, false);
    ll_parent = (LinearLayout) view.findViewById(R.id.ll_parent);
    ll_parent.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            hideSoftKeyboard();
          }
        });
    user_id =
        getActivity()
            .getSharedPreferences(
                GNLConstants.SharedPreference.SHARED_PREF_NAME, Context.MODE_PRIVATE)
            .getLong(GNLConstants.SharedPreference.ID_KEY, -1);
    ed_message = (EditText) view.findViewById(R.id.ed_message);
    ed_message.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));
    InputMethodManager imm =
        (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInputFromInputMethod(ed_message.getWindowToken(), 0);

    tv_send = (TextView) view.findViewById(R.id.tv_send);
    if (type == 1) tv_send.setText("SUGGEST");
    else tv_send.setText("SEND");
    tv_send.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));

    tv_send.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // send message to server then
            hideSoftKeyboard();
            //
            // dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
            String message = ed_message.getText().toString().trim();
            if (!TextUtils.isEmpty(message)) {
              message = Validator.getInstance().getSafeText(message);
              if (!TextUtils.isEmpty(message)) {
                //                        final LoadingDialog loadingDialog = new LoadingDialog();
                //                        Bundle args = new Bundle();
                //                        args.putString(LoadingDialog.DIALOG_TEXT_KEY,
                // getString(R.string.sending));
                //                        loadingDialog.setArguments(args);
                //                        loadingDialog.setCancelable(false);
                //                        loadingDialog.show(getFragmentManager(), "sending");
                final AlertDialog loadingDialog =
                    new SpotsDialog(
                        getActivity(),
                        getString(R.string.sending_message),
                        R.style.SpotsDialogCustom);
                loadingDialog.setCancelable(false);
                loadingDialog.show();
                WebServiceFunctions.sendMessage(
                    getActivity(),
                    user_id,
                    message,
                    type,
                    new OnSendMessageListener() {

                      @Override
                      public void onSuccess() {
                        loadingDialog.dismiss();
                        ed_message.setText("");
                        Toast.makeText(
                                getActivity().getApplicationContext(),
                                getString(R.string.message_sent),
                                Toast.LENGTH_LONG)
                            .show();
                        dialog.dismiss();
                      }

                      @Override
                      public void onFail(String error) {
                        loadingDialog.dismiss();
                        Toast.makeText(
                                getActivity().getApplicationContext(), error, Toast.LENGTH_LONG)
                            .show();
                      }
                    });
              } else {
                ed_message.setError(getString(R.string.BR_GNL_007));
              }
            }
          }
        });
    tv_cancel = (TextView) view.findViewById(R.id.tv_cancel);
    tv_cancel.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));

    tv_cancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            hideSoftKeyboard();
            dialog.dismiss();
          }
        });
    tv_contact = (TextView) view.findViewById(R.id.tv_contact);
    tv_contact.setText(title);
    tv_contact.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));

    return view;
  }
Пример #5
0
 public static void showSoftInput(Context ctx, View v) {
   InputMethodManager inputMgr =
       (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
   inputMgr.showSoftInputFromInputMethod(v.getWindowToken(), 0);
 }
Пример #6
0
 public static void showSoftInput(Context ctx, IBinder binder) {
   InputMethodManager inputMgr =
       (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
   inputMgr.showSoftInputFromInputMethod(binder, 0);
 }