Add Bright Display settings tile

This commit is contained in:
darthpaul 2022-10-23 09:50:04 +01:00
parent dc66f8bd66
commit 28bda12ae9
3 changed files with 31 additions and 2 deletions

View File

@ -63,6 +63,7 @@
<activity
android:name=".activities.BrightDisplayActivity"
android:exported="false"
android:launchMode="singleInstance"
android:label="@string/bright_display"
android:theme="@style/FullScreenTheme" />
@ -131,7 +132,7 @@
</receiver>
<service
android:name=".helpers.MyTileService"
android:name=".helpers.FlashlightTileService"
android:exported="true"
android:icon="@drawable/img_torch_widget_preview"
android:label="@string/app_launcher_name"
@ -141,6 +142,17 @@
</intent-filter>
</service>
<service
android:name=".helpers.BrightDisplayTileService"
android:exported="true"
android:icon="@drawable/img_bright_display_widget_preview"
android:label="@string/bright_display"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<activity-alias
android:name=".activities.SplashActivity.Red"
android:enabled="false"

View File

@ -0,0 +1,17 @@
package com.simplemobiletools.flashlight.helpers
import android.annotation.TargetApi
import android.content.Intent
import android.os.Build
import android.service.quicksettings.TileService
import com.simplemobiletools.flashlight.activities.BrightDisplayActivity
@TargetApi(Build.VERSION_CODES.N)
class BrightDisplayTileService : TileService() {
override fun onClick() {
val intent = Intent(applicationContext, BrightDisplayActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
startActivityAndCollapse(intent)
}
}

View File

@ -6,7 +6,7 @@ import android.service.quicksettings.Tile
import android.service.quicksettings.TileService
@TargetApi(Build.VERSION_CODES.N)
class MyTileService : TileService() {
class FlashlightTileService : TileService() {
override fun onClick() {
MyCameraImpl.newInstance(this).toggleFlashlight()