diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt index 113a1e8a5..d270cf979 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/MangaInfoHeaderAdapter.kt @@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.setChips +import eu.kanade.tachiyomi.util.view.setTooltip import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visibleIf import kotlinx.coroutines.CoroutineScope @@ -89,17 +90,20 @@ class MangaInfoHeaderAdapter( binding.btnCategories.clicks() .onEach { controller.onCategoriesClick() } .launchIn(scope) + binding.btnCategories.setTooltip(R.string.action_move_category) if (controller.presenter.source is HttpSource) { binding.btnWebview.visible() - binding.btnShare.visible() - binding.btnWebview.clicks() .onEach { controller.openMangaInWebView() } .launchIn(scope) + binding.btnWebview.setTooltip(R.string.action_open_in_web_view) + + binding.btnShare.visible() binding.btnShare.clicks() .onEach { controller.shareManga() } .launchIn(scope) + binding.btnShare.setTooltip(R.string.action_share) } binding.mangaFullTitle.longClicks() diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index 8b94966b7..3abee9bcb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -8,7 +8,9 @@ import android.view.Menu import android.view.MenuItem import android.view.View import androidx.annotation.MenuRes +import androidx.annotation.StringRes import androidx.appcompat.widget.PopupMenu +import androidx.appcompat.widget.TooltipCompat import androidx.recyclerview.widget.RecyclerView import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup @@ -38,6 +40,15 @@ inline fun View.snack(message: String, length: Int = Snackbar.LENGTH_LONG, f: Sn return snack } +/** + * Adds a tooltip shown on long press. + * + * @param stringRes String resource for tooltip. + */ +inline fun View.setTooltip(@StringRes stringRes: Int) { + TooltipCompat.setTooltipText(this, context.getString(stringRes)) +} + /** * Shows a popup menu on top of this view. *