Loading packages/SystemUI/res/drawable/ic_qs_heads_up.xml 0 → 100644 +36 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2014 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.0" android:viewportHeight="24.0"> <path android:pathData="M0,0h24v24H0V0z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M18,16v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-0.83-0.68-1.5-1.51-1.5S10.5,3.17,10.5,4v0.68C7.63,5.36,6,7.92,6,11v5 l-1.3,1.29C4.07,17.92,4.51,19,5.4,19h13.17c0.89,0,1.34-1.08,0.71-1.71L18,16z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M11.99,22c1.1,0,2-0.9,2-2h-4C9.99,21.1,10.88,22,11.99,22z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M6.77,4.73C7.19,4.35,7.2,3.7,6.8,3.3l0,0c-0.38-0.38-1-0.39-1.39-0.02C3.7,4.84,2.52,6.96,2.14,9.34 C2.05,9.95,2.52,10.5,3.14,10.5h0c0.48,0,0.9-0.35,0.98-0.83C4.42,7.73,5.38,6,6.77,4.73z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M18.6,3.28c-0.4-0.37-1.02-0.36-1.4,0.02l0,0c-0.4,0.4-0.38,1.04,0.03,1.42c1.38,1.27,2.35,3,2.65,4.94 c0.07,0.48,0.49,0.83,0.98,0.83c0.61,0,1.09-0.55,0.99-1.16C21.47,6.96,20.3,4.85,18.6,3.28z" /> </vector> packages/SystemUI/res/values/cm_strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,9 @@ <string name="quick_settings_caffeine_label">Caffeine</string> <string name="accessibility_quick_settings_caffeine_off">Caffeine off.</string> <string name="accessibility_quick_settings_caffeine_on">Caffeine on.</string> <!-- Heads up QS tile --> <string name="quick_settings_heads_up_label">Heads up</string> <string name="accessibility_quick_settings_heads_up_off">Heads up off.</string> <string name="accessibility_quick_settings_heads_up_on">Heads up on.</string> </resources> packages/SystemUI/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> internet,bt,flashlight,dnd,modes_dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices,notes,desktopeffects,caffeine internet,bt,flashlight,dnd,modes_dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices,notes,desktopeffects,caffeine,heads_up </string> <!-- The tiles to display in QuickSettings --> Loading packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt +7 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.lineage import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.CaffeineTile import com.android.systemui.qs.tiles.HeadsUpTile import dagger.Binds import dagger.Module Loading @@ -31,4 +32,10 @@ interface LineageModule { @IntoMap @StringKey(CaffeineTile.TILE_SPEC) fun bindCaffeineTile(caffeineTile: CaffeineTile): QSTileImpl<*> /** Inject HeadsUpTile into tileMap in QSModule */ @Binds @IntoMap @StringKey(HeadsUpTile.TILE_SPEC) fun bindHeadsUpTile(headsUpTile: HeadsUpTile): QSTileImpl<*> } packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java 0 → 100644 +142 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 The CyanogenMod Project * Copyright (C) 2017 The LineageOS 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 static com.android.internal.logging.MetricsLogger.VIEW_UNKNOWN; import android.content.Intent; import android.os.Handler; import android.os.Looper; import android.provider.Settings; import android.provider.Settings.Global; import android.service.quicksettings.Tile; import androidx.annotation.Nullable; import com.android.internal.logging.MetricsLogger; import com.android.systemui.animation.Expandable; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.qs.QSTile.BooleanState; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.QsEventLogger; import com.android.systemui.qs.SettingObserver; import com.android.systemui.qs.logging.QSLogger; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.res.R; import com.android.systemui.settings.UserTracker; import com.android.systemui.util.settings.GlobalSettings; import javax.inject.Inject; /** Quick settings tile: Heads up **/ public class HeadsUpTile extends QSTileImpl<BooleanState> { public static final String TILE_SPEC = "heads_up"; private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_heads_up); private static final Intent NOTIFICATION_SETTINGS = new Intent("android.settings.NOTIFICATION_SETTINGS"); private final SettingObserver mSetting; @Inject public HeadsUpTile( QSHost host, QsEventLogger uiEventLogger, @Background Looper backgroundLooper, @Main Handler mainHandler, FalsingManager falsingManager, MetricsLogger metricsLogger, StatusBarStateController statusBarStateController, ActivityStarter activityStarter, QSLogger qsLogger, GlobalSettings globalSettings, UserTracker userTracker ) { super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, statusBarStateController, activityStarter, qsLogger); mSetting = new SettingObserver(globalSettings, mHandler, Global.HEADS_UP_NOTIFICATIONS_ENABLED, userTracker.getUserId()) { @Override protected void handleValueChanged(int value, boolean observedChange) { handleRefreshState(value); } }; } @Override public BooleanState newTileState() { return new BooleanState(); } @Override protected void handleClick(@Nullable Expandable expandable) { setEnabled(!mState.value); refreshState(); } @Override public Intent getLongClickIntent() { return NOTIFICATION_SETTINGS; } private void setEnabled(boolean enabled) { Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, enabled ? 1 : 0); } @Override protected void handleUpdateState(BooleanState state, Object arg) { final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue(); final boolean headsUp = value != 0; state.value = headsUp; state.label = mContext.getString(R.string.quick_settings_heads_up_label); state.icon = mIcon; if (headsUp) { state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_heads_up_on); state.state = Tile.STATE_ACTIVE; } else { state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_heads_up_off); state.state = Tile.STATE_INACTIVE; } } @Override public CharSequence getTileLabel() { return mContext.getString(R.string.quick_settings_heads_up_label); } @Override public int getMetricsCategory() { return VIEW_UNKNOWN; } @Override public void handleSetListening(boolean listening) { // Do nothing } } Loading
packages/SystemUI/res/drawable/ic_qs_heads_up.xml 0 → 100644 +36 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2014 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.0" android:viewportHeight="24.0"> <path android:pathData="M0,0h24v24H0V0z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M18,16v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-0.83-0.68-1.5-1.51-1.5S10.5,3.17,10.5,4v0.68C7.63,5.36,6,7.92,6,11v5 l-1.3,1.29C4.07,17.92,4.51,19,5.4,19h13.17c0.89,0,1.34-1.08,0.71-1.71L18,16z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M11.99,22c1.1,0,2-0.9,2-2h-4C9.99,21.1,10.88,22,11.99,22z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M6.77,4.73C7.19,4.35,7.2,3.7,6.8,3.3l0,0c-0.38-0.38-1-0.39-1.39-0.02C3.7,4.84,2.52,6.96,2.14,9.34 C2.05,9.95,2.52,10.5,3.14,10.5h0c0.48,0,0.9-0.35,0.98-0.83C4.42,7.73,5.38,6,6.77,4.73z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M18.6,3.28c-0.4-0.37-1.02-0.36-1.4,0.02l0,0c-0.4,0.4-0.38,1.04,0.03,1.42c1.38,1.27,2.35,3,2.65,4.94 c0.07,0.48,0.49,0.83,0.98,0.83c0.61,0,1.09-0.55,0.99-1.16C21.47,6.96,20.3,4.85,18.6,3.28z" /> </vector>
packages/SystemUI/res/values/cm_strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,9 @@ <string name="quick_settings_caffeine_label">Caffeine</string> <string name="accessibility_quick_settings_caffeine_off">Caffeine off.</string> <string name="accessibility_quick_settings_caffeine_on">Caffeine on.</string> <!-- Heads up QS tile --> <string name="quick_settings_heads_up_label">Heads up</string> <string name="accessibility_quick_settings_heads_up_off">Heads up off.</string> <string name="accessibility_quick_settings_heads_up_on">Heads up on.</string> </resources>
packages/SystemUI/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> internet,bt,flashlight,dnd,modes_dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices,notes,desktopeffects,caffeine internet,bt,flashlight,dnd,modes_dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,record_issue,hearing_devices,notes,desktopeffects,caffeine,heads_up </string> <!-- The tiles to display in QuickSettings --> Loading
packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt +7 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.lineage import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.tiles.CaffeineTile import com.android.systemui.qs.tiles.HeadsUpTile import dagger.Binds import dagger.Module Loading @@ -31,4 +32,10 @@ interface LineageModule { @IntoMap @StringKey(CaffeineTile.TILE_SPEC) fun bindCaffeineTile(caffeineTile: CaffeineTile): QSTileImpl<*> /** Inject HeadsUpTile into tileMap in QSModule */ @Binds @IntoMap @StringKey(HeadsUpTile.TILE_SPEC) fun bindHeadsUpTile(headsUpTile: HeadsUpTile): QSTileImpl<*> }
packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java 0 → 100644 +142 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 The CyanogenMod Project * Copyright (C) 2017 The LineageOS 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 static com.android.internal.logging.MetricsLogger.VIEW_UNKNOWN; import android.content.Intent; import android.os.Handler; import android.os.Looper; import android.provider.Settings; import android.provider.Settings.Global; import android.service.quicksettings.Tile; import androidx.annotation.Nullable; import com.android.internal.logging.MetricsLogger; import com.android.systemui.animation.Expandable; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.qs.QSTile.BooleanState; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.QsEventLogger; import com.android.systemui.qs.SettingObserver; import com.android.systemui.qs.logging.QSLogger; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.res.R; import com.android.systemui.settings.UserTracker; import com.android.systemui.util.settings.GlobalSettings; import javax.inject.Inject; /** Quick settings tile: Heads up **/ public class HeadsUpTile extends QSTileImpl<BooleanState> { public static final String TILE_SPEC = "heads_up"; private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_heads_up); private static final Intent NOTIFICATION_SETTINGS = new Intent("android.settings.NOTIFICATION_SETTINGS"); private final SettingObserver mSetting; @Inject public HeadsUpTile( QSHost host, QsEventLogger uiEventLogger, @Background Looper backgroundLooper, @Main Handler mainHandler, FalsingManager falsingManager, MetricsLogger metricsLogger, StatusBarStateController statusBarStateController, ActivityStarter activityStarter, QSLogger qsLogger, GlobalSettings globalSettings, UserTracker userTracker ) { super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, statusBarStateController, activityStarter, qsLogger); mSetting = new SettingObserver(globalSettings, mHandler, Global.HEADS_UP_NOTIFICATIONS_ENABLED, userTracker.getUserId()) { @Override protected void handleValueChanged(int value, boolean observedChange) { handleRefreshState(value); } }; } @Override public BooleanState newTileState() { return new BooleanState(); } @Override protected void handleClick(@Nullable Expandable expandable) { setEnabled(!mState.value); refreshState(); } @Override public Intent getLongClickIntent() { return NOTIFICATION_SETTINGS; } private void setEnabled(boolean enabled) { Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, enabled ? 1 : 0); } @Override protected void handleUpdateState(BooleanState state, Object arg) { final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue(); final boolean headsUp = value != 0; state.value = headsUp; state.label = mContext.getString(R.string.quick_settings_heads_up_label); state.icon = mIcon; if (headsUp) { state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_heads_up_on); state.state = Tile.STATE_ACTIVE; } else { state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_heads_up_off); state.state = Tile.STATE_INACTIVE; } } @Override public CharSequence getTileLabel() { return mContext.getString(R.string.quick_settings_heads_up_label); } @Override public int getMetricsCategory() { return VIEW_UNKNOWN; } @Override public void handleSetListening(boolean listening) { // Do nothing } }