Merge "Add gravity center to layout params" into sc-dev am: 98a4967908

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15411507

Change-Id: I3b9263a171a9c61db45ff9fcc8ceaa43cd5df9ed
This commit is contained in:
Beverly Tai
2021-07-29 21:29:32 +00:00
committed by Automerger Merge Worker
2 changed files with 14 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ import android.graphics.PointF;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@@ -92,9 +93,12 @@ public class LockIconView extends FrameLayout implements Dumpable {
setX(mSensorRect.left); setX(mSensorRect.left);
setY(mSensorRect.top); setY(mSensorRect.top);
setLayoutParams(new FrameLayout.LayoutParams(
final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
(int) (mSensorRect.right - mSensorRect.left), (int) (mSensorRect.right - mSensorRect.left),
(int) (mSensorRect.bottom - mSensorRect.top))); (int) (mSensorRect.bottom - mSensorRect.top));
lp.gravity = Gravity.CENTER;
setLayoutParams(lp);
} }
@Override @Override

View File

@@ -96,8 +96,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
@NonNull private final AnimatedVectorDrawable mLockToUnlockIcon; @NonNull private final AnimatedVectorDrawable mLockToUnlockIcon;
@NonNull private final Drawable mLockIcon; @NonNull private final Drawable mLockIcon;
@NonNull private final Drawable mUnlockIcon; @NonNull private final Drawable mUnlockIcon;
@NonNull private final CharSequence mUnlockedLabel; @NonNull private CharSequence mUnlockedLabel;
@NonNull private final CharSequence mLockedLabel; @NonNull private CharSequence mLockedLabel;
@Nullable private final Vibrator mVibrator; @Nullable private final Vibrator mVibrator;
private boolean mIsDozing; private boolean mIsDozing;
@@ -314,6 +314,12 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
mHeightPixels = metrics.heightPixels; mHeightPixels = metrics.heightPixels;
mBottomPadding = mView.getContext().getResources().getDimensionPixelSize( mBottomPadding = mView.getContext().getResources().getDimensionPixelSize(
R.dimen.lock_icon_margin_bottom); R.dimen.lock_icon_margin_bottom);
mUnlockedLabel = mView.getContext().getResources().getString(
R.string.accessibility_unlock_button);
mLockedLabel = mView.getContext()
.getResources().getString(R.string.accessibility_lock_icon);
updateLockIconLocation(); updateLockIconLocation();
} }