Java Code Examples for android.text.Editable

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 android-thaiime, under directory /common/src/com/android/ex/editstyledtext/.

Source file: EditStyledText.java

  18 
vote

public void onRefreshZeoWidthChar(){
  Editable txt=mEST.getText();
  for (int i=0; i < txt.length(); i++) {
    if (txt.charAt(i) == ZEROWIDTHCHAR) {
      txt.replace(i,i + 1,"");
      i--;
    }
  }
}
 

Example 2

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

Source file: AbstractAQuery.java

  18 
vote

/** 
 * Gets the editable.
 * @return the editable
 */
public Editable getEditable(){
  Editable result=null;
  if (view instanceof EditText) {
    result=((EditText)view).getEditableText();
  }
  return result;
}
 

Example 3

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/ui/fragments/.

Source file: AppsViewFragment.java

  18 
vote

public void onClick(View v){
  Editable editor=mStatusText.getText();
  String update=editor.toString();
  if (update.length() != 0) {
    editor.clear();
    Helpers.sendToFeed(getActivity(),StatusObj.from(update),mFeedUri);
  }
  InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(mStatusText.getWindowToken(),0);
}
 

Example 4

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/ui/module/.

Source file: TweetEdit.java

  18 
vote

public void setTextAndFocus(String text,boolean start){
  setText(text);
  Editable editable=mEditText.getText();
  if (!start) {
    Selection.setSelection(editable,editable.length());
  }
 else {
    Selection.setSelection(editable,0);
  }
  mEditText.requestFocus();
}
 

Example 5

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: SimUnlockScreen.java

  18 
vote

public void onClick(View v){
  if (v == mBackSpaceButton) {
    final Editable digits=mPinText.getEditableText();
    final int len=digits.length();
    if (len > 0) {
      digits.delete(len - 1,len);
      mEnteredDigits--;
    }
    mCallback.pokeWakelock();
  }
 else   if (v == mOkButton) {
    checkPin();
  }
}
 

Example 6

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

Source file: Main.java

  18 
vote

public void run(){
  if (mSharedString != null && mSharedString.length() > 0) {
    mProcNew.run();
    Editable text=mEditor.getText();
    text.replace(0,0,mSharedString);
    mSharedString=null;
  }
}
 

Example 7

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

Source file: RecipientEditTextView.java

  18 
vote

private void expand(){
  removeMoreChip();
  setCursorVisible(true);
  Editable text=getText();
  setSelection(text != null && text.length() > 0 ? text.length() : 0);
  if (mTemporaryRecipients != null && mTemporaryRecipients.size() > 0) {
    new RecipientReplacementTask().execute();
    mTemporaryRecipients=null;
  }
}
 

Example 8

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

Source file: CalculatorEditText.java

  18 
vote

private void copyContent(){
  final Editable text=getText();
  int textLength=text.length();
  setSelection(0,textLength);
  ClipboardManager clipboard=(ClipboardManager)getContext().getSystemService(Context.CLIPBOARD_SERVICE);
  clipboard.setPrimaryClip(ClipData.newPlainText(null,text));
  Toast.makeText(getContext(),R.string.text_copied_toast,Toast.LENGTH_SHORT).show();
  setSelection(textLength);
}
 

Example 9

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/dialpad/.

Source file: DialpadFragment.java

  18 
vote

/** 
 * Sets formatted digits to digits field.
 */
private void setFormattedDigits(String data,String normalizedNumber){
  String dialString=PhoneNumberUtils.extractNetworkPortion(data);
  dialString=PhoneNumberUtils.formatNumber(dialString,normalizedNumber,mCurrentCountryIso);
  if (!TextUtils.isEmpty(dialString)) {
    Editable digits=mDigits.getText();
    digits.replace(0,digits.length(),dialString);
    afterTextChanged(digits);
  }
}
 

Example 10

From project TextSecure, under directory /src/org/thoughtcrime/securesms/.

Source file: PassphrasePromptActivity.java

  18 
vote

public void onClick(View v){
  try {
    Editable text=passphraseText.getText();
    String passphrase=(text == null ? "" : text.toString());
    MasterSecret masterSecret=MasterSecretUtil.getMasterSecret(PassphrasePromptActivity.this,passphrase);
    MemoryCleaner.clean(passphrase);
    setMasterSecret(masterSecret);
  }
 catch (  InvalidPassphraseException ipe) {
    Toast.makeText(getApplicationContext(),R.string.PassphrasePromptActivity_invalid_passphrase_exclamation,Toast.LENGTH_SHORT).show();
  }
}
 

Example 11

From project TL-android-app, under directory /tlandroidapp/src/org/opensourcetlapp/tl/widget/.

Source file: SpoilerSpan.java

  18 
vote

private void open(){
  if (showing)   return;
  Editable ed=(Editable)textView.getText();
  pos=((Spannable)ed).getSpanEnd(this);
  ed.insert(pos,text);
  ((Spannable)ed).setSpan(quoteSpan,pos,pos + text.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  showing=true;
}
 

Example 12

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentReceiveResultSupport.java

  17 
vote

/** 
 * This method is called when the sending activity has finished, with the result it supplied.
 */
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == GET_CODE) {
    Editable text=(Editable)mResults.getText();
    if (resultCode == RESULT_CANCELED) {
      text.append("(cancelled)");
    }
 else {
      text.append("(okay ");
      text.append(Integer.toString(resultCode));
      text.append(") ");
      if (data != null) {
        text.append(data.getAction());
      }
    }
    text.append("\n");
  }
}
 

Example 13

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: CloneLauncherActivity.java

  17 
vote

private void displayHelp(CharSequence message){
  cloneReadinessMessageView.setVisibility(message == null ? INVISIBLE : VISIBLE);
  if (message != null) {
    Editable spana=new SpannableStringBuilder(message);
    ClickableText.addLinks(spana,BOLD_LINK_STYLE,new ClickableText.Listener(){
      public void onClick(      String command,      View widget){
        if (command.equals("specify_target_dir")) {
          useDefaultGitDirLocationButton.setChecked(false);
          gitDirEditText.requestFocus();
          setCursorToEnd(gitDirEditText);
        }
 else         if (command.equals("view_existing_repo")) {
          startActivity(manageRepoIntent(existingRepoGitDir()));
        }
 else         if (command.equals("view_ssh_instructions")) {
          startActivity(new Intent(CloneLauncherActivity.this,AboutUsingSshActivity.class));
        }
 else         if (command.equals("suggest_repo")) {
          startActivityForResult(new GitIntentBuilder("repo.SUGGEST").toIntent(),0);
        }
      }
    }
);
    cloneReadinessMessageView.setText(spana);
    cloneReadinessMessageView.setMovementMethod(LinkMovementMethod.getInstance());
  }
}
 

Example 14

From project android_5, under directory /src/aarddict/android/.

Source file: LookupActivity.java

  17 
vote

private void updateWordListUI(final Iterator<Entry> results){
  runOnUiThread(new Runnable(){
    public void run(){
      TextView messageView=(TextView)findViewById(R.id.messageView);
      if (!results.hasNext()) {
        Editable text=editText.getText();
        if (text != null && !text.toString().equals("")) {
          messageView.setText(Html.fromHtml(getString(R.string.nothingFound)));
          messageView.setVisibility(View.VISIBLE);
        }
 else {
          messageView.setVisibility(View.GONE);
        }
      }
 else {
        messageView.setVisibility(View.GONE);
      }
      WordAdapter wordAdapter=new WordAdapter(results);
      listView.setAdapter(wordAdapter);
      listView.setOnItemClickListener(wordAdapter);
      setProgressBarIndeterminateVisibility(false);
    }
  }
);
}
 

Example 15

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

Source file: WalletBalanceWidgetProvider.java

  17 
vote

@Override public void onUpdate(final Context context,final AppWidgetManager appWidgetManager,final int[] appWidgetIds){
  final WalletApplication application=(WalletApplication)context.getApplicationContext();
  final Wallet wallet=application.getWallet();
  final BigInteger balance=wallet.getBalance(BalanceType.ESTIMATED);
  final Editable balanceStr=new SpannableStringBuilder(WalletUtils.formatValue(balance));
  WalletUtils.formatValue(balanceStr);
  for (  final int appWidgetId : appWidgetIds) {
    final RemoteViews views=new RemoteViews(context.getPackageName(),R.layout.wallet_balance_widget_content);
    views.setTextViewText(R.id.widget_wallet_balance,balanceStr);
    views.setOnClickPendingIntent(R.id.widget_button_balance,PendingIntent.getActivity(context,0,new Intent(context,WalletActivity.class),0));
    views.setOnClickPendingIntent(R.id.widget_button_send,PendingIntent.getActivity(context,0,new Intent(context,SendCoinsActivity.class),0));
    views.setOnClickPendingIntent(R.id.widget_button_request,PendingIntent.getActivity(context,0,new Intent(context,RequestCoinsActivity.class),0));
    AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId,views);
  }
}
 

Example 16

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

Source file: TerminalBridge.java

  17 
vote

/** 
 * Show change font size dialog
 */
public boolean showFontSizeDialog(){
  final String pickerString="+-";
  CharSequence str="";
  Editable content=Editable.Factory.getInstance().newEditable(str);
  if (parent == null)   return false;
  CharacterPickerDialog cpd=new CharacterPickerDialog(parent.getContext(),parent,content,pickerString,true){
    private void changeFontSize(    CharSequence result){
      if (result.equals("+"))       increaseFontSize();
 else       if (result.equals("-"))       decreaseFontSize();
    }
    @Override public void onItemClick(    AdapterView p,    View v,    int pos,    long id){
      final String result=String.valueOf(pickerString.charAt(pos));
      changeFontSize(result);
    }
    @Override public void onClick(    View v){
      if (v instanceof Button) {
        final CharSequence result=((Button)v).getText();
        if (result.equals(""))         dismiss();
 else         changeFontSize(result);
      }
    }
    @Override public boolean dispatchKeyEvent(    KeyEvent event){
      if (event.getAction() == KeyEvent.ACTION_DOWN) {
        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK)         dismiss();
        return keyListener.onKey(parent,event.getKeyCode(),event);
      }
      return true;
    }
  }
;
  cpd.show();
  return true;
}
 

Example 17

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentReceiveResultSupport.java

  17 
vote

/** 
 * This method is called when the sending activity has finished, with the result it supplied.
 */
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == GET_CODE) {
    Editable text=(Editable)mResults.getText();
    if (resultCode == RESULT_CANCELED) {
      text.append("(cancelled)");
    }
 else {
      text.append("(okay ");
      text.append(Integer.toString(resultCode));
      text.append(") ");
      if (data != null) {
        text.append(data.getAction());
      }
    }
    text.append("\n");
  }
}
 

Example 18

From project gast-lib, under directory /app/src/root/gast/playground/nfc/.

Source file: BeamInventoryActivity.java

  17 
vote

private void setTextFieldValues(String jsonString){
  JSONObject inventory=null;
  String name="";
  String ram="";
  String processor="";
  try {
    inventory=new JSONObject(jsonString);
    name=inventory.getString("name");
    ram=inventory.getString("ram");
    processor=inventory.getString("processor");
  }
 catch (  JSONException e) {
    Log.e(TAG,"Couldn't parse JSON: ",e);
  }
  Editable nameField=mName.getText();
  nameField.clear();
  nameField.append(name);
  Editable ramField=mRAM.getText();
  ramField.clear();
  ramField.append(ram);
  Editable processorField=mProcessor.getText();
  processorField.clear();
  processorField.append(processor);
}
 

Example 19

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/app/.

Source file: ReceiveResult.java

  17 
