mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Display pop up once, on 4th app start
This commit is contained in:
parent
4571482695
commit
452dcaec72
2 changed files with 6 additions and 15 deletions
|
|
@ -140,8 +140,10 @@ public class CommonsApplication extends Application {
|
||||||
System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0");
|
System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0");
|
||||||
|
|
||||||
Fresco.initialize(this);
|
Fresco.initialize(this);
|
||||||
PreferenceManager.getDefaultSharedPreferences(CommonsApplication.getInstance()).edit()
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(
|
||||||
.putBoolean("is_app_started", true).commit();
|
CommonsApplication.getInstance());
|
||||||
|
// Increase counter by one, starts from 1
|
||||||
|
prefs.edit().putInt("app_start_counter", prefs.getInt("app_start_counter" ,0) + 1).commit();
|
||||||
|
|
||||||
//For caching area -> categories
|
//For caching area -> categories
|
||||||
cacheData = new CacheController();
|
cacheData = new CacheController();
|
||||||
|
|
|
||||||
|
|
@ -373,12 +373,10 @@ public class ContributionsActivity
|
||||||
boolean displayFeedbackPopup = prefs.getBoolean("display_feedbak_popup", true);
|
boolean displayFeedbackPopup = prefs.getBoolean("display_feedbak_popup", true);
|
||||||
|
|
||||||
// boolean to recognize is application re-started. Will be used for "remind me later" option
|
// boolean to recognize is application re-started. Will be used for "remind me later" option
|
||||||
boolean isApplicationStarted = prefs.getBoolean("is_app_started" , true);
|
int appStartCounter = prefs.getInt("app_start_counter" ,0);
|
||||||
|
|
||||||
// if time is valid and shared pref says display
|
// if time is valid and shared pref says display
|
||||||
if (new Date().before(strDate) && displayFeedbackPopup && isApplicationStarted) {
|
if (new Date().before(strDate) && displayFeedbackPopup && (appStartCounter == 4)) {
|
||||||
// The window will be displayed once per application start
|
|
||||||
prefs.edit().putBoolean("is_app_started" , false).commit();
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(getResources().getString(R.string.feedback_popup_title));
|
builder.setTitle(getResources().getString(R.string.feedback_popup_title));
|
||||||
|
|
@ -396,15 +394,6 @@ public class ContributionsActivity
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNeutralButton(getResources().getString(R.string.feedback_popup_remind)
|
|
||||||
,new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
// Dismiss the dialog to show it later,
|
|
||||||
// don't set "display_feedbak_popup" to false, user wants to see it latr
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline)
|
builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline)
|
||||||
, new DialogInterface.OnClickListener() {
|
, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue