Update the order of the tabs.
Screenshot: https://screenshot.googleplex.com/3RiTXLhGkrQ.png
Bug: 150184723
Change-Id: I341ac4137c40f85d1bb8a5dfde6dbd4b61db0cc8
diff --git a/res/menu/bottom_navigation_menu.xml b/res/menu/bottom_navigation_menu.xml
index d477aaf..b64bf8d 100644
--- a/res/menu/bottom_navigation_menu.xml
+++ b/res/menu/bottom_navigation_menu.xml
@@ -17,19 +17,19 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- TODO (santie): replace icons with real ones when available -->
<item
+ android:id="@+id/nav_wallpaper"
+ android:title="@string/wallpaper_title"
+ android:icon="@drawable/ic_nav_wallpaper" />
+ <item
android:id="@+id/nav_theme"
android:title="@string/theme_title"
android:icon="@drawable/ic_nav_theme" />
<item
- android:id="@+id/nav_clock"
- android:title="@string/clock_title"
- android:icon="@drawable/ic_nav_clock" />
- <item
android:id="@+id/nav_grid"
android:title="@string/grid_title"
android:icon="@drawable/ic_nav_grid" />
<item
- android:id="@+id/nav_wallpaper"
- android:title="@string/wallpaper_title"
- android:icon="@drawable/ic_nav_wallpaper" />
+ android:id="@+id/nav_clock"
+ android:title="@string/clock_title"
+ android:icon="@drawable/ic_nav_clock" />
</menu>
\ No newline at end of file
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
index 7da0d74..86a0bf6 100644
--- a/src/com/android/customization/picker/CustomizationPickerActivity.java
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -130,10 +130,9 @@
// Navigate to the Wallpaper tab if we started directly from launcher, otherwise
// start at the Styles tab
- int section = WALLPAPER_FOCUS.equals(getIntent()
- .getStringExtra(WALLPAPER_FLAVOR_EXTRA))
- ? mBottomNav.getMenu().size() - 1 : 0;
- navigateToSection(mBottomNav.getMenu().getItem(section).getItemId());
+ navigateToSection(
+ WALLPAPER_FOCUS.equals(getIntent().getStringExtra(WALLPAPER_FLAVOR_EXTRA))
+ ? R.id.nav_wallpaper : R.id.nav_theme);
}
}
}
@@ -306,6 +305,11 @@
}
private void navigateToSection(@IdRes int id) {
+ // Navigate to the first section if the targeted section doesn't exist.
+ if (!mSections.containsKey(id)) {
+ id = mBottomNav.getMenu().getItem(0).getItemId();
+ }
+
mBottomNav.setSelectedItemId(id);
}