Index: adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/SharedPrefsUtils.java |
=================================================================== |
--- a/adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/SharedPrefsUtils.java |
+++ b/adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/util/SharedPrefsUtils.java |
@@ -59,16 +59,35 @@ public class SharedPrefsUtils |
return preferences.getInt(context.getString(keyResId), defValue); |
} |
catch (ClassCastException e) |
{ |
return defValue; |
} |
} |
+ public static void putLong(final Context context, final int keyResId, final long value) |
+ { |
+ final SharedPreferences.Editor editor = getDefaultSharedPreferences(context).edit(); |
+ editor.putLong(context.getString(keyResId), value).apply(); |
+ } |
+ |
+ public static long getLong(final Context context, final int keyResId, final long defValue) |
+ { |
+ final SharedPreferences preferences = getDefaultSharedPreferences(context); |
+ try |
+ { |
+ return preferences.getLong(context.getString(keyResId), defValue); |
+ } |
+ catch (final ClassCastException e) |
+ { |
+ return defValue; |
+ } |
+ } |
+ |
public static void putString(Context context, int keyResId, String value) |
{ |
final SharedPreferences.Editor editor = getDefaultSharedPreferences(context).edit(); |
editor.putString(context.getString(keyResId), value).apply(); |
} |
public static String getString(Context context, int keyResId, String defValue) |
{ |