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

Commit e6915e8b authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Brian Egizi
Browse files

Scale smartspace with the weather clock

Cherry picked I75378c6a2732f8486eef49b91a1c24caed002f1a to master due to b/286408867.

Code was merged via `-s ours` and is missing even though the sha exists on the target branch. Cherry pick is required to bring in the code.

Manually remove the "Merged in" directive to allow for downstream propagation.

Bug: 283308908
Test: Manually checked on several devices
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dcf8f5aed6730cbdd8819a38ad33e733eec5af94)
Change-Id: I2e1ecd5db49ecacc45e6f3b1af688c8c8a3e07c9
parent b6149ff1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@

    <!-- Not quite optimal but needed to translate these items as a group. The
         NotificationIconContainer has its own logic for translation. -->
    <LinearLayout
    <com.android.keyguard.KeyguardStatusAreaView
        android:id="@+id/keyguard_status_area"
        android:orientation="vertical"
        android:layout_width="match_parent"
@@ -63,5 +63,5 @@
          android:paddingStart="@dimen/below_clock_padding_start_icons"
          android:visibility="invisible"
          />
    </LinearLayout>
    </com.android.keyguard.KeyguardStatusAreaView>
</com.android.keyguard.KeyguardClockSwitch>
+1 −1
Original line number Diff line number Diff line
@@ -16,5 +16,5 @@
  -->
<resources>
     <!-- Invisibility to use for the date & weather view when it is disabled by a clock -->
    <integer name="keyguard_date_weather_view_invisibility">8</integer>
    <integer name="keyguard_date_weather_view_invisibility">4</integer>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -148,4 +148,9 @@
    <dimen name="default_dot_diameter">34dp</dimen>
    <dimen name="default_dot_spacing">0dp</dimen>

    <!-- Weather clock smartspace scaling to apply for the weather clock -->
    <item name="weather_clock_smartspace_scale" type="dimen" format="float">1.0</item>
    <dimen name="weather_clock_smartspace_translateX">0dp</dimen>
    <dimen name="weather_clock_smartspace_translateY">0dp</dimen>

</resources>
+14 −0
Original line number Diff line number Diff line
@@ -17,4 +17,18 @@

<resources>
    <item type="id" name="header_footer_views_added_tag_key" />

    <!-- animation channels for keyguard status area -->
    <item type="id" name="translate_x_clock_design_animator_tag" />
    <item type="id" name="translate_x_clock_design_animator_start_tag" />
    <item type="id" name="translate_x_clock_design_animator_end_tag" />
    <item type="id" name="translate_x_aod_animator_tag" />
    <item type="id" name="translate_x_aod_animator_start_tag" />
    <item type="id" name="translate_x_aod_animator_end_tag" />
    <item type="id" name="translate_y_clock_size_animator_tag" />
    <item type="id" name="translate_y_clock_size_animator_start_tag" />
    <item type="id" name="translate_y_clock_size_animator_end_tag" />
    <item type="id" name="translate_y_clock_design_animator_tag" />
    <item type="id" name="translate_y_clock_design_animator_start_tag" />
    <item type="id" name="translate_y_clock_design_animator_end_tag" />
</resources>
+10 −5
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ class UnfoldConstantTranslateAnimator(
            } else {
                1
            }
        viewsToTranslate.forEach { (view, direction) ->
            view.get()?.translationX = xTrans * direction.multiplier * rtlMultiplier
        viewsToTranslate.forEach { (view, direction, func) ->
            view.get()?.let { func(it, xTrans * direction.multiplier * rtlMultiplier) }
        }
    }

@@ -77,7 +77,7 @@ class UnfoldConstantTranslateAnimator(
                .filter { it.shouldBeAnimated() }
                .mapNotNull {
                    parent.findViewById<View>(it.viewId)?.let { view ->
                        ViewToTranslate(WeakReference(view), it.direction)
                        ViewToTranslate(WeakReference(view), it.direction, it.translateFunc)
                    }
                }
                .toList()
@@ -91,14 +91,19 @@ class UnfoldConstantTranslateAnimator(
    data class ViewIdToTranslate(
        val viewId: Int,
        val direction: Direction,
        val shouldBeAnimated: () -> Boolean = { true }
        val shouldBeAnimated: () -> Boolean = { true },
        val translateFunc: (View, Float) -> Unit = { view, value -> view.translationX = value },
    )

    /**
     * Represents a view whose animation process is in-progress. It should be immutable because the
     * started animation should be completed.
     */
    private data class ViewToTranslate(val view: WeakReference<View>, val direction: Direction)
    private data class ViewToTranslate(
        val view: WeakReference<View>,
        val direction: Direction,
        val translateFunc: (View, Float) -> Unit,
    )

    /** Direction of the animation. */
    enum class Direction(val multiplier: Float) {
Loading