Permalink
Browse files

Merge "Add alpha settings to Circles lockscreen rings" into jb

  • Loading branch information...
2 parents 570e618 + 7f798a6 commit 0922f4b95ecb095228591aba9bfc25a0e0406354 @KhasMek KhasMek committed with Gerrit Code Review Nov 13, 2012
@@ -3075,6 +3075,24 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
public static final String CIRCLES_LOCK_WAVE_COLOR = "circles_lock_wave_color";
/**
+ * Sets ring alpha of alt lockscreen
+ * @hide
+ */
+ public static final String CIRCLES_LOCK_RING_ALPHA = "circles_lock_ring_alpha";
+
+ /**
+ * Sets halo alpha of alt lockscreen
+ * @hide
+ */
+ public static final String CIRCLES_LOCK_HALO_ALPHA = "circles_lock_halo_alpha";
+
+ /**
+ * Sets wave alpha of alt lockscreen
+ * @hide
+ */
+ public static final String CIRCLES_LOCK_WAVE_ALPHA = "circles_lock_wave_alpha";
+
+ /**
* How to show weather on the statusbar
*
* @hide
@@ -102,14 +102,13 @@
private float mStartX;
private float mStartY;
private float mCircleSize;
- private int defaultBgColor = 0xD2000000;
- private int defaultRingColor = 0xFFFFFFFF;
- private int defaultHaloColor = 0xFFFFFFFF;
- private int defaultWaveColor = 0xD2FFFFFF;
- private int bgColor;
- private int ringColor;
- private int haloColor;
- private int waveColor;
+ private int mBgColor;
+ private int mRingColor;
+ private int mHaloColor;
+ private int mWaveColor;
+ private float mRingAlpha;
+ private float mHaloAlpha;
+ private float mWaveAlpha;
private DrawableHolder mUnlockRing;
private DrawableHolder mUnlockDefault;
private DrawableHolder mUnlockHalo;
@@ -125,14 +124,21 @@ public CirclesView(Context context) {
public CirclesView(Context context, AttributeSet attrs) {
super(context, attrs);
- bgColor = Settings.System.getInt(context.getContentResolver(),
- Settings.System.CIRCLES_LOCK_BG_COLOR, defaultBgColor);
- ringColor = Settings.System.getInt(context.getContentResolver(),
- Settings.System.CIRCLES_LOCK_RING_COLOR, defaultRingColor);
- haloColor = Settings.System.getInt(context.getContentResolver(),
- Settings.System.CIRCLES_LOCK_HALO_COLOR, defaultHaloColor);
- waveColor = Settings.System.getInt(context.getContentResolver(),
- Settings.System.CIRCLES_LOCK_WAVE_COLOR, defaultWaveColor);
+ mBgColor = Settings.System.getInt(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_BG_COLOR, 0xD2000000);
+ mRingColor = Settings.System.getInt(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_RING_COLOR, 0xFFFFFFFF);
+ mHaloColor = Settings.System.getInt(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_HALO_COLOR, 0xFFFFFFFF);
+ mWaveColor = Settings.System.getInt(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_WAVE_COLOR, 0xFFFFFFFF);
+
+ mRingAlpha = Settings.System.getFloat(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_RING_ALPHA, 1.0f);
+ mHaloAlpha = Settings.System.getFloat(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_HALO_ALPHA, 1.0f);
+ mWaveAlpha = Settings.System.getFloat(context.getContentResolver(),
+ Settings.System.CIRCLES_LOCK_WAVE_ALPHA, 0.15f);
mLockPatternUtils = new LockPatternUtils(context);
setVibrateEnabled(mVibrationDuration > 0 && mLockPatternUtils.isTactileFeedbackEnabled());
@@ -189,7 +195,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
private void initDrawables() {
mUnlockRing = new DrawableHolder(createDrawable(R.drawable.unlock_ring_circles));
- mUnlockRing.setColor(ringColor);
+ mUnlockRing.setColor(mRingColor);
mUnlockRing.setX(mLockCenterX);
mUnlockRing.setY(mLockCenterY);
mUnlockRing.setScaleX(0.1f);
@@ -198,7 +204,7 @@ private void initDrawables() {
mDrawables.add(mUnlockRing);
mUnlockHalo = new DrawableHolder(createDrawable(R.drawable.unlock_halo_circles));
- mUnlockHalo.setColor(haloColor);
+ mUnlockHalo.setColor(mHaloColor);
mUnlockHalo.setX(mLockCenterX);
mUnlockHalo.setY(mLockCenterY);
mUnlockHalo.setScaleX(0.1f);
@@ -207,7 +213,7 @@ private void initDrawables() {
mDrawables.add(mUnlockHalo);
mUnlockWave = new DrawableHolder(createDrawable(R.drawable.unlock_wave_circles));
- mUnlockWave.setColor(waveColor);
+ mUnlockWave.setColor(mWaveColor);
mUnlockWave.setX(mLockCenterX);
mUnlockWave.setY(mLockCenterY);
mUnlockWave.setScaleX(0.1f);
@@ -230,7 +236,7 @@ private void waveUpdateFrame(float mouseX, float mouseY, boolean fingerDown) {
Drawable mBackgroundDrawable = new Drawable() {
@Override
public void draw(Canvas canvas) {
- canvas.drawColor(bgColor, PorterDuff.Mode.SRC);
+ canvas.drawColor(mBgColor, PorterDuff.Mode.SRC);
canvas.drawCircle(mStartX, mStartY, mCircleSize, mPaint);
}
@@ -305,17 +311,17 @@ public int getOpacity() {
mUnlockHalo.setX(mStartX);
mUnlockHalo.setY(mStartY);
- mUnlockHalo.setAlpha(1.0f);
+ mUnlockHalo.setAlpha(mHaloAlpha);
mUnlockWave.setX(mStartX);
mUnlockWave.setY(mStartY);
- mUnlockWave.setAlpha(1.0f);
+ mUnlockWave.setAlpha(mWaveAlpha);
mUnlockRing.setX(mStartX);
mUnlockRing.setY(mStartY);
mUnlockRing.addAnimTo(DURATION, 0, "scaleX", 1.0f, true);
mUnlockRing.addAnimTo(DURATION, 0, "scaleY", 1.0f, true);
- mUnlockRing.addAnimTo(DURATION, 0, "alpha", 1.0f, true);
+ mUnlockRing.addAnimTo(DURATION, 0, "alpha", mRingAlpha, true);
mLockState = STATE_ATTEMPTING;
break;
@@ -326,10 +332,10 @@ public int getOpacity() {
if (fingerDown) {
mUnlockHalo.setScaleX(1.5f);
mUnlockHalo.setScaleY(1.5f);
- mUnlockHalo.setAlpha(1.0f);
+ mUnlockHalo.setAlpha(mHaloAlpha);
mUnlockWave.setScaleX(wavescale);
mUnlockWave.setScaleY(wavescale);
- mUnlockWave.setAlpha(1.0f);
+ mUnlockWave.setAlpha(mWaveAlpha);
} else {
if (DBG) Log.v(TAG, "up detected, moving to STATE_UNLOCK_ATTEMPT");
mLockState = STATE_UNLOCK_ATTEMPT;
@@ -339,10 +345,10 @@ public int getOpacity() {
mUnlockHalo.setScaleY(handlescale);
mCircleSize = dragDistance <= 130
? 130 : dragDistance;
- mUnlockHalo.setAlpha(1.0f);
+ mUnlockHalo.setAlpha(mHaloAlpha);
mUnlockWave.setScaleX(wavescale);
mUnlockWave.setScaleY(wavescale);
- mUnlockWave.setAlpha(1.0f);
+ mUnlockWave.setAlpha(mWaveAlpha);
}
break;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0922f4b

Please sign in to comment.