Skip to content

Commit

Permalink
Improved QS Media album art on OOS15.
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Nov 12, 2024
1 parent 5d281e4 commit cc2f6ac
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import android.graphics.drawable.TransitionDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.graphics.drawable.shapes.Shape;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
Expand Down Expand Up @@ -128,9 +129,10 @@ public class QsTileCustomization extends XposedMods {
private int qsBrightnessSliderColorMode, qsBrightnessSliderColor, qsBrightnessBackgroundColor;

// QS Media Tile
private ImageView mCoverImg = null;
private View mOplusQsMediaView = null;
private Drawable mOplusQsMediaDefaultBackground = null;
private final Drawable mOplusQsMediaDrawable = null;
private Drawable mOplusQsMediaDrawable = null;
private ViewGroup mLabelContainer = null;
private TextView mTitle = null, mSubtitle = null;
private ImageView mExpandIndicator = null;
Expand Down Expand Up @@ -334,12 +336,20 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
mOplusQsMediaView = (View) param.thisObject;
if (mQsWidgetsEnabled) return;
mOplusQsMediaDefaultBackground = mOplusQsMediaView.getBackground();
if (mOplusQsMediaDefaultBackground != null) {
mOplusQsMediaDrawable = mOplusQsMediaDefaultBackground.getConstantState().newDrawable().mutate();
}
if (qsInactiveColorEnabled) {
mOplusQsMediaDrawable.setTint(qsInactiveColor);
mOplusQsMediaDrawable.invalidateSelf();
mOplusQsMediaView.setBackground(mOplusQsMediaDrawable);
} else mOplusQsMediaView.setBackground(mOplusQsMediaDefaultBackground);

// Get OOS15 cover
if (Build.VERSION.SDK_INT >= 35) {
mCoverImg = (ImageView) getObjectField(param.thisObject, "mCoverImg");
}

// Listen for default tip change
View mDefaultTip = (View) getObjectField(param.thisObject, "mDefaultTip");
mDefaultTip.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
Expand Down Expand Up @@ -543,6 +553,7 @@ private void setSliderBackgroundColor(Object mSlider, ColorStateList colorStateL
private void updateMediaQsBackground() {
if (!showMediaArtMediaQs || mOplusQsMediaView == null) return;
if (mQsWidgetsEnabled) return;
mCoverImg.setVisibility(View.GONE);
Bitmap oldArt = mArt;
Bitmap tempArt = getArt();
if (tempArt == null) {
Expand Down

0 comments on commit cc2f6ac

Please sign in to comment.