Update some dependencies and adapt where necessary

This commit is contained in:
Ryan Harg 2021-07-01 11:25:09 +00:00
parent 6bdc7f09ff
commit 4a1630032d
6 changed files with 109 additions and 79 deletions

View File

@ -1,6 +1,7 @@
import org.jetbrains.kotlin.konan.properties.hasProperty
import java.io.FileInputStream
import java.util.*
import java.util.Properties
plugins {
id("com.android.application")
@ -113,15 +114,15 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0")
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("androidx.core:core-ktx:1.5.0-alpha02")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha07")
implementation("androidx.appcompat:appcompat:1.3.0")
implementation("androidx.core:core-ktx:1.6.0-rc01")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha02")
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
implementation("androidx.preference:preference:1.1.1")
implementation("androidx.recyclerview:recyclerview:1.1.0")
implementation("androidx.preference:preference-ktx:1.1.1")
implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("com.google.android.material:material:1.3.0-alpha02")
implementation("com.android.support.constraint:constraint-layout:2.0.1")
implementation("com.google.android.material:material:1.4.0-rc01")
implementation("com.android.support.constraint:constraint-layout:2.0.4")
implementation("com.google.android.exoplayer:exoplayer-core:2.11.5")
implementation("com.google.android.exoplayer:exoplayer-ui:2.11.5")
@ -133,12 +134,12 @@ dependencies {
isTransitive = false
}
implementation("com.aliassadi:power-preference-lib:1.4.1")
implementation("com.aliassadi:power-preference-lib:2.0.0")
implementation("com.github.kittinunf.fuel:fuel:2.1.0")
implementation("com.github.kittinunf.fuel:fuel-coroutines:2.1.0")
implementation("com.github.kittinunf.fuel:fuel-android:2.1.0")
implementation("com.github.kittinunf.fuel:fuel-gson:2.1.0")
implementation("com.google.code.gson:gson:2.8.6")
implementation("com.squareup.picasso:picasso:2.71828")
implementation("jp.wasabeef:picasso-transformations:2.2.1")
implementation("jp.wasabeef:picasso-transformations:2.4.0")
}

View File

