Commit c38683a9 authored by Michael W's avatar Michael W
Browse files

DeskClock: Fix FAB not being shown everytime

* The getTimer() method returns null when we call getFabTargetVisibility()
  before the onCreateView method gets called, resulting in the FAB not
  being shown
* A video how to reproduce the issue can be found on the bug report linked
  below
* Fix: Always return the first timer (if one exists) so we can properly
  decide if the FAB needs to be shown

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/2250
Change-Id: Id16686c729ee41d14c890827dc441e81511c8405
parent 8a9bb0c3
......@@ -687,6 +687,11 @@ public final class TimerFragment extends DeskClockFragment {
}
private Timer getTimer() {
if (mAdapter == null) {
TimerPagerAdapter adapter = new TimerPagerAdapter(getFragmentManager());
return adapter.getCount() == 0 ? null : adapter.getTimer(0);
}
if (mViewPager == null) {
return null;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment