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

Commit 46af8086 authored by Steve Kondik's avatar Steve Kondik Committed by DvTonder
Browse files

settings: Various cleanups

 * Cleanup display settings ghetto:
   - Move Brightness to the top
   - Replace the single-option menu with a switch in cast screen
   - Create display category
   - Move Cast Screen to higher priority, move down Daydream and Font
   - Create advanced category
   - Relocate advanced stuff to the bottom, including DoubleTap to wake
 * Move gesture settings so it doesn't look like it's part of expanded
   desktop's category
 * Use a seekbar preference to allow setting arbitrary animation scale values

Todo (depend on outstanding draft patches) :

   - Remove Lockscreen wallpaper option from Lockscreen settings
       - Use new ThemeChooser instead
   - Kill Trebuchet sub-settings from Home settings

Change-Id: I4ceaf0dc74e6e044e36cf3652bfc1efb33890380
parent 8c9e4cfe
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The CyanogenMod 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.
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="12dp">

        <!-- Static height enough to accommodate the text views in their biggest possible size,
        without having the dialog resize itself at any point. -->
        <LinearLayout android:id="@+id/container"
                 android:orientation="vertical"
                 android:layout_width="match_parent"
                 android:layout_height="64dp"
                 android:gravity="center_horizontal|center_vertical">

                <TextView android:id="@+id/scale"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textAppearance="?android:textAppearanceLarge" />

        </LinearLayout>

        <com.android.settings.IntervalSeekBar android:id="@+id/scale_seekbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="8dp"
                android:layout_below="@+id/container"
                settings:min="0"
                settings:max="2"
                settings:defaultValue="1.00"
                settings:digits="2" />

</RelativeLayout>
+9 −12
Original line number Diff line number Diff line
@@ -199,26 +199,23 @@
            android:title="@string/force_rtl_layout_all_locales"
            android:summary="@string/force_rtl_layout_all_locales_summary"/>

        <ListPreference
        <com.android.settings.AnimationScalePreference
            android:key="window_animation_scale"
            android:title="@string/window_animation_scale_title"
            android:persistent="false"
            android:entries="@array/window_animation_scale_entries"
            android:entryValues="@array/window_animation_scale_values" />
            android:dialogTitle="@string/window_animation_scale_title"
            android:persistent="false" />

        <ListPreference
        <com.android.settings.AnimationScalePreference
            android:key="transition_animation_scale"
            android:title="@string/transition_animation_scale_title"
            android:persistent="false"
            android:entries="@array/transition_animation_scale_entries"
            android:entryValues="@array/transition_animation_scale_values" />
            android:dialogTitle="@string/transition_animation_scale_title"
            android:persistent="false" />

        <ListPreference
        <com.android.settings.AnimationScalePreference
            android:key="animator_duration_scale"
            android:title="@string/animator_duration_scale_title"
            android:persistent="false"
            android:entries="@array/animator_duration_scale_entries"
            android:entryValues="@array/animator_duration_scale_values" />
            android:dialogTitle="@string/animator_duration_scale_title"
            android:persistent="false" />

        <ListPreference
            android:key="overlay_display_devices"
+90 −78
Original line number Diff line number Diff line
@@ -22,15 +22,9 @@
                    android:title="@string/brightness"
                    android:persistent="false"/>

        <PreferenceScreen
            android:persistent="false"
            android:key="screencolor_settings"
            android:title="@string/screencolor">
            <intent
                android:action="android.intent.action.MAIN"
                android:targetPackage="com.android.settings"
                android:targetClass="com.android.settings.ScreenColorSettings" />
        </PreferenceScreen>
        <PreferenceCategory
            android:key="display_prefs"
            android:title="@string/display_settings_title">

            <PreferenceScreen
                    android:key="display_rotation"
@@ -45,37 +39,55 @@
                    android:entries="@array/screen_timeout_entries"
                    android:entryValues="@array/screen_timeout_values" />

        <PreferenceScreen
                android:key="screensaver"
                android:title="@string/screensaver_settings_title"
                android:fragment="com.android.settings.DreamSettings" />

            <com.android.settings.FontDialogPreference
                    android:key="font_size"
                    android:title="@string/title_font_size"
                    android:summary="@string/summary_font_size"
                    android:dialogTitle="@string/dialog_title_font_size" />

            <PreferenceScreen
                    android:key="screensaver"
                    android:title="@string/screensaver_settings_title"
                    android:fragment="com.android.settings.DreamSettings" />

            <PreferenceScreen
                    android:key="wifi_display"
                    android:title="@string/wifi_display_settings_title"
                    android:fragment="com.android.settings.wfd.WifiDisplaySettings" />

        </PreferenceCategory>

        <PreferenceCategory
            android:key="lights_prefs"
            android:title="@string/lights_category_title">

            <PreferenceScreen
                android:key="notification_pulse"
                android:title="@string/notification_pulse_title"
                android:fragment="com.android.settings.notificationlight.NotificationLightSettings" />

            <PreferenceScreen
                android:key="battery_light"
                android:title="@string/battery_light_title"
                android:fragment="com.android.settings.notificationlight.BatteryLightSettings" />

        </PreferenceCategory>

        <!-- DeviceParts Device Specific Display settings -->
        <PreferenceCategory
            android:key="advanced_display_prefs"
            android:title="@string/advanced_settings">

            <CheckBoxPreference
                android:key="adaptive_backlight"
                android:title="@string/adaptive_backlight_title"
                android:summary="@string/adaptive_backlight_summary"
                android:defaultValue="true" />

        <!-- DeviceParts Device Specific Display settings -->
        <Preference
            android:key="advanced_display_settings"
            android:title="@string/advanced_settings_title">
            <intent
                android:action="com.cyanogenmod.action.LAUNCH_DEVICE_SETTINGS"
                android:targetPackage="com.cyanogenmod.settings.device"
                android:targetClass="com.cyanogenmod.settings.device.DisplaySettings" />
        </Preference>
            <CheckBoxPreference
                android:key="double_tap_wake_gesture"
                android:title="@string/double_tap_to_wake_title"
                android:defaultValue="false" />

            <CheckBoxPreference
                android:key="wake_when_plugged_or_unplugged"
