From 65ada8b5709f735c704f6341fb2664db221106a8 Mon Sep 17 00:00:00 2001 From: Aitor Viana Date: Thu, 17 Dec 2015 12:20:36 +0100 Subject: [PATCH] refactor: extract string to constant --- .../src/main/java/com/aitorvs/android/allowme/AllowMe.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/aitorvs/android/allowme/AllowMe.java b/library/src/main/java/com/aitorvs/android/allowme/AllowMe.java index b0cd085..9971f90 100644 --- a/library/src/main/java/com/aitorvs/android/allowme/AllowMe.java +++ b/library/src/main/java/com/aitorvs/android/allowme/AllowMe.java @@ -37,6 +37,7 @@ public class AllowMe { private static final String TAG = AllowMe.class.getSimpleName(); + private static final String ALLOWME_SHOULD_SHOW_PRIMING_KEY = TAG + ".key.should_show_priming"; private static AllowMe instance; private Activity mActivity; @@ -314,10 +315,10 @@ private void requestPermission(int requestCode) { public boolean shouldShowPrimingMessage() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(safeActivity()); - boolean value = sharedPreferences.getBoolean("should_show_priming", true); + boolean value = sharedPreferences.getBoolean(ALLOWME_SHOULD_SHOW_PRIMING_KEY, true); // we've been called, set it to false again - sharedPreferences.edit().putBoolean("should_show_priming", false).apply(); + sharedPreferences.edit().putBoolean(ALLOWME_SHOULD_SHOW_PRIMING_KEY, false).apply(); return value; }