Merge "Handles Flash Notifications intro if there's no valid camera" into udc-dev am: a34ab52d0a
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22244838 Change-Id: I8ccb0aa36bb4dd4865659de2bb66742f2b422e08 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -11970,6 +11970,8 @@
|
|||||||
<string name="flash_notifications_summary_on_camera_and_screen">On / Camera and screen flash</string>
|
<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] -->
|
<!-- 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>
|
<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] -->
|
<!-- 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>
|
<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]-->
|
<!-- Label of the button to preview the selected Flash Notification effects. [CHAR LIMIT=20]-->
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<com.android.settingslib.widget.TopIntroPreference
|
<com.android.settingslib.widget.TopIntroPreference
|
||||||
android:key="flash_notifications_intro"
|
android:key="flash_notifications_intro"
|
||||||
android:title="@string/flash_notifications_intro" />
|
settings:controller="com.android.settings.accessibility.FlashNotificationsIntroPreferenceController" />
|
||||||
|
|
||||||
<com.android.settingslib.widget.IllustrationPreference
|
<com.android.settingslib.widget.IllustrationPreference
|
||||||
android:key="flash_notifications_illustration"
|
android:key="flash_notifications_illustration"
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user