Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develope' into develope
Browse files Browse the repository at this point in the history
  • Loading branch information
ZTFtrue committed Nov 15, 2024
2 parents 20615e6 + 713a452 commit 98dadbc
Show file tree
Hide file tree
Showing 57 changed files with 457 additions and 117 deletions.
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> <!-- <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <!-- <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> -->
<!-- <uses-permission android:name="android.permission.BLUETOOTH" />-->
<!-- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />-->
<!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />-->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT" />
Expand Down Expand Up @@ -83,6 +87,11 @@
android:resource="@xml/file_paths"
android:value="androidx.startup" />
</provider>
<!-- <receiver android:name=".utils.BluetoothConnectionReceiver" android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.bluetooth.device.action.ACL_CONNECTED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
</application>

</manifest>
1 change: 0 additions & 1 deletion app/src/main/java/com/ztftrue/music/ErrorTipActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/ztftrue/music/PlayMusicWidget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.support.v4.media.session.PlaybackStateCompat
import android.util.Log
import android.util.SizeF
import android.widget.RemoteViews
import androidx.annotation.OptIn
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/java/com/ztftrue/music/play/PlayService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package com.ztftrue.music.play
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.bluetooth.BluetoothDevice
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.BitmapFactory
import android.os.Bundle
import android.os.CountDownTimer
Expand Down Expand Up @@ -49,6 +51,7 @@ import com.ztftrue.music.sqlData.model.MainTab
import com.ztftrue.music.sqlData.model.MusicItem
import com.ztftrue.music.sqlData.model.PlayConfig
import com.ztftrue.music.sqlData.model.SortFiledData
import com.ztftrue.music.utils.BluetoothConnectionReceiver
import com.ztftrue.music.utils.PlayListType
import com.ztftrue.music.utils.SharedPreferencesUtils
import com.ztftrue.music.utils.Utils
Expand Down Expand Up @@ -177,11 +180,18 @@ class PlayService : MediaBrowserServiceCompat() {
var playCompleted = false
var needPlayPause = false
var sleepTime = 0L
var receiver: BluetoothConnectionReceiver? = null
private var countDownTimer: CountDownTimer? = null
override fun onCreate() {
super.onCreate()
// visualizationAudioProcessor = VisualizationAudioProcessor(mediaSession)
initExo(this@PlayService)
if (SharedPreferencesUtils.getAutoPlayEnable(this)) {
receiver = BluetoothConnectionReceiver(exoPlayer)
val filter = IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED)
filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED)
filter.addAction(Intent.ACTION_HEADSET_PLUG)
registerReceiver(receiver, filter)
}
val contentIntent = Intent(this, MainActivity::class.java)
val pendingContentIntent = PendingIntent.getActivity(
this, 0, contentIntent,
Expand Down Expand Up @@ -1141,6 +1151,9 @@ class PlayService : MediaBrowserServiceCompat() {
exoPlayer.release()
} catch (_: Exception) {
}
if (receiver != null) {
unregisterReceiver(receiver)
}
super.onDestroy()
}

Expand Down Expand Up @@ -1281,7 +1294,7 @@ class PlayService : MediaBrowserServiceCompat() {
exoPlayer.setAudioAttributes(
AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
.setContentType(C.AUDIO_CONTENT_TYPE_MOVIE)
.setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
.build(),
true
)
Expand Down
Loading

0 comments on commit 98dadbc

Please sign in to comment.