diff options
| author | 2025-02-04 09:31:48 -0800 | |
|---|---|---|
| committer | 2025-02-04 09:31:48 -0800 | |
| commit | 7825d60b342c52f46e07a03c56c8d4a56758badc (patch) | |
| tree | d462473176aae5f61d0bb4fa7e35a58ce8adaa55 | |
| parent | 4772f91f521be8a6bff1302a1a6a1f900e9add4f (diff) | |
| parent | 1ffd14216e5a0e6cae2392676169e50c6daf0aa1 (diff) | |
Merge "Cleanup EmptyShadeView" into main
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/notification/emptyshade/ui/view/EmptyShadeView.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/emptyshade/ui/view/EmptyShadeView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/emptyshade/ui/view/EmptyShadeView.java index 73477da247f4..1af78e7d8d2d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/emptyshade/ui/view/EmptyShadeView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/emptyshade/ui/view/EmptyShadeView.java @@ -25,6 +25,7 @@ import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.widget.TextView; @@ -42,6 +43,7 @@ import kotlin.Unit; import java.util.Objects; public class EmptyShadeView extends StackScrollerDecorView implements LaunchableView { + private static final String TAG = "EmptyShadeView"; private TextView mEmptyText; private TextView mEmptyFooterText; @@ -55,7 +57,7 @@ public class EmptyShadeView extends StackScrollerDecorView implements Launchable private @Visibility int mFooterVisibility = View.GONE; private int mSize; - private LaunchableViewDelegate mLaunchableViewDelegate = new LaunchableViewDelegate(this, + private final LaunchableViewDelegate mLaunchableViewDelegate = new LaunchableViewDelegate(this, visibility -> { super.setVisibility(visibility); return Unit.INSTANCE; @@ -179,8 +181,12 @@ public class EmptyShadeView extends StackScrollerDecorView implements Launchable if (icon == 0) { drawable = null; } else { - drawable = getResources().getDrawable(icon); - drawable.setBounds(0, 0, mSize, mSize); + drawable = getContext().getDrawable(icon); + if (drawable != null) { + drawable.setBounds(0, 0, mSize, mSize); + } else { + Log.w(TAG, "Invalid footer icon resource ID"); + } } mEmptyFooterText.setCompoundDrawablesRelative(drawable, null, null, null); } @@ -224,8 +230,7 @@ public class EmptyShadeView extends StackScrollerDecorView implements Launchable @Override public void applyToView(View view) { super.applyToView(view); - if (view instanceof EmptyShadeView) { - EmptyShadeView emptyShadeView = (EmptyShadeView) view; + if (view instanceof EmptyShadeView emptyShadeView) { boolean visible = this.clipTopAmount <= mEmptyText.getPaddingTop() * 0.6f; emptyShadeView.setContentVisibleAnimated(visible && emptyShadeView.isVisible()); } |