Merge "Move charging indication vertically on time tick" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5baaf461a6
@@ -919,14 +919,18 @@
|
|||||||
|
|
||||||
<dimen name="global_actions_top_padding">120dp</dimen>
|
<dimen name="global_actions_top_padding">120dp</dimen>
|
||||||
|
|
||||||
<!-- the maximum offset in either direction that elements are moved horizontally to prevent
|
<!-- The maximum offset in either direction that elements are moved horizontally to prevent
|
||||||
burn-in on AOD -->
|
burn-in on AOD. -->
|
||||||
<dimen name="burn_in_prevention_offset_x">8dp</dimen>
|
<dimen name="burn_in_prevention_offset_x">8dp</dimen>
|
||||||
|
|
||||||
<!-- the maximum offset in either direction that elements are moved vertically to prevent
|
<!-- The maximum offset in either direction that elements are moved vertically to prevent
|
||||||
burn-in on AOD -->
|
burn-in on AOD. -->
|
||||||
<dimen name="burn_in_prevention_offset_y">50dp</dimen>
|
<dimen name="burn_in_prevention_offset_y">50dp</dimen>
|
||||||
|
|
||||||
|
<!-- The maximum offset in either direction that the charging indication moves vertically
|
||||||
|
to prevent burn-in on AOD. -->
|
||||||
|
<dimen name="charging_indication_burn_in_prevention_offset_y">5dp</dimen>
|
||||||
|
|
||||||
<dimen name="corner_size">8dp</dimen>
|
<dimen name="corner_size">8dp</dimen>
|
||||||
<dimen name="top_padding">0dp</dimen>
|
<dimen name="top_padding">0dp</dimen>
|
||||||
<dimen name="bottom_padding">48dp</dimen>
|
<dimen name="bottom_padding">48dp</dimen>
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
private int mIndicationBottomMarginAmbient;
|
private int mIndicationBottomMarginAmbient;
|
||||||
private float mDarkAmount;
|
private float mDarkAmount;
|
||||||
private int mBurnInXOffset;
|
private int mBurnInXOffset;
|
||||||
|
private int mBurnInYOffset;
|
||||||
|
|
||||||
public KeyguardBottomAreaView(Context context) {
|
public KeyguardBottomAreaView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -245,6 +246,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
R.dimen.keyguard_indication_margin_bottom);
|
R.dimen.keyguard_indication_margin_bottom);
|
||||||
mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize(
|
mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize(
|
||||||
R.dimen.keyguard_indication_margin_bottom_ambient);
|
R.dimen.keyguard_indication_margin_bottom_ambient);
|
||||||
|
mBurnInYOffset = getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.charging_indication_burn_in_prevention_offset_y);
|
||||||
updateCameraVisibility();
|
updateCameraVisibility();
|
||||||
mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
|
mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
|
||||||
mUnlockMethodCache.addListener(this);
|
mUnlockMethodCache.addListener(this);
|
||||||
@@ -317,6 +320,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
R.dimen.keyguard_indication_margin_bottom);
|
R.dimen.keyguard_indication_margin_bottom);
|
||||||
mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize(
|
mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize(
|
||||||
R.dimen.keyguard_indication_margin_bottom_ambient);
|
R.dimen.keyguard_indication_margin_bottom_ambient);
|
||||||
|
mBurnInYOffset = getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.charging_indication_burn_in_prevention_offset_y);
|
||||||
MarginLayoutParams mlp = (MarginLayoutParams) mIndicationArea.getLayoutParams();
|
MarginLayoutParams mlp = (MarginLayoutParams) mIndicationArea.getLayoutParams();
|
||||||
if (mlp.bottomMargin != mIndicationBottomMargin) {
|
if (mlp.bottomMargin != mIndicationBottomMargin) {
|
||||||
mlp.bottomMargin = mIndicationBottomMargin;
|
mlp.bottomMargin = mIndicationBottomMargin;
|
||||||
@@ -560,12 +565,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mDarkAmount = darkAmount;
|
mDarkAmount = darkAmount;
|
||||||
// Let's randomize the bottom margin every time we wake up to avoid burn-in.
|
|
||||||
if (darkAmount == 0) {
|
|
||||||
mIndicationBottomMarginAmbient = getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.keyguard_indication_margin_bottom_ambient)
|
|
||||||
+ (int) (Math.random() * mIndicationText.getTextSize());
|
|
||||||
}
|
|
||||||
mIndicationArea.setAlpha(MathUtils.lerp(1f, 0.7f, darkAmount));
|
mIndicationArea.setAlpha(MathUtils.lerp(1f, 0.7f, darkAmount));
|
||||||
mIndicationArea.setTranslationY(MathUtils.lerp(0,
|
mIndicationArea.setTranslationY(MathUtils.lerp(0,
|
||||||
mIndicationBottomMargin - mIndicationBottomMarginAmbient, darkAmount));
|
mIndicationBottomMargin - mIndicationBottomMarginAmbient, darkAmount));
|
||||||
@@ -841,8 +840,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
public void dozeTimeTick() {
|
public void dozeTimeTick() {
|
||||||
if (mDarkAmount == 1) {
|
if (mDarkAmount == 1) {
|
||||||
// Move indication every minute to avoid burn-in
|
// Move indication every minute to avoid burn-in
|
||||||
final int dozeTranslation = mIndicationBottomMargin - mIndicationBottomMarginAmbient;
|
int dozeTranslation = mIndicationBottomMargin - mIndicationBottomMarginAmbient;
|
||||||
mIndicationArea.setTranslationY(dozeTranslation + (float) Math.random() * 5);
|
int burnInYOffset = (int) (-mBurnInYOffset + Math.random() * mBurnInYOffset * 2);
|
||||||
|
mIndicationArea.setTranslationY(dozeTranslation + burnInYOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user