vote

/** 
 * This method is called when the sending activity has finished, with the result it supplied.
 * @param requestCode The original request code as given tostartActivity().
 * @param resultCode From sending activity as per setResult().
 * @param data From sending activity as per setResult().
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == GET_CODE) {
    Editable text=(Editable)mResults.getText();
    if (resultCode == RESULT_CANCELED) {
      text.append("(cancelled)");
    }
 else {
      text.append("(okay ");
      text.append(Integer.toString(resultCode));
      text.append(") ");
      if (data != null) {
        text.append(data.getAction());
      }
    }
    text.append("\n");
  }
}
 

Example 20

From project mythmote, under directory /src/tkj/android/homecontrol/mythmote/keymanager/.

Source file: KeyBindingManager.java

  17 
vote

public boolean onLongClick(final View v){
  if (!mEditingEnabled)   return false;
  AlertDialog.Builder alert=new AlertDialog.Builder(v.getContext());
  alert.setTitle(R.string.command_edit_title_str);
  alert.setMessage(R.string.command_edit_msg_str);
  final EditText input=new EditText(v.getContext());
  KeyBindingEntry currentEntry=viewToEntryMap.get(v);
  if (null != currentEntry)   input.setText(currentEntry.getCommand());
  alert.setView(input);
  alert.setPositiveButton("Save",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      Editable value=input.getText();
      KeyBindingEntry oldEntry=viewToEntryMap.get(v);
      if (null != oldEntry && null != communicator) {
        Log.d(MythMote.LOG_TAG,"onLongClick " + oldEntry.getFriendlyName());
        KeyBindingEntry entry=new KeyBindingEntry(oldEntry.getRowID(),oldEntry.getFriendlyName(),oldEntry.getMythKey(),value.toString(),oldEntry.requiresConfirmation());
        viewToEntryMap.put(v,entry);
        databaseAdapter.save(entry);
      }
    }
  }
);
  alert.setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
    }
  }
);
  alert.show();
  return true;
}
 

Example 21

From project No-Pain-No-Game, under directory /src/edu/ucla/cs/nopainnogame/.

Source file: LogInActivity.java

  17 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.login_layout);
  final EditText edittext=(EditText)findViewById(R.id.editInput);
  edittext.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent event){
      if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
        Editable userName=edittext.getText();
        user=userName.toString();
        do_login(userName);
        backHome();
        return true;
      }
      return false;
    }
  }
);
}
 

Example 22

From project platform_frameworks_policies_base, under directory /phone/com/android/internal/policy/impl/.

Source file: SimUnlockScreen.java

  17 
vote

public void onClick(View v){
  if (v == mBackSpaceButton) {
    final Editable digits=mPinText.getEditableText();
    final int len=digits.length();
    if (len > 0) {
      digits.delete(len - 1,len);
      mEnteredDigits--;
    }
    mCallback.pokeWakelock();
  }
 else   if (v == mEmergencyCallButton) {
    mCallback.takeEmergencyCallAction();
  }
 else   if (v == mOkButton) {
    checkPin();
  }
}
 

Example 23

From project tinfoil-sms, under directory /branches/ForgeSMSSend/src/com/tinfoil/sms/.

Source file: ForgeSMSSendActivity.java

  17 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  sendSMS=(Button)findViewById(R.id.send);
  phoneBox=(EditText)findViewById(R.id.phoneNum);
  messageBox=(EditText)findViewById(R.id.message);
  tv=new TextView(this);
  sendSMS.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      Editable phoneNumber=phoneBox.getText();
      Editable message=messageBox.getText();
      String number=phoneNumber.toString();
      String text=message.toString();
      if (number.length() > 0 && text.length() > 0) {
        sendSMS(number,text);
        Toast.makeText(getBaseContext(),"Message sent",Toast.LENGTH_SHORT).show();
      }
 else {
        tv.setText("You have failed to provide sufficent information");
        setContentView(tv);
      }
    }
  }
);
}
 

Example 24

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: AddCommentActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.layout_add_comment);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon_nouveau_rapport);
  final EditText commentField=(EditText)findViewById(R.id.EditText_comment);
  commentField.setText(getIntent().getStringExtra(IntentData.EXTRA_COMMENT));
  ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
  commentField.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable s){
      ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  findViewById(R.id.Button_validate).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (commentField.getText().toString().trim().length() > 0) {
        Intent result=new Intent();
        result.putExtra(IntentData.EXTRA_COMMENT,commentField.getText().toString());
        setResult(RESULT_OK,result);
        finish();
      }
 else {
        Toast.makeText(getApplicationContext(),"Veuillez entrer un commentaire",Toast.LENGTH_SHORT).show();
      }
    }
  }
);
}
 

Example 25

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/navigation/.

Source file: ChooseDictionaryWord.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.choose_dictionary_page);
  if (CurrentPageManager.getInstance().getCurrentDictionary().getCurrentDocument() == null) {
    Log.e(TAG,"No Dictionary");
    finish();
    return;
  }
  initialise();
  EditText searcheditText=(EditText)findViewById(R.id.searchText);
  searcheditText.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence searchText,    int arg1,    int arg2,    int arg3){
      showPossibleDictionaryKeys(searchText.toString());
    }
    @Override public void afterTextChanged(    Editable searchText){
    }
    @Override public void beforeTextChanged(    CharSequence arg0,    int arg1,    int arg2,    int arg3){
    }
  }
);
  searcheditText.requestFocus();
}
 

Example 26

From project Android, under directory /app/src/main/java/com/github/mobile/ui/comment/.

Source file: CreateCommentActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(layout.comment_create);
  commentText=finder.find(id.et_comment);
  commentText.addTextChangedListener(new TextWatcherAdapter(){
    @Override public void afterTextChanged(    Editable s){
      if (applyItem != null)       applyItem.setEnabled(!TextUtils.isEmpty(s));
    }
  }
);
}
 

Example 27

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/objecteditor/.

Source file: ObjectEditor.java

  15 
vote

private void initObjectEditor(){
  setOrientation(LinearLayout.VERTICAL);
  setScrollBarStyle(LinearLayout.SCROLLBARS_INSIDE_OVERLAY);
  LinearLayout innerLayout=new LinearLayout(context);
  innerLayout.setOrientation(LinearLayout.VERTICAL);
  innerLayout.setScrollBarStyle(LinearLayout.SCROLLBARS_INSIDE_OVERLAY);
  ScrollView scrollView=new ScrollView(context);
  for (int i=0; i < object.properties.size(); i++) {
    tag=i;
    TextView textViewName=new TextView(context);
    textViewName.setText(object.properties.get(i).getName());
    textViewName.setTextSize(textViewName.getTextSize() + 2.0f);
    innerLayout.addView(textViewName);
    final EditText editTextValue=new EditText(context);
    editTextValue.setTag(tag);
    editTextValue.setText(object.properties.get(i).getValue());
    editTextValue.addTextChangedListener(new TextWatcher(){
      public void afterTextChanged(      Editable s){
        int currentTag=(Integer)editTextValue.getTag();
        object.properties.get(currentTag).setValue(s.toString());
        Log.d("current Tag",String.valueOf(currentTag));
        Log.d("value changed",object.properties.get(currentTag).getValue());
      }
      public void beforeTextChanged(      CharSequence s,      int start,      int count,      int after){
      }
      public void onTextChanged(      CharSequence s,      int start,      int before,      int count){
      }
    }
);
    innerLayout.addView(editTextValue);
  }
  scrollView.addView(innerLayout);
  addView(scrollView);
}
 

Example 28

From project android-rackspacecloud, under directory /src/com/rackspace/cloud/files/api/client/.

Source file: ContainerManager.java

  15 
vote

public HttpBundle create(Editable editable) throws CloudServersException {
  HttpResponse resp=null;
  CustomHttpClient httpclient=new CustomHttpClient(context);
  String url=getSafeURL(Account.getAccount().getStorageUrl(),editable.toString());
  HttpPut put=new HttpPut(url);
  put.addHeader("X-Auth-Token",Account.getAccount().getAuthToken());
  httpclient.removeRequestInterceptorByClass(RequestExpectContinue.class);
  HttpBundle bundle=new HttpBundle();
  bundle.setCurlRequest(put);
  try {
    resp=httpclient.execute(put);
    bundle.setHttpResponse(resp);
  }
 catch (  ClientProtocolException e) {
    CloudServersException cse=new CloudServersException();
    cse.setMessage(e.getLocalizedMessage());
    throw cse;
  }
catch (  IOException e) {
    CloudServersException cse=new CloudServersException();
    cse.setMessage(e.getLocalizedMessage());
    throw cse;
  }
catch (  FactoryConfigurationError e) {
    CloudServersException cse=new CloudServersException();
    cse.setMessage(e.getLocalizedMessage());
    throw cse;
  }
  return bundle;
}
 

Example 29

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: AbstractContactPickerActivity.java

  15 
vote

protected void createCustomPicker(){
  mContactList=(ListView)findViewById(R.id.contactList);
  mcontactFilter=(EditText)findViewById(R.id.contactFilter);
  mcontactFilter.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int b,    int c){
    }
    public void beforeTextChanged(    CharSequence s,    int st,    int c,    int a){
    }
    public void afterTextChanged(    Editable s){
      adapter.runQueryOnBackgroundThread(s);
      adapter.getFilter().filter(s.toString());
    }
  }
);
  String[] from=new String[]{col_display_name};
  int[] to=new int[]{android.R.id.text1};
  int layout=android.R.layout.simple_list_item_1;
  adapter=new SimpleCursorAdapter(this,layout,runQuery(null),from,to);
  adapter.setFilterQueryProvider(this);
  mContactList.setAdapter(adapter);
  mContactList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final CharSequence contactName=((TextView)view.findViewById(android.R.id.text1)).getText();
      choosePhoneNumberAndDial(contactName,String.valueOf(id));
    }
  }
);
}
 

Example 30

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

Source file: BluetoothNamePreference.java

  15 
vote

public void afterTextChanged(Editable s){
  Dialog d=getDialog();
  if (d instanceof AlertDialog) {
    ((AlertDialog)d).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(s.length() > 0);
  }
}
 

Example 31

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

Source file: DTMFTwelveKeyDialer.java

  15 
vote

/** 
 * Overriden so that with each valid button press, we start sending a dtmf code and play a local dtmf tone.
 */
