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

Commit 2b5ddfad authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Scale smartspace with the weather clock" into udc-qpr-dev

parents 219d21d8 dcf8f5ae
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