Loading core/java/com/android/internal/widget/multiwaveview/GlowPadView.java +13 −3 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ public class GlowPadView extends View { private int mMaxTargetHeight; private int mMaxTargetWidth; private float mRingScaleFactor = 1f; private boolean mAllowScaling; private float mOuterRadius = 0.0f; private float mSnapMargin = 0.0f; Loading Loading @@ -222,6 +223,7 @@ public class GlowPadView extends View { mVibrationDuration); mFeedbackCount = a.getInt(R.styleable.GlowPadView_feedbackCount, mFeedbackCount); mAllowScaling = a.getBoolean(R.styleable.GlowPadView_allowScaling, false); TypedValue handle = a.peekValue(R.styleable.GlowPadView_handleDrawable); mHandleDrawable = new TargetDrawable(res, handle != null ? handle.resourceId : 0); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); Loading Loading @@ -793,8 +795,12 @@ public class GlowPadView extends View { } private void updateGlowPosition(float x, float y) { mPointCloud.glowManager.setX(x); mPointCloud.glowManager.setY(y); float dx = x - mOuterRing.getX(); float dy = y - mOuterRing.getY(); dx *= 1f / mRingScaleFactor; dy *= 1f / mRingScaleFactor; mPointCloud.glowManager.setX(mOuterRing.getX() + dx); mPointCloud.glowManager.setY(mOuterRing.getY() + dy); } private void handleDown(MotionEvent event) { Loading Loading @@ -863,7 +869,7 @@ public class GlowPadView extends View { if (mDragging) { // For multiple targets, snap to the one that matches final float snapRadius = mOuterRadius - mSnapMargin; final float snapRadius = mRingScaleFactor * mOuterRadius - mSnapMargin; final float snapDistance2 = snapRadius * snapRadius; // Find first target in range for (int i = 0; i < ntargets; i++) { Loading Loading @@ -1034,6 +1040,10 @@ public class GlowPadView extends View { */ private float computeScaleFactor(int desiredWidth, int desiredHeight, int actualWidth, int actualHeight) { // Return unity if scaling is not allowed. if (!mAllowScaling) return 1f; final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); Loading core/res/res/layout/keyguard_glow_pad_view.xml +2 −1 Original line number Diff line number Diff line Loading @@ -42,4 +42,5 @@ prvandroid:feedbackCount="1" prvandroid:vibrationDuration="20" prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius" prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot" /> prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot" prvandroid:allowScaling="true" /> core/res/res/values/attrs.xml +5 −0 Original line number Diff line number Diff line Loading @@ -5484,6 +5484,11 @@ <attr name="magneticTargets" format="boolean" /> <attr name="gravity" /> <!-- Determine whether the glow pad is allowed to scale to fit the bounds indicated by its parent. If this is set to false, no scaling will occur. If this is set to true scaling will occur to fit for any axis in which gravity is set to center. --> <attr name="allowScaling" format="boolean" /> </declare-styleable> <!-- =============================== --> Loading Loading
core/java/com/android/internal/widget/multiwaveview/GlowPadView.java +13 −3 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ public class GlowPadView extends View { private int mMaxTargetHeight; private int mMaxTargetWidth; private float mRingScaleFactor = 1f; private boolean mAllowScaling; private float mOuterRadius = 0.0f; private float mSnapMargin = 0.0f; Loading Loading @@ -222,6 +223,7 @@ public class GlowPadView extends View { mVibrationDuration); mFeedbackCount = a.getInt(R.styleable.GlowPadView_feedbackCount, mFeedbackCount); mAllowScaling = a.getBoolean(R.styleable.GlowPadView_allowScaling, false); TypedValue handle = a.peekValue(R.styleable.GlowPadView_handleDrawable); mHandleDrawable = new TargetDrawable(res, handle != null ? handle.resourceId : 0); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); Loading Loading @@ -793,8 +795,12 @@ public class GlowPadView extends View { } private void updateGlowPosition(float x, float y) { mPointCloud.glowManager.setX(x); mPointCloud.glowManager.setY(y); float dx = x - mOuterRing.getX(); float dy = y - mOuterRing.getY(); dx *= 1f / mRingScaleFactor; dy *= 1f / mRingScaleFactor; mPointCloud.glowManager.setX(mOuterRing.getX() + dx); mPointCloud.glowManager.setY(mOuterRing.getY() + dy); } private void handleDown(MotionEvent event) { Loading Loading @@ -863,7 +869,7 @@ public class GlowPadView extends View { if (mDragging) { // For multiple targets, snap to the one that matches final float snapRadius = mOuterRadius - mSnapMargin; final float snapRadius = mRingScaleFactor * mOuterRadius - mSnapMargin; final float snapDistance2 = snapRadius * snapRadius; // Find first target in range for (int i = 0; i < ntargets; i++) { Loading Loading @@ -1034,6 +1040,10 @@ public class GlowPadView extends View { */ private float computeScaleFactor(int desiredWidth, int desiredHeight, int actualWidth, int actualHeight) { // Return unity if scaling is not allowed. if (!mAllowScaling) return 1f; final int layoutDirection = getLayoutDirection(); final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection); Loading
core/res/res/layout/keyguard_glow_pad_view.xml +2 −1 Original line number Diff line number Diff line Loading @@ -42,4 +42,5 @@ prvandroid:feedbackCount="1" prvandroid:vibrationDuration="20" prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius" prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot" /> prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot" prvandroid:allowScaling="true" />
core/res/res/values/attrs.xml +5 −0 Original line number Diff line number Diff line Loading @@ -5484,6 +5484,11 @@ <attr name="magneticTargets" format="boolean" /> <attr name="gravity" /> <!-- Determine whether the glow pad is allowed to scale to fit the bounds indicated by its parent. If this is set to false, no scaling will occur. If this is set to true scaling will occur to fit for any axis in which gravity is set to center. --> <attr name="allowScaling" format="boolean" /> </declare-styleable> <!-- =============================== --> Loading