public void onBackPressed() { if (chat_layout_emote.getVisibility() == View.VISIBLE) { edittxt.requestFocus(); chat_layout_emote.setVisibility(View.GONE); showKeyBoard(); return; } else { isOk = true; dialogFinish(); } }
public void setListener() { gridview.setEditText(edittxt); edittxt.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { chat_layout_emote.setVisibility(View.GONE); } }); fragment = (AddPicFragment) getSupportFragmentManager().findFragmentById(R.id.picFragment); }
@OptionsItem(R.id.ok) public void ok() { if (!isOk) { return; } // String content = Util.FilterEmoji(edittxt.getText().toString().trim()); String content = edittxt.getText().toString().trim(); // content=EmojiFilter.filterEmoji(content); if (!Util.isStrNotNull(content) && fragment.getCount() == 0) { showCustomToast("请输入内容或添加图片"); return; } isOk = false; customShowDialog("正在定位"); location.startLocation(); }
@Override public void onLocationSuccess() { customDismissDialog(); LoginUser user = getHelper().getUser(); if (user != null) { RequestParams ap = getAjaxParams(); ap.put("content", edittxt.getText().toString().trim()); ap.put("area", ac.cs.getArea()); ap.put("cityid", ac.cs.getLocationID()); ap.put("longitude", ac.cs.getLng()); ap.put("latitude", ac.cs.getLat()); ac.finalHttp.post(URL.PUBLISH_TXT, ap, callBack); } }
@Click public void add_emoji_btn(View v) { // if (chat_layout_emote.getVisibility() == View.VISIBLE) { // chat_layout_emote.setVisibility(View.GONE); // edittxt.requestFocus(); // showKeyBoard(); // } else { // // InputMethodManager imm = // (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); // if(imm.isActive()==true){ // closeInput(); //// rlayout.setHideView(chat_layout_emote); // chat_layout_emote.setVisibility(View.VISIBLE); // }else{ //// rlayout.setHideView(chat_layout_emote); // chat_layout_emote.setVisibility(View.VISIBLE); // } // // // } InputMethodManager mInputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (chat_layout_emote.getVisibility() == View.VISIBLE) { chat_layout_emote.setVisibility(View.GONE); edittxt.requestFocus(); getWindow() .setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); mInputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } else { chat_layout_emote.setVisibility(View.VISIBLE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); // 隐藏软键盘 mInputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } }