From e7f23ad1c2eeac91132e03db4a213616a44483a1 Mon Sep 17 00:00:00 2001 From: Nils Rothaug <48482306+nproth@users.noreply.github.com> Date: Sat, 9 Apr 2022 11:54:18 +0200 Subject: Show on-demand configuration popup for stream vs download only once (#5818) --- .../java/de/danoeh/antennapod/fragment/ItemFragment.java | 12 ++++++------ .../fragment/preferences/PlaybackPreferencesFragment.java | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 7d9814998..6a8bc2585 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -188,9 +188,9 @@ public class ItemFragment extends Fragment { } private void showOnDemandConfigBalloon(boolean offerStreaming) { - boolean isLocaleRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) + final boolean isLocaleRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; - Balloon balloon = new Balloon.Builder(getContext()) + final Balloon balloon = new Balloon.Builder(getContext()) .setArrowOrientation(ArrowOrientation.TOP) .setArrowOrientationRules(ArrowOrientationRules.ALIGN_FIXED) .setArrowPosition(0.25f + ((isLocaleRtl ^ offerStreaming) ? 0f : 0.5f)) @@ -203,9 +203,9 @@ public class ItemFragment extends Fragment { .setDismissWhenTouchOutside(true) .setLifecycleOwner(this) .build(); - Button positiveButton = balloon.getContentView().findViewById(R.id.balloon_button_positive); - Button negativeButton = balloon.getContentView().findViewById(R.id.balloon_button_negative); - TextView message = balloon.getContentView().findViewById(R.id.balloon_message); + final Button positiveButton = balloon.getContentView().findViewById(R.id.balloon_button_positive); + final Button negativeButton = balloon.getContentView().findViewById(R.id.balloon_button_negative); + final TextView message = balloon.getContentView().findViewById(R.id.balloon_message); message.setText(offerStreaming ? R.string.on_demand_config_stream_text : R.string.on_demand_config_download_text); positiveButton.setOnClickListener(v1 -> { @@ -217,7 +217,7 @@ public class ItemFragment extends Fragment { balloon.dismiss(); }); negativeButton.setOnClickListener(v1 -> { - UsageStatistics.askAgainLater(UsageStatistics.ACTION_STREAM); // Type does not matter. Both are silenced. + UsageStatistics.doNotAskAgain(UsageStatistics.ACTION_STREAM); // Type does not matter. Both are silenced. balloon.dismiss(); }); balloon.showAlignBottom(butAction1, 0, (int) (-12 * getResources().getDisplayMetrics().density)); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java index 933a7d456..15fdf5d97 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java @@ -56,7 +56,8 @@ public class PlaybackPreferencesFragment extends PreferenceFragmentCompat { findPreference(PREF_PLAYBACK_PREFER_STREAMING).setOnPreferenceChangeListener((preference, newValue) -> { // Update all visible lists to reflect new streaming action button EventBus.getDefault().post(new UnreadItemsUpdateEvent()); - UsageStatistics.askAgainLater(UsageStatistics.ACTION_STREAM); + // User consciously decided whether to prefer the streaming button, disable suggestion to change that + UsageStatistics.doNotAskAgain(UsageStatistics.ACTION_STREAM); return true; }); -- cgit v1.2.3