mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-26 21:52:16 +03:00
Clean up Util.kt after conversion
(currentSong was assigned but never actually used)
This commit is contained in:
parent
fc2e4b7ae4
commit
a051d4d040
@ -125,8 +125,6 @@ public final class Constants
|
|||||||
public static final String PREFERENCES_KEY_DEFAULT_SHARE_GREETING = "sharingDefaultGreeting";
|
public static final String PREFERENCES_KEY_DEFAULT_SHARE_GREETING = "sharingDefaultGreeting";
|
||||||
public static final String PREFERENCES_KEY_DEFAULT_SHARE_EXPIRATION = "sharingDefaultExpiration";
|
public static final String PREFERENCES_KEY_DEFAULT_SHARE_EXPIRATION = "sharingDefaultExpiration";
|
||||||
public static final String PREFERENCES_KEY_SHOW_ALL_SONGS_BY_ARTIST = "showAllSongsByArtist";
|
public static final String PREFERENCES_KEY_SHOW_ALL_SONGS_BY_ARTIST = "showAllSongsByArtist";
|
||||||
public static final String PREFERENCES_KEY_IMAGE_LOADER_CONCURRENCY = "imageLoaderConcurrency";
|
|
||||||
public static final String PREFERENCES_KEY_FF_IMAGE_LOADER = "ff_new_image_loader";
|
|
||||||
public static final String PREFERENCES_KEY_USE_FIVE_STAR_RATING = "use_five_star_rating";
|
public static final String PREFERENCES_KEY_USE_FIVE_STAR_RATING = "use_five_star_rating";
|
||||||
public static final String PREFERENCES_KEY_CATEGORY_NOTIFICATIONS = "notificationsCategory";
|
public static final String PREFERENCES_KEY_CATEGORY_NOTIFICATIONS = "notificationsCategory";
|
||||||
public static final String PREFERENCES_KEY_FIRST_RUN_EXECUTED = "firstRunExecuted";
|
public static final String PREFERENCES_KEY_FIRST_RUN_EXECUTED = "firstRunExecuted";
|
||||||
|
@ -96,7 +96,6 @@ object Util {
|
|||||||
private val HEX_DIGITS =
|
private val HEX_DIGITS =
|
||||||
charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')
|
charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')
|
||||||
private var toast: Toast? = null
|
private var toast: Toast? = null
|
||||||
private var currentSong: MusicDirectory.Entry? = null
|
|
||||||
|
|
||||||
// Retrieves an instance of the application Context
|
// Retrieves an instance of the application Context
|
||||||
fun appContext(): Context {
|
fun appContext(): Context {
|
||||||
@ -717,9 +716,6 @@ object Util {
|
|||||||
avrcpIntent.putExtra("duration", 0.toLong())
|
avrcpIntent.putExtra("duration", 0.toLong())
|
||||||
avrcpIntent.putExtra("position", 0.toLong())
|
avrcpIntent.putExtra("position", 0.toLong())
|
||||||
} else {
|
} else {
|
||||||
if (song !== currentSong) {
|
|
||||||
currentSong = song
|
|
||||||
}
|
|
||||||
val title = song.title
|
val title = song.title
|
||||||
val artist = song.artist
|
val artist = song.artist
|
||||||
val album = song.album
|
val album = song.album
|
||||||
@ -755,7 +751,7 @@ object Util {
|
|||||||
fun broadcastA2dpPlayStatusChange(
|
fun broadcastA2dpPlayStatusChange(
|
||||||
context: Context,
|
context: Context,
|
||||||
state: PlayerState?,
|
state: PlayerState?,
|
||||||
currentSong: MusicDirectory.Entry?,
|
newSong: MusicDirectory.Entry?,
|
||||||
listSize: Int,
|
listSize: Int,
|
||||||
id: Int,
|
id: Int,
|
||||||
playerPosition: Int
|
playerPosition: Int
|
||||||
@ -763,20 +759,13 @@ object Util {
|
|||||||
if (!shouldSendBluetoothNotifications) {
|
if (!shouldSendBluetoothNotifications) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (currentSong != null) {
|
if (newSong != null) {
|
||||||
val avrcpIntent = Intent(CM_AVRCP_PLAYSTATE_CHANGED)
|
val avrcpIntent = Intent(CM_AVRCP_PLAYSTATE_CHANGED)
|
||||||
if (currentSong == null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME This is probably a bug.
|
val title = newSong.title
|
||||||
if (currentSong !== currentSong) {
|
val artist = newSong.artist
|
||||||
Util.currentSong = currentSong
|
val album = newSong.album
|
||||||
}
|
val duration = newSong.duration
|
||||||
val title = currentSong.title
|
|
||||||
val artist = currentSong.artist
|
|
||||||
val album = currentSong.album
|
|
||||||
val duration = currentSong.duration
|
|
||||||
|
|
||||||
avrcpIntent.putExtra("track", title)
|
avrcpIntent.putExtra("track", title)
|
||||||
avrcpIntent.putExtra("track_name", title)
|
avrcpIntent.putExtra("track_name", title)
|
||||||
@ -788,7 +777,7 @@ object Util {
|
|||||||
avrcpIntent.putExtra("album_artist_name", artist)
|
avrcpIntent.putExtra("album_artist_name", artist)
|
||||||
|
|
||||||
if (getShouldSendBluetoothAlbumArt()) {
|
if (getShouldSendBluetoothAlbumArt()) {
|
||||||
val albumArtFile = FileUtil.getAlbumArtFile(currentSong)
|
val albumArtFile = FileUtil.getAlbumArtFile(newSong)
|
||||||
avrcpIntent.putExtra("coverart", albumArtFile.absolutePath)
|
avrcpIntent.putExtra("coverart", albumArtFile.absolutePath)
|
||||||
avrcpIntent.putExtra("cover", albumArtFile.absolutePath)
|
avrcpIntent.putExtra("cover", albumArtFile.absolutePath)
|
||||||
}
|
}
|
||||||
@ -1199,14 +1188,6 @@ object Util {
|
|||||||
appContext().sendBroadcast(scanFileIntent)
|
appContext().sendBroadcast(scanFileIntent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun imageLoaderConcurrency(): Int {
|
|
||||||
val preferences = getPreferences()
|
|
||||||
return preferences.getString(
|
|
||||||
Constants.PREFERENCES_KEY_IMAGE_LOADER_CONCURRENCY,
|
|
||||||
"5"
|
|
||||||
)!!.toInt()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getResourceFromAttribute(context: Context, resId: Int): Int {
|
fun getResourceFromAttribute(context: Context, resId: Int): Int {
|
||||||
val typedValue = TypedValue()
|
val typedValue = TypedValue()
|
||||||
val theme = context.theme
|
val theme = context.theme
|
||||||
|
Loading…
x
Reference in New Issue
Block a user