public AppRate clearSettingsParam() { PreferenceHelper.setAgreeShowDialog(context, true); PreferenceHelper.clearSharedPreferences(context); return this; }
public void monitor() { if (isFirstLaunch(context)) { setInstallDate(context); } PreferenceHelper.setLaunchTimes(context, getLaunchTimes(context) + 1); }
static int getLaunchTimes(Context context) { return getPreferences(context).getInt(PREF_KEY_LAUNCH_TIMES, 0); }
static void setLaunchTimes(Context context, int launchTimes) { SharedPreferences.Editor editor = getPreferencesEditor(context); editor.putInt(PREF_KEY_LAUNCH_TIMES, launchTimes); editor.apply(); }
public AppRate clearAgreeShowDialog() { PreferenceHelper.setAgreeShowDialog(context, true); return this; }
public boolean shouldShowRateDialog() { return getIsAgreeShowDialog(context) && isOverLaunchTimes() && isOverInstallDate() && isOverRemindDate(); }
private boolean isOverInstallDate() { return isOverDate(getInstallDate(context), installDate); }
private boolean isOverRemindDate() { return isOverDate(getRemindInterval(context), remindInterval); }
private boolean isOverLaunchTimes() { return getLaunchTimes(context) >= launchTimes; }
/** * Set agree flag about show dialog.<br/> * If it is false, rate dialog will never shown unless data is cleared. * * @param context context * @param isAgree agree with showing rate dialog */ static void setAgreeShowDialog(Context context, boolean isAgree) { SharedPreferences.Editor editor = getPreferencesEditor(context); editor.putBoolean(PREF_KEY_IS_AGREE_SHOW_DIALOG, isAgree); editor.apply(); }
public AppRate clearAgreeShowDialog() { PreferenceHelper.setAgreeShowDialog(context, true); return this; }
public boolean shouldShowRateDialog() { return getIsAgreeShowDialog(context) && isOverLaunchTimes() && isOverInstallDate() && isOverRemindDate(); }
private boolean isOverInstallDate() { return isOverDate(getInstallDate(context), installDate); }
private boolean isOverRemindDate() { return isOverDate(getRemindInterval(context), remindInterval); }
private boolean isOverLaunchTimes() { return getLaunchTimes(context) >= launchTimes; }
public void monitor() { if (isFirstLaunch(context)) { setInstallDate(context); } PreferenceHelper.setLaunchTimes(context, getLaunchTimes(context) + 1); }
static Editor getPreferencesEditor(Context context) { return getPreferences(context).edit(); }
/** * Set agree flag about show dialog.<br/> * If it is false, rate dialog will never shown unless data is cleared. * * @param context context * @param isAgree agree with showing rate dialog */ static void setAgreeShowDialog(Context context, boolean isAgree) { SharedPreferences.Editor editor = getPreferencesEditor(context); editor.putBoolean(PREF_KEY_IS_AGREE_SHOW_DIALOG, isAgree); editor.apply(); }
public AppRate clearSettingsParam() { PreferenceHelper.setAgreeShowDialog(context, true); PreferenceHelper.clearSharedPreferences(context); return this; }
public AppRate setAgreeShowDialog(boolean clear) { PreferenceHelper.setAgreeShowDialog(context, clear); return this; }