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

Commit c6f7979b authored by Timi Rautamäki's avatar Timi Rautamäki Committed by Nolen Johnson
Browse files

Keyguard: don't use large clock on landscape

Large clock does not display properly on landscape mode.

Change-Id: If803ad03568671e8aed2fe37897bd1fb9cee29ae
parent 10812111
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
@@ -86,6 +87,17 @@ public class KeyguardClockSwitch extends RelativeLayout {
        super(context, attrs);
    }

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

        if (mHasVisibleNotifications != null) {
            boolean landscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
            boolean useLargeClock = !mHasVisibleNotifications && !landscape;
            animateClockChange(useLargeClock);
        }
    }

    /**
     * Apply dp changes on font/scale change
     */
@@ -272,7 +284,9 @@ public class KeyguardClockSwitch extends RelativeLayout {
                && hasVisibleNotifications == mHasVisibleNotifications) {
            return false;
        }
        boolean useLargeClock = !hasVisibleNotifications;
        boolean landscape = getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_LANDSCAPE;
        boolean useLargeClock = !hasVisibleNotifications && !landscape;
        animateClockChange(useLargeClock);

        mHasVisibleNotifications = hasVisibleNotifications;