Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42621023 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Fixes a few bugs on the keyguard with font density changes" into nyc-dev

parents 31e3b14d 6ebba59a
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@


    <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch"
    <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch"
        android:layout_width="@dimen/multi_user_switch_width_keyguard"
        android:layout_width="@dimen/multi_user_switch_width_keyguard"
        android:layout_height="@dimen/status_bar_header_height_keyguard"
        android:layout_height="match_parent"
        android:layout_alignParentEnd="true"
        android:layout_alignParentEnd="true"
        android:background="@drawable/ripple_drawable"
        android:background="@drawable/ripple_drawable"
        android:layout_marginEnd="@dimen/multi_user_switch_keyguard_margin">
        android:layout_marginEnd="@dimen/multi_user_switch_keyguard_margin">
@@ -43,7 +43,7 @@
        android:layout_height="@dimen/status_bar_header_height"
        android:layout_height="@dimen/status_bar_header_height"
        android:layout_toStartOf="@id/multi_user_switch"
        android:layout_toStartOf="@id/multi_user_switch"
        android:layout_alignWithParentIfMissing="true"
        android:layout_alignWithParentIfMissing="true"
        android:layout_marginStart="16dp"
        android:layout_marginStart="@dimen/system_icons_super_container_margin_start"
        android:paddingEnd="@dimen/system_icons_keyguard_padding_end">
        android:paddingEnd="@dimen/system_icons_keyguard_padding_end">
        <FrameLayout android:id="@+id/system_icons_container"
        <FrameLayout android:id="@+id/system_icons_container"
            android:layout_width="wrap_content"
            android:layout_width="wrap_content"
@@ -67,7 +67,7 @@
    <com.android.keyguard.CarrierText
    <com.android.keyguard.CarrierText
        android:id="@+id/keyguard_carrier_text"
        android:id="@+id/keyguard_carrier_text"
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="@dimen/status_bar_header_height_keyguard"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/keyguard_carrier_text_margin"
        android:layout_marginStart="@dimen/keyguard_carrier_text_margin"
        android:layout_toStartOf="@id/system_icons_super_container"
        android:layout_toStartOf="@id/system_icons_super_container"
        android:gravity="center_vertical"
        android:gravity="center_vertical"
+3 −0
Original line number Original line Diff line number Diff line
@@ -138,6 +138,9 @@
    <!-- Height of the status bar header bar when on Keyguard -->
    <!-- Height of the status bar header bar when on Keyguard -->
    <dimen name="status_bar_header_height_keyguard">40dp</dimen>
    <dimen name="status_bar_header_height_keyguard">40dp</dimen>


    <!-- Margin start of the system icons super container -->
    <dimen name="system_icons_super_container_margin_start">16dp</dimen>

    <!-- Width for the notification panel and related windows -->
    <!-- Width for the notification panel and related windows -->
    <dimen name="match_parent">-1px</dimen>
    <dimen name="match_parent">-1px</dimen>
    <dimen name="standard_notification_panel_width">416dp</dimen>
    <dimen name="standard_notification_panel_width">416dp</dimen>
