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

Commit 79d50ab0 authored by qing's avatar qing Committed by Andriy Naborskyy
Browse files

Do not show toolbar on small devices like watch.

Test: Manual test on UI
Bug: 278789898
Bug: 263527039
Merged-In: I5c9f61aece28a4a07209f5e815630c6ad1ac167a
Change-Id: I5c9f61aece28a4a07209f5e815630c6ad1ac167a
(cherry picked from commit 98e04e4d)
parent 2560a97e
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;
@@ -58,7 +59,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;
        }
@@ -138,6 +140,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());