Loading packages/SystemUI/res/drawable/ic_qs_night_display_off.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2016 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="24" android:viewportHeight="24" android:alpha="0.3"> <path android:fillColor="#FFF" android:pathData="M6,12c0,5.5,4.5,10,10,10c1,0,2-0.2,3-0.5c-4.1-1.3-7-5.1-7-9.5s2.9-8.3,7-9.5C18.1,2.2,17.1,2,16,2C10.5,2,6,6.5,6,12z" /> </vector> packages/SystemUI/res/drawable/ic_qs_night_display_on.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2016 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#FFF" android:pathData="M6,12c0,5.5,4.5,10,10,10c1,0,2-0.2,3-0.5c-4.1-1.3-7-5.1-7-9.5s2.9-8.3,7-9.5C18.1,2.2,17.1,2,16,2C10.5,2,6,6.5,6,12z" /> </vector> packages/SystemUI/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -752,6 +752,12 @@ <string name="quick_settings_cellular_detail_data_warning"><xliff:g id="data_limit" example="2.0 GB">%s</xliff:g> warning</string> <!-- QuickSettings: Work mode [CHAR LIMIT=NONE] --> <string name="quick_settings_work_mode_label">Work mode</string> <!-- QuickSettings: Label for the toggle to activate Night display (renamed "Night Light" with title caps). [CHAR LIMIT=20] --> <string name="quick_settings_night_display_label">Night Light</string> <!-- QuickSettings: Summary for the toggle to deactivate Night display when it's on (renamed "Night Light" with title caps). [CHAR LIMIT=NONE] --> <string name="quick_settings_night_display_summary_on">Night Light on, tap to turn off</string> <!-- QuickSettings: Label for the toggle to activate Night display when it's off (renamed "Night Light" with title caps). [CHAR LIMIT=NONE] --> <string name="quick_settings_night_display_summary_off">Night Light off, tap to turn on</string> <!-- Recents: The empty recents string. [CHAR LIMIT=NONE] --> <string name="recents_empty_message">No recent items</string> Loading packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java 0 → 100644 +99 −0 Original line number Diff line number Diff line /* * Copyright (c) 2016, 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.systemui.qs.tiles; import android.content.Intent; import android.provider.Settings; import android.widget.Switch; import com.android.internal.app.NightDisplayController; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.qs.QSTile; public class NightDisplayTile extends QSTile<QSTile.BooleanState> implements NightDisplayController.Callback { private final NightDisplayController mController; public NightDisplayTile(Host host) { super(host); mController = new NightDisplayController(mContext); } @Override public boolean isAvailable() { return NightDisplayController.isAvailable(mContext); } @Override public BooleanState newTileState() { return new BooleanState(); } @Override protected void handleClick() { final boolean activated = !mState.value; MetricsLogger.action(mContext, getMetricsCategory(), activated); mController.setActivated(activated); } @Override protected void handleUpdateState(BooleanState state, Object arg) { final boolean isActivated = mController.isActivated(); state.value = isActivated; state.label = mContext.getString(R.string.quick_settings_night_display_label); state.icon = ResourceIcon.get(isActivated ? R.drawable.ic_qs_night_display_on : R.drawable.ic_qs_night_display_off); state.contentDescription = mContext.getString(isActivated ? R.string.quick_settings_night_display_summary_on : R.string.quick_settings_night_display_summary_off); state.minimalAccessibilityClassName = state.expandedAccessibilityClassName = Switch.class.getName(); } @Override public int getMetricsCategory() { return MetricsEvent.QS_NIGHT_DISPLAY; } @Override public Intent getLongClickIntent() { return new Intent(Settings.ACTION_DISPLAY_SETTINGS); } @Override protected void setListening(boolean listening) { if (listening) { mController.setListener(this); refreshState(); } else { mController.setListener(null); } } @Override public CharSequence getTileLabel() { return mContext.getString(R.string.quick_settings_night_display_label); } @Override public void onActivated(boolean activated) { refreshState(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +2 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import com.android.systemui.qs.tiles.FlashlightTile; import com.android.systemui.qs.tiles.HotspotTile; import com.android.systemui.qs.tiles.IntentTile; import com.android.systemui.qs.tiles.LocationTile; import com.android.systemui.qs.tiles.NightDisplayTile; import com.android.systemui.qs.tiles.RotationLockTile; import com.android.systemui.qs.tiles.UserTile; import com.android.systemui.qs.tiles.WifiTile; Loading Loading @@ -440,6 +441,7 @@ public class QSTileHost implements QSTile.Host, Tunable { else if (tileSpec.equals("user")) return new UserTile(this); else if (tileSpec.equals("battery")) return new BatteryTile(this); else if (tileSpec.equals("saver")) return new DataSaverTile(this); else if (tileSpec.equals("night")) return new NightDisplayTile(this); // Intent tiles. else if (tileSpec.startsWith(IntentTile.PREFIX)) return IntentTile.create(this,tileSpec); else if (tileSpec.startsWith(CustomTile.PREFIX)) return CustomTile.create(this,tileSpec); Loading Loading
packages/SystemUI/res/drawable/ic_qs_night_display_off.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2016 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="24" android:viewportHeight="24" android:alpha="0.3"> <path android:fillColor="#FFF" android:pathData="M6,12c0,5.5,4.5,10,10,10c1,0,2-0.2,3-0.5c-4.1-1.3-7-5.1-7-9.5s2.9-8.3,7-9.5C18.1,2.2,17.1,2,16,2C10.5,2,6,6.5,6,12z" /> </vector>
packages/SystemUI/res/drawable/ic_qs_night_display_on.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2016 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="64dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#FFF" android:pathData="M6,12c0,5.5,4.5,10,10,10c1,0,2-0.2,3-0.5c-4.1-1.3-7-5.1-7-9.5s2.9-8.3,7-9.5C18.1,2.2,17.1,2,16,2C10.5,2,6,6.5,6,12z" /> </vector>
packages/SystemUI/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -752,6 +752,12 @@ <string name="quick_settings_cellular_detail_data_warning"><xliff:g id="data_limit" example="2.0 GB">%s</xliff:g> warning</string> <!-- QuickSettings: Work mode [CHAR LIMIT=NONE] --> <string name="quick_settings_work_mode_label">Work mode</string> <!-- QuickSettings: Label for the toggle to activate Night display (renamed "Night Light" with title caps). [CHAR LIMIT=20] --> <string name="quick_settings_night_display_label">Night Light</string> <!-- QuickSettings: Summary for the toggle to deactivate Night display when it's on (renamed "Night Light" with title caps). [CHAR LIMIT=NONE] --> <string name="quick_settings_night_display_summary_on">Night Light on, tap to turn off</string> <!-- QuickSettings: Label for the toggle to activate Night display when it's off (renamed "Night Light" with title caps). [CHAR LIMIT=NONE] --> <string name="quick_settings_night_display_summary_off">Night Light off, tap to turn on</string> <!-- Recents: The empty recents string. [CHAR LIMIT=NONE] --> <string name="recents_empty_message">No recent items</string> Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java 0 → 100644 +99 −0 Original line number Diff line number Diff line /* * Copyright (c) 2016, 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.systemui.qs.tiles; import android.content.Intent; import android.provider.Settings; import android.widget.Switch; import com.android.internal.app.NightDisplayController; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.qs.QSTile; public class NightDisplayTile extends QSTile<QSTile.BooleanState> implements NightDisplayController.Callback { private final NightDisplayController mController; public NightDisplayTile(Host host) { super(host); mController = new NightDisplayController(mContext); } @Override public boolean isAvailable() { return NightDisplayController.isAvailable(mContext); } @Override public BooleanState newTileState() { return new BooleanState(); } @Override protected void handleClick() { final boolean activated = !mState.value; MetricsLogger.action(mContext, getMetricsCategory(), activated); mController.setActivated(activated); } @Override protected void handleUpdateState(BooleanState state, Object arg) { final boolean isActivated = mController.isActivated(); state.value = isActivated; state.label = mContext.getString(R.string.quick_settings_night_display_label); state.icon = ResourceIcon.get(isActivated ? R.drawable.ic_qs_night_display_on : R.drawable.ic_qs_night_display_off); state.contentDescription = mContext.getString(isActivated ? R.string.quick_settings_night_display_summary_on : R.string.quick_settings_night_display_summary_off); state.minimalAccessibilityClassName = state.expandedAccessibilityClassName = Switch.class.getName(); } @Override public int getMetricsCategory() { return MetricsEvent.QS_NIGHT_DISPLAY; } @Override public Intent getLongClickIntent() { return new Intent(Settings.ACTION_DISPLAY_SETTINGS); } @Override protected void setListening(boolean listening) { if (listening) { mController.setListener(this); refreshState(); } else { mController.setListener(null); } } @Override public CharSequence getTileLabel() { return mContext.getString(R.string.quick_settings_night_display_label); } @Override public void onActivated(boolean activated) { refreshState(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +2 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import com.android.systemui.qs.tiles.FlashlightTile; import com.android.systemui.qs.tiles.HotspotTile; import com.android.systemui.qs.tiles.IntentTile; import com.android.systemui.qs.tiles.LocationTile; import com.android.systemui.qs.tiles.NightDisplayTile; import com.android.systemui.qs.tiles.RotationLockTile; import com.android.systemui.qs.tiles.UserTile; import com.android.systemui.qs.tiles.WifiTile; Loading Loading @@ -440,6 +441,7 @@ public class QSTileHost implements QSTile.Host, Tunable { else if (tileSpec.equals("user")) return new UserTile(this); else if (tileSpec.equals("battery")) return new BatteryTile(this); else if (tileSpec.equals("saver")) return new DataSaverTile(this); else if (tileSpec.equals("night")) return new NightDisplayTile(this); // Intent tiles. else if (tileSpec.startsWith(IntentTile.PREFIX)) return IntentTile.create(this,tileSpec); else if (tileSpec.startsWith(CustomTile.PREFIX)) return CustomTile.create(this,tileSpec); Loading