Java Code Examples for android.text.InputType

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/widget/.

Source file: SearchView.java

  20 
vote

/** 
 * Updates the auto-complete text view.
 */
private void updateSearchAutoComplete(){
  mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
  mQueryTextView.setImeOptions(mSearchable.getImeOptions());
  int inputType=mSearchable.getInputType();
  if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
    inputType&=~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
    if (mSearchable.getSuggestAuthority() != null) {
      inputType|=InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      inputType|=InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
    }
  }
  mQueryTextView.setInputType(inputType);
  if (mSuggestionsAdapter != null) {
    mSuggestionsAdapter.changeCursor(null);
  }
  if (mSearchable.getSuggestAuthority() != null) {
    mSuggestionsAdapter=new SuggestionsAdapter(getContext(),this,mSearchable,mOutsideDrawablesCache);
    mQueryTextView.setAdapter(mSuggestionsAdapter);
    ((SuggestionsAdapter)mSuggestionsAdapter).setQueryRefinement(mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY);
  }
}
 

Example 2

From project 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/Preferences/.

Source file: BalancePreferencesActivity.java

  19 
vote

public boolean onPreferenceClick(Preference preference){
  if (preference.getKey().equals("password")) {
    EditTextPreference pref=(EditTextPreference)preference;
    EditText field=pref.getEditText();
    field.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    field.setTransformationMethod(new PasswordTransformationMethod());
  }
  return false;
}
 

Example 3

From project android-bankdroid, under directory /src/com/liato/bankdroid/banking/banks/.

Source file: Chalmrest.java

  19 
vote

public Chalmrest(Context context){
  super(context);
  super.TAG=TAG;
  super.NAME=NAME;
  super.NAME_SHORT=NAME_SHORT;
  super.BANKTYPE_ID=BANKTYPE_ID;
  super.INPUT_TITLETEXT_USERNAME=R.string.card_number;
  super.INPUT_HINT_USERNAME="XXXXXXXXXXXXXXXX";
  super.INPUT_TYPE_USERNAME=InputType.TYPE_CLASS_NUMBER;
  super.INPUT_HIDDEN_PASSWORD=true;
}
 

Example 4

From project android-client_2, under directory /src/org/mifos/androidclient/main/.

Source file: CollectionSheetCustomerActivity.java

  19 
vote

@Override public void onCreate(Bundle bundle){
  super.onCreate(bundle);
  setContentView(R.layout.collection_sheet_customer);
  mCollectionSheetCustomer=CollectionSheetHolder.getCurrentCustomer();
  TextView textView=(TextView)findViewById(R.id.collectionSheet_customer_header);
  textView.setText(mCollectionSheetCustomer.getName());
  List<CollectionSheetCustomerLoan> customerLoans=mCollectionSheetCustomer.getCollectionSheetCustomerLoan();
  List<CollectionSheetCustomerSavings> customerSavings=mCollectionSheetCustomer.getCollectionSheetCustomerSaving();
  List<CollectionSheetCustomerSavings> customerIndividuals=mCollectionSheetCustomer.getIndividualSavingAccounts();
  TableRow.LayoutParams params=new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT,TableRow.LayoutParams.WRAP_CONTENT);
  TableLayout dueCollectionsLayout=(TableLayout)findViewById(R.id.collectionSheet_customerTableLayout);
  prepareCollectionTable(customerLoans,customerSavings,customerIndividuals,params,dueCollectionsLayout,mCollectionSheetCustomer);
  feeField=(EditText)findViewById(R.id.collectionSheetCustomer_ac_Collections);
  feeField.setText(String.valueOf(mCollectionSheetCustomer.getCollectionSheetCustomerAccount().getTotalCustomerAccountCollectionFee()));
  feeField.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
}
 

Example 5

From project android-thaiime, under directory /latinime/src/com/sugree/inputmethod/latin/.

Source file: LatinIME.java

  19 
vote

public boolean getCurrentAutoCapsState(){
  final InputConnection ic=getCurrentInputConnection();
  EditorInfo ei=getCurrentInputEditorInfo();
  if (mSettingsValues.mAutoCap && ic != null && ei != null && ei.inputType != InputType.TYPE_NULL) {
    return ic.getCursorCapsMode(ei.inputType) != 0;
  }
  return false;
}
 

Example 6

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnProfileEditor.java

  19 
vote

/** 
 * Adds the preferences to the panel. Subclasses should override {@link #loadExtraPreferencesTo(PreferenceGroup)} instead of this method.
 */
public void loadPreferencesTo(PreferenceGroup subpanel){
  Context c=subpanel.getContext();
  mName=(EditTextPreference)subpanel.findPreference(KEY_VPN_NAME);
  mName.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference pref,    Object newValue){
      setName((String)newValue);
      return true;
    }
  }
);
  setName(getProfile().getName());
  mName.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
  subpanel.addPreference(createServerNamePreference(c));
  loadExtraPreferencesTo(subpanel);
  subpanel.addPreference(createDomainSufficesPreference(c));
}
 

Example 7

From project android_8, under directory /src/com/defuzeme/gui/.

Source file: Gui.java

  19 
vote

public void showInputManualConnectDialog(int title,int content){
  this._inputText=new EditText(this._activity);
  this._inputText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
  Gui._builder=new AlertDialog.Builder(this._activity);
  Gui._builder.setView(this._inputText);
  Gui._builder.setTitle(title);
  Gui._builder.setMessage(content);
  Gui._builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (isValidIPAddress(_inputText.getText().toString()) == true) {
        DefuzeMe.Network.connectIP(_inputText.getText().toString());
      }
 else {
        DefuzeMe.Gui.toast("\"" + _inputText.getText().toString() + "\" "+ DefuzeMe._mainActivity.getString(string.NotValidIPAddress));
      }
    }
  }
);
  Gui._builder.setNegativeButton(android.R.string.cancel,null);
  Gui._builder.setCancelable(true);
  Gui._builder.create().show();
}
 

