Search in sources :

Example 61 with TextWatcher

use of android.text.TextWatcher in project SeaStar by 13120241790.

the class FriendsFragment method initView.

private void initView() {
    //实例化汉字转拼音类
    characterParser = CharacterParser.getInstance();
    pinyinComparator = PinyinComparator.getInstance();
    mAboutSerrch = (ClearWriteEditText) mView.findViewById(R.id.filter_edit);
    mListView = (ListView) mView.findViewById(R.id.friendlistview);
    mSidBar = (SideBar) mView.findViewById(R.id.sidrbar);
    dialog = (TextView) mView.findViewById(R.id.dialog);
    show_no_friends = (TextView) mView.findViewById(R.id.show_no_friends);
    mSidBar.setTextView(dialog);
    //设置右侧触摸监听
    mSidBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {

        @Override
        public void onTouchingLetterChanged(String s) {
            //该字母首次出现的位置
            int position = adapter.getPositionForSection(s.charAt(0));
            if (position != -1) {
                mListView.setSelection(position);
            }
        }
    });
    //-------------- 获取好友列表数据 ---------------
    friendDao = DBManager.getInstance(getActivity()).getDaoSession().getFriendDao();
    QueryBuilder<com.rongseal.db.com.rongseal.database.Friend> qb = friendDao.queryBuilder();
    if (qb.list().size() > 0 && qb.list() != null) {
        for (int i = 0; i < qb.list().size(); i++) {
            com.rongseal.db.com.rongseal.database.Friend bean = qb.list().get(i);
            mSourceDateList.add(new Friend(bean.getUserId(), bean.getName(), bean.getPortraitUri()));
        }
    } else {
        //TODO 是否需要网络再次拉取? login 已经拉取存数据库
        NLog.e("database", "friend database is null");
    }
    //过滤数据对象为友字母字段
    SourceDateList = filledData(mSourceDateList);
    if (SourceDateList.size() > 0) {
        show_no_friends.setVisibility(View.GONE);
    }
    for (int i = 0; i < mSourceDateList.size(); i++) {
        SourceDateList.get(i).setUserId(mSourceDateList.get(i).getUserId());
        SourceDateList.get(i).setName(mSourceDateList.get(i).getName());
        SourceDateList.get(i).setUri(mSourceDateList.get(i).getUri());
    }
    mSourceDateList = null;
    // 根据a-z进行排序源数据
    Collections.sort(SourceDateList, pinyinComparator);
    adapter = new FriendAdapter(getActivity(), SourceDateList);
    mListView.setAdapter(adapter);
    mListView.setOnItemLongClickListener(this);
    mListView.setOnItemClickListener(this);
    //根据输入框输入值的改变来过滤搜索  顶部实时搜索
    mAboutSerrch.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            //当输入框里面的值为空,更新为原来的列表,否则为过滤数据列表
            filterData(s.toString());
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
}
Also used : FriendAdapter(com.rongseal.adapter.FriendAdapter) Friend(com.rongseal.bean.Friend) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) SideBar(com.rongseal.pinyin.SideBar)

Example 62 with TextWatcher

use of android.text.TextWatcher in project AntennaPod by AntennaPod.

the class PreferenceController method onCreate.

