Skip to content

Commit

Permalink
Fixed MusicSearchquickSettings not start
Browse files Browse the repository at this point in the history
  • Loading branch information
WSTxda committed Feb 6, 2024
1 parent abd5299 commit ad52f27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ plugins {

android {
namespace = "com.wstxda.gsl"
compileSdk = 34
compileSdk = 33

defaultConfig {
applicationId = "com.wstxda.gsl"
minSdk = 24
targetSdk = 34
targetSdk = 33
versionCode = 360
versionName = "3.6"

Expand Down
21 changes: 8 additions & 13 deletions app/src/main/java/com/wstxda/gsl/MusicSearchQuickSettings.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package com.wstxda.gsl

import android.annotation.SuppressLint
import android.content.Intent
import android.service.quicksettings.Tile
import android.service.quicksettings.TileService

class MusicSearchQuickSettings : TileService() {

// android.service.quicksettings.TileService
@SuppressLint("StartActivityAndCollapseDeprecated")
override fun onClick() {
super.onClick()

if (qsTile.state == Tile.STATE_ACTIVE) {
val intent = Intent("com.google.android.googlequicksearchbox.MUSIC_SEARCH")
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK

try {
startActivityAndCollapse(intent)
} catch (e: Exception) {
e.printStackTrace()
}
}
startActivityAndCollapse(
Intent("com.google.android.googlequicksearchbox.MUSIC_SEARCH").setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK
)
)
}
}

0 comments on commit ad52f27

Please sign in to comment.