Browse Source

favorite tab for anons

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
d8d47befab
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 14
      app/src/main/java/awais/instagrabber/activities/MainActivity.java

14
app/src/main/java/awais/instagrabber/activities/MainActivity.java

@ -564,6 +564,13 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
private List<Tab> setupAnonBottomNav() { private List<Tab> setupAnonBottomNav() {
final int selectedItemId = binding.bottomNavView.getSelectedItemId(); final int selectedItemId = binding.bottomNavView.getSelectedItemId();
final Tab favoriteTab = new Tab(R.drawable.ic_star_24,
getString(R.string.title_favorites),
false,
"favorites_nav_graph",
R.navigation.favorites_nav_graph,
R.id.favorites_nav_graph,
R.id.favoritesFragment);
final Tab profileTab = new Tab(R.drawable.ic_person_24, final Tab profileTab = new Tab(R.drawable.ic_person_24,
getString(R.string.profile), getString(R.string.profile),
false, false,
@ -580,12 +587,15 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
R.id.morePreferencesFragment); R.id.morePreferencesFragment);
final Menu menu = binding.bottomNavView.getMenu(); final Menu menu = binding.bottomNavView.getMenu();
menu.clear(); menu.clear();
menu.add(0, favoriteTab.getNavigationRootId(), 0, favoriteTab.getTitle()).setIcon(favoriteTab.getIconResId());
menu.add(0, profileTab.getNavigationRootId(), 0, profileTab.getTitle()).setIcon(profileTab.getIconResId()); menu.add(0, profileTab.getNavigationRootId(), 0, profileTab.getTitle()).setIcon(profileTab.getIconResId());
menu.add(0, moreTab.getNavigationRootId(), 0, moreTab.getTitle()).setIcon(moreTab.getIconResId()); menu.add(0, moreTab.getNavigationRootId(), 0, moreTab.getTitle()).setIcon(moreTab.getIconResId());
if (selectedItemId != R.id.profile_nav_graph && selectedItemId != R.id.more_nav_graph) {
if (selectedItemId != R.id.profile_nav_graph
&& selectedItemId != R.id.more_nav_graph
&& selectedItemId != R.id.favorites_nav_graph) {
setBottomNavSelectedTab(profileTab); setBottomNavSelectedTab(profileTab);
} }
return ImmutableList.of(profileTab, moreTab);
return ImmutableList.of(favoriteTab, profileTab, moreTab);
} }
private List<Tab> setupMainBottomNav() { private List<Tab> setupMainBottomNav() {

Loading…
Cancel
Save