@Override public boolean onKeyDown(View view,Editable content,int keyCode,KeyEvent event){
  char c=(char)lookup(event,content);
  if (event.getRepeatCount() == 0 && super.onKeyDown(view,content,keyCode,event)) {
    boolean keyOK=ok(getAcceptedChars(),c);
    if (keyOK) {
      if (DBG)       log("DTMFKeyListener reading '" + c + "' from input.");
      processDtmf(c);
    }
 else     if (DBG) {
      log("DTMFKeyListener rejecting '" + c + "' from input.");
    }
    return true;
  }
  return false;
}
 

Example 32

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: SearchActivity.java

  15 
vote

public void afterTextChanged(Editable s){
  boolean empty=s.length() == 0;
  if (empty != mQueryWasEmpty) {
    mQueryWasEmpty=empty;
    updateUi(empty);
  }
  if (mUpdateSuggestions) {
    updateSuggestionsBuffered();
  }
}
 

Example 33

From project apps-for-android, under directory /AnyCut/src/com/example/anycut/.

Source file: ShortcutEditorDialog.java

  15 
vote

public void afterTextChanged(Editable text){
  if (text.length() == 0) {
    mNameView.setError(getContext().getText(R.string.errorEmptyName));
  }
 else {
    mNameView.setError(null);
  }
}
 

