@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.question_details_layout); mQid = getIntent().getIntExtra("qid", -1); mContentView = findViewById(R.id.view_content); mProgBar = (ProgressBar) findViewById(R.id.progressBar); mContent = (TextView) findViewById(R.id.txt_content); mUser = (TextView) findViewById(R.id.txt_user); mTime = (TextView) findViewById(R.id.txt_time); mType = (TextView) findViewById(R.id.txt_type); mAnswerList = (ListView) findViewById(R.id.list_answer); mOtherList = (ListView) findViewById(R.id.list_other); mEditAnswer = (EditText) findViewById(R.id.edit_answer); mTopicLayout = (CustomLinearLayout) findViewById(R.id.top_layout); mPrevBtn = (Button) findViewById(R.id.btn_prev); mQuestionStack = new Stack<Integer>(); initData(mQid); findViewById(R.id.btn_back).setOnClickListener(this); findViewById(R.id.btn_answer).setOnClickListener(this); mPrevBtn.setOnClickListener(this); mFace = (ImageView) findViewById(R.id.face); mFaceView = (TSFaceView) findViewById(R.id.face_view); setBottomClick(); mEditAnswer.clearFocus(); mFaceView.setFaceAdapter(mFaceAdapter); }
public void onSendBtn(View v) { String mess = messEt.getText().toString(); if (!mess.equals("")) { SimpleDateFormat sf = new SimpleDateFormat("HH:mm"); String time = sf.format(new Date()); JSONObject data = new JSONObject(); try { data.put("id", userID); data.put("gameID", gameID); data.put("uname", uname); data.put("time", time); data.put("mess", mess); data.put("role", role); data.put("mode", "chat"); } catch (JSONException e) { e.printStackTrace(); } LoginActivity.socket.emit("gameOn", data); messEt.setText(""); messEt.clearFocus(); View view = this.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } } }
public void onPrepareDialog(int id, Dialog dialog) { switch (id) { case EDIT_STEP: ((EditText) dialog.findViewById(R.id.nameEdit)).setText(modifiedStep.name); ((EditText) dialog.findViewById(R.id.nameEdit)).clearFocus(); ((EditText) dialog.findViewById(R.id.durationEdit)) .setText( String.format("%d:%02d", modifiedStep.duration / 60, modifiedStep.duration % 60)); ((EditText) dialog.findViewById(R.id.durationEdit)).clearFocus(); CheckBox agitateCB = (CheckBox) dialog.findViewById(R.id.agitateCheckbox); agitateCB.setOnCheckedChangeListener(this); agitateEdit = (EditText) dialog.findViewById(R.id.agitateEdit); if (modifiedStep.agitateEvery == -1) { agitateEdit.setText(""); agitateEdit.setEnabled(false); agitateCB.setChecked(true); } else { agitateEdit.setText(String.format("%d", modifiedStep.agitateEvery)); agitateEdit.setEnabled(true); agitateCB.setChecked(false); } agitateEdit.clearFocus(); CheckBox cb = (CheckBox) dialog.findViewById(R.id.pourCheck); if (modifiedStep.pourFor > 0) { cb.setChecked(true); } else { cb.setChecked(false); } break; } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_edit_note, container, false); titleEditText = (EditText) rootView.findViewById(R.id.titleEditText); contentEditText = (EditText) rootView.findViewById(R.id.contentEditText); if (getArguments() != null) { note = new Note( getArguments().getString(ARG_ID), getArguments().getString(ARG_TITLE), getArguments().getString(ARG_CONTENT)); titleEditText.setText(note.getTitle()); // Place cursor at the end of title titleEditText.setSelection(titleEditText.getText().length()); contentEditText.setText(note.getContent()); showKeyboard = getArguments().getBoolean(ARG_SHOW_KEYBOARD); } titleEditText.clearFocus(); if (showKeyboard) { titleEditText.requestFocus(); } getActivity().setTitle(getString(R.string.title_add_note)); return rootView; }
/** * Adding new task * * @param view */ @SuppressLint("SimpleDateFormat") public void onClick(View view) { switch (view.getId()) { case R.id.button_add: Task task = new Task(); EditText text = (EditText) findViewById(R.id.edit_text_task); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); task.setText(text.getText().toString()); task.setCreatedDate(sdf.format(new Date())); task.setUpdatedDate(sdf.format(new Date())); task.setArchived(false); task.setChecked(false); System.out.println(user.getName()); task.setUsername(user.getName()); long id = table.tasks.create(task); task.setId(id); this.tasks.add(task); text.setText(""); text.clearFocus(); InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow( this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); break; } }
public void clearSearch() { mQuery.setText(""); mClear.setVisibility(8); mQuery.clearFocus(); getSupportActionBar().getCustomView().setVisibility(8); Util.setSoftKeyboardVisibility(this, mQuery, false); }
@Override public void clearFocus() { mClearingFocus = true; hideKeyboard(this); super.clearFocus(); mSearchEditText.clearFocus(); mClearingFocus = false; }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { numEditText.setCursorVisible(false); numEditText.setFocusableInTouchMode(false); numEditText.clearFocus(); String num = numEditText.getText().toString(); if (TextUtils.isEmpty(num.trim())) { Toast.makeText(getActivity(), "号码不能为空", 0).show(); return; } if (!checkNumber(num)) { Toast.makeText(getActivity(), "号码格式不正确!", 0).show(); return; } if (!CommonUtil.checkNetState(getActivity())) { Toast.makeText(getActivity(), "对不起,您的网络不可用....", 0).show(); return; } if (address == null) { getAddressFromServer(num.trim()); Toast.makeText(getActivity(), "稍等,正在获取号码归属地......", 0).show(); return; } view.setBackgroundColor(Color.YELLOW); ImageView selectedImageView = (ImageView) view.findViewById(R.id.recharge_gridview_item_im_selected); TextView cardTextView = (TextView) view.findViewById(R.id.recharge_gridview_item_tv); card = cardTextView.getText().toString(); selectedImageView.setVisibility(View.VISIBLE); int childSize = rechargeItmes.getChildCount(); for (int i = 0; i < childSize; i++) { View child = rechargeItmes.getChildAt(i); if (!(child != null && child == view)) { child.setBackgroundColor(Color.WHITE); ImageView selected = (ImageView) child.findViewById(R.id.recharge_gridview_item_im_selected); selected.setVisibility(View.GONE); } } // q = 归属地 +card; String subaddress = address.substring(0, 3); String mobile = ""; if (address.contains("电信")) { mobile = "电信"; } if (address.contains("移动")) { mobile = "移动"; } if (address.contains("联通")) { mobile = "联通"; } q = subaddress + mobile + " 充值" + " " + card; String sort = "price_asc"; if (resultMap == null || resultMap.get(q) == null) { seachTaobaokeFromKeyWord(q, sort, true, false, 1); } }
@Override public void onPause() { super.onPause(); txt_psi.clearFocus(); txt_lpm.clearFocus(); DataManager dataManager = ((TabsMainActivity) getActivity()).getDataManager(); if ((txt_lpm.getText().toString().matches("")) || (Integer.parseInt(txt_lpm.getText().toString()) < 10)) { dataManager.lpm = (10); txt_lpm.setText(String.valueOf(dataManager.lpm)); } dataManager.lpm = Integer.parseInt(txt_lpm.getText().toString()); dataManager.psi = Integer.parseInt(txt_psi.getText().toString()); }
private void find() { // Getting user input location location = etLocation.getText().toString(); // getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); etLocation.clearFocus(); hideSoftKeyboard(); if (location != null && !location.equals("")) { new GeocoderTask().execute(location); } }
@Override protected void onResume() { super.onResume(); mIsCacheClear = false; mSearchEditText.setText(""); mSearchEditText.clearFocus(); if (mAutoKeyboard) { mSearchEditText.requestFocus(); } }
/** * Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to make it * valid. * * @param url The URL to be loaded by the shell. */ public void loadUrl(String url) { if (url == null) return; if (TextUtils.equals(url, mContentView.getUrl())) { mContentView.reload(); } else { mContentView.loadUrl(new LoadUrlParams(sanitizeUrl(url))); } mUrlTextView.clearFocus(); }
void updateInputState() { InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (mYearEnabled && inputMethodManager.isActive(mYearSpinnerInput)) { mYearSpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else if (mMonthEnabled && inputMethodManager.isActive(mMonthSpinnerInput)) { mMonthSpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else if (mDayEnabled && inputMethodManager.isActive(mDaySpinnerInput)) { mDaySpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else if (mHourEnabled && inputMethodManager.isActive(mHourSpinnerInput)) { mHourSpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else if (mMinuteEnabled && inputMethodManager.isActive(mMinuteSpinnerInput)) { mMinuteSpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } }
@Override protected void initView(View view) { gridView = (GridView) view.findViewById(R.id.gridView); comment = (EditText) view.findViewById(R.id.et_comment); btnOK = (Button) view.findViewById(R.id.btn_ok); mTvClear = (TextView) view.findViewById(R.id.tv_clear); comment.clearFocus(); InputMethodManager imm = (InputMethodManager) fatherActivity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(comment.getWindowToken(), 0); // SystemUtils.popSoftkeyboard(fatherActivity, comment, false); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_add_item: addItem(); // close keyboard ((MainActivity) getActivity()).hideKeyboard(); mTxtItem.getText().clear(); mTxtItem.clearFocus(); break; } }
private void hideSearchSuggestions() { mDividerView.setVisibility(View.GONE); mBackgroundCoverFrameLayout.setVisibility(View.GONE); setUpLeftDrawable(false); mRecyclerView.setVisibility(View.GONE); mRecyclerView.removeItemDecoration(mDividerItemDecoration); mSearchEditText.clearFocus(); mAreSearchSuggestionsVisible = false; }
void init() { ed_id = (EditText) findViewById(R.id.editText_ID); ed_pw = (EditText) findViewById(R.id.editText_PW); Til_id = (TextInputLayout) findViewById(R.id.Til_id); Til_id.setHint("아이디"); Til_pw = (TextInputLayout) findViewById(R.id.Til_pw); Til_pw.setHint("패스워드"); ed_id.clearFocus(); rel = (RelativeLayout) findViewById(R.id.MainActivityRelativeLayout); rel.requestFocus(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ActivityStackManager.getStackManager().pushActivity(this); setContentView(R.layout.activity_edit_info); initOperateStep(); initDatas(); initControls(); initListener(); initUIData(); mEditName.clearFocus(); mEditName.setSelection(mNewUserBean.userName.length()); }
private void updateInputState() { // Make sure that if the user changes the value and the IME is active // for one of the inputs if this widget, the IME is closed. If the user // changed the value via the IME and there is a next input the IME will // be shown, otherwise the user chose another means of changing the // value and having the IME up makes no sense. Context context = getContext(); InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { if (inputMethodManager.isActive(mYearSpinnerInput)) { mYearSpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else if (inputMethodManager.isActive(mMonthSpinnerInput)) { mMonthSpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else if (inputMethodManager.isActive(mDaySpinnerInput)) { mDaySpinnerInput.clearFocus(); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } } }
@Override public void onStateChange(View view, HideablePartBehavior.State state) { switch (state) { case COLLAPSED: if (collapsed) return; if (getView() == null) return; collapsed = true; ((RelativeLayout.LayoutParams) send.getLayoutParams()) .getRules()[RelativeLayout.ALIGN_BOTTOM] = R.id.text; ((RelativeLayout.LayoutParams) target.getLayoutParams()) .getRules()[RelativeLayout.ALIGN_BOTTOM] = 0; ((RelativeLayout.LayoutParams) text.getLayoutParams()).getRules()[RelativeLayout.LEFT_OF] = R.id.send; ((CoordinatorLayout.LayoutParams) commentFrame.getLayoutParams()).rightMargin = (int) (getView().getResources().getDisplayMetrics().density * 59); root.invalidate(); text.clearFocus(); text.setSingleLine(true); text.setVerticalScrollBarEnabled(false); case HIDDEN: hideKeyboard(); break; case EXPANDED: if (!collapsed) return; if (getView() == null) return; collapsed = false; ((RelativeLayout.LayoutParams) send.getLayoutParams()) .getRules()[RelativeLayout.ALIGN_BOTTOM] = 0; ((RelativeLayout.LayoutParams) target.getLayoutParams()) .getRules()[RelativeLayout.ALIGN_BOTTOM] = R.id.send; ((RelativeLayout.LayoutParams) text.getLayoutParams()).getRules()[RelativeLayout.LEFT_OF] = 0; ((CoordinatorLayout.LayoutParams) commentFrame.getLayoutParams()).rightMargin = 0; root.invalidate(); text.setVerticalScrollBarEnabled(true); text.setSingleLine(false); text.setMaxLines(9); showKeyboard(); break; } }
private void setKeyboardVisibility(boolean showKeyboard) { final InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); if (showKeyboard) { mEtFeedback.requestFocus(); mEtFeedback.setHorizontallyScrolling(false); imm.showSoftInput(mEtFeedback, InputMethodManager.SHOW_IMPLICIT); } else { mEtFeedback.clearFocus(); imm.hideSoftInputFromWindow( mEtFeedback.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); } }
private void initViews() { input = (EditText) findViewById(R.id.ps_search_edit); input.clearFocus(); gridSearchHistory = (GridView) findViewById(R.id.ps_seatch_history_grid); gridSearchHotKey = (GridView) findViewById(R.id.ps_hot_key_grid); // gridSearchHistory.setOnItemClickListener(this); gridSearchHotKey.setOnItemClickListener(this); layoutSearchHistory = (LinearLayout) findViewById(R.id.ps_search_history); layoutSearchHotKey = (LinearLayout) findViewById(R.id.ps_hot_key); searchResultListView = (MyListView) findViewById(R.id.listView); myProgressBar = (ProgressBar) findViewById(R.id.progressBar); myErrText = (TextView) findViewById(R.id.err_text); searchBtn = (Button) findViewById(R.id.search); }
public void handleMessage(Message paramMessage) { if (paramMessage.what == handle_Init) { try { JSONObject retString = new JSONObject(ListData); String total = retString.getString("total"); if (!total.equals("1")) { setTipErrorMessage("ȡҩƷ��Ϣ����,��˶ԣ�"); return; } String jsonarr1 = retString.getString("rows"); JSONArray jsonArrayinfo = new JSONArray(jsonarr1); JSONObject itemsobj = jsonArrayinfo.getJSONObject(0); stkbinIncidesc.setText(itemsobj.getString("incidesc")); stkbinQty.setText(itemsobj.getString("qty")); stkbinUom.setText(itemsobj.getString("puomdesc")); stkbinBatNo.setText(itemsobj.getString("batno")); stkbinExpDate.setText(itemsobj.getString("expdate")); stkbinUomID.setText(itemsobj.getString("puomdr")); stkbinInclb.setText(itemsobj.getString("inclb")); stkbinPLabel.setText(itemsobj.getString("barcode")); stkbindesc.setText(itemsobj.getString("stkbindesc")); stkbincode.setText(itemsobj.getString("stkbincode")); /// ���ý��� stkbinLLabel.setFocusable(true); stkbinLLabel.requestFocus(); stkbinPLabel.clearFocus(); progressDialog.dismiss(); // �������б���ݣ���رնԻ��� } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (paramMessage.what == handle_second) { progressDialog.dismiss(); // �������б���ݣ���رնԻ��� // JSONObject retString = new JSONObject(ListData); if (ListData.indexOf("-2") != -1) { Toast tst = Toast.makeText(StkBinActivity.this, ListData, Toast.LENGTH_SHORT); tst.show(); } else if (!ListData.contains("0")) { setTipErrorMessage(ListData); } else { // clearUIContent(); Toast tst = Toast.makeText(StkBinActivity.this, "�����ɹ���", Toast.LENGTH_SHORT); tst.show(); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_destinations); setTitle("Tracebox for Android - Destinations"); newDestinationEditText = (EditText) findViewById(R.id.destinations_page_add_edittext); destinations_table = (TableLayout) findViewById(R.id.destinations_table); db = new DatabaseHandler(this); newDestinationEditText.clearFocus(); fillTable(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mListView = (ListView) findViewById(R.id.mListView); mSendBtn = (Button) findViewById(R.id.mSendBtn); mEditText = (EditText) findViewById(R.id.mEditText); mEditText.clearFocus(); adapter = new MsgAdapter(MainActivity.this, R.layout.msg_item, msgList); mListView.setAdapter(adapter); Intent intent = getIntent(); IP = intent.getStringExtra("ip"); receiveMsg(); // mSendBtn.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // String s = mEditText.getText().toString().trim(); // if (!s.equals("")) { // Msg msg = new Msg(s, Msg.TYPE_SEND); // msgList.add(msg); // adapter.notifyDataSetChanged(); // mListView.setSelection(msgList.size()); // mEditText.setText(""); // // new SendMsg(s, socket).start(); // } // } // }); /* 发送数据 */ mSendBtn.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { String s = mEditText.getText().toString().trim(); if (!s.equals("")) { Msg msg = new Msg(s, Msg.TYPE_SEND); msgList.add(msg); adapter.notifyDataSetChanged(); mListView.setSelection(msgList.size()); mEditText.setText(""); sendMsg(s); } } }); }
/** * We start the long click here but rely on the {@link NumberPickerButton} to inform us when the * long click has ended. */ public boolean onLongClick(View v) { /* The text view may still have focus so clear it's focus which will * trigger the on focus changed and any typed values to be pulled. */ mText.clearFocus(); if (R.id.increment == v.getId()) { mIncrement = true; mHandler.post(mRunnable); } else if (R.id.decrement == v.getId()) { mDecrement = true; mHandler.post(mRunnable); } return true; }
private void closeSearchBar() { // Remove custom view. getActionBar().setDisplayShowCustomEnabled(false); // close the soft keyboard mSearchEt.clearFocus(); mSearchAction.collapseActionView(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mSearchEt.getWindowToken(), 0); mSearchEt.setText(""); // Change search icon accordingly. mSearchAction.setIcon(mIconOpenSearch); mSearchOpened = false; }
/// ��ս������� public void clearUIContent() { stkbinIncidesc.setText(null); stkbinQty.setText(null); stkbinUom.setText(null); stkbinBatNo.setText(null); stkbinExpDate.setText(null); stkbinUomID.setText(null); stkbinInclb.setText(null); stkbinPLabel.setText(null); stkbinLLabel.setText(null); stkbindesc.setText(null); stkbincode.setText(null); /// ���ý��� stkbinPLabel.setFocusable(true); stkbinPLabel.requestFocus(); stkbinLLabel.clearFocus(); }
/** * Post a new Comment. Called by the Post button on the menu * * @param v */ public void postComment(View v) { EditText newCom = (EditText) findViewById(R.id.editText1); if (!newCom .getText() .toString() .trim() .equals("")) { // If there is text in the enter comment section if (theQuests.getOpenQuestion() == -1) { // If there are no open questions, enter the new comment as a new question pic.addQuestion("Anonymous", newCom.getText().toString()); } else { // Otherwise, add it as an answer to the currently open question pic.getQuestions() .get(pic.getQuestions().size() - theQuests.getOpenQuestion() - 1) .addAnswer("Anonymous", newCom.getText().toString()); } } newCom.setText(""); InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); // Gets rid of the keyboard newCom.clearFocus(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_stkbin_main); /// ��ȡ����Ԫ�� stkbinIncidesc = (TextView) findViewById(R.id.stkbin_incidesc); stkbinBatNo = (TextView) findViewById(R.id.stkbin_batno); stkbinExpDate = (TextView) findViewById(R.id.stkbin_expdate); stkbinQty = (TextView) findViewById(R.id.stkbin_qty); stkbinUom = (TextView) findViewById(R.id.stkbin_uomdesc); stkbinUomID = (TextView) findViewById(R.id.stkbin_uomrowid); stkbinInclb = (TextView) findViewById(R.id.stkbin_inclb); stkbinPLabel = (EditText) findViewById(R.id.stkbin_packlabel); stkbinLLabel = (EditText) findViewById(R.id.stkbin_linklabel); stkbindesc = (TextView) findViewById(R.id.stkbin_stkbindesc); stkbincode = (TextView) findViewById(R.id.stkbin_stkbincode); stkbinPLabel.setFocusable(true); stkbinPLabel.requestFocus(); stkbinLLabel.clearFocus(); stkbinPLabel.setInputType(InputType.TYPE_NULL); // ��������� stkbinLLabel.setInputType(InputType.TYPE_NULL); /// ��� btnClear = (Button) findViewById(R.id.stkbin_clear); btnClear.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { clearUIContent(); } }); /// ȷ�� btnSure = (Button) findViewById(R.id.stkbin_sure); btnSure.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { LinkInclbStkBin(); } }); }