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

Commit 72c93c3e authored by Chip Fukuhara's avatar Chip Fukuhara Committed by Android (Google) Code Review
Browse files

Merge "Do not show toolbar on small devices like watch."

parents 0923dc7c 98e04e4d
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settingslib.collapsingtoolbar;

import android.app.ActionBar;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -59,7 +60,8 @@ public class CollapsingToolbarBaseActivity extends FragmentActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mCustomizeLayoutResId > 0 && !BuildCompatUtils.isAtLeastS()) {
        // for backward compatibility on R devices or wearable devices due to small device size.
        if (mCustomizeLayoutResId > 0 && (!BuildCompatUtils.isAtLeastS() || isWatch())) {
            super.setContentView(mCustomizeLayoutResId);
            return;
        }
@@ -157,6 +159,14 @@ public class CollapsingToolbarBaseActivity extends FragmentActivity {
        return getToolbarDelegate().getAppBarLayout();
    }

    private boolean isWatch() {
        PackageManager packageManager = getPackageManager();
        if (packageManager == null) {
            return false;
        }
        return packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH);
    }

    private CollapsingToolbarDelegate getToolbarDelegate() {
        if (mToolbardelegate == null) {
            mToolbardelegate = new CollapsingToolbarDelegate(new DelegateCallback());