List of usage examples for android.text TextWatcher TextWatcher
TextWatcher
From source file:com.acrylicgoat.scrumnotes.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); sharedPref = getSharedPreferences("com.acrylicgoat.scrumnotes", MODE_PRIVATE); if (savedInstanceState != null) { currentOwner = savedInstanceState.getString("currentOwner"); }/*from www . j a va2 s . c o m*/ if (currentOwner == null || currentOwner.equals("")) { currentOwner = sharedPref.getString("currentOwner", ""); } aBar = this.getActionBar(); today = (EditText) findViewById(R.id.editToday); today.setAutoLinkMask(Linkify.ALL); today.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { Linkify.addLinks(today, Linkify.ALL); } }); devName = (TextView) findViewById(R.id.devName); yesterday = (ImageButton) findViewById(R.id.calendarButton); yesterday.setOnClickListener(new OnClickListener() { public void onClick(View v) { displayPopup(); } }); String[] items = getResources().getStringArray(R.array.nav_list); setDrawer(items); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); SimpleAdapter sAdapter = new SimpleAdapter(this, navTitles, R.layout.nav_drawer, from, to); // Set the adapter for the list view //drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item, navTitles)); // Set the list's click listener drawerList.setOnItemClickListener(new DrawerItemClickListener()); drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; drawerToggle.setDrawerIndicatorEnabled(true); drawerToggle.syncState(); drawerLayout.setDrawerListener(drawerToggle); aBar.setTitle(getString(R.string.app_name)); //aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); aBar.setDisplayHomeAsUpEnabled(true); aBar.setHomeButtonEnabled(true); drawerList.setAdapter(sAdapter); }
From source file:com.acceleratedio.pac_n_zoom.FindTagsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_find_tags); req_str = getIntent().getExtras().getString("requestString"); fil_tags = getIntent().getExtras().getString("tagString").split("(\\s*,\\s*)|(\\s* \\s*)"); Arrays.sort(fil_tags, String.CASE_INSENSITIVE_ORDER); dsply_tags();//from w w w.jav a2 s . c o m tgTxtBar = (EditText) findViewById(R.id.ed_tgs); tgTxtBar.setOnClickListener(this); tgTxtBar.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence key_sqnc, int start, int before, int count) { final StringBuilder strBldr = new StringBuilder(key_sqnc.length()); strBldr.append(key_sqnc); srch_str = strBldr.toString(); dsply_tags(); } @Override public void afterTextChanged(Editable s) { } }); }
From source file:com.imalu.alyou.activity.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (AlUApplication.getInstance().isLogined()) { autoLogin = true;/* w w w. ja v a 2s . c o m*/ startActivity(new Intent(LoginActivity.this, MainActivity.class)); return; } setContentView(R.layout.activity_login); usernameEditText = (EditText) findViewById(R.id.username); passwordEditText = (EditText) findViewById(R.id.password); // ???? usernameEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { passwordEditText.setText(null); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); }
From source file:com.djkim.slap.selectionModel.EnterTextFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mNameView.addTextChangedListener(new TextWatcher() { @Override/* www . ja v a 2 s . co m*/ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(EnterTextPage.NAME_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); /* mEmailView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(EnterTextPage.EMAIL_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } });*/ }
From source file:com.battlelancer.seriesguide.ui.SearchActivity.java
private void setupViews() { clearButton = ButterKnife.findById(this, R.id.imageButtonSearchClear); clearButton.setVisibility(View.GONE); clearButton.setOnClickListener(new View.OnClickListener() { @Override/*from ww w . j av a 2s .co m*/ public void onClick(View v) { searchBar.setText(null); } }); searchBar = ButterKnife.findById(this, R.id.editTextSearchBar); searchBar.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) { boolean isEmptyText = TextUtils.isEmpty(s); submitSearchQuery(isEmptyText ? "" : s.toString()); clearButton.setVisibility(isEmptyText ? View.GONE : View.VISIBLE); } @Override public void afterTextChanged(Editable s) { } }); viewPager = (ViewPager) findViewById(R.id.pagerSearch); TabStripAdapter tabsAdapter = new TabStripAdapter(getSupportFragmentManager(), this, (ViewPager) findViewById(R.id.pagerSearch), (SlidingTabLayout) findViewById(R.id.tabsSearch)); tabsAdapter.addTab(R.string.shows, ShowSearchFragment.class, null); tabsAdapter.addTab(R.string.episodes, EpisodeSearchFragment.class, null); tabsAdapter.notifyTabsChanged(); }
From source file:com.example.android.wizardpager.wizard.ui.TextareaFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mMessageView.addTextChangedListener(new TextWatcher() { @Override// ww w. j a v a 2s. c o m public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { mPage.getData().putString(Page.SIMPLE_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); }
From source file:com.easemob.chatuidemo.activity.LoginFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); usernameEditText = (EditText) view.findViewById(R.id.username); passwordEditText = (EditText) view.findViewById(R.id.password); // ????//from ww w . j a va 2 s .co m usernameEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { passwordEditText.setText(null); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); if (HXApplication.getInstance().getUserName() != null) { usernameEditText.setText(HXApplication.getInstance().getUserName()); } }
From source file:com.acrylicgoat.devchat.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); sharedPref = getSharedPreferences("com.acrylicgoat.devchat", MODE_PRIVATE); if (savedInstanceState != null) { currentOwner = savedInstanceState.getString("currentOwner"); }/*from w w w . j av a2 s . co m*/ if (currentOwner == null || currentOwner.equals("")) { currentOwner = sharedPref.getString("currentOwner", ""); } aBar = this.getActionBar(); today = (EditText) findViewById(R.id.editToday); today.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { Linkify.addLinks(today, Linkify.ALL); } }); devName = (TextView) findViewById(R.id.devName); yesterday = (ImageButton) findViewById(R.id.calendarButton); yesterday.setOnClickListener(new OnClickListener() { public void onClick(View v) { displayPopup(); } }); String[] items = getResources().getStringArray(R.array.nav_list); setDrawer(items); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); SimpleAdapter sAdapter = new SimpleAdapter(this, navTitles, R.layout.nav_drawer, from, to); // Set the adapter for the list view //drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item, navTitles)); // Set the list's click listener drawerList.setOnItemClickListener(new DrawerItemClickListener()); drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(getString(R.string.app_name)); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; drawerToggle.setDrawerIndicatorEnabled(true); drawerToggle.syncState(); drawerLayout.setDrawerListener(drawerToggle); aBar.setTitle(getString(R.string.app_name)); //aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); aBar.setDisplayHomeAsUpEnabled(true); aBar.setHomeButtonEnabled(true); drawerList.setAdapter(sAdapter); }
From source file:com.example.android.wizardpager.wizard.ui.SingleTextFieldFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mFieldView.addTextChangedListener(new TextWatcher() { public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }/*from www. j a va 2s. c o m*/ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } public void afterTextChanged(Editable editable) { mPage.getData().putString(Page.SIMPLE_DATA_KEY, (editable != null) ? editable.toString() : null); mPage.notifyDataChanged(); } }); }
From source file:com.grarak.kerneladiutor.activities.SecurityActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_security); final String password = Utils.decodeString(getIntent().getStringExtra(PASSWORD_INTENT)); AppCompatEditText editText = (AppCompatEditText) findViewById(R.id.edittext); mPasswordWrong = findViewById(R.id.password_wrong); editText.addTextChangedListener(new TextWatcher() { @Override/*from w ww. ja v a 2s . c o m*/ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { if (editable.toString().equals(password)) { mPasswordWrong.setVisibility(View.GONE); setResult(1); finish(); } else { mPasswordWrong.setVisibility(editable.toString().isEmpty() ? View.GONE : View.VISIBLE); } } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Prefs.getBoolean("fingerprint", false, this)) { mFingerprintManagerCompat = FingerprintManagerCompat.from(this); if (mFingerprintManagerCompat.isHardwareDetected() && mFingerprintManagerCompat.hasEnrolledFingerprints() && getSystemService(KeyguardManager.class).isDeviceSecure()) { loadFingerprint(); } } }