Example 8

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothPairingDialog.java

  19 
vote

private View createView(){
  View view=getLayoutInflater().inflate(R.layout.bluetooth_pin_entry,null);
  String name=mLocalManager.getCachedDeviceManager().getName(mDevice);
  TextView messageView=(TextView)view.findViewById(R.id.message);
  mPairingView=(EditText)view.findViewById(R.id.text);
  mPairingView.addTextChangedListener(this);
  if (mType == BluetoothDevice.PAIRING_VARIANT_PIN) {
    messageView.setText(getString(R.string.bluetooth_enter_pin_msg,name));
    mPairingView.setFilters(new InputFilter[]{new LengthFilter(BLUETOOTH_PIN_MAX_LENGTH)});
  }
 else   if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY) {
    messageView.setText(getString(R.string.bluetooth_enter_passkey_msg,name));
    mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
    mPairingView.setFilters(new InputFilter[]{new LengthFilter(BLUETOOTH_PASSKEY_MAX_LENGTH)});
  }
 else   if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION) {
    mPairingView.setVisibility(View.GONE);
    messageView.setText(getString(R.string.bluetooth_confirm_passkey_msg,name,mPasskey));
  }
 else   if (mType == BluetoothDevice.PAIRING_VARIANT_CONSENT) {
    mPairingView.setVisibility(View.GONE);
    messageView.setText(getString(R.string.bluetooth_incoming_pairing_msg,name));
  }
 else   if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
    mPairingView.setVisibility(View.GONE);
    messageView.setText(getString(R.string.bluetooth_display_passkey_msg,name,mPasskey));
  }
 else   if (mType == BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT) {
    mPairingView.setVisibility(View.GONE);
    messageView.setText(getString(R.string.bluetooth_incoming_pairing_msg,name));
  }
 else {
    Log.e(TAG,"Incorrect pairing type received, not creating view");
  }
  return view;
}
 

Example 9

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/latin/.

Source file: LatinIME.java

  19 
vote

public boolean getCurrentAutoCapsState(){
  final InputConnection ic=getCurrentInputConnection();
  EditorInfo ei=getCurrentInputEditorInfo();
  if (mSettingsValues.mAutoCap && ic != null && ei != null && ei.inputType != InputType.TYPE_NULL) {
    return ic.getCursorCapsMode(ei.inputType) != 0;
  }
  return false;
}
 

Example 10

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: UserDictionaryEditorActivity.java

  19 
vote

public Dialog createAddEditWordDialog(){
  View content=getLayoutInflater().inflate(R.layout.dialog_edittext,null);
  final EditText editText=(EditText)content.findViewById(R.id.edittext);
  editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
  return new AlertDialog.Builder(this).setTitle(mDialogEditingWord != null ? R.string.user_dict_settings_edit_dialog_title : R.string.user_dict_settings_add_dialog_title).setView(content).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      onAddOrEditFinished(editText.getText().toString());
      if (mAutoReturn)       finish();
    }
  }
).setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      if (mAutoReturn)       finish();
    }
  }
).create();
}
 

Example 11

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: CurrencyAmountView.java

  19 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  final Context context=getContext();
  textView=(TextView)getChildAt(0);
  textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
  textView.setHintTextColor(lessSignificantColor);
  setHint(null);
  setValidateAmount(textView instanceof EditText);
  final TextViewListener textViewListener=new TextViewListener();
  textView.addTextChangedListener(textViewListener);
  textView.setOnFocusChangeListener(textViewListener);
  textView.setOnEditorActionListener(textViewListener);
  contextButton=new View(context){
    @Override protected void onMeasure(    final int wMeasureSpec,    final int hMeasureSpec){
      setMeasuredDimension(textView.getCompoundPaddingRight(),textView.getMeasuredHeight());
    }
  }
;
  final LayoutParams chooseViewParams=new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  chooseViewParams.gravity=Gravity.RIGHT;
  contextButton.setLayoutParams(chooseViewParams);
  this.addView(contextButton);
  setCurrencyCode(Constants.CURRENCY_CODE_BITCOIN);
  updateAppearance();
}
 

Example 12

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/content/bricks/.

Source file: ChangeBrightnessBrick.java

  19 
vote

public void onClick(View view){
  final Context context=view.getContext();
  AlertDialog.Builder dialog=new AlertDialog.Builder(context);
  final EditText input=new EditText(context);
  input.setText(String.valueOf(changeBrightness));
  input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
  input.setSelectAllOnFocus(true);
  dialog.setView(input);
  dialog.setOnCancelListener((OnCancelListener)context);
  dialog.setPositiveButton(context.getString(R.string.ok),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      try {
        changeBrightness=Double.parseDouble(input.getText().toString());
      }
 catch (      NumberFormatException exception) {
        Toast.makeText(context,R.string.error_no_number_entered,Toast.LENGTH_SHORT).show();
      }
      dialog.cancel();
    }
  }
);
  dialog.setNeutralButton(context.getString(R.string.cancel_button),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      dialog.cancel();
    }
  }
);
  AlertDialog finishedDialog=dialog.create();
  finishedDialog.setOnShowListener(Utils.getBrickDialogOnClickListener(context,input));
  finishedDialog.show();
}
 

Example 13

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: ConsoleActivity.java

  19 
vote

/** 
 * Show any prompts requested by the currently visible  {@link TerminalView}.
 */
