From 48dcf2293cabf19578a35269e890125838efa8c2 Mon Sep 17 00:00:00 2001 From: o13e <109251285+o13e@users.noreply.github.com> Date: Sat, 15 Oct 2022 13:07:24 +0200 Subject: [PATCH] Disable Copied toast on android 13+ (#1139) --- .../infinityforreddit/activities/GiveAwardActivity.java | 4 +++- .../infinityforreddit/activities/WebViewActivity.java | 4 +++- .../adapters/PrivateMessagesDetailRecyclerViewAdapter.java | 4 +++- .../bottomsheetfragments/CopyTextBottomSheetFragment.java | 4 +++- .../bottomsheetfragments/ShareLinkBottomSheetFragment.java | 4 +++- .../bottomsheetfragments/UrlMenuBottomSheetFragment.java | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/GiveAwardActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/GiveAwardActivity.java index e6094cdd..d3b32e4e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/GiveAwardActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/GiveAwardActivity.java @@ -148,7 +148,9 @@ public class GiveAwardActivity extends BaseActivity { if (clipboard != null) { ClipData clip = ClipData.newPlainText("simple text", text); clipboard.setPrimaryClip(clip); - Toast.makeText(GiveAwardActivity.this, R.string.copy_success, Toast.LENGTH_SHORT).show(); + if (android.os.Build.VERSION.SDK_INT < 33) { + Toast.makeText(GiveAwardActivity.this, R.string.copy_success, Toast.LENGTH_SHORT).show(); + } } else { Toast.makeText(GiveAwardActivity.this, R.string.copy_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java index 9922ca59..c61bb41b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java @@ -157,7 +157,9 @@ public class WebViewActivity extends BaseActivity { if (clipboard != null) { ClipData clip = ClipData.newPlainText("simple text", url); clipboard.setPrimaryClip(clip); - Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show(); + if (android.os.Build.VERSION.SDK_INT < 33) { + Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show(); + } } else { Toast.makeText(this, R.string.copy_link_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java index 5893d79e..de0898ae 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java @@ -294,7 +294,9 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt if (clipboard != null) { ClipData clip = ClipData.newPlainText("simple text", message.getBody()); clipboard.setPrimaryClip(clip); - Toast.makeText(mViewPrivateMessagesActivity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + if (android.os.Build.VERSION.SDK_INT < 33) { + Toast.makeText(mViewPrivateMessagesActivity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + } } else { Toast.makeText(mViewPrivateMessagesActivity, R.string.copy_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java index c30fdddb..d4852e04 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java @@ -134,7 +134,9 @@ public class CopyTextBottomSheetFragment extends LandscapeExpandedRoundedBottomS if (clipboard != null) { ClipData clip = ClipData.newPlainText("simple text", text); clipboard.setPrimaryClip(clip); - Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + if (android.os.Build.VERSION.SDK_INT < 33) { + Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + } } else { Toast.makeText(activity, R.string.copy_link_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java index 1d69854f..f50e17d7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java @@ -140,7 +140,9 @@ public class ShareLinkBottomSheetFragment extends LandscapeExpandedRoundedBottom if (clipboard != null) { ClipData clip = ClipData.newPlainText("simple text", link); clipboard.setPrimaryClip(clip); - Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + if (android.os.Build.VERSION.SDK_INT < 33) { + Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + } } else { Toast.makeText(activity, R.string.copy_link_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java index 85da693c..ac9d1fdf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java @@ -80,7 +80,9 @@ public class UrlMenuBottomSheetFragment extends LandscapeExpandedRoundedBottomSh if (clipboard != null) { ClipData clip = ClipData.newPlainText("simple text", url); clipboard.setPrimaryClip(clip); - Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + if (android.os.Build.VERSION.SDK_INT < 33) { + Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show(); + } } else { Toast.makeText(activity, R.string.copy_link_failed, Toast.LENGTH_SHORT).show(); }