Merge "Use layout parameters to determine lock icon location" into sc-dev
This commit is contained in:
@@ -54,8 +54,7 @@
|
||||
<com.android.keyguard.LockIconView
|
||||
android:id="@+id/lock_icon_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center">
|
||||
android:layout_height="wrap_content">
|
||||
<!-- Background protection -->
|
||||
<ImageView
|
||||
android:id="@+id/lock_icon_bg"
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@@ -91,13 +90,11 @@ public class LockIconView extends FrameLayout implements Dumpable {
|
||||
mLockIconCenter.x + mRadius,
|
||||
mLockIconCenter.y + mRadius);
|
||||
|
||||
setX(mSensorRect.left);
|
||||
setY(mSensorRect.top);
|
||||
|
||||
final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
|
||||
(int) (mSensorRect.right - mSensorRect.left),
|
||||
(int) (mSensorRect.bottom - mSensorRect.top));
|
||||
lp.gravity = Gravity.CENTER;
|
||||
final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
|
||||
lp.width = (int) (mSensorRect.right - mSensorRect.left);
|
||||
lp.height = (int) (mSensorRect.bottom - mSensorRect.top);
|
||||
lp.topMargin = (int) mSensorRect.top;
|
||||
lp.setMarginStart((int) mSensorRect.left);
|
||||
setLayoutParams(lp);
|
||||
}
|
||||
|
||||
@@ -114,5 +111,6 @@ public class LockIconView extends FrameLayout implements Dumpable {
|
||||
public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
pw.println("Center in px (x, y)= (" + mLockIconCenter.x + ", " + mLockIconCenter.y + ")");
|
||||
pw.println("Radius in pixels: " + mRadius);
|
||||
pw.println("topLeft= (" + getX() + ", " + getY() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user