sdm660-common: XiaomiDoze: Add Doze Tile
- Launches DozeSettingsActivity
* Reference: 827d11cc8b
Signed-off-by: AnierinB <anierinb@evolution-x.org>
Signed-off-by: OdSazib <odsazib@gmail.com>
This commit is contained in:
parent
fe22a9fdc9
commit
88279b484c
4 changed files with 84 additions and 0 deletions
|
@ -54,6 +54,17 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="org.lineageos.settings.doze.DozeTileService"
|
||||||
|
android:icon="@drawable/ic_doze"
|
||||||
|
android:label="@string/ambient_display_gestures_title"
|
||||||
|
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
||||||
|
<intent-filter>
|
||||||
|
<action
|
||||||
|
android:name="android.service.quicksettings.action.QS_TILE"/>
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
9
XiaomiDoze/res/drawable/ic_doze.xml
Normal file
9
XiaomiDoze/res/drawable/ic_doze.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<!-- drawable/cellphone_text.xml -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:width="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?android:attr/colorControlNormal">
|
||||||
|
<path android:fillColor="#FFFFFFFF" android:pathData="M17,19V5H7V19H17M17,1A2,2 0 0,1 19,3V21A2,2 0 0,1 17,23H7C5.89,23 5,22.1 5,21V3C5,1.89 5.89,1 7,1H17M9,7H15V9H9V7M9,11H13V13H9V11Z" />
|
||||||
|
</vector>
|
|
@ -56,4 +56,7 @@
|
||||||
<!-- Help texts -->
|
<!-- Help texts -->
|
||||||
<string name="doze_settings_help_title">Help</string>
|
<string name="doze_settings_help_title">Help</string>
|
||||||
<string name="doze_settings_help_text">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.</string>
|
<string name="doze_settings_help_text">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.</string>
|
||||||
|
|
||||||
|
<!-- Doze Tile Service -->
|
||||||
|
<string name="ambient_display_gestures_title">Ambient Display Gesture</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue