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

Commit 5deb6973 authored by Stefan Maftei's avatar Stefan Maftei
Browse files

[Expressive design] Add trailing buttons to CollapsingToolbar



Bug: 423874847
Bug: 423962950
Test: visual in showcase app
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Change-Id: I3e34e52648a7d71d0251af2a15e74d7ee3853030
Signed-off-by: default avatarStefan Maftei <smaftei@google.com>
parent 9eab341e
Loading
Loading
Loading
Loading
+26 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/content_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <include layout="@layout/settingslib_expressive_support_toolbar_layout"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+2 −30
Original line number Original line Diff line number Diff line
@@ -50,21 +50,7 @@
                android:touchscreenBlocksFocus="false"
                android:touchscreenBlocksFocus="false"
                app:layout_collapseMode="pin">
                app:layout_collapseMode="pin">


                <LinearLayout
                <include layout="@layout/settingslib_expressive_toolbar_buttons"/>
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingStart="@dimen/settingslib_expressive_space_extrasmall6"
                    android:layout_marginEnd="@dimen/settingslib_expressive_space_small4"
                    android:layout_gravity="end">

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/action_button"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        style="@style/SettingsLibButtonStyle.Expressive.Filled"
                        android:visibility="gone"/>
                </LinearLayout>

            </Toolbar>
            </Toolbar>


        </com.google.android.material.appbar.CollapsingToolbarLayout>
        </com.google.android.material.appbar.CollapsingToolbarLayout>
@@ -76,19 +62,5 @@
        android:layout_height="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>


    <com.google.android.material.floatingtoolbar.FloatingToolbarLayout
    <include layout="@layout/settingslib_expressive_floating_toolbar_layout"/>
        android:id="@+id/floating_toolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:theme="@style/Theme.Material3.DynamicColors.DayNight"
        style="@style/Widget.SettingsLib.Material3Expressive.FloatingToolbar"
        app:layout_behavior="com.google.android.material.behavior.HideViewOnScrollBehavior"
        android:layout_margin="@dimen/settingslib_expressive_space_small1"
        android:visibility="gone">

        <com.android.settingslib.collapsingtoolbar.widget.ScrollableToolbarItemLayout
            android:id="@+id/floating_toolbar_items"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.floatingtoolbar.FloatingToolbarLayout>
</merge>
</merge>
+33 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<com.google.android.material.floatingtoolbar.FloatingToolbarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/floating_toolbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:theme="@style/Theme.Material3.DynamicColors.DayNight"
    style="@style/Widget.SettingsLib.Material3Expressive.FloatingToolbar"
    app:layout_behavior="com.google.android.material.behavior.HideViewOnScrollBehavior"
    android:layout_margin="@dimen/settingslib_expressive_space_small1"
    android:visibility="gone">

    <com.android.settingslib.collapsingtoolbar.widget.ScrollableToolbarItemLayout
        android:id="@+id/floating_toolbar_items"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</com.google.android.material.floatingtoolbar.FloatingToolbarLayout>
+66 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:outlineAmbientShadowColor="@android:color/transparent"
        android:outlineSpotShadowColor="@android:color/transparent"
        android:background="@android:color/transparent"
        android:touchscreenBlocksFocus="false"
        app:expanded="false"
        android:theme="@style/SettingsLibTheme.CollapsingToolbar.Expressive">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/settingslib_toolbar_layout_height"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
            app:toolbarId="@id/action_bar"
            app:maxLines="2"
            style="@style/SettingsLibCollapsingToolbarLayoutStyle.Expressive">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/support_action_bar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_marginStart="@dimen/settingslib_expressive_space_extrasmall4"
                android:theme="?android:attr/actionBarTheme"
                android:transitionName="shared_element_view"
                android:nextFocusForward="@+id/content_frame"
                android:touchscreenBlocksFocus="false"
                app:layout_collapseMode="pin">

                <include layout="@layout/settingslib_expressive_toolbar_buttons"/>
            </androidx.appcompat.widget.Toolbar>

        </com.google.android.material.appbar.CollapsingToolbarLayout>
    </com.google.android.material.appbar.AppBarLayout>

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

    <include layout="@layout/settingslib_expressive_floating_toolbar_layout"/>
</merge>
+50 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingStart="@dimen/settingslib_expressive_space_extrasmall6"
    android:layout_marginEnd="@dimen/settingslib_expressive_space_small4"
    android:layout_gravity="end">

    <com.google.android.material.button.MaterialButton
        android:theme="@style/Theme.Material3.DynamicColors.DayNight"
        android:id="@+id/primary_button"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        app:iconTint="@color/settingslib_materialColorOnSurfaceVariant"
        style="@style/Widget.Material3.Button.IconButton"
        android:visibility="gone"/>

    <com.google.android.material.button.MaterialButton
        android:theme="@style/Theme.Material3.DynamicColors.DayNight"
        android:id="@+id/secondary_button"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        app:iconTint="@color/settingslib_materialColorOnSurfaceVariant"
        style="@style/Widget.Material3.Button.IconButton"
        android:visibility="gone"/>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/action_button"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        style="@style/SettingsLibButtonStyle.Expressive.Filled"
        android:visibility="gone"/>
</LinearLayout>
Loading