public void onCreate() {
    final Activity activity = ui.getActivity();
    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        // disable expanded notification option on unsupported android versions
        ui.findPreference(PreferenceController.PREF_EXPANDED_NOTIFICATION).setEnabled(false);
        ui.findPreference(PreferenceController.PREF_EXPANDED_NOTIFICATION).setOnPreferenceClickListener(preference -> {
            Toast toast = Toast.makeText(activity, R.string.pref_expand_notify_unsupport_toast, Toast.LENGTH_SHORT);
            toast.show();
            return true;
        });
    }
    ui.findPreference(PreferenceController.PREF_FLATTR_REVOKE).setOnPreferenceClickListener(preference -> {
        FlattrUtils.revokeAccessToken(activity);
        checkItemVisibility();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_ABOUT).setOnPreferenceClickListener(preference -> {
        activity.startActivity(new Intent(activity, AboutActivity.class));
        return true;
    });
    ui.findPreference(PreferenceController.STATISTICS).setOnPreferenceClickListener(preference -> {
        activity.startActivity(new Intent(activity, StatisticsActivity.class));
        return true;
    });
    ui.findPreference(PreferenceController.PREF_OPML_EXPORT).setOnPreferenceClickListener(preference -> export(new OpmlWriter()));
    ui.findPreference(PreferenceController.PREF_HTML_EXPORT).setOnPreferenceClickListener(preference -> export(new HtmlWriter()));
    ui.findPreference(PreferenceController.PREF_CHOOSE_DATA_DIR).setOnPreferenceClickListener(preference -> {
        if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
            showChooseDataFolderDialog();
        } else {
            int readPermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);
            int writePermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
            if (readPermission == PackageManager.PERMISSION_GRANTED && writePermission == PackageManager.PERMISSION_GRANTED) {
                openDirectoryChooser();
            } else {
                requestPermission();
            }
        }
        return true;
    });
    ui.findPreference(PreferenceController.PREF_CHOOSE_DATA_DIR).setOnPreferenceClickListener(preference -> {
        if (Build.VERSION.SDK_INT >= 19) {
            showChooseDataFolderDialog();
        } else {
            Intent intent = new Intent(activity, DirectoryChooserActivity.class);
            activity.startActivityForResult(intent, DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED);
        }
        return true;
    });
    ui.findPreference(UserPreferences.PREF_THEME).setOnPreferenceChangeListener((preference, newValue) -> {
        Intent i = new Intent(activity, MainActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        activity.finish();
        activity.startActivity(i);
        return true;
    });
    ui.findPreference(UserPreferences.PREF_HIDDEN_DRAWER_ITEMS).setOnPreferenceClickListener(preference -> {
        showDrawerPreferencesDialog();
        return true;
    });
    ui.findPreference(UserPreferences.PREF_COMPACT_NOTIFICATION_BUTTONS).setOnPreferenceClickListener(preference -> {
        showNotificationButtonsDialog();
        return true;
    });
    ui.findPreference(UserPreferences.PREF_UPDATE_INTERVAL).setOnPreferenceClickListener(preference -> {
        showUpdateIntervalTimePreferencesDialog();
        return true;
    });
    ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL).setOnPreferenceChangeListener((preference, newValue) -> {
        if (newValue instanceof Boolean) {
            boolean enabled = (Boolean) newValue;
            ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setEnabled(enabled);
            ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_ON_BATTERY).setEnabled(enabled);
            ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER).setEnabled(enabled);
            setSelectedNetworksEnabled(enabled && UserPreferences.isEnableAutodownloadWifiFilter());
        }
        return true;
    });
    ui.findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER).setOnPreferenceChangeListener((preference, newValue) -> {
        if (newValue instanceof Boolean) {
            setSelectedNetworksEnabled((Boolean) newValue);
            return true;
        } else {
            return false;
        }
    });
    ui.findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS).setOnPreferenceChangeListener((preference, o) -> {
        if (o instanceof String) {
            try {
                int value = Integer.parseInt((String) o);
                if (1 <= value && value <= 50) {
                    setParallelDownloadsText(value);
                    return true;
                }
            } catch (NumberFormatException e) {
                return false;
            }
        }
        return false;
    });
    // validate and set correct value: number of downloads between 1 and 50 (inclusive)
    final EditText ev = ((EditTextPreference) ui.findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS)).getEditText();
    ev.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) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.length() > 0) {
                try {
                    int value = Integer.parseInt(s.toString());
                    if (value <= 0) {
                        ev.setText("1");
                    } else if (value > 50) {
                        ev.setText("50");
                    }
                } catch (NumberFormatException e) {
                    ev.setText("6");
                }
                ev.setSelection(ev.getText().length());
            }
        }
    });
    ui.findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setOnPreferenceChangeListener((preference, o) -> {
        if (o instanceof String) {
            setEpisodeCacheSizeText(UserPreferences.readEpisodeCacheSize((String) o));
        }
        return true;
    });
    ui.findPreference(PreferenceController.PREF_PLAYBACK_SPEED_LAUNCHER).setOnPreferenceClickListener(preference -> {
        VariableSpeedDialog.showDialog(activity);
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_SETLOGIN_INFORMATION).setOnPreferenceClickListener(preference -> {
        AuthenticationDialog dialog = new AuthenticationDialog(activity, R.string.pref_gpodnet_setlogin_information_title, false, false, GpodnetPreferences.getUsername(), null) {

            @Override
            protected void onConfirmed(String username, String password, boolean saveUsernamePassword) {
                GpodnetPreferences.setPassword(password);
            }
        };
        dialog.show();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_SYNC).setOnPreferenceClickListener(preference -> {
        GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext());
        Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, Toast.LENGTH_SHORT);
        toast.show();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_FORCE_FULL_SYNC).setOnPreferenceClickListener(preference -> {
        GpodnetPreferences.setLastSubscriptionSyncTimestamp(0L);
        GpodnetPreferences.setLastEpisodeActionsSyncTimestamp(0L);
        GpodnetPreferences.setLastSyncAttempt(false, 0);
        updateLastGpodnetSyncReport(false, 0);
        GpodnetSyncService.sendSyncIntent(ui.getActivity().getApplicationContext());
        Toast toast = Toast.makeText(ui.getActivity(), R.string.pref_gpodnet_sync_started, Toast.LENGTH_SHORT);
        toast.show();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_LOGOUT).setOnPreferenceClickListener(preference -> {
        GpodnetPreferences.logout();
        Toast toast = Toast.makeText(activity, R.string.pref_gpodnet_logout_toast, Toast.LENGTH_SHORT);
        toast.show();
        updateGpodnetPreferenceScreen();
        return true;
    });
    ui.findPreference(PreferenceController.PREF_GPODNET_HOSTNAME).setOnPreferenceClickListener(preference -> {
        GpodnetSetHostnameDialog.createDialog(activity).setOnDismissListener(dialog -> updateGpodnetPreferenceScreen());
        return true;
    });
    ui.findPreference(PreferenceController.PREF_AUTO_FLATTR_PREFS).setOnPreferenceClickListener(preference -> {
        AutoFlattrPreferenceDialog.newAutoFlattrPreferenceDialog(activity, new AutoFlattrPreferenceDialog.AutoFlattrPreferenceDialogInterface() {

            @Override
            public void onCancelled() {
            }

            @Override
            public void onConfirmed(boolean autoFlattrEnabled, float autoFlattrValue) {
                UserPreferences.setAutoFlattrSettings(autoFlattrEnabled, autoFlattrValue);
                checkItemVisibility();
            }
        });
        return true;
    });
    ui.findPreference(UserPreferences.PREF_IMAGE_CACHE_SIZE).setOnPreferenceChangeListener((preference, o) -> {
        if (o instanceof String) {
            int newValue = Integer.parseInt((String) o) * 1024 * 1024;
            if (newValue != UserPreferences.getImageCacheSize()) {
                AlertDialog.Builder dialog = new AlertDialog.Builder(ui.getActivity());
                dialog.setTitle(android.R.string.dialog_alert_title);
                dialog.setMessage(R.string.pref_restart_required);
                dialog.setPositiveButton(android.R.string.ok, null);
                dialog.show();
            }
            return true;
        }
        return false;
    });
    ui.findPreference(PREF_PROXY).setOnPreferenceClickListener(preference -> {
        ProxyDialog dialog = new ProxyDialog(ui.getActivity());
        dialog.createDialog().show();
        return true;
    });
    ui.findPreference(PREF_KNOWN_ISSUES).setOnPreferenceClickListener(preference -> {
        openInBrowser("https://github.com/AntennaPod/AntennaPod/labels/bug");
        return true;
    });
    ui.findPreference(PREF_FAQ).setOnPreferenceClickListener(preference -> {
        openInBrowser("http://antennapod.org/faq.html");
        return true;
    });
    ui.findPreference(PREF_SEND_CRASH_REPORT).setOnPreferenceClickListener(preference -> {
        Intent emailIntent = new Intent(Intent.ACTION_SEND);
        emailIntent.setType("text/plain");
        emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "Martin.Fietz@gmail.com" });
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "AntennaPod Crash Report");
        emailIntent.putExtra(Intent.EXTRA_TEXT, "Please describe what you were doing when the app crashed");
        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(CrashReportWriter.getFile()));
        String intentTitle = ui.getActivity().getString(R.string.send_email);
        ui.getActivity().startActivity(Intent.createChooser(emailIntent, intentTitle));
        return true;
    });
    PreferenceControllerFlavorHelper.setupFlavoredUI(ui);
    buildEpisodeCleanupPreference();
    buildSmartMarkAsPlayedPreference();
    buildAutodownloadSelectedNetworsPreference();
    setSelectedNetworksEnabled(UserPreferences.isEnableAutodownloadWifiFilter());
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ProxyDialog(de.danoeh.antennapod.dialog.ProxyDialog) AutoFlattrPreferenceDialog(de.danoeh.antennapod.dialog.AutoFlattrPreferenceDialog) HtmlWriter(de.danoeh.antennapod.core.export.html.HtmlWriter) MainActivity(de.danoeh.antennapod.activity.MainActivity) AboutActivity(de.danoeh.antennapod.activity.AboutActivity) StatisticsActivity(de.danoeh.antennapod.activity.StatisticsActivity) PreferenceActivity(de.danoeh.antennapod.activity.PreferenceActivity) DirectoryChooserActivity(de.danoeh.antennapod.activity.DirectoryChooserActivity) Activity(android.app.Activity) StatisticsActivity(de.danoeh.antennapod.activity.StatisticsActivity) Toast(android.widget.Toast) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) EditText(android.widget.EditText) AuthenticationDialog(de.danoeh.antennapod.dialog.AuthenticationDialog) Intent(android.content.Intent) EditTextPreference(android.preference.EditTextPreference) SuppressLint(android.annotation.SuppressLint) AboutActivity(de.danoeh.antennapod.activity.AboutActivity) OpmlWriter(de.danoeh.antennapod.core.export.opml.OpmlWriter)

