Java Code Examples for com.gianlu.commonutils.preferences.Prefs#setContains()

The following examples show how to use com.gianlu.commonutils.preferences.Prefs#setContains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DomainActivity.java    From DNSHero with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.domain_preferences:
            startActivity(new Intent(this, PreferenceActivity.class));
            return true;
        case android.R.id.home:
            onBackPressed();
            return true;
        case R.id.domain_favorite:
            Domain domain = (Domain) getIntent().getSerializableExtra("domain");
            if (domain != null) {
                if (Prefs.setContains(PK.FAVORITES, domain.name))
                    Prefs.removeFromSet(PK.FAVORITES, domain.name);
                else
                    Prefs.addToSet(PK.FAVORITES, domain.name);

                invalidateOptionsMenu();
                return true;
            } else {
                return false;
            }
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 2
Source File: TutorialManager.java    From CommonUtils with Apache License 2.0 4 votes vote down vote up
private boolean shouldShowFor(@NonNull BaseTutorial tutorial) {
    return !Prefs.setContains(CommonPK.TUTORIAL_DISCOVERIES, tutorial.discovery.name());
}
 
Example 3
Source File: Option.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
public boolean isQuick() {
    return Prefs.setContains(PK.A2_QUICK_OPTIONS_MIXED, name);
}
 
Example 4
Source File: BlockedUsers.java    From PretendYoureXyzzyAndroid with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isBlocked(@NonNull String name) {
    return Prefs.setContains(PK.BLOCKED_USERS, name);
}