1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

Replace Toast with Tooltip in PostViewV2Fragment. Fixes austinhuang0131/barinsta#1264

This commit is contained in:
Ammar Githam 2021-05-23 12:10:42 +09:00
parent 0986f2fb71
commit 0dfdc4bb41

View File

@ -27,6 +27,7 @@ import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.view.ContextThemeWrapper; import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.appcompat.widget.TooltipCompat;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.PermissionChecker; import androidx.core.content.PermissionChecker;
import androidx.core.view.WindowCompat; import androidx.core.view.WindowCompat;
@ -423,12 +424,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
Log.e(TAG, "setupComment: ", e); Log.e(TAG, "setupComment: ", e);
} }
}); });
bottom.comment.setOnLongClickListener(v -> { TooltipCompat.setTooltipText(bottom.comment, getString(R.string.comment));
final Context context = getContext();
if (context == null) return false;
Utils.displayToastAboveView(context, v, getString(R.string.comment));
return true;
});
} }
private void setupDownload() { private void setupDownload() {
@ -441,12 +437,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
} }
requestPermissions(DownloadUtils.PERMS, STORAGE_PERM_REQUEST_CODE); requestPermissions(DownloadUtils.PERMS, STORAGE_PERM_REQUEST_CODE);
}); });
bottom.download.setOnLongClickListener(v -> { TooltipCompat.setTooltipText(bottom.download, getString(R.string.action_download));
final Context context = getContext();
if (context == null) return false;
Utils.displayToastAboveView(context, v, getString(R.string.action_download));
return true;
});
} }
private void setupLike() { private void setupLike() {
@ -737,12 +728,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
return; return;
} }
bottom.share.setVisibility(View.VISIBLE); bottom.share.setVisibility(View.VISIBLE);
bottom.share.setOnLongClickListener(v -> { TooltipCompat.setTooltipText(bottom.share, getString(R.string.share));
final Context context = getContext();
if (context == null) return false;
Utils.displayToastAboveView(context, v, getString(R.string.share));
return true;
});
bottom.share.setOnClickListener(v -> { bottom.share.setOnClickListener(v -> {
final Media media = viewModel.getMedia(); final Media media = viewModel.getMedia();
final User profileModel = media.getUser(); final User profileModel = media.getUser();