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

Commit 36fa93b4 authored by Sam Blitzstein's avatar Sam Blitzstein Committed by Isaac Katzenelson
Browse files

Fix alarm expanding issues.

Use expandAlarm() directly instead of getView().

Change-Id: I69dc118cd305a59e7f536db1d7e347184e261be8
(cherry picked from commit d1e550a1)
parent 144d2a08
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -609,8 +609,16 @@ public class AlarmClockFragment extends DeskClockFragment implements
            final int firstPositionId = mAlarmsList.getFirstVisiblePosition();
            final int childId = alarmPosition - firstPositionId;

            // We need to expand the first view item because bindView may have been called
            // before setNewAlarm took effect. In that case, the newly created alarm will not be
            // expanded.
            final View view = mAlarmsList.getChildAt(childId);
            mAdapter.getView(alarmPosition, view, mAlarmsList);
            Object tag = view.getTag();
            if (tag != null && tag instanceof AlarmItemAdapter.ItemHolder) {
                mAdapter.expandAlarm((AlarmItemAdapter.ItemHolder) tag, true);
            } else {
                Log.e("Unable to get ItemHolder for view at id "+childId);
            }
        } else {
            // Trying to display a deleted alarm should only happen from a missed notification for
            // an alarm that has been marked deleted after use.
@@ -1760,12 +1768,6 @@ public class AlarmClockFragment extends DeskClockFragment implements
                }
                mAdapter.setNewAlarm(alarm.id);
                scrollToAlarm(alarm.id);

                // We need to refresh the first view item because bindView may have been called
                // before setNewAlarm took effect. In that case, the newly created alarm will not be
                // expanded.
                View view = mAlarmsList.getChildAt(0);
                mAdapter.getView(0, view, mAlarmsList);
            }
        };
        updateTask.execute();