@ -122,7 +122,8 @@ class MainActivity : AppCompatActivity() {
CommandBus.send(Command.ToggleState)
}
now_playing_details_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
now_playing_details_progress.setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
override fun onStopTrackingTouch(view: SeekBar?) {}
override fun onStartTrackingTouch(view: SeekBar?) {}
@ -135,7 +136,8 @@ class MainActivity : AppCompatActivity() {
})
landscape_queue?.let {
supportFragmentManager.beginTransaction().replace(R.id.landscape_queue, LandscapeQueueFragment()).commit()
supportFragmentManager.beginTransaction()
.replace(R.id.landscape_queue, LandscapeQueueFragment()).commit()
}
}
@ -205,8 +207,7 @@ class MainActivity : AppCompatActivity() {
menu.findItem(R.id.nav_all_music).isEnabled = false
menu.findItem(R.id.nav_my_music).isChecked = false
menu.findItem(R.id.nav_followed).isChecked = false
PowerPreference.getDefaultFile().set("scope", "all")
PowerPreference.getDefaultFile().setString("scope", "all")
EventBus.send(Event.ListingsChanged)
return false
@ -234,7 +235,7 @@ class MainActivity : AppCompatActivity() {
scopes.add("all")
}
PowerPreference.getDefaultFile().set("scope", scopes.joinToString(","))
PowerPreference.getDefaultFile().setString("scope", scopes.joinToString(","))
EventBus.send(Event.ListingsChanged)
return false
@ -254,7 +255,8 @@ class MainActivity : AppCompatActivity() {
Intent(this, LoginActivity::class.java).apply {
Otter.get().deleteAllData()
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
flags =
Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
stopService(Intent(this@MainActivity, PlayerService::class.java))
startActivity(this)
@ -382,8 +384,8 @@ class MainActivity : AppCompatActivity() {
is Command.RefreshTrack -> refreshCurrentTrack(command.track)
is Command.AddToPlaylist -> if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
AddToPlaylistDialog.show(this@MainActivity, lifecycleScope, command.tracks)
}
AddToPlaylistDialog.show(this@MainActivity, lifecycleScope, command.tracks)
}
}
}
}
@ -484,14 +486,25 @@ class MainActivity : AppCompatActivity() {
now_playing_details_info?.let { now_playing_details_info ->
now_playing_details_info.setOnClickListener {
PopupMenu(this@MainActivity, now_playing_details_info, Gravity.START, R.attr.actionOverflowMenuStyle, 0).apply {
PopupMenu(
this@MainActivity,
now_playing_details_info,
Gravity.START,
R.attr.actionOverflowMenuStyle,
0
).apply {
inflate(R.menu.track_info)
setOnMenuItemClickListener {
when (it.itemId) {
R.id.track_info_artist -> ArtistsFragment.openAlbums(this@MainActivity, track.artist, art = track.album?.cover())
R.id.track_info_artist -> ArtistsFragment.openAlbums(
this@MainActivity,
track.artist,
art = track.album?.cover()
)
R.id.track_info_album -> AlbumsFragment.openTracks(this@MainActivity, track.album)
R.id.track_info_details -> TrackInfoDetailsFragment.new(track).show(supportFragmentManager, "dialog")
R.id.track_info_details -> TrackInfoDetailsFragment.new(track)
.show(supportFragmentManager, "dialog")
}
now_playing.close()
@ -548,7 +561,12 @@ class MainActivity : AppCompatActivity() {
Cache.set(this@MainActivity, "repeat", "0".toByteArray())
now_playing_details_repeat?.setImageResource(R.drawable.repeat)
now_playing_details_repeat?.setColorFilter(ContextCompat.getColor(this, R.color.controlForeground))
now_playing_details_repeat?.setColorFilter(
ContextCompat.getColor(
this,
R.color.controlForeground
)
)
now_playing_details_repeat?.alpha = 0.2f
CommandBus.send(Command.SetRepeatMode(Player.REPEAT_MODE_OFF))
@ -559,7 +577,12 @@ class MainActivity : AppCompatActivity() {
Cache.set(this@MainActivity, "repeat", "1".toByteArray())
now_playing_details_repeat?.setImageResource(R.drawable.repeat)
now_playing_details_repeat?.setColorFilter(ContextCompat.getColor(this, R.color.controlForeground))
now_playing_details_repeat?.setColorFilter(
ContextCompat.getColor(
this,
R.color.controlForeground
)
)
now_playing_details_repeat?.alpha = 1.0f
CommandBus.send(Command.SetRepeatMode(Player.REPEAT_MODE_ALL))
@ -569,7 +592,12 @@ class MainActivity : AppCompatActivity() {
2 -> {
Cache.set(this@MainActivity, "repeat", "2".toByteArray())
now_playing_details_repeat?.setImageResource(R.drawable.repeat_one)
now_playing_details_repeat?.setColorFilter(ContextCompat.getColor(this, R.color.controlForeground))
now_playing_details_repeat?.setColorFilter(
ContextCompat.getColor(
this,
R.color.controlForeground
)
)
now_playing_details_repeat?.alpha = 1.0f
CommandBus.send(Command.SetRepeatMode(Player.REPEAT_MODE_ONE))

View File

@ -156,7 +156,7 @@
android:layout_margin="8dp"
android:contentDescription="@string/alt_track_info"
android:src="@drawable/more"
android:tint="@color/controlForeground" />
app:tint="@color/controlForeground" />
</LinearLayout>
@ -245,4 +245,4 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -130,7 +130,7 @@
android:background="@drawable/circle"
android:contentDescription="@string/alt_track_info"
android:src="@drawable/more"
android:tint="@color/controlForeground" />
app:tint="@color/controlForeground" />
</FrameLayout>
@ -277,4 +277,4 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -1,60 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="6dp"
android:paddingEnd="16dp"
android:paddingBottom="6dp"
tools:showIn="@layout/activity_downloads">
<LinearLayout
android:layout_width="0dp"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="6dp"
android:paddingEnd="16dp"
android:paddingBottom="6dp"
tools:showIn="@layout/activity_downloads">
<TextView
android:id="@+id/title"
style="@style/AppTheme.ItemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Track title" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Artist name" />
<TextView
android:id="@+id/title"
style="@style/AppTheme.ItemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Track title" />
<ProgressBar
android:id="@+id/progress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Artist name" />
</LinearLayout>
<ProgressBar
android:id="@+id/progress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/toggle"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:src="@drawable/pause" />
</LinearLayout>
<ImageButton
android:id="@+id/delete"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:src="@drawable/delete"
android:tint="@color/colorAccent" />
<ImageButton
android:id="@+id/toggle"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:src="@drawable/pause" />
</LinearLayout>
<ImageButton
android:id="@+id/delete"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:src="@drawable/delete"
app:tint="@color/colorAccent" />
</LinearLayout>

View File

@ -75,4 +75,4 @@
android:contentDescription="@string/alt_more_options"
android:src="@drawable/more" />
</LinearLayout>
</LinearLayout>