diff options
author | ByteHamster <info@bytehamster.com> | 2020-07-13 11:02:15 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-07-25 10:15:00 +0200 |
commit | cc04e08e7432920da712742804bde5f67b3391f7 (patch) | |
tree | 3d10155053ea7780d9288663990bfe179dc99281 /app/src/main | |
parent | 03190dfa20db70a72c6accfd9176126bd68467d6 (diff) | |
download | AntennaPod-cc04e08e7432920da712742804bde5f67b3391f7.zip |
Added new icon poll
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java | 2 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/IconPollDialog.java | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index eaa423708..8c8ce9522 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -32,6 +32,7 @@ import de.danoeh.antennapod.core.event.MessageEvent; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; +import de.danoeh.antennapod.dialog.IconPollDialog; import de.danoeh.antennapod.dialog.RatingDialog; import de.danoeh.antennapod.fragment.AddFeedFragment; import de.danoeh.antennapod.fragment.AudioPlayerFragment; @@ -315,6 +316,7 @@ public class MainActivity extends CastEnabledActivity { super.onStart(); EventBus.getDefault().register(this); RatingDialog.init(this); + IconPollDialog.showIfNeeded(this); if (lastTheme != UserPreferences.getNoTitleTheme()) { finish(); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/IconPollDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/IconPollDialog.java new file mode 100644 index 000000000..70cf6dc78 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/dialog/IconPollDialog.java @@ -0,0 +1,35 @@ +package de.danoeh.antennapod.dialog; + +import android.content.Context; +import android.content.SharedPreferences; +import androidx.appcompat.app.AlertDialog; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.util.IntentUtils; + +public class IconPollDialog { + + private IconPollDialog() { + + } + + public static final String PREFS_NAME = "IconPollDialog"; + public static final String KEY_DIALOG_ALLOWED = "dialog_allowed"; + + public static void showIfNeeded(Context context) { + SharedPreferences preferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); + + if (!preferences.getBoolean(KEY_DIALOG_ALLOWED, true)) { + return; + } + + new AlertDialog.Builder(context) + .setTitle(R.string.icon_poll_title) + .setMessage(R.string.icon_poll_message) + .setCancelable(false) + .setPositiveButton(R.string.icon_poll_vote, (dialog, which) -> + IntentUtils.openInBrowser(context, "https://www.surveymonkey.com/r/96WSBLC")) + .setNegativeButton(R.string.icon_poll_dont_vote, null) + .setOnDismissListener(dialog -> preferences.edit().putBoolean(KEY_DIALOG_ALLOWED, false).apply()) + .show(); + } +} |