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

Commit a34ab52d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handles Flash Notifications intro if there's no valid camera" into udc-dev

parents 39dd52d4 aa33027c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11970,6 +11970,8 @@
    <string name="flash_notifications_summary_on_camera_and_screen">On / Camera and screen flash</string>
    <!-- Introduction in Flash Notification page to introduce flash notifications feature. [CHAR LIMIT=NONE]  -->
    <string name="flash_notifications_intro">Flash the camera light or the screen when you receive notifications or when alarms sound</string>
    <!-- Introduction in Flash Notification page to introduce flash notifications feature without camera flash option. [CHAR LIMIT=NONE]  -->
    <string name="flash_notifications_intro_without_camera_flash">Flash the screen when you receive notifications or when alarms sound</string>
    <!-- Notes in Flash Notification page footer for something should be aware. [CHAR LIMIT=NONE]  -->
    <string name="flash_notifications_note">Use flash notifications with caution if you\u0027re light sensitive</string>
    <!-- Label of the button to preview the selected Flash Notification effects. [CHAR LIMIT=20]-->
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@

    <com.android.settingslib.widget.TopIntroPreference
        android:key="flash_notifications_intro"
        android:title="@string/flash_notifications_intro" />
        settings:controller="com.android.settings.accessibility.FlashNotificationsIntroPreferenceController" />

    <com.android.settingslib.widget.IllustrationPreference
        android:key="flash_notifications_illustration"
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.accessibility;

import android.content.Context;

import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

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

/** Preference controller that controls the text content of Flash Notifications intro. */
public class FlashNotificationsIntroPreferenceController extends BasePreferenceController {

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

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

    @Override
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        final int titleResource = FlashNotificationsUtil.isTorchAvailable(mContext)
                ? R.string.flash_notifications_intro
                : R.string.flash_notifications_intro_without_camera_flash;
        final Preference preference = screen.findPreference(getPreferenceKey());
        if (preference != null) {
            preference.setTitle(titleResource);
        }
    }
}