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

Commit 9ef3d79e authored by Michael W's avatar Michael W Committed by Michael Bestas
Browse files

DeskClock: Replace ViewPager with manual fragment handling

Change-Id: Iaadfb417f0ca8638936875113ec2f39853f2a39c
parent 248c6793
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@ android_app {
    resource_dirs: ["res"],
    sdk_version: "current",
    overrides: ["AlarmClock"],
    optimize: {
        proguard_flags_files: ["proguard.flags"],
    },
    srcs: [
        "src/**/*.java",
        "gen/**/*.java",

proguard.flags

0 → 100644
+1 −0
Original line number Diff line number Diff line
-keep class androidx.viewpager.widget.* { *; }
+1 −2
Original line number Diff line number Diff line
@@ -18,9 +18,8 @@
<androidx.recyclerview.widget.RecyclerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/cities"
    android:layout_width="0dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:clickable="false"
    android:clipToPadding="false"
    android:paddingBottom="@dimen/fab_height"
+20 −23
Original line number Diff line number Diff line
@@ -25,12 +25,6 @@
    app:statusBarBackground="@null"
    android:fitsSystemWindows="true">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
@@ -55,13 +49,16 @@
        </androidx.appcompat.widget.Toolbar>
    </com.google.android.material.appbar.AppBarLayout>

        <androidx.viewpager.widget.ViewPager
            android:id="@+id/desk_clock_pager"
    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <FrameLayout
            android:id="@+id/fragment_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:importantForAccessibility="no"
            android:saveEnabled="false"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
            android:layout_height="match_parent"/>

        <LinearLayout
            android:layout_width="match_parent"
+8 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.loader.content.CursorLoader;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

@@ -81,7 +82,7 @@ public final class AlarmClockFragment extends DeskClockFragment implements
    private RecyclerView mRecyclerView;

    // Data
    private Loader mCursorLoader;
    private CursorLoader mCursorLoader;
    private long mScrollToAlarmId = Alarm.INVALID_ID;
    private long mExpandedAlarmId = Alarm.INVALID_ID;
    private long mCurrentUpdateToken;
@@ -103,7 +104,7 @@ public final class AlarmClockFragment extends DeskClockFragment implements
    @Override
    public void onCreate(Bundle savedState) {
        super.onCreate(savedState);
        mCursorLoader = LoaderManager.getInstance(this).initLoader(0, null, this);
        mCursorLoader = (CursorLoader) LoaderManager.getInstance(this).initLoader(0, null, this);
        if (savedState != null) {
            mExpandedAlarmId = savedState.getLong(KEY_EXPANDED_ID, Alarm.INVALID_ID);
        }
@@ -402,6 +403,11 @@ public final class AlarmClockFragment extends DeskClockFragment implements
        right.setVisibility(View.INVISIBLE);
    }

    @Override
    public final int getFabTargetVisibility() {
        return View.VISIBLE;
    }

    private void startCreatingAlarm() {
        // Clear the currently selected alarm.
        mAlarmTimeClickHandler.setSelectedAlarm(null);
Loading