Search in sources :

Example 1 with PreferencesLoader

use of me.drakeet.meizhi.util.PreferencesLoader in project Meizhi by drakeet.

the class MainActivity method initNotifiableItemState.

private void initNotifiableItemState(MenuItem item) {
    PreferencesLoader loader = new PreferencesLoader(this);
    item.setChecked(loader.getBoolean(R.string.action_notifiable, true));
}
Also used : PreferencesLoader(me.drakeet.meizhi.util.PreferencesLoader)

Example 2 with PreferencesLoader

use of me.drakeet.meizhi.util.PreferencesLoader in project Meizhi by drakeet.

the class MainActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch(id) {
        case R.id.action_trending:
            openGitHubTrending();
            return true;
        case R.id.action_notifiable:
            boolean isChecked = !item.isChecked();
            item.setChecked(isChecked);
            PreferencesLoader loader = new PreferencesLoader(this);
            loader.saveBoolean(R.string.action_notifiable, isChecked);
            Toasts.showShort(isChecked ? R.string.notifiable_on : R.string.notifiable_off);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : PreferencesLoader(me.drakeet.meizhi.util.PreferencesLoader)

Aggregations

PreferencesLoader (me.drakeet.meizhi.util.PreferencesLoader)2