protected void updatePromptVisible(){
  View view=findCurrentView(R.id.console_flip);
  hideAllPrompts();
  if (!(view instanceof TerminalView)) {
    return;
  }
  PromptHelper prompt=((TerminalView)view).bridge.promptHelper;
  if (String.class.equals(prompt.promptRequested)) {
    stringPromptGroup.setVisibility(View.VISIBLE);
    String instructions=prompt.promptInstructions;
    boolean password=prompt.passwordRequested;
    if (instructions != null && instructions.length() > 0) {
      stringPromptInstructions.setVisibility(View.VISIBLE);
      stringPromptInstructions.setText(instructions);
    }
 else     stringPromptInstructions.setVisibility(View.GONE);
    if (password) {
      stringPrompt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
      stringPrompt.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }
 else {
      stringPrompt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
      stringPrompt.setTransformationMethod(SingleLineTransformationMethod.getInstance());
    }
    stringPrompt.setText("");
    stringPrompt.setHint(prompt.promptHint);
    stringPrompt.requestFocus();
  }
 else   if (Boolean.class.equals(prompt.promptRequested)) {
    booleanPromptGroup.setVisibility(View.VISIBLE);
    booleanPrompt.setText(prompt.promptHint);
    booleanYes.requestFocus();
  }
 else {
    hideAllPrompts();
    view.requestFocus();
  }
}
 

Example 14

From project creamed_glacier_app_settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothPairingDialog.java

  19 
vote

private View createPinEntryView(String deviceName){
  View view=getLayoutInflater().inflate(R.layout.bluetooth_pin_entry,null);
  TextView messageView=(TextView)view.findViewById(R.id.message);
  TextView messageView2=(TextView)view.findViewById(R.id.message_below_pin);
  CheckBox alphanumericPin=(CheckBox)view.findViewById(R.id.alphanumeric_pin);
  mPairingView=(EditText)view.findViewById(R.id.text);
  mPairingView.addTextChangedListener(this);
  alphanumericPin.setOnCheckedChangeListener(this);
  int messageId1;
  int messageId2;
  int maxLength;
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
    messageId1=R.string.bluetooth_enter_pin_msg;
  messageId2=R.string.bluetooth_enter_pin_other_device;
maxLength=BLUETOOTH_PIN_MAX_LENGTH;
break;
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
messageId1=R.string.bluetooth_enter_passkey_msg;
messageId2=R.string.bluetooth_enter_passkey_other_device;
maxLength=BLUETOOTH_PASSKEY_MAX_LENGTH;
alphanumericPin.setVisibility(View.GONE);
break;
default :
Log.e(TAG,"Incorrect pairing type for createPinEntryView: " + mType);
return null;
}
String messageText=getString(messageId1,deviceName);
messageView.setText(Html.fromHtml(messageText));
messageView2.setText(messageId2);
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
mPairingView.setFilters(new InputFilter[]{new LengthFilter(maxLength)});
return view;
}
 

Example 15

From project daily-money, under directory /dailymoney/src/com/bottleworks/dailymoney/calculator2/.

Source file: CalculatorDisplay.java

  19 
vote

protected void setLogic(Logic logic){
  mLogic=logic;
  NumberKeyListener calculatorKeyListener=new NumberKeyListener(){
    public int getInputType(){
      return InputType.TYPE_NULL;
    }
    protected char[] getAcceptedChars(){
      return ACCEPTED_CHARS;
    }
    public CharSequence filter(    CharSequence source,    int start,    int end,    Spanned dest,    int dstart,    int dend){
      return null;
    }
  }
;
  Editable.Factory factory=new CalculatorEditable.Factory(logic);
  for (int i=0; i < 2; ++i) {
    EditText text=(EditText)getChildAt(i);
    text.setBackgroundDrawable(null);
    text.setEditableFactory(factory);
    text.setKeyListener(calculatorKeyListener);
  }
}
 

Example 16

From project dreamDroid, under directory /libraries/numberpicker/src/com/michaelnovakjr/numberpicker/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setOnEditorActionListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.numberpicker);
  mStart=a.getInt(R.styleable.numberpicker_startRange,DEFAULT_MIN);
  mEnd=a.getInt(R.styleable.numberpicker_endRange,DEFAULT_MAX);
  mWrap=a.getBoolean(R.styleable.numberpicker_wrap,DEFAULT_WRAP);
  mCurrent=a.getInt(R.styleable.numberpicker_defaultValue,DEFAULT_VALUE);
  mCurrent=Math.max(mStart,Math.min(mCurrent,mEnd));
  mText.setText("" + mCurrent);
}
 

Example 17

From project droidkit, under directory /src/org/droidkit/widget/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  mText.addTextChangedListener(this);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 18

From project Hax-Launcher, under directory /src/com/t3hh4xx0r/haxlauncher/.

Source file: Folder.java

  19 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  mContent=(CellLayout)findViewById(R.id.folder_content);
  mContent.setGridSize(0,0);
  mContent.getChildrenLayout().setMotionEventSplittingEnabled(false);
  mFolderName=(FolderEditText)findViewById(R.id.folder_name);
  mFolderName.setFolder(this);
  mFolderName.setOnFocusChangeListener(this);
  int measureSpec=MeasureSpec.UNSPECIFIED;
  mFolderName.measure(measureSpec,measureSpec);
  mFolderNameHeight=mFolderName.getMeasuredHeight();
  mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
  mFolderName.setOnEditorActionListener(this);
  mFolderName.setSelectAllOnFocus(true);
  mFolderName.setInputType(mFolderName.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
}
 

Example 19

From project hiofenigma-android, under directory /opentimer/src/com/quietlycoding/android/picker/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(TextView)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 20

From project ICS_LatinIME_QHD, under directory /java/src/com/android/inputmethod/latin/.

Source file: LatinIME.java

  19 
vote

public boolean getCurrentAutoCapsState(){
  final InputConnection ic=getCurrentInputConnection();
  EditorInfo ei=getCurrentInputEditorInfo();
  if (mSettingsValues.mAutoCap && ic != null && ei != null && ei.inputType != InputType.TYPE_NULL) {
    return ic.getCursorCapsMode(ei.inputType) != 0;
  }
  return false;
}
 

Example 21

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/text/.

Source file: TextView.java

  19 
vote

