Merge pull request #8966 from Stypox/feed-menuitem-tooltip

Show correct tooltips for actions in feed
This commit is contained in:
Stypox 2022-09-19 08:54:06 +02:00 committed by GitHub
commit f26bf33ead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import androidx.appcompat.app.AlertDialog
import androidx.appcompat.content.res.AppCompatResources import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.edit import androidx.core.content.edit
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.core.view.MenuItemCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
@ -286,6 +287,15 @@ class FeedFragment : BaseStateFragment<FeedState>() {
requireContext(), requireContext(),
if (showPlayedItems) R.drawable.ic_visibility_on else R.drawable.ic_visibility_off if (showPlayedItems) R.drawable.ic_visibility_on else R.drawable.ic_visibility_off
) )
MenuItemCompat.setTooltipText(
menuItem,
getString(
if (showPlayedItems)
R.string.feed_toggle_hide_played_items
else
R.string.feed_toggle_show_played_items
)
)
} }
private fun updateToggleFutureItemsButton(menuItem: MenuItem) { private fun updateToggleFutureItemsButton(menuItem: MenuItem) {
@ -294,6 +304,15 @@ class FeedFragment : BaseStateFragment<FeedState>() {
requireContext(), requireContext(),
if (showFutureItems) R.drawable.ic_history_future else R.drawable.ic_history if (showFutureItems) R.drawable.ic_history_future else R.drawable.ic_history
) )
MenuItemCompat.setTooltipText(
menuItem,
getString(
if (showPlayedItems)
R.string.feed_toggle_hide_future_items
else
R.string.feed_toggle_show_future_items
)
)
} }
// ////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////

View File

@ -684,6 +684,7 @@
\n \n
\nSo the choice boils down to what you prefer: speed or precise information.</string> \nSo the choice boils down to what you prefer: speed or precise information.</string>
<string name="feed_toggle_show_played_items">Show watched items</string> <string name="feed_toggle_show_played_items">Show watched items</string>
<string name="feed_toggle_hide_played_items">Hide watched items</string>
<string name="content_not_supported">This content is not yet supported by NewPipe.\n\nIt will hopefully be supported in a future version.</string> <string name="content_not_supported">This content is not yet supported by NewPipe.\n\nIt will hopefully be supported in a future version.</string>
<string name="detail_sub_channel_thumbnail_view_description">Channel\'s avatar thumbnail</string> <string name="detail_sub_channel_thumbnail_view_description">Channel\'s avatar thumbnail</string>
<string name="channel_created_by">Created by %s</string> <string name="channel_created_by">Created by %s</string>
@ -746,5 +747,6 @@
<string name="select_quality_external_players">Select quality for external players</string> <string name="select_quality_external_players">Select quality for external players</string>
<string name="unknown_format">Unknown format</string> <string name="unknown_format">Unknown format</string>
<string name="unknown_quality">Unknown quality</string> <string name="unknown_quality">Unknown quality</string>
<string name="feed_toggle_show_future_items">Show future videos</string> <string name="feed_toggle_show_future_items">Show future items</string>
<string name="feed_toggle_hide_future_items">Hide future items</string>
</resources> </resources>