From 88279b484cff84da131f3e371e1add30cb0ffd71 Mon Sep 17 00:00:00 2001 From: AnierinB Date: Fri, 7 Aug 2020 15:55:20 +0600 Subject: [PATCH] sdm660-common: XiaomiDoze: Add Doze Tile - Launches DozeSettingsActivity * Reference: https://github.com/Evolution-X-Devices/device_oneplus_sdm845-common/commit/827d11cc8b4bc8d6bab8a8bb4a965da204c1115d Signed-off-by: AnierinB Signed-off-by: OdSazib --- XiaomiDoze/AndroidManifest.xml | 11 ++++ XiaomiDoze/res/drawable/ic_doze.xml | 9 +++ XiaomiDoze/res/values/strings.xml | 3 + .../settings/doze/DozeTileService.java | 61 +++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 XiaomiDoze/res/drawable/ic_doze.xml create mode 100644 XiaomiDoze/src/org/lineageos/settings/doze/DozeTileService.java diff --git a/XiaomiDoze/AndroidManifest.xml b/XiaomiDoze/AndroidManifest.xml index 93f5a3bf..bf2c80d9 100644 --- a/XiaomiDoze/AndroidManifest.xml +++ b/XiaomiDoze/AndroidManifest.xml @@ -54,6 +54,17 @@ + + + + + + diff --git a/XiaomiDoze/res/drawable/ic_doze.xml b/XiaomiDoze/res/drawable/ic_doze.xml new file mode 100644 index 00000000..58810644 --- /dev/null +++ b/XiaomiDoze/res/drawable/ic_doze.xml @@ -0,0 +1,9 @@ + + + + diff --git a/XiaomiDoze/res/values/strings.xml b/XiaomiDoze/res/values/strings.xml index 8fd65f0f..34c9debb 100644 --- a/XiaomiDoze/res/values/strings.xml +++ b/XiaomiDoze/res/values/strings.xml @@ -56,4 +56,7 @@ Help These features use sensor events to launch a doze notification pulse. The chosen sensor is only enabled when the device receives a notification, this helps to reduce battery usage. There is also an option to enable the chosen sensor as soon as the screen turns off, this will cause higher battery usage. + + + Ambient Display Gesture diff --git a/XiaomiDoze/src/org/lineageos/settings/doze/DozeTileService.java b/XiaomiDoze/src/org/lineageos/settings/doze/DozeTileService.java new file mode 100644 index 00000000..0a57d781 --- /dev/null +++ b/XiaomiDoze/src/org/lineageos/settings/doze/DozeTileService.java @@ -0,0 +1,61 @@ +/* +* Copyright (C) 2019-20 Evolution X Project +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +*/ +package org.lineageos.settings.doze; + +import android.annotation.TargetApi; +import android.content.Intent; +import android.service.quicksettings.Tile; +import android.service.quicksettings.TileService; + +import org.lineageos.settings.doze.R; + +@TargetApi(24) +public class DozeTileService extends TileService { + @Override + public void onDestroy() { + super.onDestroy(); + } + + @Override + public void onTileAdded() { + super.onTileAdded(); + } + + @Override + public void onTileRemoved() { + super.onTileRemoved(); + } + + @Override + public void onStartListening() { + super.onStartListening(); + } + + @Override + public void onStopListening() { + super.onStopListening(); + } + + @Override + public void onClick() { + super.onClick(); + Intent XiaomiDoze = new Intent(this, DozeSettingsActivity.class); + XiaomiDoze.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivityAndCollapse(XiaomiDoze); + } +}