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

Commit a66bad92 authored by David Liu's avatar David Liu Committed by Android (Google) Code Review
Browse files

Merge "[Settingslib] Fix ActionButton for CollapsingToolbarAppCompatActivity" into main

parents 7870811c a9c78aff
Loading
Loading
Loading
Loading
+42 −0
Original line number 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.
-->
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/support_action_bar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:theme="?android:attr/actionBarTheme"
    android:transitionName="shared_element_view"
    android:filterTouchesWhenObscured="true"
    app:layout_collapseMode="pin">

    <LinearLayout
        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>
</android.support.v7.widget.Toolbar>
+6 −2
Original line number Diff line number Diff line
@@ -152,7 +152,6 @@ public class CollapsingToolbarDelegate {

        initCollapsingToolbar(mCollapsingToolbarLayout, mAppBarLayout);
        mContentFrameLayout = view.findViewById(R.id.content_frame);
        mActionButton = view.findViewById(R.id.action_button);
        if (activity instanceof AppCompatActivity) {
            Log.d(TAG, "onCreateView: from AppCompatActivity and sub-class.");
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
@@ -174,6 +173,7 @@ public class CollapsingToolbarDelegate {
                actionBar.setDisplayShowTitleEnabled(true);
            }
        }
        mActionButton = view.findViewById(R.id.action_button);

        initFloatingToolbar(context, view.findViewById(R.id.floating_toolbar));
        return view;
@@ -298,7 +298,11 @@ public class CollapsingToolbarDelegate {
            return;
        }
        mCollapsingToolbarLayout.removeAllViews();
        if (SettingsThemeHelper.isExpressiveTheme(inflater.getContext())) {
            inflater.inflate(R.layout.settingslib_expressive_support_toolbar, mCollapsingToolbarLayout);
        } else {
            inflater.inflate(R.layout.support_toolbar, mCollapsingToolbarLayout);
        }
        final androidx.appcompat.widget.Toolbar supportToolbar =
                mCollapsingToolbarLayout.findViewById(R.id.support_action_bar);
        final androidx.appcompat.app.ActionBar actionBar =