Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89eef637 authored by Amin Shaikh's avatar Amin Shaikh
Browse files

Add ripple effect to bottom nav and options

Fixes: 130761292
Fixes: 130760161
Fixes: 130759539
Change-Id: I9c34e62eaebd34e783cc43af2aab5d544e294d31
parent 06972d81
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -13,8 +13,18 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    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" />
            <corners android:radius="4dp" />
        </shape>
    </item>
</ripple>
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
        <item name="itemTextColor">@color/bottom_nav_item_color</item>
        <item name="itemTextAppearanceActive">@style/BottomNavTextAppearance</item>
        <item name="itemTextAppearanceInactive">@style/BottomNavTextAppearance</item>
        <item name="itemBackground">?android:attr/selectableItemBackgroundBorderless</item>
        <item name="android:background">?android:colorPrimary</item>
    </style>

+13 −1
Original line number Diff line number Diff line
@@ -76,11 +76,23 @@ public class OptionSelectorController<T extends CustomizationOption<T>> {
        if (!mOptions.contains(option)) {
            throw new IllegalArgumentException("Invalid option");
        }
        updateActivatedStatus(mSelectedOption, false);
        updateActivatedStatus(option, true);
        mSelectedOption = option;
        mAdapter.notifyDataSetChanged();
        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.
     */