Example 34

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/properties/.

Source file: StringProperty.java

  15 
vote

/** 
 * Build the editor for this property
 */
@Override public View getView(LayoutInflater inflater){
  View v=inflater.inflate(R.layout.property_value_string,null);
  ViewTagger.setTag(v,R.id.TAG_PROPERTY,this);
  final TextView name=(TextView)v.findViewById(R.id.name);
  final EditText value=(EditText)v.findViewById(R.id.value);
  name.setText(getName());
  value.setHint(getName());
  value.setText(get());
  value.addTextChangedListener(new TextWatcher(){
    @Override public void afterTextChanged(    Editable s){
      set(s.toString());
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  return v;
}
 

Example 35

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

Source file: EditDialog.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.dialog_edit_text);
  setCanceledOnTouchOutside(true);
  okButton=(Button)findViewById(R.id.dialog_edit_dialog_ok_button);
  editText=(EditText)findViewById(R.id.dialog_edit_dialog_edit_text);
  editText.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      if (s.length() == 0 || (s.length() == 1 && s.charAt(0) == '.')) {
        Toast.makeText(context,R.string.notification_invalid_text_entered,Toast.LENGTH_SHORT).show();
        okButton.setEnabled(false);
      }
 else {
        okButton.setEnabled(true);
      }
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void afterTextChanged(    Editable s){
    }
  }
);
  this.setOnShowListener(new OnShowListener(){
    public void onShow(    DialogInterface dialog){
      InputMethodManager inputManager=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
      inputManager.showSoftInput(editText,InputMethodManager.SHOW_IMPLICIT);
    }
  }
);
  super.onCreate(savedInstanceState);
}
 

Example 36

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

Source file: BluetoothNameDialogFragment.java

  15 
vote

public void afterTextChanged(Editable s){
  if (mDeviceNameUpdated) {
    mDeviceNameUpdated=false;
    mOkButton.setEnabled(false);
  }
 else {
    mDeviceNameEdited=true;
    if (mOkButton != null) {
      mOkButton.setEnabled(s.length() != 0);
    }
  }
}
 

Example 37

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

Source file: CalculatorDisplay.java

  15 
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 38

From project droidgiro-android, under directory /src/se/droidgiro/.

Source file: PairingActivity.java

  15 
vote

public void afterTextChanged(Editable s){
  if (digit1.getText().length() == 0)   digit1.requestFocus();
 else   if (digit2.getText().length() == 0)   digit2.requestFocus();
 else   if (digit3.getText().length() == 0)   digit3.requestFocus();
 else   if (digit4.getText().length() == 0)   digit4.requestFocus();
 else {
    final String pin=digit1.getText().toString() + digit2.getText().toString() + digit3.getText().toString()+ digit4.getText().toString();
    final ProgressDialog pd=ProgressDialog.show(PairingActivity.this,null,getString(R.string.pairing_msg));
    new Thread(){
      public void run(){
        final Registration registration=register(pin);
        handler.post(new Runnable(){
          public void run(){
            pd.dismiss();
            if (registration.isSuccessful()) {
              Intent intent=new Intent(PairingActivity.this,CaptureActivity.class);
              intent.putExtra("channel",registration.getChannel());
              startActivity(intent);
            }
 else {
              Toast.makeText(PairingActivity.this,R.string.pairing_failed,Toast.LENGTH_SHORT).show();
              clear();
            }
          }
        }
);
      }
    }
.start();
  }
}
 

Example 39

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

Source file: NumberPicker.java

  15 
vote

public void afterTextChanged(Editable str){
  if (str.toString().trim().equals("") || str.toString().trim().equals("-")) {
    return;
  }
  int current=Integer.parseInt(str.toString());
  if (mCurrent != current) {
    changeCurrent(current);
  }
}
 

Example 40

From project gauges-android, under directory /app/src/main/java/com/github/mobile/gauges/authenticator/.

Source file: GaugesAuthenticatorActivity.java

  15 
vote

private TextWatcher validationTextWatcher(){
  return new TextWatcherAdapter(){
    public void afterTextChanged(    Editable gitDirEditText){
      updateUIWithValidation();
    }
  }
;
}
 

Example 41

From project gh4a, under directory /src/com/github/mobile/util/.

Source file: HtmlUtils.java

  15 
vote

public ListSeparator append(Editable output,int indentLevel){
  output.append('\n');
  for (int i=0; i < indentLevel * 2; i++)   output.append(' ');
  if (count != -1) {
    output.append(Integer.toString(count)).append('.');
    count++;
  }
 else   output.append('\u2022');
  output.append(' ').append(' ');
  return this;
}
 

Example 42

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: ContactsPickerActivity.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.contacts_picker_activity);
  if (!resolveIntent()) {
    if (Log.isLoggable(ImApp.LOG_TAG,Log.DEBUG)) {
      log("no data, finish");
    }
    finish();
    return;
  }
  EditText filter=(EditText)findViewById(R.id.filter);
  filter.addTextChangedListener(new TextWatcher(){
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      mFilter.filter(s);
    }
    public void afterTextChanged(    Editable s){
    }
  }
);
}
 

Example 43

From project GnucashMobile, under directory /GnucashMobile/src/org/gnucash/android/ui/transactions/.

Source file: NewTransactionFragment.java

  15 
vote

@Override public void afterTextChanged(Editable s){
  if (s.length() == 0)   return;
  BigDecimal amount=parseInputToDecimal(s.toString());
  DecimalFormat formatter=(DecimalFormat)NumberFormat.getInstance(Locale.getDefault());
  formatter.setMinimumFractionDigits(2);
  formatter.setMaximumFractionDigits(2);
  current=formatter.format(amount.doubleValue());
  mAmountEditText.removeTextChangedListener(this);
  mAmountEditText.setText(current);
  mAmountEditText.setSelection(current.length());
  mAmountEditText.addTextChangedListener(this);
}
 

