Loading res/drawable/option_border.xml +15 −5 Original line number Original line Diff line number Diff line Loading @@ -13,8 +13,18 @@ See the License for the specific language governing permissions and See the License for the specific language governing permissions and limitations under the License. limitations under the License. --> --> <shape xmlns:android="http://schemas.android.com/apk/res/android" <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> android:color="?android:attr/colorControlHighlight"> <item android:id="@android:id/mask"> <shape android:shape="rectangle"> <solid android:color="@android:color/white"/> <corners android:radius="4dp" /> </shape> </item> <item> <shape android:shape="rectangle"> <stroke android:color="@color/option_border_color" android:width="@dimen/option_border_width" /> <stroke android:color="@color/option_border_color" android:width="@dimen/option_border_width" /> <corners android:radius="4dp" /> <corners android:radius="4dp" /> </shape> </shape> </item> </ripple> res/values/styles.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ <item name="itemTextColor">@color/bottom_nav_item_color</item> <item name="itemTextColor">@color/bottom_nav_item_color</item> <item name="itemTextAppearanceActive">@style/BottomNavTextAppearance</item> <item name="itemTextAppearanceActive">@style/BottomNavTextAppearance</item> <item name="itemTextAppearanceInactive">@style/BottomNavTextAppearance</item> <item name="itemTextAppearanceInactive">@style/BottomNavTextAppearance</item> <item name="itemBackground">?android:attr/selectableItemBackgroundBorderless</item> <item name="android:background">?android:colorPrimary</item> <item name="android:background">?android:colorPrimary</item> </style> </style> Loading src/com/android/customization/widget/OptionSelectorController.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -76,11 +76,23 @@ public class OptionSelectorController<T extends CustomizationOption<T>> { if (!mOptions.contains(option)) { if (!mOptions.contains(option)) { throw new IllegalArgumentException("Invalid option"); throw new IllegalArgumentException("Invalid option"); } } updateActivatedStatus(mSelectedOption, false); updateActivatedStatus(option, true); mSelectedOption = option; mSelectedOption = option; mAdapter.notifyDataSetChanged(); notifyListeners(); notifyListeners(); } } private void updateActivatedStatus(CustomizationOption option, boolean isActivated) { int index = mOptions.indexOf(option); if (index < 0) { return; } RecyclerView.ViewHolder holder = mContainer.findViewHolderForAdapterPosition(index); if (holder != null && holder.itemView != null) { holder.itemView.setActivated(isActivated); } } /** /** * Initializes the UI for the options passed in the constructor of this class. * Initializes the UI for the options passed in the constructor of this class. */ */ Loading Loading
res/drawable/option_border.xml +15 −5 Original line number Original line Diff line number Diff line Loading @@ -13,8 +13,18 @@ See the License for the specific language governing permissions and See the License for the specific language governing permissions and limitations under the License. limitations under the License. --> --> <shape xmlns:android="http://schemas.android.com/apk/res/android" <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> android:color="?android:attr/colorControlHighlight"> <item android:id="@android:id/mask"> <shape android:shape="rectangle"> <solid android:color="@android:color/white"/> <corners android:radius="4dp" /> </shape> </item> <item> <shape android:shape="rectangle"> <stroke android:color="@color/option_border_color" android:width="@dimen/option_border_width" /> <stroke android:color="@color/option_border_color" android:width="@dimen/option_border_width" /> <corners android:radius="4dp" /> <corners android:radius="4dp" /> </shape> </shape> </item> </ripple>
res/values/styles.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ <item name="itemTextColor">@color/bottom_nav_item_color</item> <item name="itemTextColor">@color/bottom_nav_item_color</item> <item name="itemTextAppearanceActive">@style/BottomNavTextAppearance</item> <item name="itemTextAppearanceActive">@style/BottomNavTextAppearance</item> <item name="itemTextAppearanceInactive">@style/BottomNavTextAppearance</item> <item name="itemTextAppearanceInactive">@style/BottomNavTextAppearance</item> <item name="itemBackground">?android:attr/selectableItemBackgroundBorderless</item> <item name="android:background">?android:colorPrimary</item> <item name="android:background">?android:colorPrimary</item> </style> </style> Loading
src/com/android/customization/widget/OptionSelectorController.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -76,11 +76,23 @@ public class OptionSelectorController<T extends CustomizationOption<T>> { if (!mOptions.contains(option)) { if (!mOptions.contains(option)) { throw new IllegalArgumentException("Invalid option"); throw new IllegalArgumentException("Invalid option"); } } updateActivatedStatus(mSelectedOption, false); updateActivatedStatus(option, true); mSelectedOption = option; mSelectedOption = option; mAdapter.notifyDataSetChanged(); notifyListeners(); notifyListeners(); } } private void updateActivatedStatus(CustomizationOption option, boolean isActivated) { int index = mOptions.indexOf(option); if (index < 0) { return; } RecyclerView.ViewHolder holder = mContainer.findViewHolderForAdapterPosition(index); if (holder != null && holder.itemView != null) { holder.itemView.setActivated(isActivated); } } /** /** * Initializes the UI for the options passed in the constructor of this class. * Initializes the UI for the options passed in the constructor of this class. */ */ Loading