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

Commit d3ccae1b authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Fix Display settings summary when there is no wallpaper."

parents 80306d1a 0023558e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -8920,6 +8920,10 @@
    <string name="display_summary">Sleep after <xliff:g id="timeout_description" example="10 minutes">%1$s</xliff:g> of inactivity</string>
    <!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
    <string name="display_dashboard_summary">Wallpaper, sleep, font size</string>
    <!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
    <string name="display_dashboard_nowallpaper_summary">Sleep, font size</string>
    <!-- Example summary of display used in Setup Wizard preview screen [CHAR LIMIT=NONE] -->
    <string name="display_summary_example">Sleep after 10 minutes of inactivity</string>
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@
        android:title="@string/wallpaper_settings_title"
        settings:keywords="@string/keywords_display_wallpaper"
        settings:useAdminDisabledSummary="true"
        settings:searchable="false">
        settings:controller="com.android.settings.display.WallpaperPreferenceController">
        <intent
            android:targetPackage="@string/config_wallpaper_picker_package"
            android:targetClass="@string/config_wallpaper_picker_class" />
+3 −2
Original line number Diff line number Diff line
@@ -59,10 +59,11 @@
    <Preference
        android:key="top_level_display"
        android:title="@string/display_settings"
        android:summary="@string/display_dashboard_summary"
        android:summary="@string/summary_placeholder"
        android:icon="@drawable/ic_homepage_display"
        android:order="-70"
        android:fragment="com.android.settings.DisplaySettings"/>
        android:fragment="com.android.settings.DisplaySettings"
        settings:controller="com.android.settings.display.TopLevelDisplayPreferenceController"/>

    <Preference
        android:key="top_level_sound"
+0 −1
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ public class DisplaySettings extends DashboardFragment {
        controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
        controllers.add(new VrDisplayPreferenceController(context));
        controllers.add(new ShowOperatorNamePreferenceController(context));
        controllers.add(new WallpaperPreferenceController(context));
        controllers.add(new ThemePreferenceController(context));
        controllers.add(new BrightnessLevelPreferenceController(context, lifecycle));
        return controllers;
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 */

package com.android.settings.display;

import android.content.Context;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;

public class TopLevelDisplayPreferenceController extends BasePreferenceController {

    public TopLevelDisplayPreferenceController(Context context, String preferenceKey) {
        super(context, preferenceKey);
    }

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
    }

    @Override
    public CharSequence getSummary() {
        if (new WallpaperPreferenceController(mContext, "dummy_key").isAvailable()) {
            return mContext.getText(R.string.display_dashboard_summary);
        } else {
            return mContext.getText(R.string.display_dashboard_nowallpaper_summary);
        }
    }

}
Loading