Example 44

From project gobandroid, under directory /src/org/ligi/gobandroid_hd/ui/recording/.

Source file: RecordingGameExtrasFragment.java

  15 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
  et=new EditText(getActivity());
  getGame().addGoGameChangeListener(this);
  et.setText(getGame().getActMove().getComment());
  et.setHint(R.string.enter_your_comments_here);
  et.setGravity(Gravity.TOP);
  et.setTextColor(this.getResources().getColor(R.color.text_color_on_board_bg));
  et.addTextChangedListener(new TextWatcher(){
    @Override public void afterTextChanged(    Editable s){
      getGame().getActMove().setComment(s.toString());
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  et.setLayoutParams(lp);
  return et;
}
 

Example 45

From project greenDAO, under directory /DaoExample/src/de/greenrobot/daoexample/.

Source file: NoteActivity.java

  15 
vote

protected void addUiListeners(){
  editText.setOnEditorActionListener(new OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_DONE) {
        addNote();
        return true;
      }
      return false;
    }
  }
);
  final View button=findViewById(R.id.buttonAdd);
  button.setEnabled(false);
  editText.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      boolean enable=s.length() != 0;
      button.setEnabled(enable);
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void afterTextChanged(    Editable s){
    }
  }
);
}
 

Example 46

From project greenhouse-android, under directory /src/com/springsource/greenhouse/events/sessions/.

Source file: EventSessionRatingActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.event_session_rating);
  textViewCount=(TextView)this.findViewById(R.id.event_session_rating_count);
  textWatcher=new TextWatcher(){
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      textViewCount.setText(String.valueOf(MAX_LENGTH - s.length()));
    }
    public void afterTextChanged(    Editable s){
    }
  }
;
  final EditText editText=(EditText)findViewById(R.id.event_session_rating_text);
  editText.addTextChangedListener(textWatcher);
  final Button submitButton=(Button)findViewById(R.id.event_session_rating_submit);
  submitButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      EditText editText=(EditText)findViewById(R.id.event_session_rating_text);
      inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(),0);
      submitRating();
    }
  }
);
  final Button selectStartButton=(Button)findViewById(R.id.event_session_rating_select_star);
  selectStartButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      showSelectStarRatingDialog();
    }
  }
);
}
 

Example 47

From project HapiPodcastJ, under directory /src/info/xuluan/podcast/.

Source file: SearchActivity.java

  15 
vote

public void afterTextChanged(Editable arg0){
  mStart=0;
  mItems.clear();
  mAdapter.clear();
  updateBtn();
}
 

Example 48

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

Source file: Accounts.java

  15 
vote

@Override public void afterTextChanged(Editable arg0){
  boolean enable=false;
  if (mIncomingPasswordView.getText().length() > 0) {
    if (mOutgoingPasswordView == null) {
      enable=true;
    }
 else     if (mUseIncomingView.isChecked() || mOutgoingPasswordView.getText().length() > 0) {
      enable=true;
    }
  }
  mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(enable);
}
 

Example 49

From project OAK, under directory /oak-demos/src/oak/demo/.

Source file: CancelEditTextActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.cancel_edit_text_demo);
  RelativeLayout attr=(RelativeLayout)findViewById(R.id.attribution);
  attr.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse("http://www.willowtreeapps.com"));
      startActivity(i);
    }
  }
);
  final CancelEditText cancelEditText=(CancelEditText)findViewById(R.id.cancel_edit_one);
  cancelEditText.addTextChangedListener(new TextWatcher(){
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      if (cancelEditText.getText().length() == 0) {
        Toast.makeText(CancelEditTextActivity.this,"The CancelEditText was cleared",1000).show();
      }
    }
    @Override public void afterTextChanged(    Editable s){
    }
  }
);
}
 

Example 50

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

Source file: TextPrompt.java

  15 
vote

@Override public View getView(Context context){
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View layout=inflater.inflate(R.layout.prompt_text,null);
  EditText editText=(EditText)layout.findViewById(R.id.text);
  editText.setText(mText);
  editText.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void afterTextChanged(    Editable s){
      mText=s.toString().trim();
    }
  }
);
  return layout;
}
 

Example 51

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

Source file: TextPrompt.java

  15 
vote

@Override public View getView(Context context){
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View layout=inflater.inflate(R.layout.prompt_text,null);
  EditText editText=(EditText)layout.findViewById(R.id.text);
  editText.setText(mText);
  editText.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void afterTextChanged(    Editable s){
      mText=s.toString().trim();
    }
  }
);
  return layout;
}
 

Example 52

From project Orweb, under directory /src/info/guardianproject/browser/.

Source file: BrowserHomepagePreference.java

  15 
vote

public void afterTextChanged(Editable s){
  AlertDialog dialog=(AlertDialog)getDialog();
  if (dialog != null) {
    dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true);
  }
}
 

Example 53

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

Source file: DTMFTwelveKeyDialer.java

  15 
vote

/** 
 * Overriden so that with each valid button press, we start sending a dtmf code and play a local dtmf tone.
 */
@Override public boolean onKeyDown(View view,Editable content,int keyCode,KeyEvent event){
  char c=(char)lookup(event,content);
  if (event.getRepeatCount() == 0 && super.onKeyDown(view,content,keyCode,event)) {
    boolean keyOK=ok(getAcceptedChars(),c);
    if (keyOK) {
      if (DBG)       log("DTMFKeyListener reading '" + c + "' from input.");
      processDtmf(c);
    }
 else     if (DBG) {
      log("DTMFKeyListener rejecting '" + c + "' from input.");
    }
    return true;
  }
  return false;
}
 

Example 54

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

Source file: AutoFillSettingsFragment.java

  15 
vote