public void showIme(boolean show){
  InputMethodManager imm=InputMethodManager.peekInstance();
  if (!mDontUseSoftkeyWithHardkey || getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
  }
 else {
    show=false;
  }
  if (show) {
    int type=InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE;
    if (mAutoCapitalize) {
      type|=EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
    }
    setInputType(type);
    if (imm != null) {
      imm.showSoftInput(this,0);
    }
  }
 else {
    setRawInputType(0);
    if (imm != null) {
      imm.hideSoftInputFromWindow(getWindowToken(),0);
    }
  }
}
 

Example 22

From project k-9, under directory /src/com/fsck/k9/helper/.

Source file: FileBrowserHelper.java

  19 
vote

private void showPathTextInput(final Activity c,final File startPath,final FileBrowserFailOverCallback callback){
  AlertDialog.Builder alert=new AlertDialog.Builder(c);
  alert.setTitle(c.getString(R.string.attachment_save_title));
  alert.setMessage(c.getString(R.string.attachment_save_desc));
  final EditText input=new EditText(c);
  input.setInputType(InputType.TYPE_CLASS_TEXT);
  if (startPath != null)   input.setText(startPath.toString());
  alert.setView(input);
  alert.setPositiveButton(c.getString(R.string.okay_action),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      String path=input.getText().toString();
      callback.onPathEntered(path);
    }
  }
);
  alert.setNegativeButton(c.getString(R.string.cancel_action),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      callback.onCancel();
    }
  }
);
  alert.show();
}
 

Example 23

From project keepassdroid, under directory /src/com/keepassdroid/.

Source file: EntryEditActivity.java

  19 
vote

private void setPasswordStyle(){
  TextView password=(TextView)findViewById(R.id.entry_password);
  TextView confpassword=(TextView)findViewById(R.id.entry_confpassword);
  if (mShowPassword) {
    password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    confpassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
  }
 else {
    password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    confpassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
  }
}
 

Example 24

From project KeyboardTerm, under directory /src/tw/kenshinn/keyboardTerm/.

Source file: TerminalView.java

  19 
vote

/** 
 * Chinese InputMethod
 * @author Chen slepher ([email protected])
 */
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs){
  final int IME_FLAG_NO_FULLSCREEN=0x80000000;
  outAttrs.imeOptions=EditorInfo.IME_FLAG_NO_EXTRACT_UI | IME_FLAG_NO_FULLSCREEN;
  outAttrs.inputType=InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
  InputConnection ic=new TermInputConnection(this);
  return ic;
}
 

Example 25

From project kumvandroid, under directory /src/com/ijuru/kumva/activity/.

Source file: DictionariesActivity.java

  19 
vote

/** 
 * Called when user selects add menu option
 */
private void onMenuAdd(){
  Dialogs.prompt(this,getString(R.string.str_newdictionary),getString(R.string.str_siteurl),InputType.TYPE_TEXT_VARIATION_URI,new Dialogs.InputListener(){
    @Override public void entered(    String url){
      if (!url.startsWith("http://"))       url="http://" + url;
      KumvaApplication app=(KumvaApplication)getApplication();
      Dictionary existing=app.getDictionaryByURL(url);
      if (existing == null)       fetchDictionary(url);
 else       Dialogs.toast(DictionariesActivity.this,getString(R.string.err_dictduplicate));
    }
  }
);
}
 

Example 26

From project LigiAndroidCommons, under directory /src/org/ligi/android/common/preferences/.

Source file: SeekBarPreference.java

  19 
vote

protected void onPrepareDialogBuilder(Builder builder){
  LinearLayout layout=new LinearLayout(context);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  layout.setMinimumWidth(400);
  layout.setPadding(20,20,20,20);
  edit_text=new EditText(context);
  edit_text.setInputType(InputType.TYPE_CLASS_NUMBER);
  edit_text.setText("" + getPersistedInt(0));
  layout.addView(edit_text);
  seek_bar=new SeekBar(context);
  seek_bar.setMax(max);
  seek_bar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
  seek_bar.setOnSeekBarChangeListener(this);
  seek_bar.setProgress(getPersistedInt(0));
  layout.addView(seek_bar);
  builder.setView(layout);
  super.onPrepareDialogBuilder(builder);
}
 

Example 27

From project LunaTerm, under directory /src/tw/loli/lunaTerm/.

Source file: TerminalView.java

  19 
vote

/** 
 * Chinese InputMethod
 * @author Chen slepher ([email protected])
 */
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs){
  final int IME_FLAG_NO_FULLSCREEN=0x80000000;
  outAttrs.imeOptions=EditorInfo.IME_FLAG_NO_EXTRACT_UI | IME_FLAG_NO_FULLSCREEN;
  outAttrs.inputType=InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
  InputConnection ic=new TermInputConnection(this);
  return ic;
}
 

Example 28

From project MyExpenses, under directory /src/org/totschnig/myexpenses/.

Source file: EditActivity.java

  19 
vote

/** 
 * configures the decimal format and the amount EditText based on configured currency_decimal_separator 
 */
protected void configAmountInput(){
  mAmountText=(EditText)findViewById(R.id.Amount);
  SharedPreferences settings=((MyApplication)getApplicationContext()).getSettings();
  mCurrencyDecimalSeparator=settings.getString(MyApplication.PREFKEY_CURRENCY_DECIMAL_SEPARATOR,Utils.getDefaultDecimalSeparator());
  mMinorUnitP=mCurrencyDecimalSeparator.equals(CURRENCY_USE_MINOR_UNIT);
  if (mMinorUnitP) {
    nfDLocal=new DecimalFormat("#0");
    nfDLocal.setParseIntegerOnly(true);
    mAmountText.setInputType(InputType.TYPE_CLASS_NUMBER);
  }
 else {
    DecimalFormatSymbols symbols=new DecimalFormatSymbols();
    symbols.setDecimalSeparator(mCurrencyDecimalSeparator.charAt(0));
    nfDLocal=new DecimalFormat("#0.###",symbols);
    mAmountText.setKeyListener(DigitsKeyListener.getInstance("+-0123456789" + mCurrencyDecimalSeparator));
    mAmountText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    mAmountText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
  }
  nfDLocal.setGroupingUsed(false);
}
 