+18 −0
Original line number Original line Diff line number Diff line
@@ -230,6 +230,24 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
        mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(
                getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.text_size_small_material));
                        com.android.internal.R.dimen.text_size_small_material));

        ViewGroup.LayoutParams lp = mCameraImageView.getLayoutParams();
        lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_width);
        lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_height);
        mCameraImageView.setLayoutParams(lp);
        mCameraImageView.setImageDrawable(mContext.getDrawable(R.drawable.ic_camera_alt_24dp));

        lp = mLockIcon.getLayoutParams();
        lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_width);
        lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_height);
        mLockIcon.setLayoutParams(lp);
        mLockIcon.update(true /* force */);

        lp = mLeftAffordanceView.getLayoutParams();
        lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_width);
        lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_height);
        mLeftAffordanceView.setLayoutParams(lp);
        updateLeftAffordanceIcon();
    }
    }


    public void setActivityStarter(ActivityStarter activityStarter) {
    public void setActivityStarter(ActivityStarter activityStarter) {
+50 −7
Original line number Original line Diff line number Diff line
@@ -58,6 +58,7 @@ public class KeyguardStatusBarView extends RelativeLayout
    private KeyguardUserSwitcher mKeyguardUserSwitcher;
    private KeyguardUserSwitcher mKeyguardUserSwitcher;


    private int mSystemIconsSwitcherHiddenExpandedMargin;
    private int mSystemIconsSwitcherHiddenExpandedMargin;
    private View mSystemIconsContainer;


    public KeyguardStatusBarView(Context context, AttributeSet attrs) {
    public KeyguardStatusBarView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
@@ -67,6 +68,7 @@ public class KeyguardStatusBarView extends RelativeLayout
    protected void onFinishInflate() {
    protected void onFinishInflate() {
        super.onFinishInflate();
        super.onFinishInflate();
        mSystemIconsSuperContainer = findViewById(R.id.system_icons_super_container);
        mSystemIconsSuperContainer = findViewById(R.id.system_icons_super_container);
        mSystemIconsContainer = findViewById(R.id.system_icons_container);
        mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
        mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
        mMultiUserAvatar = (ImageView) findViewById(R.id.multi_user_avatar);
        mMultiUserAvatar = (ImageView) findViewById(R.id.multi_user_avatar);
        mBatteryLevel = (TextView) findViewById(R.id.battery_level);
        mBatteryLevel = (TextView) findViewById(R.id.battery_level);
@@ -79,17 +81,58 @@ public class KeyguardStatusBarView extends RelativeLayout
    protected void onConfigurationChanged(Configuration newConfig) {
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        super.onConfigurationChanged(newConfig);


        // Respect font size setting.
        mCarrierLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.text_size_small_material));
        mBatteryLevel.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(R.dimen.battery_level_text_size));

        MarginLayoutParams lp = (MarginLayoutParams) mMultiUserAvatar.getLayoutParams();
        MarginLayoutParams lp = (MarginLayoutParams) mMultiUserAvatar.getLayoutParams();
        lp.width = lp.height = getResources().getDimensionPixelSize(
        lp.width = lp.height = getResources().getDimensionPixelSize(
                R.dimen.multi_user_avatar_keyguard_size);
                R.dimen.multi_user_avatar_keyguard_size);
        mMultiUserAvatar.setLayoutParams(lp);
        mMultiUserAvatar.setLayoutParams(lp);

        lp = (MarginLayoutParams) mMultiUserSwitch.getLayoutParams();
        lp.width = getResources().getDimensionPixelSize(
                R.dimen.multi_user_switch_width_keyguard);
        lp.setMarginEnd(getResources().getDimensionPixelSize(
                R.dimen.multi_user_switch_keyguard_margin));
        mMultiUserSwitch.setLayoutParams(lp);

        lp = (MarginLayoutParams) mSystemIconsSuperContainer.getLayoutParams();
        lp.height = getResources().getDimensionPixelSize(
                R.dimen.status_bar_header_height);
        lp.setMarginStart(getResources().getDimensionPixelSize(
                R.dimen.system_icons_super_container_margin_start));
        mSystemIconsSuperContainer.setLayoutParams(lp);
        mSystemIconsSuperContainer.setPaddingRelative(mSystemIconsSuperContainer.getPaddingStart(),
                mSystemIconsSuperContainer.getPaddingTop(),
                getResources().getDimensionPixelSize(R.dimen.system_icons_keyguard_padding_end),
                mSystemIconsSuperContainer.getPaddingBottom());

        lp = (MarginLayoutParams) mSystemIconsContainer.getLayoutParams();
        lp.height = getResources().getDimensionPixelSize(
                R.dimen.status_bar_height);
        mSystemIconsContainer.setLayoutParams(lp);

        lp = (MarginLayoutParams) mBatteryLevel.getLayoutParams();
        lp.setMarginStart(
                getResources().getDimensionPixelSize(R.dimen.header_battery_margin_keyguard));
        mBatteryLevel.setLayoutParams(lp);
        mBatteryLevel.setPaddingRelative(mBatteryLevel.getPaddingStart(),
                mBatteryLevel.getPaddingTop(),
                getResources().getDimensionPixelSize(R.dimen.battery_level_padding_end),
                mBatteryLevel.getPaddingBottom());
        mBatteryLevel.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(R.dimen.battery_level_text_size));

        // Respect font size setting.
        mCarrierLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.text_size_small_material));
        lp = (MarginLayoutParams) mCarrierLabel.getLayoutParams();
        lp.setMarginStart(
                getResources().getDimensionPixelSize(R.dimen.keyguard_carrier_text_margin));
        mCarrierLabel.setLayoutParams(lp);

        lp = (MarginLayoutParams) getLayoutParams();
        lp.height =  getResources().getDimensionPixelSize(
                R.dimen.status_bar_header_height_keyguard);
        setLayoutParams(lp);
    }
    }


    private void loadDimens() {
    private void loadDimens() {
+21 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone;
package com.android.systemui.statusbar.phone;


import android.content.Context;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.InsetDrawable;
@@ -46,10 +47,11 @@ public class LockIcon extends KeyguardAffordanceView {
    private boolean mDeviceInteractive;
    private boolean mDeviceInteractive;
    private boolean mScreenOn;
    private boolean mScreenOn;
    private boolean mLastScreenOn;
    private boolean mLastScreenOn;
    private final TrustDrawable mTrustDrawable;
    private TrustDrawable mTrustDrawable;
    private final UnlockMethodCache mUnlockMethodCache;
    private final UnlockMethodCache mUnlockMethodCache;
    private AccessibilityController mAccessibilityController;
    private AccessibilityController mAccessibilityController;
    private boolean mHasFingerPrintIcon;
    private boolean mHasFingerPrintIcon;
    private int mDensity;


    public LockIcon(Context context, AttributeSet attrs) {
    public LockIcon(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
@@ -89,7 +91,24 @@ public class LockIcon extends KeyguardAffordanceView {
        update();
        update();
    }
    }


    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        final int density = newConfig.densityDpi;
        if (density != mDensity) {
            mDensity = density;
            mTrustDrawable.stop();
            mTrustDrawable = new TrustDrawable(getContext());
            setBackground(mTrustDrawable);
            update();
        }
    }

    public void update() {
    public void update() {
        update(false /* force */);
    }

    public void update(boolean force) {
        boolean visible = isShown()
        boolean visible = isShown()
                && KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
                && KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
        if (visible) {
        if (visible) {
@@ -103,7 +122,7 @@ public class LockIcon extends KeyguardAffordanceView {
        boolean useAdditionalPadding = anyFingerprintIcon;
        boolean useAdditionalPadding = anyFingerprintIcon;
        boolean trustHidden = anyFingerprintIcon;
        boolean trustHidden = anyFingerprintIcon;
        if (state != mLastState || mDeviceInteractive != mLastDeviceInteractive
        if (state != mLastState || mDeviceInteractive != mLastDeviceInteractive
                || mScreenOn != mLastScreenOn) {
                || mScreenOn != mLastScreenOn || force) {
            boolean isAnim = true;
            boolean isAnim = true;
            int iconRes = getAnimationResForTransition(mLastState, state, mLastDeviceInteractive,
            int iconRes = getAnimationResForTransition(mLastState, state, mLastDeviceInteractive,
                    mDeviceInteractive, mLastScreenOn, mScreenOn);
                    mDeviceInteractive, mLastScreenOn, mScreenOn);
Loading