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

Unverified Commit d0b9efa3 authored by Timi Rautamäki's avatar Timi Rautamäki Committed by Michael Bestas
Browse files

Keyguard: don't use large clock on landscape

Large clock does not display properly on landscape mode.

Change-Id: If803ad03568671e8aed2fe37897bd1fb9cee29ae
parent 3295311e
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -3,12 +3,14 @@ package com.android.keyguard;
import static com.android.keyguard.KeyguardStatusAreaView.TRANSLATE_X_CLOCK_DESIGN;
import static com.android.keyguard.KeyguardStatusAreaView.TRANSLATE_Y_CLOCK_DESIGN;
import static com.android.keyguard.KeyguardStatusAreaView.TRANSLATE_Y_CLOCK_SIZE;
import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -135,6 +137,18 @@ public class KeyguardClockSwitch extends RelativeLayout {
        super(context, attrs);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        if (mDisplayedClockSize != null) {
            boolean landscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
            boolean useLargeClock = mDisplayedClockSize == LARGE &&
                    (!landscape || isLargeScreen(mContext));
            updateClockViews(useLargeClock, /* animate */ true);
        }
    }

    /**
     * Apply dp changes on configuration change
     */
@@ -430,11 +444,14 @@ public class KeyguardClockSwitch extends RelativeLayout {
        if (mDisplayedClockSize != null && clockSize == mDisplayedClockSize) {
            return false;
        }
        boolean landscape = getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_LANDSCAPE;
        boolean useLargeClock = clockSize == LARGE && (!landscape || isLargeScreen(mContext));

        // let's make sure clock is changed only after all views were laid out so we can
        // translate them properly
        if (mChildrenAreLaidOut) {
            updateClockViews(clockSize == LARGE, animate);
            updateClockViews(useLargeClock, animate);
        }

        mDisplayedClockSize = clockSize;