From 436c63bafce59365c6e781b61e8db3bed352a325 Mon Sep 17 00:00:00 2001 From: jneivil Date: Wed, 6 Nov 2019 17:15:55 +0100 Subject: [PATCH] Update RateThisApp.java When "remenber" set false KEY_OPT_OUT. and reset counter launchtimes --- .../java/com/kobakei/ratethisapp/RateThisApp.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java b/ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java index bd00812..95c7034 100644 --- a/ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java +++ b/ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java @@ -290,6 +290,7 @@ public void onCancel(DialogInterface dialog) { } clearSharedPreferences(context); storeAskLaterDate(context); + storeAskLaterDate(context); } }); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @@ -311,6 +312,7 @@ private static void clearSharedPreferences(Context context) { Editor editor = pref.edit(); editor.remove(KEY_INSTALL_DATE); editor.remove(KEY_LAUNCH_TIMES); + editor.remove(KEY_OPT_OUT); editor.apply(); } @@ -360,6 +362,17 @@ private static void storeAskLaterDate(final Context context) { editor.putLong(KEY_ASK_LATER_DATE, System.currentTimeMillis()); editor.apply(); } + + /** + * Store the date the user asked for being asked again later. + * @param context + */ + private static void storeAskLaterTimes(final Context context) { + SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); + Editor editor = pref.edit(); + editor.putInt(KEY_LAUNCH_TIMES, 0); + editor.apply(); + } /** * Print values in SharedPreferences (used for debug)