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

Commit 86ef6285 authored by Steve Elliott's avatar Steve Elliott
Browse files

Global Actions Panel plugin can override Global Actions background

Bug: 128828632
Test: manual
Change-Id: I7b68bd0be5243d0e42101d4e02ae24da786aee32
parent 29c74cd4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.systemui.plugins;

import android.annotation.Nullable;
import android.app.PendingIntent;
import android.graphics.drawable.Drawable;
import android.view.View;

import com.android.systemui.plugins.annotations.DependsOn;
@@ -98,5 +100,13 @@ public interface GlobalActionsPanelPlugin extends Plugin {
         * Invoked when the device is either locked or unlocked.
         */
        void onDeviceLockStateChanged(boolean locked);

        /**
         * Optionally returns a drawable to be used as the background for Global Actions.
         */
        @Nullable
        default Drawable getBackgroundDrawable() {
            return null;
        }
    }
}
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <gradient
        android:centerY="0.45"
        android:startColor="#dc3c4043"
        android:centerColor="#dc3c4043"
        android:endColor="#4d3c4043"
        android:angle="270" />
</shape>
 No newline at end of file
+7 −9
Original line number Diff line number Diff line
@@ -1576,6 +1576,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
                        new ViewGroup.LayoutParams(
                                ViewGroup.LayoutParams.MATCH_PARENT,
                                ViewGroup.LayoutParams.MATCH_PARENT));
                mBackgroundDrawable = mPanelController.getBackgroundDrawable();
                mScrimAlpha = 1f;
            }
        }

@@ -1595,16 +1597,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            mGlobalActionsLayout.setRotationListener(this::onRotate);
            mGlobalActionsLayout.setAdapter(mAdapter);

            if (!shouldUsePanel()) {
            if (shouldUsePanel()) {
                initializePanel();
            }
            if (mBackgroundDrawable == null) {
                mBackgroundDrawable = new ScrimDrawable();
                }
                mScrimAlpha = ScrimController.GRADIENT_SCRIM_ALPHA;
            } else {
                mBackgroundDrawable = mContext.getDrawable(
                        com.android.systemui.R.drawable.global_action_panel_scrim);
                mScrimAlpha = 1f;
                initializePanel();
            }
            getWindow().setBackgroundDrawable(mBackgroundDrawable);
        }