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

Commit 1b303278 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[SettingsLib] Add method to allow using a non collapsing toolbar" into main

parents d9386b81 ba669dc9
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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/non_collapsing_toolbar_content_layout"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+45 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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:theme="@style/Theme.CollapsingToolbar.Settings">

        <Toolbar
            android:id="@+id/action_bar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:theme="?android:attr/actionBarTheme"
            android:transitionName="shared_element_view"
            app:layout_collapseMode="pin"/>
    </com.google.android.material.appbar.AppBarLayout>

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</merge>
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ public class CollapsingToolbarAppCompatActivity extends AppCompatActivity {

    private CollapsingToolbarDelegate getToolbarDelegate() {
        if (mToolbardelegate == null) {
            mToolbardelegate = new CollapsingToolbarDelegate(new DelegateCallback());
            mToolbardelegate = new CollapsingToolbarDelegate(new DelegateCallback(), true);
        }
        return mToolbardelegate;
    }
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ public class CollapsingToolbarBaseActivity extends FragmentActivity {

    private CollapsingToolbarDelegate getToolbarDelegate() {
        if (mToolbardelegate == null) {
            mToolbardelegate = new CollapsingToolbarDelegate(new DelegateCallback());
            mToolbardelegate = new CollapsingToolbarDelegate(new DelegateCallback(), true);
        }
        return mToolbardelegate;
    }
+6 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ public abstract class CollapsingToolbarBaseFragment extends Fragment {
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mToolbardelegate = new CollapsingToolbarDelegate(new DelegateCallback());
        mToolbardelegate =
                new CollapsingToolbarDelegate(new DelegateCallback(), useCollapsingToolbar());
    }

    @Nullable
@@ -98,4 +99,8 @@ public abstract class CollapsingToolbarBaseFragment extends Fragment {
    public FrameLayout getContentFrameLayout() {
        return mToolbardelegate.getContentFrameLayout();
    }

    protected boolean useCollapsingToolbar() {
        return true;
    }
}
Loading