public void afterTextChanged(Editable s){
  String phoneNumber=s.toString();
  int phoneNumberLength=phoneNumber.length();
  phoneNumber=phoneNumber.replaceAll(PHONE_NUMBER_SEPARATORS_REGEX,"");
  int strippedPhoneNumberLength=phoneNumber.length();
  if (phoneNumberLength > 0 && strippedPhoneNumberLength < PHONE_NUMBER_LENGTH) {
    mPhoneEdit.setError(getResources().getText(R.string.autofill_profile_editor_phone_number_invalid));
  }
 else {
    mPhoneEdit.setError(null);
  }
  updateSaveMenuItemState();
}
 

Example 55

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

Source file: DTMFTwelveKeyDialer.java

  15 
vote

/** 
 * Overriden so that with each valid button press, we start sending a dtmf code and play a local dtmf tone.
 */
@Override public boolean onKeyDown(View view,Editable content,int keyCode,KeyEvent event){
  char c=(char)lookup(event,content);
  if (event.getRepeatCount() == 0 && super.onKeyDown(view,content,keyCode,event)) {
    boolean keyOK=ok(getAcceptedChars(),c);
    if (keyOK) {
      if (DBG)       log("DTMFKeyListener reading '" + c + "' from input.");
      processDtmf(c);
    }
 else     if (DBG) {
      log("DTMFKeyListener rejecting '" + c + "' from input.");
    }
    return true;
  }
  return false;
}
 

Example 56

From project platform_packages_apps_im, under directory /src/com/android/im/app/.

Source file: ContactsPickerActivity.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.contacts_picker_activity);
  if (!resolveIntent()) {
    if (Log.isLoggable(ImApp.LOG_TAG,Log.DEBUG)) {
      log("no data, finish");
    }
    finish();
    return;
  }
  EditText filter=(EditText)findViewById(R.id.filter);
  filter.addTextChangedListener(new TextWatcher(){
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      mFilter.filter(s);
    }
    public void afterTextChanged(    Editable s){
    }
  }
);
}
 

Example 57

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: BasicSlideEditorView.java

  15 
vote

@Override public void onFinishInflate(){
  mImageView=(ImageView)findViewById(R.id.image);
  mAudioView=findViewById(R.id.audio);
  mAudioNameView=(TextView)findViewById(R.id.audio_name);
  mEditText=(EditText)findViewById(R.id.text_message);
  mEditText.addTextChangedListener(new TextWatcher(){
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      if (mOnTextChangedListenerEnabled && (mOnTextChangedListener != null)) {
        mOnTextChangedListener.onTextChanged(s.toString());
      }
    }
    public void afterTextChanged(    Editable s){
    }
  }
);
}
 

Example 58

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

Source file: DTMFTwelveKeyDialer.java

  15 
vote

/** 
 * Overriden so that with each valid button press, we start sending a dtmf code and play a local dtmf tone.
 */
@Override public boolean onKeyDown(View view,Editable content,int keyCode,KeyEvent event){
  char c=(char)lookup(event,content);
  if (event.getRepeatCount() == 0 && super.onKeyDown(view,content,keyCode,event)) {
    boolean keyOK=ok(getAcceptedChars(),c);
    if (keyOK) {
      if (DBG)       log("DTMFKeyListener reading '" + c + "' from input.");
      processDtmf(c);
    }
 else     if (DBG) {
      log("DTMFKeyListener rejecting '" + c + "' from input.");
    }
    return true;
  }
  return false;
}
 

Example 59

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

Source file: BluetoothNameDialogFragment.java

  15 
vote

public void afterTextChanged(Editable s){
  if (mDeviceNameUpdated) {
    mDeviceNameUpdated=false;
    mOkButton.setEnabled(false);
  }
 else {
    mDeviceNameEdited=true;
    if (mOkButton != null) {
      mOkButton.setEnabled(s.length() != 0);
    }
  }
}
 

Example 60

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

Source file: TextBinding.java

  15 
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 61

From project ratebeer-for-Android, under directory /RateBeerForAndroid/src/com/ratebeer/android/gui/fragments/.

Source file: RateFragment.java

  15 
vote

@Override public void afterTextChanged(Editable s){
  int left=MIN_CHARACTERS - commentsEdit.getText().length();
  if (commentsEdit.getText().length() == 0) {
    charsText.setText(R.string.rate_commenttooshort);
  }
 else   if (left >= 0) {
    charsText.setText(getString(R.string.rate_charstogo,Integer.toString(left)));
  }
 else {
    charsText.setText(R.string.rate_commentok);
  }
  storeOfflineRating();
}
 

Example 62

From project ratebeerforandroid, under directory /RateBeerForAndroid/src/com/ratebeer/android/gui/fragments/.

Source file: RateFragment.java

  15 
vote

@Override public void afterTextChanged(Editable s){
  int left=MIN_CHARACTERS - commentsEdit.getText().length();
  if (commentsEdit.getText().length() == 0) {
    charsText.setText(R.string.rate_commenttooshort);
  }
 else   if (left >= 0) {
    charsText.setText(getString(R.string.rate_charstogo,Integer.toString(left)));
  }
 else {
    charsText.setText(R.string.rate_commentok);
  }
  storeOfflineRating();
}
 

Example 63

From project RoboBinding, under directory /robobinding/src/main/java/org/robobinding/viewattribute/edittext/.

Source file: OnTextChangedAttribute.java

  15 
vote

@Override protected void bind(final Command command){
  view.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      TextChangedEvent event=new TextChangedEvent(view,start,before,count);
      command.invoke(event);
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void afterTextChanged(    Editable s){
    }
  }
);
}
 

Example 64

From project SamyGo-Android-Remote, under directory /src/de/quist/app/samyGoRemote/.

Source file: Remote.java

  15 
vote

private void showInputDialog(){
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(R.string.text_input_title);
  EditText edit=new EditText(this);
  edit.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void afterTextChanged(    Editable s){
      TextSender sender=(TextSender)mSender;
      try {
        sender.sendText(s.toString());
      }
 catch (      IOException e) {
      }
catch (      InterruptedException e) {
      }
    }
  }
);
  builder.setView(edit);
  AlertDialog d=builder.create();
  d.setOnDismissListener(new OnDismissListener(){
    public void onDismiss(    DialogInterface dialog){
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
  }
);
  d.show();
}
 

