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

Commit 34a0a6fe authored by Keith Mok's avatar Keith Mok Committed by Luca Stefani
Browse files

SystemUI: Add caffeine qs tile

Change-Id: I5d4aa97ae63fc0bcc40f0fa7d9305efbba091029
parent 9a925293
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.systemui">

    <!-- QS Tiles -->
    <uses-permission android:name="lineageos.permission.WRITE_SETTINGS" />
    <uses-permission android:name="lineageos.permission.WRITE_SECURE_SETTINGS" />

    <!-- SystemUI Tuner -->
    <application>
        <activity-alias
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="48dp"
        android:height="48dp"
        android:viewportWidth="24"
        android:viewportHeight="24">

    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M2,21H20V19H2M20,8H18V5H20M20,3H4V13A4,4 0 0,0 8,17H14A4,4 0 0,0 18,13V10H20A2,2 0 0,0 22,8V5C22,3.89 21.1,3 20,3Z" />
</vector>
+6 −0
Original line number Diff line number Diff line
@@ -39,4 +39,10 @@

    <!-- Label for current user in power menu options dialog -->
    <string name="global_action_current_user">Current</string>

    <!-- Custom QS tiles -->
    <!-- Caffeine QS tile -->
    <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>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,caffeine
    </string>

    <!-- The tiles to display in QuickSettings -->
+10 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 * Copyright (C) 2017 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use mHost file
 * except in compliance with the License. You may obtain a copy of the License at
@@ -29,6 +30,7 @@ import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.qs.tiles.AirplaneModeTile;
import com.android.systemui.qs.tiles.BatterySaverTile;
import com.android.systemui.qs.tiles.BluetoothTile;
import com.android.systemui.qs.tiles.CaffeineTile;
import com.android.systemui.qs.tiles.CastTile;
import com.android.systemui.qs.tiles.CellularTile;
import com.android.systemui.qs.tiles.ColorInversionTile;
@@ -75,6 +77,7 @@ public class QSFactoryImpl implements QSFactory {
    private final Provider<NfcTile> mNfcTileProvider;
    private final Provider<GarbageMonitor.MemoryTile> mMemoryTileProvider;
    private final Provider<UiModeNightTile> mUiModeNightTileProvider;
    private final Provider<CaffeineTile> mCaffeineTileProvider;

    private QSTileHost mHost;

@@ -97,7 +100,8 @@ public class QSFactoryImpl implements QSFactory {
            Provider<NightDisplayTile> nightDisplayTileProvider,
            Provider<NfcTile> nfcTileProvider,
            Provider<GarbageMonitor.MemoryTile> memoryTileProvider,
            Provider<UiModeNightTile> uiModeNightTileProvider) {
            Provider<UiModeNightTile> uiModeNightTileProvider,
            Provider<CaffeineTile> caffeineTileProvider) {
        mWifiTileProvider = wifiTileProvider;
        mBluetoothTileProvider = bluetoothTileProvider;
        mCellularTileProvider = cellularTileProvider;
@@ -117,6 +121,7 @@ public class QSFactoryImpl implements QSFactory {
        mNfcTileProvider = nfcTileProvider;
        mMemoryTileProvider = memoryTileProvider;
        mUiModeNightTileProvider = uiModeNightTileProvider;
        mCaffeineTileProvider = caffeineTileProvider;
    }

    public void setHost(QSTileHost host) {
@@ -132,8 +137,8 @@ public class QSFactoryImpl implements QSFactory {
    }

    private QSTileImpl createTileInternal(String tileSpec) {
        // Stock tiles.
        switch (tileSpec) {
            // Stock tiles.
            case "wifi":
                return mWifiTileProvider.get();
            case "bt":
@@ -170,6 +175,9 @@ public class QSFactoryImpl implements QSFactory {
                return mNfcTileProvider.get();
            case "dark":
                return mUiModeNightTileProvider.get();
            // Custom tiles.
            case "caffeine":
                return mCaffeineTileProvider.get();
        }

        // Intent tiles.
Loading