public static AppRate with(Context context) { if (singleton == null) { synchronized (AppRate.class) { if (singleton == null) { singleton = new AppRate(context); } } } return singleton; }
public boolean shouldShowRateDialog() { return getIsAgreeShowDialog(context) && isOverLaunchTimes() && isOverInstallDate() && isOverRemindDate(); }
public static boolean showRateDialogIfMeetsConditions(Activity activity) { boolean isMeetsConditions = singleton.isDebug || singleton.shouldShowRateDialog(); if (isMeetsConditions) { singleton.showRateDialog(activity); } return isMeetsConditions; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AppRate.with(this) .setStoreType(StoreType.GOOGLEPLAY) //default is Google, other option is Amazon .setInstallDays(3) // default 10, 0 means install day. .setLaunchTimes(10) // default 10 times. .setRemindInterval(2) // default 1 day. .setShowLaterButton(true) // default true. .setDebug(true) // default false. .setCancelable(false) // default false. .setOnClickButtonListener(new OnClickButtonListener() { // callback listener. @Override public void onClickButton(int which) { Log.d(MainActivity.class.getName(), Integer.toString(which)); } }) .setTitle(R.string.new_rate_dialog_title) .setTextLater(R.string.new_rate_dialog_later) .setTextNever(R.string.new_rate_dialog_never) .setTextRateNow(R.string.new_rate_dialog_ok) .monitor(); AppRate.showRateDialogIfMeetsConditions(this); }
private boolean isOverInstallDate() { return isOverDate(getInstallDate(context), installDate); }
private boolean isOverRemindDate() { return isOverDate(getRemindInterval(context), remindInterval); }
public boolean shouldShowRateDialog() { return getIsAgreeShowDialog(context) && isOverLaunchTimes() && isOverInstallDate() && isOverRemindDate(); }
public static boolean showRateDialogIfMeetsConditions(Activity activity) { boolean isMeetsConditions = singleton.isDebug || singleton.shouldShowRateDialog(); if (isMeetsConditions) { singleton.showRateDialog(activity); } return isMeetsConditions; }
private boolean isOverInstallDate() { return isOverDate(getInstallDate(context), installDate); }
public static AppRate with(Context context) { if (singleton == null) { synchronized (AppRate.class) { if (singleton == null) { singleton = new AppRate(context); } } } return singleton; }
private boolean isOverRemindDate() { return isOverDate(getRemindInterval(context), remindInterval); }