Example 65

From project shoppinglist, under directory /ShoppingList/src/org/openintents/shopping/ui/widget/.

Source file: StoreListView.java

  15 
vote

@Override public void afterTextChanged(Editable s){
  if (mBinding)   return;
  if (mView != m_lastView) {
    mView.setOnFocusChangeListener(this);
  }
  m_lastView=mView;
  m_lastCol=mCol;
}
 

Example 66

From project sls, under directory /src/com/adam/aslfms/.

Source file: EditUserCredentials.java

  15 
vote

@Override protected void onBindDialogView(View view){
  super.onBindDialogView(view);
  mUsername=(EditText)view.findViewById(R.id.username);
  mPassword=(EditText)view.findViewById(R.id.password);
  mUsername.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void afterTextChanged(    Editable s){
    }
  }
);
  mUsername.setText(settings.getUsername(mNetApp));
  mPassword.setText(settings.getPassword(mNetApp));
}
 

Example 67

From project smsdroid, under directory /src/de/ub0r/android/smsdroid/.

Source file: MyTextWatcher.java

  15 
vote

/** 
 * {@inheritDoc}
 */
public void afterTextChanged(final Editable s){
  final int len=s.length();
  if (len == 0) {
    if (this.cbmgr.hasText() && !PreferenceManager.getDefaultSharedPreferences(this.context).getBoolean(PreferencesActivity.PREFS_HIDE_PASTE,false)) {
      this.tvPaste.setVisibility(View.VISIBLE);
    }
 else {
      this.tvPaste.setVisibility(View.GONE);
    }
    this.tvTextLabel.setVisibility(View.GONE);
  }
 else {
    this.tvPaste.setVisibility(View.GONE);
    if (len > TEXT_LABLE_MIN_LEN) {
      this.tvTextLabel.setVisibility(View.VISIBLE);
      int[] l=SmsMessage.calculateLength(s.toString(),false);
      this.tvTextLabel.setText(l[0] + "/" + l[2]);
    }
 else {
      this.tvTextLabel.setVisibility(View.GONE);
    }
  }
}
 

Example 68

From project SORMA, under directory /sorma/examples/sorma-address-book/src/com/gaoshin/sorma/addressbook/.

Source file: EditContactActivity.java

  15 
vote

private void getContact(){
  long contactId=getIntent().getLongExtra("contactId",-1);
  if (contactId == -1) {
    contact=new Contact();
    Button btn=(Button)findViewById(R.id.deleteBtn);
    btn.setEnabled(false);
  }
 else {
    contact=sorma.get(Contact.class,"_id=?",new String[]{String.valueOf(contactId)});
    List<Phone> phoneList=sorma.select(Phone.class,"contactId=?",new String[]{String.valueOf(contactId)});
    contact.setPhoneList(phoneList);
  }
  displayNameView=(EditText)findViewById(R.id.displayName);
  displayNameView.addTextChangedListener(new TextWatcher(){
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void afterTextChanged(    Editable s){
      contact.setDisplayName(displayNameView.getText().toString());
    }
  }
);
}
 

Example 69

From project sthlmtraveling, under directory /src/com/markupartist/sthlmtraveling/.

Source file: PlannerFragment.java

  15 
vote

@Override public void afterTextChanged(Editable s){
  if (!getString(R.string.my_location).equals(s.toString()) || getString(R.string.point_on_map).equals(s.toString())) {
    mStop.setName(s.toString());
    mStop.setLocation(null);
  }
}
 

Example 70

From project SVQCOM, under directory /Core/src/com/ushahidi/android/app/.

Source file: DeploymentSearch.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.deployment_search);
  setTitleFromActivityLabel(R.id.title_text);
  promptForDeployment();
  mTextView=(TextView)findViewById(R.id.search_deployment);
  mListView=(ListView)findViewById(R.id.deployment_list);
  mEmptyList=(TextView)findViewById(R.id.empty_list_for_deployments);
  mDeployments=new ArrayList<DeploymentsData>();
  deploymentAdapter=new DeploymentAdapter(this);
  registerForContextMenu(mListView);
  mHandler=new Handler();
  mTextView.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable arg0){
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      showResults(s.toString());
    }
  }
);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final String deploymentId=mDeployments.get(position).getId();
      if (isDeploymentActive(Integer.parseInt(deploymentId))) {
        goToReports();
      }
 else {
        ReportsTask reportsTask=new ReportsTask();
        reportsTask.appContext=DeploymentSearch.this;
        reportsTask.id=String.valueOf(deploymentId);
        reportsTask.execute();
      }
    }
  }
);
  showResults("");
  displayEmptyListText();
}
 

Example 71

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/ui/dialogs/.

Source file: EditDialog.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.dialog_edit_text);
  setCanceledOnTouchOutside(true);
  okButton=(Button)findViewById(R.id.dialog_edit_dialog_ok_button);
  editText=(EditText)findViewById(R.id.dialog_edit_dialog_edit_text);
  editText.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      if (s.length() == 0 || (s.length() == 1 && s.charAt(0) == '.')) {
        Toast.makeText(context,R.string.notification_invalid_text_entered,Toast.LENGTH_SHORT).show();
        okButton.setEnabled(false);
      }
 else {
        okButton.setEnabled(true);
      }
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void afterTextChanged(    Editable s){
    }
  }
);
  this.setOnShowListener(new OnShowListener(){
    public void onShow(    DialogInterface dialog){
      InputMethodManager inputManager=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
      inputManager.showSoftInput(editText,InputMethodManager.SHOW_IMPLICIT);
    }
  }
);
  super.onCreate(savedInstanceState);
}