diff options
5 files changed, 37 insertions, 2 deletions
diff --git a/packages/SystemUI/res/layout/tv_notification_panel.xml b/packages/SystemUI/res/layout/tv_notification_panel.xml index 8f00a727b912..eae44c8bcbb8 100644 --- a/packages/SystemUI/res/layout/tv_notification_panel.xml +++ b/packages/SystemUI/res/layout/tv_notification_panel.xml @@ -20,7 +20,7 @@ android:layout_width="@dimen/tv_notification_panel_width" android:layout_height="match_parent" android:layout_gravity="end" - android:background="@color/tv_notification_background_color" + android:background="@android:color/transparent" android:orientation="vertical"> <TextView diff --git a/packages/SystemUI/res/values/colors_tv.xml b/packages/SystemUI/res/values/colors_tv.xml index 0961f503e7d4..64c942de8875 100644 --- a/packages/SystemUI/res/values/colors_tv.xml +++ b/packages/SystemUI/res/values/colors_tv.xml @@ -34,6 +34,7 @@ <color name="tv_volume_dialog_seek_bar_fill">#FFF8F9FA</color> <color name="tv_volume_dialog_accent">#FFDADCE0</color> - <color name="tv_notification_background_color">#383838</color> + <color name="tv_notification_default_background_color">#383838</color> + <color name="tv_notification_blur_background_color">#a0383838</color> <color name="tv_notification_text_color">#FFFFFF</color> </resources> diff --git a/packages/SystemUI/res/values/dimens_tv.xml b/packages/SystemUI/res/values/dimens_tv.xml index 9545bfd088a0..5bd95ebc1c41 100644 --- a/packages/SystemUI/res/values/dimens_tv.xml +++ b/packages/SystemUI/res/values/dimens_tv.xml @@ -16,4 +16,5 @@ --> <resources> <dimen name="tv_notification_panel_width">360dp</dimen> + <dimen name="tv_notification_blur_radius">100dp</dimen> </resources>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/styles_tv.xml b/packages/SystemUI/res/values/styles_tv.xml index cb433f3a6009..3e090269699b 100644 --- a/packages/SystemUI/res/values/styles_tv.xml +++ b/packages/SystemUI/res/values/styles_tv.xml @@ -30,5 +30,6 @@ <item name="android:backgroundDimEnabled">false</item> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> + <item name="android:windowIsFloating">true</item> </style> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/notifications/TvNotificationPanelActivity.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/notifications/TvNotificationPanelActivity.java index 30f401b91d25..b325b10957f7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/notifications/TvNotificationPanelActivity.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/notifications/TvNotificationPanelActivity.java @@ -20,15 +20,19 @@ import android.annotation.NonNull; import android.app.Activity; import android.app.NotificationManager; import android.content.Intent; +import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.service.notification.StatusBarNotification; import android.util.SparseArray; +import android.view.Gravity; import android.view.View; import androidx.leanback.widget.VerticalGridView; import com.android.systemui.R; +import java.util.function.Consumer; + import javax.inject.Inject; /** @@ -42,6 +46,7 @@ public class TvNotificationPanelActivity extends Activity implements private VerticalGridView mNotificationListView; private View mNotificationPlaceholder; private boolean mPanelAlreadyOpen = false; + private final Consumer<Boolean> mBlurConsumer = this::enableBlur; @Inject public TvNotificationPanelActivity(TvNotificationHandler tvNotificationHandler) { @@ -103,6 +108,33 @@ public class TvNotificationPanelActivity extends Activity implements } @Override + public void onAttachedToWindow() { + super.onAttachedToWindow(); + getWindow().setGravity(Gravity.END); + getWindowManager().addCrossWindowBlurEnabledListener(mBlurConsumer); + } + + private void enableBlur(boolean enabled) { + if (enabled) { + int blurRadius = getResources().getDimensionPixelSize( + R.dimen.tv_notification_blur_radius); + getWindow().setBackgroundDrawable( + new ColorDrawable(getColor(R.color.tv_notification_blur_background_color))); + getWindow().setBackgroundBlurRadius(blurRadius); + } else { + getWindow().setBackgroundDrawable( + new ColorDrawable(getColor(R.color.tv_notification_default_background_color))); + getWindow().setBackgroundBlurRadius(0); + } + } + + @Override + public void onDetachedFromWindow() { + super.onDetachedFromWindow(); + getWindowManager().removeCrossWindowBlurEnabledListener(mBlurConsumer); + } + + @Override public void onDestroy() { super.onDestroy(); mTvNotificationHandler.setTvNotificationListener(null); |