Example 29

From project nuxeo-android, under directory /nuxeo-android-connector/src/main/java/org/nuxeo/android/layout/widgets/.

Source file: RichTextWidgetWrapper.java

  19 
vote

@Override public View buildView(LayoutContext context,LayoutMode mode,Document doc,List<String> attributeNames,WidgetDefinition widgetDef){
  super.buildView(context,mode,doc,attributeNames,widgetDef);
  Context ctx=context.getActivity();
  if (mode == LayoutMode.VIEW) {
    container=new LinearLayout(ctx);
    container.setOrientation(LinearLayout.VERTICAL);
    applyBinding();
    return container;
  }
 else {
    editWidget=new EditText(ctx);
    editWidget.setSingleLine(false);
    editWidget.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    editWidget.setLines(3);
    editWidget.setGravity(Gravity.TOP | Gravity.LEFT);
    applyBinding();
    return editWidget;
  }
}
 

Example 30

From project ohmagePhone, under directory /src/org/ohmage/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(TextView)findViewById(R.id.timepicker_text);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 31

From project Ohmage_Phone, under directory /src/org/ohmage/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(TextView)findViewById(R.id.timepicker_text);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 32

From project open311-android, under directory /open311-android/src/gov/in/bloomington/georeporter/fragments/.

Source file: PersonalInfoFragment.java

  19 
vote

@Override public void onListItemClick(ListView l,View v,int position,long id){
  super.onListItemClick(l,v,position,id);
  final String fieldname=PersonalInfoAdapter.FIELDS[position];
  final TextView label=(TextView)v.findViewById(android.R.id.text1);
  final TextView input=(TextView)v.findViewById(android.R.id.text2);
  final EditText newValue=new EditText(getActivity());
  newValue.setText(input.getText());
  int type=InputType.TYPE_TEXT_FLAG_CAP_WORDS;
  if (fieldname == "email") {
    type=InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
  }
  if (fieldname == "phone") {
    type=InputType.TYPE_CLASS_PHONE;
  }
  newValue.setInputType(type);
  new AlertDialog.Builder(getActivity()).setTitle(label.getText()).setView(newValue).setPositiveButton("Ok",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      try {
        mPersonalInfo.put(fieldname,newValue.getText());
      }
 catch (      JSONException e) {
      }
    }
  }
).setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
    }
  }
).show();
}
 

Example 33

From project packages_apps_God_Mode, under directory /src/com/t3hh4xx0r/god_mode/utils/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 34

From project Pixelesque, under directory /src/com/rj/pixelesque/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  mText.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent event){
      return false;
    }
  }
);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 35

From project platform_frameworks_ex, under directory /chips/src/com/android/ex/chips/.

Source file: RecipientEditTextView.java

  19 
vote

public RecipientEditTextView(Context context,AttributeSet attrs){
  super(context,attrs);
  if (sSelectedTextColor == -1) {
    sSelectedTextColor=context.getResources().getColor(android.R.color.white);
  }
  mAlternatesPopup=new ListPopupWindow(context);
  mAlternatesPopup.setOnDismissListener(this);
  mAddressPopup=new ListPopupWindow(context);
  mAddressPopup.setOnDismissListener(this);
  mCopyDialog=new Dialog(context);
  mAlternatesListener=new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long rowId){
      mAlternatesPopup.setOnItemClickListener(null);
      setEnabled(true);
      replaceChip(mSelectedChip,((RecipientAlternatesAdapter)adapterView.getAdapter()).getRecipientEntry(position));
      Message delayed=Message.obtain(mHandler,DISMISS);
      delayed.obj=mAlternatesPopup;
      mHandler.sendMessageDelayed(delayed,DISMISS_DELAY);
      clearComposingText();
    }
  }
;
  setInputType(getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
  setOnItemClickListener(this);
  setCustomSelectionActionModeCallback(this);
  mHandler=new Handler(){
    @Override public void handleMessage(    Message msg){
      if (msg.what == DISMISS) {
        ((ListPopupWindow)msg.obj).dismiss();
        return;
      }
      super.handleMessage(msg);
    }
  }
;
  mTextWatcher=new RecipientTextWatcher();
  addTextChangedListener(mTextWatcher);
  mGestureDetector=new GestureDetector(context,this);
}
 

Example 36

From project platform_packages_apps_browser, under directory /src/com/android/browser/preferences/.

Source file: GeneralPreferencesFragment.java

  19 
vote

void promptForHomepage(final ListPreference pref){
  final BrowserSettings settings=BrowserSettings.getInstance();
  final EditText editText=new EditText(getActivity());
  editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
  editText.setText(settings.getHomePage());
  editText.setSelectAllOnFocus(true);
  editText.setSingleLine(true);
  editText.setImeActionLabel(null,EditorInfo.IME_ACTION_DONE);
  final AlertDialog dialog=new AlertDialog.Builder(getActivity()).setView(editText).setPositiveButton(android.R.string.ok,new OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      String homepage=editText.getText().toString().trim();
      homepage=UrlUtils.smartUrlFilter(homepage);
      settings.setHomePage(homepage);
      pref.setValue(getHomepageValue());
      pref.setSummary(getHomepageSummary());
    }
  }
).setNegativeButton(android.R.string.cancel,new OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.cancel();
    }
  }
).setTitle(R.string.pref_set_homepage_to).create();
  editText.setOnEditorActionListener(new OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_DONE) {
        dialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
        return true;
      }
      return false;
    }
  }
);
  dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
  dialog.show();
}
 

Example 37

From project platform_packages_apps_calculator, under directory /src/com/android/calculator2/.

Source file: CalculatorDisplay.java

  19 
vote

