Show 'copied to clipboard' message on Android 12L (#6745)

This commit is contained in:
ByteHamster 2023-11-05 15:48:35 +01:00 committed by GitHub
parent 1d415c9f7f
commit 34c7fd576f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -332,7 +332,7 @@ public class CoverFragment extends Fragment {
if (clipboardManager != null) { if (clipboardManager != null) {
clipboardManager.setPrimaryClip(ClipData.newPlainText("AntennaPod", text)); clipboardManager.setPrimaryClip(ClipData.newPlainText("AntennaPod", text));
} }
if (Build.VERSION.SDK_INT < 32) { if (Build.VERSION.SDK_INT <= 32) {
((MainActivity) requireActivity()).showSnackbarAbovePlayer( ((MainActivity) requireActivity()).showSnackbarAbovePlayer(
getResources().getString(R.string.copied_to_clipboard), Snackbar.LENGTH_SHORT); getResources().getString(R.string.copied_to_clipboard), Snackbar.LENGTH_SHORT);
} }

View File

@ -99,7 +99,7 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu
android.content.ClipboardManager cm = (android.content.ClipboardManager) getContext() android.content.ClipboardManager cm = (android.content.ClipboardManager) getContext()
.getSystemService(Context.CLIPBOARD_SERVICE); .getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(clipData); cm.setPrimaryClip(clipData);
if (Build.VERSION.SDK_INT < 32) { if (Build.VERSION.SDK_INT <= 32) {
((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.copied_to_clipboard, ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.copied_to_clipboard,
Snackbar.LENGTH_SHORT); Snackbar.LENGTH_SHORT);
} }

View File

@ -25,7 +25,7 @@ public class AboutFragment extends PreferenceFragmentCompat {
ClipData clip = ClipData.newPlainText(getString(R.string.bug_report_title), ClipData clip = ClipData.newPlainText(getString(R.string.bug_report_title),
findPreference("about_version").getSummary()); findPreference("about_version").getSummary());
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);
if (Build.VERSION.SDK_INT < 32) { if (Build.VERSION.SDK_INT <= 32) {
Snackbar.make(getView(), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show(); Snackbar.make(getView(), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show();
} }
return true; return true;

View File

@ -104,7 +104,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene
if (clipboardManager != null) { if (clipboardManager != null) {
clipboardManager.setPrimaryClip(ClipData.newPlainText("AntennaPod", r.getExtra())); clipboardManager.setPrimaryClip(ClipData.newPlainText("AntennaPod", r.getExtra()));
} }
if (Build.VERSION.SDK_INT < 32 && this.getContext() instanceof MainActivity) { if (Build.VERSION.SDK_INT <= 32 && this.getContext() instanceof MainActivity) {
((MainActivity) this.getContext()).showSnackbarAbovePlayer( ((MainActivity) this.getContext()).showSnackbarAbovePlayer(
getResources().getString(R.string.copied_to_clipboard), getResources().getString(R.string.copied_to_clipboard),
Snackbar.LENGTH_SHORT); Snackbar.LENGTH_SHORT);