Search in sources :

Example 1 with SubChooseAdapter

use of me.ccrama.redditslide.Adapters.SubChooseAdapter in project Slide by ccrama.

the class SetupWidget method doShortcut.

public void doShortcut() {
    setContentView(R.layout.activity_setup_widget);
    setupAppBar(R.id.toolbar, R.string.widget_creation_title, true, true);
    header = getLayoutInflater().inflate(R.layout.widget_header, null);
    ListView list = (ListView) findViewById(R.id.subs);
    final ArrayList<String> sorted = UserSubscriptions.getSubscriptionsForShortcut(SetupWidget.this);
    final SubChooseAdapter adapter = new SubChooseAdapter(this, sorted, UserSubscriptions.getAllSubreddits(this));
    list.addHeaderView(header);
    list.setAdapter(adapter);
    (header.findViewById(R.id.sort)).clearFocus();
    ((EditText) header.findViewById(R.id.sort)).addTextChangedListener(new SimpleTextWatcher() {

        @Override
        public void afterTextChanged(Editable editable) {
            final String result = editable.toString();
            adapter.getFilter().filter(result);
        }
    });
}
Also used : EditText(android.widget.EditText) SubChooseAdapter(me.ccrama.redditslide.Adapters.SubChooseAdapter) ListView(android.widget.ListView) SimpleTextWatcher(me.ccrama.redditslide.util.stubs.SimpleTextWatcher) Editable(android.text.Editable)

Example 2 with SubChooseAdapter

use of me.ccrama.redditslide.Adapters.SubChooseAdapter in project Slide by ccrama.

the class Shortcut method doShortcut.

public void doShortcut() {
    setContentView(R.layout.activity_setup_widget);
    setupAppBar(R.id.toolbar, R.string.shortcut_creation_title, true, true);
    header = getLayoutInflater().inflate(R.layout.shortcut_header, null);
    ListView list = (ListView) findViewById(R.id.subs);
    list.addHeaderView(header);
    final ArrayList<String> sorted = UserSubscriptions.getSubscriptionsForShortcut(Shortcut.this);
    final SubChooseAdapter adapter = new SubChooseAdapter(this, sorted, UserSubscriptions.getAllSubreddits(this));
    list.setAdapter(adapter);
    (header.findViewById(R.id.sort)).clearFocus();
    ((EditText) header.findViewById(R.id.sort)).addTextChangedListener(new SimpleTextWatcher() {

        @Override
        public void afterTextChanged(Editable editable) {
            final String result = editable.toString();
            adapter.getFilter().filter(result);
        }
    });
}
Also used : EditText(android.widget.EditText) SubChooseAdapter(me.ccrama.redditslide.Adapters.SubChooseAdapter) ListView(android.widget.ListView) SimpleTextWatcher(me.ccrama.redditslide.util.stubs.SimpleTextWatcher) Editable(android.text.Editable)

Aggregations

Editable (android.text.Editable)2 EditText (android.widget.EditText)2 ListView (android.widget.ListView)2 SubChooseAdapter (me.ccrama.redditslide.Adapters.SubChooseAdapter)2 SimpleTextWatcher (me.ccrama.redditslide.util.stubs.SimpleTextWatcher)2