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

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

DeskClock: Integrate ScreensaverSettings better with Settings

By using a CollapsingToolbarLayout and removing the icon space, the
ScreensaverSettings integrate better with the rest of the Settings

Change-Id: I508afdca6fe5d021ee6fe23656ff2b9fd19d5b76
parent 2016f034
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <fragment
        android:id="@+id/main"
        android:name="com.android.deskclock.settings.ScreensaverSettingsActivity$PrefsFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</FrameLayout>
+5 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:title="@string/app_label">

    <ListPreference
@@ -22,12 +23,14 @@
        android:entries="@array/clock_style_entries"
        android:entryValues="@array/clock_style_values"
        android:key="screensaver_clock_style"
        android:title="@string/clock_style" />
        android:title="@string/clock_style"
        app:iconSpaceReserved="false" />

    <CheckBoxPreference
        android:defaultValue="true"
        android:key="screensaver_night_mode"
        android:summary="@string/night_mode_summary"
        android:title="@string/night_mode_title" />
        android:title="@string/night_mode_title"
        app:iconSpaceReserved="false" />

</PreferenceScreen>
+10 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.deskclock.settings;
import android.os.Bundle;
import android.view.MenuItem;

import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.CheckBoxPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
@@ -27,19 +26,27 @@ import androidx.preference.PreferenceFragmentCompat;

import com.android.deskclock.R;
import com.android.deskclock.data.DataModel;
import com.android.deskclock.widget.CollapsingToolbarBaseActivity;

/**
 * Settings for Clock screen saver
 */
public final class ScreensaverSettingsActivity extends AppCompatActivity {
public final class ScreensaverSettingsActivity extends CollapsingToolbarBaseActivity {

    public static final String KEY_CLOCK_STYLE = "screensaver_clock_style";
    public static final String KEY_NIGHT_MODE = "screensaver_night_mode";
    private static final String PREFS_FRAGMENT_TAG = "prefs_fragment";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screensaver_settings);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.content_frame, new PrefsFragment(), PREFS_FRAGMENT_TAG)
                    .disallowAddToBackStack()
                    .commit();
        }
    }

    @Override