Skip to content

Commit

Permalink
Added Quick-Tile service to start tradow tracking from quick-setting-…
Browse files Browse the repository at this point in the history
…drawer
  • Loading branch information
HarshPanchal18 committed Mar 9, 2024
1 parent d157410 commit 9354dae
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

15 changes: 14 additions & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
android:enabled="true"
android:foregroundServiceType="location" />

<service
android:name="dev.harsh.tradow.quicksetting.TrackingQsTile"
android:enabled="true"
android:icon="@drawable/location"
android:roundIcon="@drawable/location"
android:exported="true"
android:label="Start Tradow tracking"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
</application>

</manifest>
21 changes: 21 additions & 0 deletions app/src/main/java/dev/harsh/tradow/quicksetting/TrackingQsTile.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.harsh.tradow.quicksetting

import android.content.Intent
import android.service.quicksettings.TileService
import dev.harsh.tradow.service.BackgroundService
import dev.harsh.tradow.util.showShortToast

class TrackingQsTile : TileService() {

override fun onClick() {
super.onClick()
startService(Intent(applicationContext, BackgroundService::class.java))
applicationContext.showShortToast("Tradow is active")
}

override fun onDestroy() {
super.onDestroy()
stopService(Intent(applicationContext, BackgroundService::class.java))
applicationContext.showShortToast("Tradow is inactive")
}
}

0 comments on commit 9354dae

Please sign in to comment.