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

Commit 3ebbdd7a authored by Jay Aliomer's avatar Jay Aliomer Committed by Automerger Merge Worker
Browse files

Merge "Fixing stroked qs tile" into rvc-dev am: 83040157

Change-Id: Ic7453f7051f22b8b8ed97e26bf6d020dfa6587c4
parents 6a502384 83040157
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -559,6 +559,10 @@

    <dimen name="resolver_max_width">480dp</dimen>

    <!-- Tile Stroke width -->
    <dimen name="config_qsTileStrokeWidthActive">-1dp</dimen>
    <dimen name="config_qsTileStrokeWidthInactive">-1dp</dimen>

    <!-- Amount to reduce the size of the circular mask by (to compensate for
         aliasing effects). This is only used on circular displays. -->
    <dimen name="circular_display_mask_thickness">1px</dimen>
+2 −0
Original line number Diff line number Diff line
@@ -361,6 +361,8 @@
  <java-symbol type="bool" name="config_disableUsbPermissionDialogs"/>
  <java-symbol type="dimen" name="config_highResTaskSnapshotScale" />
  <java-symbol type="dimen" name="config_lowResTaskSnapshotScale" />
  <java-symbol type="dimen" name="config_qsTileStrokeWidthInactive" />
  <java-symbol type="dimen" name="config_qsTileStrokeWidthActive" />
  <java-symbol type="bool" name="config_use16BitTaskSnapshotPixelFormat" />
  <java-symbol type="bool" name="config_hasRecents" />
  <java-symbol type="string" name="config_recentsComponentName" />
+32 −0
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@ import static com.android.systemui.qs.tileimpl.QSIconViewImpl.QS_ANIM_LENGTH;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.Drawable;
@@ -64,6 +66,8 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView {
    private boolean mTileState;
    private boolean mCollapsedView;
    private boolean mShowRippleEffect = true;
    private float mStrokeWidthActive;
    private float mStrokeWidthInactive;

    private final ImageView mBg;
    private final TextView mDetailText;
@@ -83,6 +87,10 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView {
        // Default to Quick Tile padding, and QSTileView will specify its own padding.
        int padding = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_padding);
        mIconFrame = new FrameLayout(context);
        mStrokeWidthActive = context.getResources()
                .getDimension(com.android.internal.R.dimen.config_qsTileStrokeWidthActive);
        mStrokeWidthInactive = context.getResources()
                .getDimension(com.android.internal.R.dimen.config_qsTileStrokeWidthInactive);
        int size = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
        addView(mIconFrame, new LayoutParams(size, size));
        mBg = new ImageView(getContext());
@@ -206,7 +214,31 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView {
        mHandler.obtainMessage(H.STATE_CHANGED, state).sendToTarget();
    }

    private void updateStrokeShapeWidth(QSTile.State state) {
        Resources resources = getContext().getResources();
        if (!(mBg.getDrawable() instanceof ShapeDrawable)) {
            return;
        }
        ShapeDrawable d = (ShapeDrawable) mBg.getDrawable();
        d.getPaint().setStyle(Paint.Style.FILL);
        switch (state.state) {
            case Tile.STATE_INACTIVE:
                if (mStrokeWidthInactive >= 0) {
                    d.getPaint().setStyle(Paint.Style.STROKE);
                    d.getPaint().setStrokeWidth(mStrokeWidthInactive);
                }
                break;
            case Tile.STATE_ACTIVE:
                if (mStrokeWidthActive >= 0) {
                    d.getPaint().setStyle(Paint.Style.STROKE);
                    d.getPaint().setStrokeWidth(mStrokeWidthActive);
                }
                break;
        }
    }

    protected void handleStateChanged(QSTile.State state) {
        updateStrokeShapeWidth(state);
        int circleColor = getCircleColor(state.state);
        boolean allowAnimations = animationsEnabled();
        if (circleColor != mCircleColor) {
+1 −2
Original line number Diff line number Diff line
@@ -24,6 +24,5 @@
    <!-- Corner radius for bottom sheet system dialogs -->
    <dimen name="config_bottomDialogCornerRadius">0dp</dimen>
    <!-- Tile stroke width -->
    <dimen name="config_qsTileStrokeWidthInactive">10dp</dimen>

    <dimen name="config_qsTileStrokeWidthInactive">1dp</dimen>
</resources>