use of android.text.TextWatcher in project android_frameworks_base by AOSPA.
the class TextView method sendAfterTextChanged.
/**
* Not private so it can be called from an inner class without going
* through a thunk.
*/
void sendAfterTextChanged(Editable text) {
if (mListeners != null) {
final ArrayList<TextWatcher> list = mListeners;
final int count = list.size();
for (int i = 0; i < count; i++) {
list.get(i).afterTextChanged(text);
}
}
hideErrorIfUnchanged();
}
use of android.text.TextWatcher in project android_frameworks_base by AOSPA.
the class TextView method sendBeforeTextChanged.
private void sendBeforeTextChanged(CharSequence text, int start, int before, int after) {
if (mListeners != null) {
final ArrayList<TextWatcher> list = mListeners;
final int count = list.size();
for (int i = 0; i < count; i++) {
list.get(i).beforeTextChanged(text, start, before, after);
}
}
// The spans that are inside or intersect the modified region no longer make sense
removeIntersectingNonAdjacentSpans(start, start + before, SpellCheckSpan.class);
removeIntersectingNonAdjacentSpans(start, start + before, SuggestionSpan.class);
}
use of android.text.TextWatcher in project Diaspora-Webclient by voidcode.
the class PodSettingsActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
if (isNetworkAvailable()) {
try {
//load pods from poduptime.me as a AsyncTask
lvPods_arr = new getPodlistTask(this).execute().get();
Log.i("lvPods_arr", String.valueOf(lvPods_arr.length));
super.onCreate(savedInstanceState);
setContentView(R.layout.podsettings);
//load elements from layout file podsettings.xml
editTextCurrentpod = (EditText) findViewById(R.id.editText_currentpod);
lvPods = (ListView) findViewById(R.id.listView_poduptime);
//show the currentpod to user
SharedPreferences preferences = getSharedPreferences(SETTINGS_FILENAME, MODE_PRIVATE);
editTextCurrentpod.setText(preferences.getString("currentpod", "You need to choose a pod"));
editTextCurrentpod.selectAll();
//check if user have be get the dialog info box
if (preferences.getBoolean("has_show_dialog", false) == false) {
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(R.string.podsettings_dialog_title);
alert.setMessage(R.string.podsettings_dialog_text);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert.show();
//this ensure the user only see the dialogbox ones
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("has_show_dialog", true);
editor.commit();
}
//fill listview with pods form http://podupti.me
fillListview(this.lvPods_arr);
//podsearch, A fast find search on editTextCurrentpod, So user don�t have to scholl the podlist to finde a pod
editTextCurrentpod.addTextChangedListener(new TextWatcher() {
List<String> filter_podurl_list = null;
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
filter_podurl_list = new ArrayList<String>();
for (String podurl : lvPods_arr) {
if (podurl.startsWith(s.toString())) {
filter_podurl_list.add(podurl);
}
}
}
public void afterTextChanged(Editable s) {
///add reslut to listview
if (!filter_podurl_list.equals(null))
fillListview(filter_podurl_list.toArray(new String[filter_podurl_list.size()]));
}
});
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else //user have NO internet
{
this.finish();
startActivity(new Intent(this, SetupInternetActivity.class));
}
}
use of android.text.TextWatcher in project Ushahidi_Android by ushahidi.
the class ListMapFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
mListMapModel = new ListMapModel();
this.dialog = new ProgressDialog(getActivity());
this.dialog.setCancelable(true);
this.dialog.setIndeterminate(true);
this.dialog.setMessage(getString(R.string.please_wait));
if (Util.isHoneycomb()) {
listView.setLongClickable(true);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setOnItemLongClickListener(new ActionModeHelper(this, listView));
} else {
registerForContextMenu(listView);
}
// filter map list
if (view != null) {
if (view.mSearchMap != null) {
view.mSearchMap.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) {
if (!(TextUtils.isEmpty(s.toString()))) {
filter = s.toString();
mHandler.post(filterMapList);
} else {
mHandler.post(fetchMapList);
}
}
});
}
}
if (savedInstanceState != null) {
int position = savedInstanceState.getInt(STATE_CHECKED, -1);
if (position > -1) {
listView.setItemChecked(position, true);
}
}
}
use of android.text.TextWatcher in project Ushahidi_Android by ushahidi.
the class ListReportFragment method headerView.
@Override
protected View headerView() {
LayoutInflater inflater = getActivity().getLayoutInflater();
ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.list_report_header, getListView(), false);
TextView textView = (TextView) viewGroup.findViewById(R.id.filter_report);
textView.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) {
if (!(TextUtils.isEmpty(s.toString()))) {
filterTitle = s.toString();
mHandler.post(filterReportList);
}
}
});
return viewGroup;
}
Aggregations