Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -3163,6 +3163,8 @@ <string name="twilight_mode_location_off_dialog_message">Device location needed to determine your sunset and sunrise times.</string> <!-- When location mode is off, twilight scheduling does not function. [CHAR LIMIT=40] --> <string name="twilight_mode_launch_location">Location settings</string> <!-- When location mode is on but a location could not be determined, twilight scheduling does not function. [CHAR LIMIT=120] --> <string name="twilight_mode_pending_location">Location services are active. Schedule will activate once location is determined.</string> <!-- Dark ui screen--> <!-- Display settings screen, activation button action for manual mode. [CHAR LIMIT=40] --> res/xml/dark_mode_settings.xml +7 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,13 @@ settings:searchable="false"/> </PreferenceCategory> <com.android.settingslib.widget.FooterPreference android:key="dark_theme_connection_footer" android:title= "@string/twilight_mode_pending_location" android:selectable="false" settings:searchable="false" settings:controller="com.android.settings.display.darkmode.DarkModePendingLocationPreferenceController" /> <com.android.settingslib.widget.FooterPreference android:key="dark_theme_custom_bedtime_footer" android:title="@string/dark_ui_bedtime_footer_summary" Loading src/com/android/settings/display/NightDisplayAutoModePreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class NightDisplayAutoModePreferenceController extends BasePreferenceCont public final boolean onPreferenceChange(Preference preference, Object newValue) { if (String.valueOf(ColorDisplayManager.AUTO_MODE_TWILIGHT).equals(newValue) && !mLocationManager.isLocationEnabled()) { TwilightLocationDialog.show(mContext); TwilightLocationDialog.showLocationOff(mContext); return true; } return mColorDisplayManager.setNightDisplayAutoMode(Integer.parseInt((String) newValue)); Loading src/com/android/settings/display/TwilightLocationDialog.java +21 −3 Original line number Diff line number Diff line Loading @@ -24,14 +24,19 @@ import android.util.Log; import com.android.settings.R; import com.android.settings.Settings; /* * This class lauches a dialog when users try to use twilight scheduling without /** * This class launches a dialog when users try to use twilight scheduling without * turning on location services */ public class TwilightLocationDialog { public static String TAG = "TwilightLocationDialog"; public static void show(Context context) { /** * This method launches a dialog when users try to use twilight scheduling without * turning on location services. * @param context The context of the calling activity. */ public static void showLocationOff(Context context) { final AlertDialog dialog = new AlertDialog.Builder(context) .setPositiveButton(R.string.twilight_mode_launch_location, ((dialog1, which) -> { Log.d(TAG, "clicked forget"); Loading @@ -44,4 +49,17 @@ public class TwilightLocationDialog { .create(); dialog.show(); } /** * This method launches a dialog when users try to use twilight scheduling but the location * could not be determined. * @param context The context of the calling activity. */ public static void showLocationPending(Context context) { final AlertDialog dialog = new AlertDialog.Builder(context) .setPositiveButton(R.string.dlg_ok, null /* listener */) .setMessage(R.string.twilight_mode_pending_location) .create(); dialog.show(); } } src/com/android/settings/display/TwilightLocationPreferenceController.java +7 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.Intent; import android.location.LocationManager; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.R; Loading Loading @@ -57,10 +58,15 @@ public class TwilightLocationPreferenceController extends BasePreferenceControll @Override public int getAvailabilityStatus() { return mLocationManager.isLocationEnabled() ? CONDITIONALLY_UNAVAILABLE return mLocationManager.isLocationEnabled() ? DISABLED_DEPENDENT_SETTING : AVAILABLE_UNSEARCHABLE; } @Override public void updateState(Preference preference) { preference.setVisible(!mLocationManager.isLocationEnabled()); } private void launchLocationSettings() { final Intent intent = new Intent(); intent.setClass(mContext, Settings.LocationSettingsActivity.class); Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -3163,6 +3163,8 @@ <string name="twilight_mode_location_off_dialog_message">Device location needed to determine your sunset and sunrise times.</string> <!-- When location mode is off, twilight scheduling does not function. [CHAR LIMIT=40] --> <string name="twilight_mode_launch_location">Location settings</string> <!-- When location mode is on but a location could not be determined, twilight scheduling does not function. [CHAR LIMIT=120] --> <string name="twilight_mode_pending_location">Location services are active. Schedule will activate once location is determined.</string> <!-- Dark ui screen--> <!-- Display settings screen, activation button action for manual mode. [CHAR LIMIT=40] -->
res/xml/dark_mode_settings.xml +7 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,13 @@ settings:searchable="false"/> </PreferenceCategory> <com.android.settingslib.widget.FooterPreference android:key="dark_theme_connection_footer" android:title= "@string/twilight_mode_pending_location" android:selectable="false" settings:searchable="false" settings:controller="com.android.settings.display.darkmode.DarkModePendingLocationPreferenceController" /> <com.android.settingslib.widget.FooterPreference android:key="dark_theme_custom_bedtime_footer" android:title="@string/dark_ui_bedtime_footer_summary" Loading
src/com/android/settings/display/NightDisplayAutoModePreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class NightDisplayAutoModePreferenceController extends BasePreferenceCont public final boolean onPreferenceChange(Preference preference, Object newValue) { if (String.valueOf(ColorDisplayManager.AUTO_MODE_TWILIGHT).equals(newValue) && !mLocationManager.isLocationEnabled()) { TwilightLocationDialog.show(mContext); TwilightLocationDialog.showLocationOff(mContext); return true; } return mColorDisplayManager.setNightDisplayAutoMode(Integer.parseInt((String) newValue)); Loading
src/com/android/settings/display/TwilightLocationDialog.java +21 −3 Original line number Diff line number Diff line Loading @@ -24,14 +24,19 @@ import android.util.Log; import com.android.settings.R; import com.android.settings.Settings; /* * This class lauches a dialog when users try to use twilight scheduling without /** * This class launches a dialog when users try to use twilight scheduling without * turning on location services */ public class TwilightLocationDialog { public static String TAG = "TwilightLocationDialog"; public static void show(Context context) { /** * This method launches a dialog when users try to use twilight scheduling without * turning on location services. * @param context The context of the calling activity. */ public static void showLocationOff(Context context) { final AlertDialog dialog = new AlertDialog.Builder(context) .setPositiveButton(R.string.twilight_mode_launch_location, ((dialog1, which) -> { Log.d(TAG, "clicked forget"); Loading @@ -44,4 +49,17 @@ public class TwilightLocationDialog { .create(); dialog.show(); } /** * This method launches a dialog when users try to use twilight scheduling but the location * could not be determined. * @param context The context of the calling activity. */ public static void showLocationPending(Context context) { final AlertDialog dialog = new AlertDialog.Builder(context) .setPositiveButton(R.string.dlg_ok, null /* listener */) .setMessage(R.string.twilight_mode_pending_location) .create(); dialog.show(); } }
src/com/android/settings/display/TwilightLocationPreferenceController.java +7 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.Intent; import android.location.LocationManager; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.settings.R; Loading Loading @@ -57,10 +58,15 @@ public class TwilightLocationPreferenceController extends BasePreferenceControll @Override public int getAvailabilityStatus() { return mLocationManager.isLocationEnabled() ? CONDITIONALLY_UNAVAILABLE return mLocationManager.isLocationEnabled() ? DISABLED_DEPENDENT_SETTING : AVAILABLE_UNSEARCHABLE; } @Override public void updateState(Preference preference) { preference.setVisible(!mLocationManager.isLocationEnabled()); } private void launchLocationSettings() { final Intent intent = new Intent(); intent.setClass(mContext, Settings.LocationSettingsActivity.class); Loading