@@ -83,11 +95,6 @@
                android:summary="@string/wake_when_plugged_or_unplugged_summary"
                android:defaultValue="false" />

        <CheckBoxPreference
            android:key="double_tap_wake_gesture"
            android:title="@string/double_tap_to_wake_title"
            android:defaultValue="false" />

            <com.android.settings.cyanogenmod.SystemSettingCheckBoxPreference
                android:key="screen_off_animation"
                android:title="@string/screen_animation_off_title"
@@ -99,19 +106,24 @@
                android:entries="@array/screen_animation_style_entries"
                android:entryValues="@array/screen_animation_style_values" />

        <PreferenceCategory
            android:key="lights_prefs"
            android:title="@string/lights_category_title">

            <PreferenceScreen
                android:key="notification_pulse"
                android:title="@string/notification_pulse_title"
                android:fragment="com.android.settings.notificationlight.NotificationLightSettings" />
                android:persistent="false"
                android:key="screencolor_settings"
                android:title="@string/screencolor">
                <intent
                    android:action="android.intent.action.MAIN"
                    android:targetPackage="com.android.settings"
                    android:targetClass="com.android.settings.ScreenColorSettings" />
            </PreferenceScreen>

            <PreferenceScreen
                android:key="battery_light"
                android:title="@string/battery_light_title"
                android:fragment="com.android.settings.notificationlight.BatteryLightSettings" />
            <Preference
                android:key="advanced_display_settings"
                android:title="@string/radio_controls_title">
                <intent
                    android:action="com.cyanogenmod.action.LAUNCH_DEVICE_SETTINGS"
                    android:targetPackage="com.cyanogenmod.settings.device"
                    android:targetClass="com.cyanogenmod.settings.device.DisplaySettings" />
            </Preference>

        </PreferenceCategory>

+9 −9
Original line number Diff line number Diff line
@@ -34,6 +34,15 @@
        android:fragment="com.android.settings.cyanogenmod.NotificationDrawer"
        android:title="@string/notification_drawer_title" />

    <!-- Device Specific Touchscreen gestures. Avoid duplicating CMHW functionality, please -->
    <Preference
        android:key="touch_screen_gesture_settings">
        <intent
            android:action="com.cyanogenmod.action.LAUNCH_TOUCHSCREEN_GESTURE_SETTINGS"
            android:targetPackage="com.cyanogenmod.settings.device"
            android:targetClass="com.cyanogenmod.settings.device.TouchscreenGestureSettings" />
    </Preference>

    <PreferenceCategory
            android:key="expanded_desktop_category"
            android:title="@string/power_menu_expanded_desktop" >
@@ -58,15 +67,6 @@

    </PreferenceCategory>

    <!-- Device Specific Touchscreen gestures. Avoid duplicating CMHW functionality, please -->
    <Preference
        android:key="touch_screen_gesture_settings">
        <intent
            android:action="com.cyanogenmod.action.LAUNCH_TOUCHSCREEN_GESTURE_SETTINGS"
            android:targetPackage="com.cyanogenmod.settings.device"
            android:targetClass="com.cyanogenmod.settings.device.TouchscreenGestureSettings" />
    </Preference>

    <PreferenceCategory
        android:key="navigation_bar"
        android:title="@string/navigation_bar_category" >
+94 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The CyanogenMod 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.
 */

package com.android.settings;

import android.content.Context;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;

public class AnimationScalePreference extends DialogPreference
    implements SeekBar.OnSeekBarChangeListener {

    private TextView mScaleText;
    private IntervalSeekBar mSeekBar;

    private float mScale = 1.0f;

    public AnimationScalePreference(Context context, AttributeSet attrs) {
        super(context, attrs);

        setPositiveButtonText(android.R.string.ok);
        setNegativeButtonText(android.R.string.cancel);

        setDialogLayoutResource(R.layout.preference_dialog_fontsize);
    }

    @Override
    protected View onCreateDialogView() {
        LayoutInflater inflater =
                (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.preference_dialog_animation_scale, null);

        mScaleText = (TextView) view.findViewById(R.id.scale);
        mScaleText.setText(String.valueOf(mScale) + "x");

        mSeekBar = (IntervalSeekBar) view.findViewById(R.id.scale_seekbar);
        mSeekBar.setProgressFloat(mScale);
        mSeekBar.setOnSeekBarChangeListener(this);

        return view;
    }

    public void setScale(float scale) {
        mScale = scale;
        setSummary(String.valueOf(scale) + "x");
    }

    @Override
    protected void onDialogClosed(boolean positiveResult) {
        if (positiveResult) {
            callChangeListener(mSeekBar.getProgressFloat());
        }
    }

    @Override
    protected void onClick() {
        // Ignore this until an explicit call to click()
    }

    public void click() {
        super.onClick();
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        mScaleText.setText(String.valueOf(mSeekBar.getProgressFloat()) + "x");
    }

    // Not used
    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    }
}
Loading