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

Commit 5d2a5d41 authored by Sam Blitzstein's avatar Sam Blitzstein Committed by Isaac Katzenelson
Browse files

Fix jank issues with expanding alarms.

Bug: 10744911
Change-Id: Ibddcaf91d5a496116ff3610c65f8e0beb7c83f7e
(cherry picked from commit 832a8109)
parent 8afb7d57
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:layout_marginBottom="48dp"
            android:layout_marginBottom="@dimen/collapse_expand_height"
            android:layout_gravity="bottom" >
            <TextView
                android:id="@+id/edit_label"
@@ -198,7 +198,7 @@
        <FrameLayout
            android:id="@+id/collapse_expand"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_height="@dimen/collapse_expand_height"
            android:contentDescription="@string/collapse_alarm"
            android:layout_gravity="bottom" >
            <ImageView
+3 −0
Original line number Diff line number Diff line
@@ -210,4 +210,7 @@
    <!-- top margin for digital_appwidget_listview -->
    <dimen name="digital_widget_list_margin_top">20dp</dimen>
    <dimen name="digital_widget_city_margin_bottom">10dp</dimen>

    <!-- Bottom margin for the expand area -->
    <dimen name="collapse_expand_height">48dp</dimen>
</resources>
+7 −4
Original line number Diff line number Diff line
@@ -674,6 +674,7 @@ public class AlarmClockFragment extends DeskClockFragment implements
        private Bundle mPreviousDaysOfWeekMap = new Bundle();

        private final boolean mHasVibrator;
        private final int mCollapseExpandHeight;

        // This determines the order in which it is shown and processed in the UI.
        private final int[] DAY_ORDER = new int[] {
@@ -764,6 +765,8 @@ public class AlarmClockFragment extends DeskClockFragment implements

            mHasVibrator = ((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE))
                    .hasVibrator();

            mCollapseExpandHeight = (int) res.getDimension(R.dimen.collapse_expand_height);
        }

        public void removeSelectedId(int id) {
@@ -1517,9 +1520,8 @@ public class AlarmClockFragment extends DeskClockFragment implements
                    // Calculate some values to help with the animation.
                    final int endingHeight = itemHolder.alarmItem.getHeight();
                    final int distance = endingHeight - startingHeight;
                    final int collapseHeight = itemHolder.collapseExpandArea.getHeight();
                    int hairlineHeight = itemHolder.hairLine.getHeight();
                    final int hairlineDistance = collapseHeight - hairlineHeight;
                    final int hairlineDistance = mCollapseExpandHeight - hairlineHeight;

                    // Re-set the visibilities for the start state of the animation.
                    itemHolder.expandArea.setVisibility(View.VISIBLE);
@@ -1539,7 +1541,8 @@ public class AlarmClockFragment extends DeskClockFragment implements
                                    (int) (value * distance + startingHeight);
                            FrameLayout.LayoutParams expandParams = (FrameLayout.LayoutParams)
                                    itemHolder.expandArea.getLayoutParams();
                            expandParams.setMargins(0, (int) (value * distance), 0, collapseHeight);
                            expandParams.setMargins(
                                    0, (int) (value * distance), 0, mCollapseExpandHeight);
                            itemHolder.arrow.setRotation(180 * (1 - value));
                            itemHolder.hairLine.setTranslationY(-hairlineDistance * (1 - value));
                            itemHolder.summary.setAlpha(value);
@@ -1558,7 +1561,7 @@ public class AlarmClockFragment extends DeskClockFragment implements

                            FrameLayout.LayoutParams expandParams = (FrameLayout.LayoutParams)
                                    itemHolder.expandArea.getLayoutParams();
                            expandParams.setMargins(0, 0, 0, 96);
                            expandParams.setMargins(0, 0, 0, mCollapseExpandHeight);

                            itemHolder.expandArea.setVisibility(View.GONE);
                            itemHolder.arrow.setRotation(0);