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

Commit b1a85a7b authored by Jorge Gil's avatar Jorge Gil
Browse files

Add MaximizeMenuView with m3's dynamic color theming

To more easily support theming, this change also:
1) Replaces the maximize button's drawable with a custom
   StateListDrawable with selector state support, for out-of-the-box
   theming based on hover, selected, pressed and inactive states without
   manual motion event tracking.
   Also disables hardware acceleration on this button except for during
   animations, to prevent aliasing.
2) Moves toolkit specific logic into MaximizeMenuView, to encapsulate
   view inflation, binding, animations, etc and to keep it separate
   from the menu's window management logic

Bug: 328668781
Test: maximize menu theming follows app theme, regardless of system
theme

Change-Id: I8f5866102226d161cbb4d94611df46155747ce75
parent 7ee6daf9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,5 +20,6 @@
    android:shape="rectangle">
    <corners
        android:radius="@dimen/desktop_mode_maximize_menu_buttons_outline_radius"/>
    <solid android:color="?androidprv:attr/materialColorSurfaceContainerLow"/>
    <stroke android:width="1dp" android:color="?androidprv:attr/materialColorOutlineVariant"/>
</shape>
 No newline at end of file
+7 −15
Original line number Diff line number Diff line
@@ -31,23 +31,15 @@
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <FrameLayout
            android:id="@+id/maximize_menu_maximize_button_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/desktop_mode_maximize_menu_layout_background"
            android:padding="4dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="4dp"
            android:alpha="0">
        <Button
            android:layout_width="94dp"
            android:layout_height="60dp"
            android:id="@+id/maximize_menu_maximize_button"
            style="?android:attr/buttonBarButtonStyle"
                android:layout_width="86dp"
                android:layout_height="@dimen/desktop_mode_maximize_menu_button_height"
                android:background="@drawable/desktop_mode_maximize_menu_button_background"
                android:stateListAnimator="@null"/>
        </FrameLayout>
            android:stateListAnimator="@null"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="4dp"
            android:alpha="0"/>

        <TextView
            android:id="@+id/maximize_menu_maximize_window_text"
+6 −0
Original line number Diff line number Diff line
@@ -476,6 +476,12 @@

    <!-- The radius of the layout outline around the maximize menu buttons. -->
    <dimen name="desktop_mode_maximize_menu_buttons_outline_radius">6dp</dimen>
    <!-- The stroke width of the outline around the maximize menu buttons. -->
    <dimen name="desktop_mode_maximize_menu_buttons_outline_stroke">1dp</dimen>
    <!-- The radius of the inner fill of the maximize menu buttons. -->
    <dimen name="desktop_mode_maximize_menu_buttons_fill_radius">4dp</dimen>
    <!-- The padding between the outline and fill of the maximize menu buttons. -->
    <dimen name="desktop_mode_maximize_menu_buttons_fill_padding">4dp</dimen>

    <!-- The corner radius of the maximize menu. -->
    <dimen name="desktop_mode_maximize_menu_corner_radius">8dp</dimen>
Loading