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

Commit 98e04e4d authored by qing's avatar qing Committed by Chip Fukuhara
Browse files

Do not show toolbar on small devices like watch.

Test: Manual test on UI
Bug: 263527039
Change-Id: I5c9f61aece28a4a07209f5e815630c6ad1ac167a
parent dcdcf650
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());