Shorter names for bottom navigation (#7625)

This commit is contained in:
ByteHamster 2025-01-25 09:08:30 +01:00 committed by GitHub
parent baedabbc4b
commit bbc098aba9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 4 deletions

View File

@ -528,10 +528,11 @@ public class MainActivity extends CastEnabledActivity {
Menu menu = bottomNavigationView.getMenu();
menu.clear();
for (int i = 0; i < drawerItems.size() && i < bottomNavigationView.getMaxItemCount() - 1; i++) {
int maxItems = Math.min(5, bottomNavigationView.getMaxItemCount());
for (int i = 0; i < drawerItems.size() && i < maxItems - 1; i++) {
String tag = drawerItems.get(i);
MenuItem item = menu.add(0, NavigationNames.getBottomNavigationItemId(tag),
0, getString(NavigationNames.getLabel(tag)));
0, getString(NavigationNames.getShortLabel(tag)));
item.setIcon(NavigationNames.getDrawable(tag));
}
MenuItem moreItem = menu.add(0, R.id.bottom_navigation_more, 0, getString(R.string.searchpreference_more));

View File

@ -61,6 +61,31 @@ public abstract class NavigationNames {
}
}
public static @StringRes int getShortLabel(String tag) {
switch (tag) {
case HomeFragment.TAG:
return R.string.home_label_short;
case QueueFragment.TAG:
return R.string.queue_label_short;
case InboxFragment.TAG:
return R.string.inbox_label_short;
case AllEpisodesFragment.TAG:
return R.string.episodes_label_short;
case SubscriptionFragment.TAG:
return R.string.subscriptions_label_short;
case CompletedDownloadsFragment.TAG:
return R.string.downloads_label_short;
case PlaybackHistoryFragment.TAG:
return R.string.playback_history_label_short;
case AddFeedFragment.TAG:
return R.string.add_feed_label_short;
case NavListAdapter.SUBSCRIPTION_LIST_TAG:
return R.string.subscriptions_list_label;
default:
return 0;
}
}
public static int getBottomNavigationItemId(String tag) {
switch (tag) {
case QueueFragment.TAG:

View File

@ -450,7 +450,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
};
MaterialAlertDialogBuilder ab = new MaterialAlertDialogBuilder(OnlineFeedViewActivity.this)
.setTitle(R.string.feeds_label)
.setTitle(R.string.subscriptions_label)
.setCancelable(true)
.setOnCancelListener(dialog -> finish())
.setAdapter(adapter, onClickListener);

View File

@ -6,21 +6,28 @@
<!-- Activity and fragment titles -->
<string name="provider_authority" translatable="false">de.danoeh.antennapod.provider</string>
<string name="feed_update_receiver_name">Update subscriptions</string>
<string name="feeds_label">Podcasts</string>
<string name="statistics_label">Statistics</string>
<string name="add_feed_label">Add podcast</string>
<string name="add_feed_label_short">Add</string>
<string name="episodes_label">Episodes</string>
<string name="episodes_label_short">Episodes</string>
<string name="home_label">Home</string>
<string name="home_label_short">Home</string>
<string name="queue_label">Queue</string>
<string name="queue_label_short">Queue</string>
<string name="inbox_label">Inbox</string>
<string name="inbox_label_short">Inbox</string>
<string name="favorite_episodes_label">Favorites</string>
<string name="settings_label">Settings</string>
<string name="downloads_label">Downloads</string>
<string name="downloads_label_short">Downloads</string>
<string name="downloads_log_label">Download log</string>
<string name="subscriptions_label">Subscriptions</string>
<string name="subscriptions_label_short">Subscriptions</string>
<string name="subscriptions_list_label">Subscriptions list (side menu only)</string>
<string name="cancel_download_label">Cancel download</string>
<string name="playback_history_label">Playback history</string>
<string name="playback_history_label_short">History</string>
<string name="years_statistics_label">Years</string>
<string name="notification_pref_fragment">Notifications</string>
<string name="current_playing_episode">Current</string>