protected void setLogic(Logic logic){
  NumberKeyListener calculatorKeyListener=new NumberKeyListener(){
    public int getInputType(){
      return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
    }
    @Override protected char[] getAcceptedChars(){
      return ACCEPTED_CHARS;
    }
    @Override public CharSequence filter(    CharSequence source,    int start,    int end,    Spanned dest,    int dstart,    int dend){
      return null;
    }
  }
;
  Editable.Factory factory=new CalculatorEditable.Factory(logic);
  for (int i=0; i < 2; ++i) {
    EditText text=(EditText)getChildAt(i);
    text.setBackgroundDrawable(null);
    text.setEditableFactory(factory);
    text.setKeyListener(calculatorKeyListener);
    text.setSingleLine();
  }
}
 

Example 38

From project platform_packages_apps_phone, under directory /src/com/android/phone/.

Source file: EditPinPreference.java

  19 
vote

/** 
 * Overridden to setup the correct dialog layout, as well as setting up  other properties for the pin / puk entry field.
 */
@Override protected View onCreateDialogView(){
  setDialogLayoutResource(R.layout.pref_dialog_editpin);
  View dialog=super.onCreateDialogView();
  getEditText().setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
  return dialog;
}
 

Example 39

From project platform_packages_apps_settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothPairingDialog.java

  19 
vote

private View createPinEntryView(String deviceName){
  View view=getLayoutInflater().inflate(R.layout.bluetooth_pin_entry,null);
  TextView messageView=(TextView)view.findViewById(R.id.message);
  TextView messageView2=(TextView)view.findViewById(R.id.message_below_pin);
  CheckBox alphanumericPin=(CheckBox)view.findViewById(R.id.alphanumeric_pin);
  mPairingView=(EditText)view.findViewById(R.id.text);
  mPairingView.addTextChangedListener(this);
  alphanumericPin.setOnCheckedChangeListener(this);
  int messageId1;
  int messageId2;
  int maxLength;
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
    messageId1=R.string.bluetooth_enter_pin_msg;
  messageId2=R.string.bluetooth_enter_pin_other_device;
maxLength=BLUETOOTH_PIN_MAX_LENGTH;
break;
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
messageId1=R.string.bluetooth_enter_passkey_msg;
messageId2=R.string.bluetooth_enter_passkey_other_device;
maxLength=BLUETOOTH_PASSKEY_MAX_LENGTH;
alphanumericPin.setVisibility(View.GONE);
break;
default :
Log.e(TAG,"Incorrect pairing type for createPinEntryView: " + mType);
return null;
}
String messageText=getString(messageId1,deviceName);
messageView.setText(Html.fromHtml(messageText));
messageView2.setText(messageId2);
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
mPairingView.setFilters(new InputFilter[]{new LengthFilter(maxLength)});
return view;
}
 

Example 40

From project propoid, under directory /propoid-ui/src/main/java/propoid/ui/bind/.

Source file: TextBinding.java

  19 
vote

@Override public void afterTextChanged(Editable editable){
  String string=editable.toString();
  if ((getView().getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE) == 0) {
    string=string.trim();
  }
  T value;
  try {
    value=converter.fromString(string);
  }
 catch (  ConverterException ex) {
    getView().setError(ex.getMessage(getView().getContext()));
    return;
  }
  safeChange(value);
}
 

Example 41

From project QuotaForAndroid, under directory /Quota/src/com/southfreo/quota/activities/.

Source file: PinEntry.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.pinentry);
  butOK=(Button)findViewById(R.id.okbutt);
  pinTxt=(EditText)findViewById(R.id.pinDisplay);
  header=(TextView)findViewById(R.id.headertxt);
  butOK.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      CheckPin();
    }
  }
);
  pinmode=getIntent().getIntExtra(MODE_OP,MODE_CREATE);
  if (pinmode == MODE_CREATE) {
    pin_submode=SUBMODE_ENTERPIN;
  }
 else   if (pinmode == MODE_VALIDATE) {
    cpin=SlotManager.getInstance().pinCode;
    pin_submode=SUBMODE_VALIDATEPIN;
  }
 else   if (pinmode == MODE_CHANGE) {
    cpin=SlotManager.getInstance().pinCode;
    pin_submode=SUBMODE_VALIDATEPIN;
  }
  pinTxt.setSingleLine();
  pinTxt.setInputType(InputType.TYPE_CLASS_PHONE);
  PasswordTransformationMethod transMethod=new PasswordTransformationMethod();
  pinTxt.setTransformationMethod(transMethod);
  mgr=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  mgr.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  pinTxt.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_DONE) {
        CheckPin();
      }
      return false;
    }
  }
);
}
 

Example 42

From project reader, under directory /src/com/quietlycoding/android/reader/widget/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 43

From project RebeLauncher, under directory /src/com/dirtypepper/rebelauncher/.

Source file: NumberPicker.java

  19 
vote

public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 44

From project ReGalAndroid, under directory /regalandroid/src/main/java/net/dahanne/android/regalandroid/utils/modified_android_source/.

Source file: NumberPicker.java

  19 
vote

public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mInflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  mInputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(TextView)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{mInputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  mSlideUpOutAnimation=new TranslateAnimation(Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,-100);
  mSlideUpOutAnimation.setDuration(200);
  mSlideUpInAnimation=new TranslateAnimation(Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,100,Animation.RELATIVE_TO_SELF,0);
  mSlideUpInAnimation.setDuration(200);
  mSlideDownOutAnimation=new TranslateAnimation(Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,100);
  mSlideDownOutAnimation.setDuration(200);
  mSlideDownInAnimation=new TranslateAnimation(Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,-100,Animation.RELATIVE_TO_SELF,0);
  mSlideDownInAnimation.setDuration(200);
  if (!isEnabled()) {
    setEnabled(false);
  }
}
 

Example 45

From project RHQpocket, under directory /src/org/rhq/pocket/operation/.

Source file: ScheduleOperationDetailFragment.java

  19 
vote

