Merge "Remove burn in offset on lock screen." into qt-dev

This commit is contained in:
TreeHugger Robot
2019-05-01 08:08:19 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 4 deletions

View File

@@ -189,6 +189,7 @@ public class AnalogClockController implements ClockPlugin {
@Override
public void setDarkAmount(float darkAmount) {
mClockPosition.setDarkAmount(darkAmount);
mBigClockView.setDarkAmount(darkAmount);
}
@Override

View File

@@ -181,6 +181,7 @@ public class BubbleClockController implements ClockPlugin {
@Override
public void setDarkAmount(float darkAmount) {
mClockPosition.setDarkAmount(darkAmount);
mView.setDarkAmount(darkAmount);
}
@Override

View File

@@ -20,6 +20,7 @@ import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.MathUtils;
import android.view.View;
import android.widget.FrameLayout;
@@ -43,6 +44,8 @@ public class ClockLayout extends FrameLayout {
private int mBurnInPreventionOffsetX;
private int mBurnInPreventionOffsetY;
private float mDarkAmount;
public ClockLayout(Context context) {
this(context, null);
}
@@ -78,11 +81,21 @@ public class ClockLayout extends FrameLayout {
positionChildren();
}
/**
* See {@link com.android.systemui.plugins.ClockPlugin#setDarkAmount(float)}.
*/
void setDarkAmount(float darkAmount) {
mDarkAmount = darkAmount;
positionChildren();
}
private void positionChildren() {
final float offsetX = getBurnInOffset(mBurnInPreventionOffsetX * 2, true)
- mBurnInPreventionOffsetX;
final float offsetY = getBurnInOffset(mBurnInPreventionOffsetY * 2, false)
- mBurnInPreventionOffsetY;
final float offsetX = MathUtils.lerp(0f,
getBurnInOffset(mBurnInPreventionOffsetX * 2, true) - mBurnInPreventionOffsetX,
mDarkAmount);
final float offsetY = MathUtils.lerp(0f,
getBurnInOffset(mBurnInPreventionOffsetY * 2, false) - mBurnInPreventionOffsetY,
mDarkAmount);
// Put the analog clock in the middle of the screen.
if (mAnalogClock != null) {