Example usage for android.app Activity getSharedPreferences

List of usage examples for android.app Activity getSharedPreferences

Introduction

In this page you can find the example usage for android.app Activity getSharedPreferences.

Prototype

@Override
    public SharedPreferences getSharedPreferences(String name, int mode) 

Source Link

Usage

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static int getCurrencyUnit(Activity context) {
    SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    return settingsToGet.getInt(BRConstants.CURRENT_UNIT, BRConstants.CURRENT_UNIT_BITS);
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static String getIso(Activity context) {
    SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    return settingsToGet.getString(BRConstants.CURRENT_CURRENCY,
            Currency.getInstance(Locale.getDefault()).getCurrencyCode());
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static String getDeviceId(Activity context) {
    SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    String deviceId = settingsToGet.getString(BRConstants.USER_ID, "");
    if (deviceId.isEmpty())
        setDeviceId(context, UUID.randomUUID().toString());
    return (settingsToGet.getString(BRConstants.USER_ID, ""));
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static void clearAllPrefs(Activity activity) {
    SharedPreferences.Editor editor = activity
            .getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE).edit();
    editor.clear();/* ww w. j  a va2  s .  c o  m*/
    editor.apply();
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static void putFeePerKb(Activity context, long fee) {
    SharedPreferences prefs = context.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putLong(BRConstants.FEE_KB_PREFS, fee);
    editor.apply();//from   w ww  .  j a  va 2 s  .  co m
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static void putSecureTime(Activity activity, long date) {
    SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putLong(BRConstants.SECURE_TIME_PREFS, date);
    editor.apply();//  w w  w . j a  va 2  s  .c  o  m
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static void putLimit(Activity activity, int limit) {
    SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putInt(BRConstants.LIMIT_PREFS, limit);
    editor.apply();/*  w  w w  .  ja  v  a2s.  c  o  m*/
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static void putRate(Activity context, float rate) {
    SharedPreferences settings = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
    SharedPreferences.Editor editor = settings.edit();
    editor.putFloat(BRConstants.RATE, rate);
    editor.apply();/*from   www .  j av a2s  .c  om*/
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static void putPhraseWroteDown(Activity context, boolean check) {
    SharedPreferences prefs = context.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean(BRConstants.PHRASE_WRITTEN, check);
    editor.apply();//ww  w .j av a 2s.  c om
}

From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java

public static boolean getFeatureEnabled(Activity activity, String feature) {
    SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE);
    return prefs.getBoolean(feature, false);
}