Search in sources :

Example 66 with TextWatcher

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();
}
Also used : TextWatcher(android.text.TextWatcher) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 67 with TextWatcher

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);
}
Also used : TextWatcher(android.text.TextWatcher) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 68 with TextWatcher

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));
    }
}
Also used : AlertDialog(android.app.AlertDialog) SharedPreferences(android.content.SharedPreferences) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) Intent(android.content.Intent) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) ExecutionException(java.util.concurrent.ExecutionException)

Example 69 with TextWatcher

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);
        }
    }
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) ListMapModel(com.ushahidi.android.app.models.ListMapModel) ProgressDialog(android.app.ProgressDialog) ActionModeHelper(com.ushahidi.android.app.helpers.ActionModeHelper)

Example 70 with TextWatcher

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;
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(android.view.LayoutInflater) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) TextView(android.widget.TextView)

Aggregations

TextWatcher (android.text.TextWatcher)192 Editable (android.text.Editable)158 View (android.view.View)96 TextView (android.widget.TextView)75 Paint (android.graphics.Paint)37 ImageView (android.widget.ImageView)30 TextPaint (android.text.TextPaint)28 EditText (android.widget.EditText)28 Intent (android.content.Intent)25 KeyEvent (android.view.KeyEvent)24 AdapterView (android.widget.AdapterView)21 ListView (android.widget.ListView)17 RecyclerView (android.support.v7.widget.RecyclerView)15 DialogInterface (android.content.DialogInterface)13 SuppressLint (android.annotation.SuppressLint)12 OnClickListener (android.view.View.OnClickListener)12 Button (android.widget.Button)12 InputMethodManager (android.view.inputmethod.InputMethodManager)11 AlertDialog (android.app.AlertDialog)10 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9