@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mSearchDialogBuilder.cancelDialog(); UnitSearchItem item = mSearchDialogBuilder.getItem(position); selectUnitAtUnitArrayPos(item.getUnitPosition(), item.getUnitTypeKey()); } });
/** * Helper method used to set the main display with HTML formatting, without * highlighting * * @param expStr is the main expression to update */ private void setTextHtml(String expStr) { setText(ViewUtils.fromHtml("<font color='gray'>" + mTextPrefix + "</font>" + expStr + "<font color='gray'>" + mTextSuffix + "</font>")); }
/** * Clear the unit selection for unit type fragment at position pos * * @param unitTypeFragPos the position of the desired unit type fragment * from which to clear selected units */ private void clearUnitSelection(int unitTypeFragPos) { ConvKeysFragment currFragAtPos = getConvKeyFrag(unitTypeFragPos); if (currFragAtPos != null) currFragAtPos.clearButtonSelection(); }
/** * Helper function to build a list dialog box that has a search function * Dialog lists has a cancel button. * * @param hint hint that displays in the EditText search box * @param itemClickListener OnClickListener for when the user selects one * of the units in the dialog list */ private void createSearchDialog(CharSequence hint, AdapterView.OnItemClickListener itemClickListener) { Context context = getActivity(); mSearchDialogBuilder = new UnitSearchDialogBuilder(mUnitType); CalcActivity ca = (CalcActivity) getActivity(); //TODO not sure if the idleResource should be accessed this way... mSearchDialogBuilder.buildDialog(context, hint, ca.getIdlingResource(), itemClickListener); }
/** * Disable soft keyboard from appearing, use in conjunction with * android:windowSoftInputMode="stateAlwaysHidden|adjustNothing" */ public void disableSoftInputFromAppearing() { setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); setTextIsSelectable(true); }
@Override public void onClick(View v) { //ViewUtils.toast("onClick",mAppContext); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mDisplay.getWindowToken(), 0); } });
/** * Clears the history, updates the screen, and toasts the user */ public void clearHistory() { mCalc.clearResultList(); updateScreen(true); ViewUtils.toastCentered("History cleared", mAppContext); }
public EditTextDisplay(Context context, AttributeSet attrs) { super(context, attrs); setUpEditText(context, attrs); }
public DynamicTextView(Context context, AttributeSet attrs) { super(context, attrs); setUpTextView(context, attrs); }
@Override public boolean onLongClick(View v) { // //keyboard hiding wasn't working on Samsung device, brute force instead // ViewUtils.toast("on long click",mAppContext); // InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // imm.hideSoftInputFromWindow(mDisplay.getWindowToken(), 0); mDisplay.selectAll(); return false; } });
@Override public void onAnimationEnd(Animator animation) { clearHighlighted(); } });
@Override public void onClick(View v) { numButtonPressed("="); } });
@SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { mArrayList = (ArrayList<UnitSearchItem>) results.values; // has the filtered values notifyDataSetChanged(); // notifies the data with new filtered values }
private void extraLongClickButton() { if (mExtraLongClickListener != null) mExtraLongClickListener.onExtraLongClick(this); }
@Override public Fragment getItem(int pos) { return ConvKeysFragment.newInstance(pos); }
public UnitSearchItem getItem(int position) { return mArrayAdapter.getUnitSearchItem(position); }
ResultAdapter(List<Result> prevTest) { super(getActivity(), 0, prevTest); }
private void toast(String msg) { ViewUtils.toastLongCentered(msg, mAppContext); }
public EditTextDisplay(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setUpEditText(context, attrs); }
public DynamicTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setUpTextView(context, attrs); }