removing INIT_EQUALIZER command, doesnt seem to be needed anymore

This commit is contained in:
tibbi 2021-02-28 22:30:30 +01:00
parent b99c27c514
commit 61f285fd2c
4 changed files with 2 additions and 19 deletions

View file

@ -138,7 +138,6 @@
<action android:name="com.simplemobiletools.musicplayer.action.INIT"/> <action android:name="com.simplemobiletools.musicplayer.action.INIT"/>
<action android:name="com.simplemobiletools.musicplayer.action.INIT_PATH"/> <action android:name="com.simplemobiletools.musicplayer.action.INIT_PATH"/>
<action android:name="com.simplemobiletools.musicplayer.action.INIT_QUEUE"/> <action android:name="com.simplemobiletools.musicplayer.action.INIT_QUEUE"/>
<action android:name="com.simplemobiletools.musicplayer.action.INIT_EQUALIZER"/>
<action android:name="com.simplemobiletools.musicplayer.action.FINISH"/> <action android:name="com.simplemobiletools.musicplayer.action.FINISH"/>
<action android:name="com.simplemobiletools.musicplayer.action.FINISH_IF_NOT_PLAYING"/> <action android:name="com.simplemobiletools.musicplayer.action.FINISH_IF_NOT_PLAYING"/>
<action android:name="com.simplemobiletools.musicplayer.action.PREVIOUS"/> <action android:name="com.simplemobiletools.musicplayer.action.PREVIOUS"/>

View file

@ -6,7 +6,6 @@ import android.content.Intent
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.media.AudioManager import android.media.AudioManager
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.widget.RelativeLayout import android.widget.RelativeLayout
@ -30,7 +29,6 @@ import com.simplemobiletools.musicplayer.dialogs.NewPlaylistDialog
import com.simplemobiletools.musicplayer.dialogs.SleepTimerCustomDialog import com.simplemobiletools.musicplayer.dialogs.SleepTimerCustomDialog
import com.simplemobiletools.musicplayer.extensions.* import com.simplemobiletools.musicplayer.extensions.*
import com.simplemobiletools.musicplayer.fragments.MyViewPagerFragment import com.simplemobiletools.musicplayer.fragments.MyViewPagerFragment
import com.simplemobiletools.musicplayer.helpers.INIT_EQUALIZER
import com.simplemobiletools.musicplayer.helpers.INIT_QUEUE import com.simplemobiletools.musicplayer.helpers.INIT_QUEUE
import com.simplemobiletools.musicplayer.helpers.START_SLEEP_TIMER import com.simplemobiletools.musicplayer.helpers.START_SLEEP_TIMER
import com.simplemobiletools.musicplayer.helpers.STOP_SLEEP_TIMER import com.simplemobiletools.musicplayer.helpers.STOP_SLEEP_TIMER
@ -63,7 +61,6 @@ class MainActivity : SimpleActivity() {
handlePermission(PERMISSION_WRITE_STORAGE) { handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) { if (it) {
initActivity() initActivity()
sendIntent(INIT_EQUALIZER)
} else { } else {
toast(R.string.no_storage_permissions) toast(R.string.no_storage_permissions)
finish() finish()
@ -91,13 +88,6 @@ class MainActivity : SimpleActivity() {
getAllFragments().forEach { getAllFragments().forEach {
it?.setupColors(config.textColor, adjustedPrimaryColor) it?.setupColors(config.textColor, adjustedPrimaryColor)
} }
// equalizer can sometimes reset on app start/resume, no idea why. Lets just wait a bit and reenable it
Handler().postDelayed({
if (MusicService.mPlayer != null && MusicService.mCurrTrack != null) {
sendIntent(INIT_EQUALIZER)
}
}, 2000)
} }
override fun onDestroy() { override fun onDestroy() {

View file

@ -24,7 +24,6 @@ val artworkUri = Uri.parse("content://media/external/audio/albumart")
const val INIT = PATH + "INIT" const val INIT = PATH + "INIT"
const val INIT_PATH = PATH + "INIT_PATH" const val INIT_PATH = PATH + "INIT_PATH"
const val INIT_QUEUE = PATH + "INIT_QUEUE" const val INIT_QUEUE = PATH + "INIT_QUEUE"
const val INIT_EQUALIZER = PATH + "INIT_EQUALIZER"
const val FINISH = PATH + "FINISH" const val FINISH = PATH + "FINISH"
const val FINISH_IF_NOT_PLAYING = PATH + "FINISH_IF_NOT_PLAYING" const val FINISH_IF_NOT_PLAYING = PATH + "FINISH_IF_NOT_PLAYING"
const val PREVIOUS = PATH + "PREVIOUS" const val PREVIOUS = PATH + "PREVIOUS"

View file

@ -134,7 +134,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
} }
val action = intent.action val action = intent.action
if (isOreoPlus() && action != NEXT && action != PREVIOUS && action != PLAYPAUSE && action != INIT_EQUALIZER) { if (isOreoPlus() && action != NEXT && action != PREVIOUS && action != PLAYPAUSE) {
setupFakeNotification() setupFakeNotification()
} }
@ -142,7 +142,6 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
INIT -> handleInit(intent) INIT -> handleInit(intent)
INIT_PATH -> handleInitPath(intent) INIT_PATH -> handleInitPath(intent)
INIT_QUEUE -> handleInitQueue() INIT_QUEUE -> handleInitQueue()
INIT_EQUALIZER -> setupEqualizer()
PREVIOUS -> handlePrevious() PREVIOUS -> handlePrevious()
PAUSE -> pauseTrack() PAUSE -> pauseTrack()
PLAYPAUSE -> handlePlayPause() PLAYPAUSE -> handlePlayPause()
@ -162,11 +161,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
} }
MediaButtonReceiver.handleIntent(mMediaSession!!, intent) MediaButtonReceiver.handleIntent(mMediaSession!!, intent)
setupNotification()
if (action != INIT_EQUALIZER) {
setupNotification()
}
return START_NOT_STICKY return START_NOT_STICKY
} }