Example 63 with TextWatcher

use of android.text.TextWatcher in project android_frameworks_base by DirtyUnicorns.

the class TextView method sendOnTextChanged.

/**
     * Not private so it can be called from an inner class without going
     * through a thunk.
     */
void sendOnTextChanged(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).onTextChanged(text, start, before, after);
        }
    }
    if (mEditor != null)
        mEditor.sendOnTextChanged(start, after);
}
Also used : TextWatcher(android.text.TextWatcher) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 64 with TextWatcher

use of android.text.TextWatcher in project KISS by Neamar.

the class MainActivity method onCreate.

/**
     * Called when the activity is first created.
     */
@Override
public void onCreate(Bundle savedInstanceState) {
    // Initialize UI
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String theme = prefs.getString("theme", "light");
    switch(theme) {
        case "dark":
            setTheme(R.style.AppThemeDark);
            break;
        case "transparent":
            setTheme(R.style.AppThemeTransparent);
            break;
        case "semi-transparent":
            setTheme(R.style.AppThemeSemiTransparent);
            break;
        case "semi-transparent-dark":
            setTheme(R.style.AppThemeSemiTransparentDark);
            break;
        case "transparent-dark":
            setTheme(R.style.AppThemeTransparentDark);
            break;
    }
    super.onCreate(savedInstanceState);
    IntentFilter intentFilter = new IntentFilter(START_LOAD);
    IntentFilter intentFilterBis = new IntentFilter(LOAD_OVER);
    IntentFilter intentFilterTer = new IntentFilter(FULL_LOAD_OVER);
    mReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equalsIgnoreCase(LOAD_OVER)) {
                updateRecords(searchEditText.getText().toString());
            } else if (intent.getAction().equalsIgnoreCase(FULL_LOAD_OVER)) {
                // Run GC once to free all the garbage accumulated during provider initialization
                System.gc();
                displayQuickFavoritesBar(true, false);
                displayLoader(false);
            } else if (intent.getAction().equalsIgnoreCase(START_LOAD)) {
                displayLoader(true);
            }
        }
    };
    this.registerReceiver(mReceiver, intentFilter);
    this.registerReceiver(mReceiver, intentFilterBis);
    this.registerReceiver(mReceiver, intentFilterTer);
    KissApplication.initDataHandler(this);
    // Initialize preferences
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    // Do it here (before initializing the view) to make the transition as smooth as possible
    if (prefs.getBoolean("force-portrait", true)) {
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
    }
    setContentView(R.layout.main);
    this.list = (ListView) this.findViewById(android.R.id.list);
    this.listContainer = (View) this.list.getParent();
    this.listEmpty = this.findViewById(android.R.id.empty);
    // Create adapter for records
    this.adapter = new RecordAdapter(this, this, R.layout.item_app, new ArrayList<Result>());
    this.list.setAdapter(this.adapter);
    this.list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            adapter.onClick(position, v);
        }
    });
    this.adapter.registerDataSetObserver(new DataSetObserver() {

        @Override
        public void onChanged() {
            super.onChanged();
            if (adapter.isEmpty()) {
                listContainer.setVisibility(View.GONE);
                listEmpty.setVisibility(View.VISIBLE);
            } else {
                listContainer.setVisibility(View.VISIBLE);
                listEmpty.setVisibility(View.GONE);
            }
        }
    });
    registerLongClickOnFavorites();
    searchEditText = (EditText) findViewById(R.id.searchEditText);
    // Listen to changes
    searchEditText.addTextChangedListener(new TextWatcher() {

        public void afterTextChanged(Editable s) {
            // Auto left-trim text.
            if (s.length() > 0 && s.charAt(0) == ' ')
                s.delete(0, 1);
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            String text = s.toString();
            adjustInputType(text);
            updateRecords(text);
            displayClearOnInput();
        }
    });
    // On validate, launch first record
    searchEditText.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            RecordAdapter adapter = ((RecordAdapter) list.getAdapter());
            adapter.onClick(adapter.getCount() - 1, v);
            return true;
        }
    });
    kissBar = findViewById(R.id.main_kissbar);
    favoritesKissBar = findViewById(R.id.favoritesKissBar);
    menuButton = findViewById(R.id.menuButton);
    registerForContextMenu(menuButton);
    this.list.setLongClickable(true);
    this.list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id) {
            ((RecordAdapter) parent.getAdapter()).onLongClick(pos, v);
            return true;
        }
    });
    this.hider = new KeyboardScrollHider(this, (BlockableListView) this.list, (BottomPullEffectView) this.findViewById(R.id.listEdgeEffect));
    this.hider.start();
    // Check whether user enabled spell check and adjust input type accordingly
    searchEditTextWorkaround = prefs.getBoolean("enable-keyboard-workaround", false);
    adjustInputType(null);
    //enable/disable phone/sms broadcast receiver
    PackageManagerUtils.enableComponent(this, IncomingSmsHandler.class, prefs.getBoolean("enable-sms-history", false));
    PackageManagerUtils.enableComponent(this, IncomingCallHandler.class, prefs.getBoolean("enable-phone-history", false));
    // Hide the "X" after the text field, instead displaying the menu button
    displayClearOnInput();
    UiTweaks.updateThemePrimaryColor(this);
    UiTweaks.tintResources(this);
}
Also used : ArrayList(java.util.ArrayList) KeyEvent(android.view.KeyEvent) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) TextView(android.widget.TextView) KeyboardScrollHider(fr.neamar.kiss.ui.KeyboardScrollHider) Context(android.content.Context) IntentFilter(android.content.IntentFilter) BlockableListView(fr.neamar.kiss.ui.BlockableListView) BottomPullEffectView(fr.neamar.kiss.ui.BottomPullEffectView) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BottomPullEffectView(fr.neamar.kiss.ui.BottomPullEffectView) ListView(android.widget.ListView) BlockableListView(fr.neamar.kiss.ui.BlockableListView) DataSetObserver(android.database.DataSetObserver) SuppressLint(android.annotation.SuppressLint) RecordAdapter(fr.neamar.kiss.adapter.RecordAdapter) AdapterView(android.widget.AdapterView) OnEditorActionListener(android.widget.TextView.OnEditorActionListener)

Example 65 with TextWatcher

use of android.text.TextWatcher in project android_frameworks_base by ParanoidAndroid.

the class TextView method sendOnTextChanged.

/**
     * Not private so it can be called from an inner class without going
     * through a thunk.
     */
void sendOnTextChanged(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).onTextChanged(text, start, before, after);
        }
    }
    if (mEditor != null)
        mEditor.sendOnTextChanged(start, after);
}
Also used : TextWatcher(android.text.TextWatcher) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

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