private void fillFieldsFromDefinition(){
  TextView tv=(TextView)layout.findViewById(R.id.operation_name);
  tv.setText(definition.getName());
  TableLayout tl=(TableLayout)layout.findViewById(R.id.opsParamsTable);
  for (  SimplePropDef spd : definition.getParams()) {
    TableRow row=new TableRow(getActivity());
    tl.addView(row);
    TextView nameView=new TextView(getActivity());
    nameView.setTextAppearance(getActivity(),R.style.table_header);
    String name=spd.getName();
    String displayName=name;
    if (spd.isRequired())     displayName+="*";
    nameView.setText(displayName);
    row.addView(nameView);
    if (spd.getType() == PropertyType.BOOLEAN) {
      CheckBox cb=new CheckBox(getActivity());
      cb.setTag(name);
      if (spd.getDefaultValue() != null)       cb.setChecked(Boolean.valueOf(spd.getDefaultValue()));
      row.addView(cb);
    }
 else {
      EditText et=new EditText(getActivity());
      et.setTextAppearance(getActivity(),R.style.table_cell);
      et.setTag(name);
      if (PropertyType.isNumeric(spd.getType())) {
        et.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
      }
      if (spd.getDefaultValue() != null) {
        et.setText("" + spd.getDefaultValue());
      }
      row.addView(et);
    }
  }
}
 

Example 46

From project sms-backup-plus, under directory /src/com/zegoggles/smssync/.

Source file: NumberPicker.java

  19 
vote

private void initValueEditText(Context context,float initialValue){
  value=initialValue;
  valueText=new EditText(context);
  valueText.setTextSize(mTextSize);
  valueText.setOnKeyListener(new View.OnKeyListener(){
    public boolean onKey(    View v,    int arg1,    KeyEvent event){
      float backupValue=value;
      try {
        value=Float.parseFloat(((EditText)v).getText().toString());
      }
 catch (      NumberFormatException nfe) {
        value=backupValue;
      }
      return false;
    }
  }
);
  valueText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
      }
    }
  }
);
  valueText.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
  valueText.setText(value.toString());
  valueText.setInputType(InputType.TYPE_CLASS_NUMBER);
}
 

Example 47

From project SOCIETIES-SCE-Services, under directory /3rdPartyServices/DisasterManagement/iDisaster/src/com/disaster/idisaster/.

Source file: LoginActivity.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.login_layout);
  userNameView=(EditText)findViewById(R.id.editUserName);
  userEmailView=(EditText)findViewById(R.id.editEmail);
  userPasswordView=(EditText)findViewById(R.id.editPassword);
  userPasswordView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
  final Button button=(Button)findViewById(R.id.loginButton);
  button.setOnClickListener(this);
}
 

Example 48

From project Something-Awful-Android, under directory /application/src/com/ferg/awfulapp/widget/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mMinButton=(Button)findViewById(R.id.min);
  mMinButton.setOnClickListener(this);
  mMinButton.setOnLongClickListener(this);
  mMaxButton=(Button)findViewById(R.id.max);
  mMaxButton.setOnClickListener(this);
  mMaxButton.setOnLongClickListener(this);
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 49

From project SoundFuse, under directory /src/org/androidaalto/soundfuse/picker/.

Source file: NumberPicker.java

  19 
vote

@SuppressWarnings({"UnusedDeclaration"}) public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 50

From project SWADroid, under directory /SWADroid/src/es/ugr/swad/swadroid/widget/.

Source file: NumberPicker.java

  19 
vote

public NumberPicker(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  setOrientation(VERTICAL);
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.number_picker,this,true);
  mHandler=new Handler();
  InputFilter inputFilter=new NumberPickerInputFilter();
  mNumberInputFilter=new NumberRangeKeyListener();
  mIncrementButton=(NumberPickerButton)findViewById(R.id.increment);
  mIncrementButton.setOnClickListener(this);
  mIncrementButton.setOnLongClickListener(this);
  mIncrementButton.setNumberPicker(this);
  mDecrementButton=(NumberPickerButton)findViewById(R.id.decrement);
  mDecrementButton.setOnClickListener(this);
  mDecrementButton.setOnLongClickListener(this);
  mDecrementButton.setNumberPicker(this);
  mText=(EditText)findViewById(R.id.timepicker_input);
  mText.setOnFocusChangeListener(this);
  mText.setFilters(new InputFilter[]{inputFilter});
  mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  if (!isEnabled()) {
    setEnabled(false);
  }
  mStart=DEFAULT_MIN;
  mEnd=DEFAULT_MAX;
}
 

Example 51

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/content/bricks/.

Source file: ChangeBrightnessBrick.java

  19 
vote

public void onClick(View view){
  final Context context=view.getContext();
  AlertDialog.Builder dialog=new AlertDialog.Builder(context);
  final EditText input=new EditText(context);
  input.setText(String.valueOf(changeBrightness));
  input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
  input.setSelectAllOnFocus(true);
  dialog.setView(input);
  dialog.setOnCancelListener((OnCancelListener)context);
  dialog.setPositiveButton(context.getString(R.string.ok),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      try {
        changeBrightness=Double.parseDouble(input.getText().toString());
      }
 catch (      NumberFormatException exception) {
        Toast.makeText(context,R.string.error_no_number_entered,Toast.LENGTH_SHORT).show();
      }
      dialog.cancel();
    }
  }
);
  dialog.setNeutralButton(context.getString(R.string.cancel_button),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      dialog.cancel();
    }
  }
);
  AlertDialog finishedDialog=dialog.create();
  finishedDialog.setOnShowListener(Utils.getBrickDialogOnClickListener(context,input));
  finishedDialog.show();
}
 

Example 52

From project Synodroid, under directory /src/com/bigpupdev/synodroid/preference/.

Source file: EditTextPreferenceWithValue.java

  19 
vote

/** 
 * Update the value showned in the preference
 * @param valueP
 */
private void updateValueInPreference(String valueP){
  EditText editText=getEditText();
  if (valueP != null && editText != null && (editText.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD) != 0) {
    valueP="*********************************************************************************************************************".substring(0,valueP.length());
  }
  if (valueView != null) {
    valueView.setText(valueP);
  }
}
 

