Added new icon poll

This commit is contained in:
ByteHamster 2020-07-13 11:02:15 +02:00
parent 03190dfa20
commit cc04e08e74
4 changed files with 50 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.dialog.IconPollDialog;
import de.danoeh.antennapod.dialog.RatingDialog;
import de.danoeh.antennapod.fragment.NavDrawerFragment;
import org.awaitility.Awaitility;
@ -134,6 +135,12 @@ public class EspressoTestUtils {
.putString(UserPreferences.PREF_UPDATE_INTERVAL, "0")
.commit();
InstrumentationRegistry.getInstrumentation().getTargetContext()
.getSharedPreferences(IconPollDialog.PREFS_NAME, Context.MODE_PRIVATE)
.edit()
.putBoolean(IconPollDialog.KEY_DIALOG_ALLOWED, false)
.commit();
RatingDialog.init(InstrumentationRegistry.getTargetContext());
RatingDialog.saveRated();
}

View File

@ -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();

View File

@ -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();
}
}

View File

@ -828,4 +828,10 @@
<string name="on_demand_config_setting_changed">Setting updated successfully.</string>
<string name="on_demand_config_stream_text">Looks like you stream a lot. Do you want episode lists to show stream buttons?</string>
<string name="on_demand_config_download_text">Looks like you download a lot. Do you want episode lists to show download buttons?</string>
<!-- New icon poll (temporary) -->
<string name="icon_poll_title">New icon</string>
<string name="icon_poll_message">Thank you for being a beta tester!\n\nTo celebrate the public release of version 2.0.0, we set up a vote for a new app icon. Vote now to help shape the future of AntennaPod!</string>
<string name="icon_poll_vote">Vote</string>
<string name="icon_poll_dont_vote">Accept other user\'s vote</string>
</resources>