Merge "Importance slider updates." into nyc-dev

This commit is contained in:
Julia Reynolds
2016-05-26 16:50:56 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 5 deletions

View File

@@ -20,8 +20,8 @@
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11.2,13.6l1.6,0l-0.8,-2.6z"/>
android:pathData="M10.8,12.7l2.4,0l-1.2,-3.7z"/>
<path
android:fillColor="#FF000000"
android:pathData="M22.5,9.6L15,9l-3,-7L9,9L1.5,9.6l5.7,5L5.5,22l6.5,-3.9l6.5,3.9l-1.7,-7.4L22.5,9.6zM13.6,16l-0.5,-1.4h-2.3L10.4,16H9l2.3,-6.4h1.4L15,16H13.6z"/>
android:pathData="M12,2C6.5,2 2,6.5 2,12s4.5,10 10,10s10,-4.5 10,-10S17.5,2 12,2zM14.3,16l-0.7,-2h-3.2l-0.7,2H7.8L11,7h2l3.2,9H14.3z"/>
</vector>

View File

@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Handler;
@@ -70,6 +71,8 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
private ImageView mAutoButton;
private ColorStateList mActiveSliderTint;
private ColorStateList mInactiveSliderTint;
private float mActiveSliderAlpha = 1.0f;
private float mInactiveSliderAlpha;
private TextView mImportanceSummary;
private TextView mImportanceTitle;
private boolean mAuto;
@@ -100,6 +103,11 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
}
}
};
final TypedArray ta =
context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.Theme, 0, 0);
mInactiveSliderAlpha =
ta.getFloat(com.android.internal.R.styleable.Theme_disabledAlpha, 0.5f);
ta.recycle();
}
public void resetFalsingCheck() {
@@ -299,13 +307,12 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
private void applyAuto() {
mSeekBar.setEnabled(!mAuto);
final ColorStateList sliderTint = mAuto ? mInactiveSliderTint : mActiveSliderTint;
final ColorStateList starTint = mAuto ? mActiveSliderTint : mInactiveSliderTint;
final float alpha = mAuto ? mInactiveSliderAlpha : mActiveSliderAlpha;
Drawable icon = mAutoButton.getDrawable().mutate();
icon.setTintList(starTint);
mAutoButton.setImageDrawable(icon);
mSeekBar.setProgressTintList(sliderTint);
mSeekBar.setThumbTintList(sliderTint);
mSeekBar.setAlpha(alpha);
if (mAuto) {
mSeekBar.setProgress(mNotificationImportance);