diff options
author | Jonathan Zopf <47294759+JonathanZopf@users.noreply.github.com> | 2023-05-14 18:26:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-14 18:26:46 +0200 |
commit | 194067deeae66145331a6f70cdf1ddb346a04ba3 (patch) | |
tree | e698f93912115bb6a18cb2c5fd9715262f6350d2 | |
parent | c9d74e7942b6930004e6ee8cd420aad77e8066fb (diff) | |
download | AntennaPod-194067deeae66145331a6f70cdf1ddb346a04ba3.zip |
Don't show copying feedback on Android 13 (#6481)
7 files changed, 30 insertions, 12 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java index 4bf157560..8d07eb969 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/BugReportActivity.java @@ -4,6 +4,7 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.util.Log; import com.google.android.material.snackbar.Snackbar; @@ -67,7 +68,10 @@ public class BugReportActivity extends AppCompatActivity { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.bug_report_title), crashDetailsTextView.getText()); clipboard.setPrimaryClip(clip); - Snackbar.make(findViewById(android.R.id.content), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show(); + if (Build.VERSION.SDK_INT < 32) { + Snackbar.make(findViewById(android.R.id.content), R.string.copied_to_clipboard, + Snackbar.LENGTH_SHORT).show(); + } }); } diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java index 00936a38a..2c18a23fa 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/DownloadLogDetailsDialog.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.dialog; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.os.Build; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; @@ -49,7 +50,9 @@ public class DownloadLogDetailsDialog extends MaterialAlertDialogBuilder { .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(context.getString(R.string.download_error_details), messageFull); clipboard.setPrimaryClip(clip); - EventBus.getDefault().post(new MessageEvent(context.getString(R.string.copied_to_clipboard))); + if (Build.VERSION.SDK_INT < 32) { + EventBus.getDefault().post(new MessageEvent(context.getString(R.string.copied_to_clipboard))); + } }); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index f29f64b5c..8bc88b8f7 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -10,6 +10,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.graphics.ColorFilter; import android.graphics.drawable.Drawable; +import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -331,9 +332,10 @@ public class CoverFragment extends Fragment { if (clipboardManager != null) { clipboardManager.setPrimaryClip(ClipData.newPlainText("AntennaPod", text)); } - ((MainActivity) requireActivity()).showSnackbarAbovePlayer( - getResources().getString(R.string.copied_to_clipboard), - Snackbar.LENGTH_SHORT); + if (Build.VERSION.SDK_INT < 32) { + ((MainActivity) requireActivity()).showSnackbarAbovePlayer( + getResources().getString(R.string.copied_to_clipboard), Snackbar.LENGTH_SHORT); + } return true; } } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java index 930440b39..1ad55b2af 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -7,6 +7,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.graphics.LightingColorFilter; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -98,7 +99,10 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu android.content.ClipboardManager cm = (android.content.ClipboardManager) getContext() .getSystemService(Context.CLIPBOARD_SERVICE); cm.setPrimaryClip(clipData); - ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.copied_url_msg, Snackbar.LENGTH_SHORT); + if (Build.VERSION.SDK_INT < 32) { + ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.copied_to_clipboard, + Snackbar.LENGTH_SHORT); + } } } }; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java index e85f60027..ad203d12a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/AboutFragment.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.fragment.preferences.about; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.os.Build; import android.os.Bundle; import androidx.preference.PreferenceFragmentCompat; import com.google.android.material.snackbar.Snackbar; @@ -24,7 +25,9 @@ public class AboutFragment extends PreferenceFragmentCompat { ClipData clip = ClipData.newPlainText(getString(R.string.bug_report_title), findPreference("about_version").getSummary()); clipboard.setPrimaryClip(clip); - Snackbar.make(getView(), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show(); + if (Build.VERSION.SDK_INT < 32) { + Snackbar.make(getView(), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show(); + } return true; }); findPreference("about_contributors").setOnPreferenceClickListener((preference) -> { diff --git a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java index b284aa2d6..a289e630a 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.net.Uri; +import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.ContextMenu; @@ -104,7 +105,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene if (clipboardManager != null) { clipboardManager.setPrimaryClip(ClipData.newPlainText("AntennaPod", r.getExtra())); } - if (this.getContext() instanceof MainActivity) { + if (Build.VERSION.SDK_INT < 32 && this.getContext() instanceof MainActivity) { ((MainActivity) this.getContext()).showSnackbarAbovePlayer( getResources().getString(R.string.copied_to_clipboard), Snackbar.LENGTH_SHORT); @@ -130,9 +131,11 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene ClipboardManager cm = (ClipboardManager) getContext() .getSystemService(Context.CLIPBOARD_SERVICE); cm.setPrimaryClip(clipData); - Snackbar s = Snackbar.make(this, R.string.copied_url_msg, Snackbar.LENGTH_LONG); - ViewCompat.setElevation(s.getView(), 100); - s.show(); + if (Build.VERSION.SDK_INT < 32) { + Snackbar s = Snackbar.make(this, R.string.copied_to_clipboard, Snackbar.LENGTH_LONG); + ViewCompat.setElevation(s.getView(), 100); + s.show(); + } } else if (itemId == R.id.go_to_position_item) { if (ShownotesCleaner.isTimecodeLink(selectedUrl) && timecodeSelectedListener != null) { timecodeSelectedListener.accept(ShownotesCleaner.getTimecodeLinkTime(selectedUrl)); diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index 1959a2252..b5307afbd 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -92,7 +92,6 @@ <string name="open_in_browser_label">Open in Browser</string> <string name="copy_url_label">Copy URL</string> <string name="share_url_label">Share URL</string> - <string name="copied_url_msg">Copied URL to Clipboard</string> <string name="go_to_position_label">Go to this Position</string> <!-- Playback history --> |