Example 53

From project TiVo-Commander, under directory /src/com/arantius/tivocommander/.

Source file: Discover.java

  19 
vote

public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  final HashMap<String,Object> item=mHosts.get(position);
  int messageId=(Integer)item.get("messageId");
  if (messageId != 0) {
    showHelp(messageId);
    return;
  }
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(Discover.this.getBaseContext());
  final EditText makEditText=new EditText(Discover.this);
  makEditText.setInputType(InputType.TYPE_CLASS_PHONE);
  makEditText.setText(prefs.getString("tivo_mak",""));
  new AlertDialog.Builder(Discover.this).setTitle("MAK").setMessage(R.string.pref_mak_instructions).setView(makEditText).setPositiveButton("OK",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      Editor editor=prefs.edit();
      editor.putString("tivo_addr",(String)item.get("addr"));
      editor.putString("tivo_port",(String)item.get("port"));
      String mak=makEditText.getText().toString();
      editor.putString("tivo_mak",mak);
      editor.commit();
      Discover.this.finish();
    }
  }
).setNegativeButton("Cancel",null).create().show();
}
 

Example 54

From project ToDo-List-Widget, under directory /src/org/chrisbailey/todo/activities/.

Source file: ToDoActivity.java

  19 
vote

private static EditText createInput(Context c){
  EditText et=new EditText(c);
  et.setWidth((int)(scale * 200));
  et.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL);
  return et;
}
 

Example 55

From project TweakGS2, under directory /src/net/sakuramilk/TweakGS2/Parts/.

Source file: TextInputDialog.java

  19 
vote

private View createInputView(Context context){
  LinearLayout view=new LinearLayout(context);
  view.setOrientation(LinearLayout.VERTICAL);
  LayoutParams lp;
  mInputPrompt=new TextView(context);
  mInputPrompt.setGravity(Gravity.LEFT);
  mInputPrompt.setTextSize(TypedValue.COMPLEX_UNIT_SP,18);
  mInputPrompt.setTextColor(Color.WHITE);
  mInputPrompt.setText("Enter text:");
  lp=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  lp.setMargins(20,20,20,10);
  view.addView(mInputPrompt,lp);
  mInputField=new EditText(context);
  mInputField.setHorizontallyScrolling(true);
  mInputField.setGravity(Gravity.FILL_HORIZONTAL);
  mInputField.setTextAppearance(context,android.R.attr.textAppearanceMedium);
  mInputField.setInputType(InputType.TYPE_CLASS_TEXT);
  mInputField.setImeOptions(EditorInfo.IME_ACTION_DONE);
  lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
  lp.setMargins(20,10,20,20);
  view.addView(mInputField,lp);
  return view;
}
 

Example 56

From project valence, under directory /src/com/cafbit/valence/device/.

Source file: ValenceDeviceSetupView.java

  19 
vote

private void createPhase1(){
  removeAllViews();
  LinearLayout layout=new LinearLayout(context);
  layout.setOrientation(LinearLayout.VERTICAL);
  TextView stepLabel=new TextView(context);
  stepLabel.setText("Step 1: Server address");
  stepLabel.setTypeface(null,Typeface.BOLD);
  layout.addView(stepLabel);
  TextView addressLabel=new TextView(context);
  addressLabel.setText("Enter the IP address or hostname of the VNC server:");
  layout.addView(addressLabel);
  addressEdit=new EditText(context);
  addressEdit.setSingleLine();
  addressEdit.setHint("0.0.0.0");
  addressEdit.setText(state.device.getHostname());
  layout.addView(addressEdit);
  TextView portLabel=new TextView(context);
  portLabel.setText("Port number (default 5900):");
  layout.addView(portLabel);
  portEdit=new EditText(context);
  portEdit.setSingleLine();
  portEdit.setInputType(InputType.TYPE_CLASS_NUMBER);
  if (state.device.port != 0) {
    portEdit.setText("" + state.device.port);
  }
 else {
    portEdit.setText("" + RFBConnection.DEFAULT_PORT);
  }
  layout.addView(portEdit);
  Button button=new Button(context);
  button.setText("Next...");
  button.setOnClickListener(this);
  layout.addView(button);
  ScrollView scrollView=new ScrollView(context);
  scrollView.addView(layout);
  addView(scrollView);
}
 

Example 57

From project Yeno-Checklist, under directory /src/com/yeno/checklist/view/.

Source file: ChecklistActivity.java

  19 
vote

private void askForProblemDetails(final Task task){
  AlertDialog.Builder alert=new AlertDialog.Builder(this);
  alert.setTitle(R.string.task_problem_dialog_title);
  alert.setMessage(R.string.task_problem_dialog_label);
  final EditText input=new EditText(this);
  input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
  alert.setView(input);
  alert.setNeutralButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int whichButton){
      String value=input.getText().toString();
      if (!TextUtils.isEmpty(value)) {
        task.setProblem(value);
        adapter.notifyDataSetChanged();
      }
    }
  }
);
  alert.show();
}
 

Example 58

From project zirco-browser, under directory /src/org/zirco/ui/activities/.

Source file: AdBlockerWhiteListActivity.java

  19 
vote

/** 
 * Build and show a dialog for user input. Add user input to the white list.
 */
private void addToWhiteList(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(android.R.drawable.ic_input_add);
  builder.setTitle(getResources().getString(R.string.AdBlockerWhiteListActivity_AddMessage));
  builder.setInverseBackgroundForced(true);
  final EditText input=new EditText(this);
  input.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
  builder.setView(input);
  builder.setInverseBackgroundForced(true);
  builder.setPositiveButton(getResources().getString(R.string.Commons_Ok),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
      doAddToWhiteList(input.getText().toString());
    }
  }
);
  builder.setNegativeButton(getResources().getString(R.string.Commons_Cancel),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
);
  AlertDialog alert=builder.create();
  alert.show();
}