From 0dfdc4bb41aab02c9bb0a8d718a6d712d4f2ada4 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Sun, 23 May 2021 12:10:42 +0900 Subject: [PATCH] Replace Toast with Tooltip in PostViewV2Fragment. Fixes austinhuang0131/barinsta#1264 --- .../fragments/PostViewV2Fragment.java | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java index a502ec49..f2e4fac0 100644 --- a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java @@ -27,6 +27,7 @@ import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.view.ContextThemeWrapper; import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.Toolbar; +import androidx.appcompat.widget.TooltipCompat; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.PermissionChecker; import androidx.core.view.WindowCompat; @@ -423,12 +424,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme Log.e(TAG, "setupComment: ", e); } }); - bottom.comment.setOnLongClickListener(v -> { - final Context context = getContext(); - if (context == null) return false; - Utils.displayToastAboveView(context, v, getString(R.string.comment)); - return true; - }); + TooltipCompat.setTooltipText(bottom.comment, getString(R.string.comment)); } private void setupDownload() { @@ -441,12 +437,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme } requestPermissions(DownloadUtils.PERMS, STORAGE_PERM_REQUEST_CODE); }); - bottom.download.setOnLongClickListener(v -> { - final Context context = getContext(); - if (context == null) return false; - Utils.displayToastAboveView(context, v, getString(R.string.action_download)); - return true; - }); + TooltipCompat.setTooltipText(bottom.download, getString(R.string.action_download)); } private void setupLike() { @@ -737,12 +728,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme return; } bottom.share.setVisibility(View.VISIBLE); - bottom.share.setOnLongClickListener(v -> { - final Context context = getContext(); - if (context == null) return false; - Utils.displayToastAboveView(context, v, getString(R.string.share)); - return true; - }); + TooltipCompat.setTooltipText(bottom.share, getString(R.string.share)); bottom.share.setOnClickListener(v -> { final Media media = viewModel.getMedia(); final User profileModel = media.getUser();