Java Code Examples for com.pixplicity.easyprefs.library.Prefs#remove()

The following examples show how to use com.pixplicity.easyprefs.library.Prefs#remove() . 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: LoginMaster.java    From uPods-android with Apache License 2.0 6 votes vote down vote up
public void logout() {
    if (AccessToken.getCurrentAccessToken() != null) {
        LoginManager.getInstance().logOut();
        Logger.printInfo(LOG_TAG, "Loged out from facebook");
    }
    if (Twitter.getSessionManager().getActiveSession() != null) {
        Twitter.getSessionManager().clearActiveSession();
        Twitter.logOut();
        Logger.printInfo(LOG_TAG, "Loged out from twitter");
    }
    if (VKSdk.isLoggedIn()) {
        VKSdk.logout();
        Logger.printInfo(LOG_TAG, "Loged out from vk");
    }
    Prefs.remove(SyncMaster.GLOBAL_TOKEN);
    userProfile = new UserProfile();
}
 
Example 2
Source File: ConfigurationManagerImpl.java    From mirror with Apache License 2.0 5 votes vote down vote up
@Override
public boolean getBoolean(String preferenceKey, boolean defaultValue) {
    try {
        return Prefs.getBoolean(preferenceKey, defaultValue);
    } catch (ClassCastException e) {
        Timber.e(e, "Error getting the value for %s", preferenceKey);
        Prefs.remove(preferenceKey);
        return defaultValue;
    }
}
 
Example 3
Source File: ConfigurationManagerImpl.java    From mirror with Apache License 2.0 5 votes vote down vote up
@Override
public float getFloat(String preferenceKey, float defaultValue) {
    try {
        return Prefs.getFloat(preferenceKey, defaultValue);
    } catch (ClassCastException e) {
        Timber.e(e, "Error getting the value for %s", preferenceKey);
        Prefs.remove(preferenceKey);
        return defaultValue;
    }
}
 
Example 4
Source File: ConfigurationManagerImpl.java    From mirror with Apache License 2.0 5 votes vote down vote up
@Override
public String getString(String preferenceKey, String defaultValue) {
    try {
        return Prefs.getString(preferenceKey, defaultValue);
    } catch (ClassCastException e) {
        Timber.e(e, "Error getting the value for %s", preferenceKey);
        Prefs.remove(preferenceKey);
        return defaultValue;
    }
}
 
Example 5
Source File: ConfigurationManagerImpl.java    From mirror with Apache License 2.0 5 votes vote down vote up
@Override
public void updateString(String preferenceKey, String preferenceValue) {
    final String value = trimToNull(preferenceValue);
    if (value != null) {
        Prefs.putString(preferenceKey, value);
    } else {
        Prefs.remove(preferenceKey);
    }
}