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

Commit a69ed26e authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Automerger Merge Worker
Browse files

Merge "Optionally hide default keygaurd weather view" into udc-dev am: 6eb183ba

parents 157bbbee 6eb183ba
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -154,6 +154,10 @@ interface ClockFaceEvents {
    val tickRate: ClockTickRate
    val tickRate: ClockTickRate
        get() = ClockTickRate.PER_MINUTE
        get() = ClockTickRate.PER_MINUTE


    /** Call to check whether the clock consumes weather data */
    val hasCustomWeatherDataDisplay: Boolean
        get() = false

    /** Region Darkness specific to the clock face */
    /** Region Darkness specific to the clock face */
    fun onRegionDarknessChanged(isDark: Boolean) {}
    fun onRegionDarknessChanged(isDark: Boolean) {}


+27 −7
Original line number Original line Diff line number Diff line
@@ -110,7 +110,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
    private final ContentObserver mShowWeatherObserver = new ContentObserver(null) {
    private final ContentObserver mShowWeatherObserver = new ContentObserver(null) {
        @Override
        @Override
        public void onChange(boolean change) {
        public void onChange(boolean change) {
            setWeatherVisibility();
            setDateWeatherVisibility();
        }
        }
    };
    };


@@ -236,7 +236,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        );
        );


        updateDoubleLineClock();
        updateDoubleLineClock();
        setWeatherVisibility();
        setDateWeatherVisibility();


        mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(
        mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(
                mKeyguardUnlockAnimationListener);
                mKeyguardUnlockAnimationListener);
@@ -337,6 +337,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }
        }


        mCurrentClockSize = clockSize;
        mCurrentClockSize = clockSize;
        setDateWeatherVisibility();


        ClockController clock = getClock();
        ClockController clock = getClock();
        boolean appeared = mView.switchToClock(clockSize, animate);
        boolean appeared = mView.switchToClock(clockSize, animate);
@@ -457,6 +458,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS


        mClockEventController.setClock(clock);
        mClockEventController.setClock(clock);
        mView.setClock(clock, mStatusBarStateController.getState());
        mView.setClock(clock, mStatusBarStateController.getState());
        setDateWeatherVisibility();
    }
    }


    @Nullable
    @Nullable
@@ -478,11 +480,18 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }
        }
    }
    }


    private void setWeatherVisibility() {
    private void setDateWeatherVisibility() {
        if (mDateWeatherView != null || mWeatherView != null) {
            mUiExecutor.execute(() -> {
                if (mDateWeatherView != null) {
                    mDateWeatherView.setVisibility(
                            clockHasCustomWeatherDataDisplay() ? View.GONE : View.VISIBLE);
                }
                if (mWeatherView != null) {
                if (mWeatherView != null) {
            mUiExecutor.execute(
                    mWeatherView.setVisibility(
                    () -> mWeatherView.setVisibility(
                            mSmartspaceController.isWeatherEnabled() ? View.VISIBLE : View.GONE);
                        mSmartspaceController.isWeatherEnabled() ? View.VISIBLE : View.GONE));
                }
            });
        }
        }
    }
    }


@@ -511,6 +520,17 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }
        }
    }
    }


    /** Returns true if the clock handles the display of weather information */
    private boolean clockHasCustomWeatherDataDisplay() {
        ClockController clock = getClock();
        if (clock == null) {
            return false;
        }

        return ((mCurrentClockSize == LARGE) ? clock.getLargeClock() : clock.getSmallClock())
                .getEvents().getHasCustomWeatherDataDisplay();
    }

    /** Gets the animations for the current clock. */
    /** Gets the animations for the current clock. */
    @Nullable
    @Nullable
    public ClockAnimations getClockAnimations() {
    public ClockAnimations getClockAnimations() {