diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt index 4f278e5e..44483a3b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt @@ -4,10 +4,12 @@ import android.app.ActivityOptions import android.content.Intent import android.graphics.Color import android.os.Bundle -import android.transition.Slide -import android.view.* -import android.view.animation.AnimationUtils +import android.view.Menu +import android.view.MenuItem +import android.view.SubMenu +import android.view.View import android.widget.ImageView +import androidx.core.app.ActivityCompat import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager @@ -38,20 +40,18 @@ import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.PreferenceUtil import com.bumptech.glide.Glide -import io.reactivex.disposables.CompositeDisposable import kotlinx.android.synthetic.main.activity_album.* import kotlinx.android.synthetic.main.activity_album_content.* import java.util.* import javax.inject.Inject import android.util.Pair as UtilPair + class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { private lateinit var simpleSongAdapter: SimpleSongAdapter - private var disposable = CompositeDisposable() - private lateinit var album: Album - + private lateinit var artistImage: ImageView private val savedSortOrder: String get() = PreferenceUtil.getInstance(this).albumDetailSongSortOrder @@ -59,21 +59,11 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { return wrapSlidingMusicPanel(R.layout.activity_album) } - private fun setupWindowTransition() { - val slide = Slide(Gravity.BOTTOM) - slide.excludeTarget(android.R.id.statusBarBackground, true) - slide.excludeTarget(android.R.id.navigationBarBackground, true) - slide.excludeTarget(toolbar, true) - slide.interpolator = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in) - window.enterTransition = slide - } - @Inject lateinit var albumDetailsPresenter: AlbumDetailsPresenter override fun onCreate(savedInstanceState: Bundle?) { setDrawUnderStatusBar() - //setupWindowTransition() super.onCreate(savedInstanceState) toggleBottomNavigationView(true) setStatusbarColor(Color.TRANSPARENT) @@ -82,9 +72,9 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { setLightNavigationBar(true) setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary))) - App.musicComponent.inject(this) - postponeEnterTransition() + ActivityCompat.postponeEnterTransition(this) + App.musicComponent.inject(this) artistImage = findViewById(R.id.artistImage) setupRecyclerView() @@ -122,12 +112,11 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { override fun onDestroy() { super.onDestroy() - disposable.dispose() albumDetailsPresenter.detachView() } override fun complete() { - scheduleStartPostponedTransition(image) + ActivityCompat.startPostponedEnterTransition(this) } override fun album(album: Album) { @@ -149,7 +138,6 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { albumDetailsPresenter.loadMore(album.artistId) } - private lateinit var artistImage: ImageView override fun moreAlbums(albums: ArrayList) { moreTitle.show() @@ -186,16 +174,6 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { }) } - private fun scheduleStartPostponedTransition(image: ImageView) { - image.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener { - override fun onPreDraw(): Boolean { - image.viewTreeObserver.removeOnPreDrawListener(this) - startPostponedEnterTransition(); - return true; - } - }) - } - private fun setColors(color: Int) { val themeColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color else ThemeStore.accentColor(this) @@ -212,10 +190,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView { toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary)) setSupportActionBar(toolbar) supportActionBar?.title = null - } - override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_album_detail, menu) val sortOrder = menu.findItem(R.id.action_sort_order) diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt index 60dbebee..b1f21096 100755 --- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt @@ -7,12 +7,9 @@ import android.os.Build import android.os.Bundle import android.text.Html import android.text.Spanned -import android.transition.Slide -import android.view.Gravity import android.view.Menu import android.view.MenuItem import android.view.View -import android.view.animation.AnimationUtils import android.widget.Toast import androidx.core.app.ActivityCompat import androidx.recyclerview.widget.DefaultItemAnimator @@ -54,12 +51,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView { private lateinit var albumAdapter: AlbumAdapter private var forceDownload: Boolean = false - private fun setupWindowTransitions() { - val slide = Slide(Gravity.BOTTOM) - slide.interpolator = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in) - window.enterTransition = slide - } - override fun createContentView(): View { return wrapSlidingMusicPanel(R.layout.activity_artist_details) } @@ -69,7 +60,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView { override fun onCreate(savedInstanceState: Bundle?) { setDrawUnderStatusBar() - // setupWindowTransitions() super.onCreate(savedInstanceState) toggleBottomNavigationView(true) setStatusbarColor(Color.TRANSPARENT) @@ -128,7 +118,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView { } - private fun setupRecyclerView() { albumAdapter = HorizontalAlbumAdapter(this, ArrayList(), false, null) albumRecyclerView.apply { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt index b065af76..0ca1aa53 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/LockScreenActivity.kt @@ -19,7 +19,7 @@ import com.r0adkll.slidr.Slidr import com.r0adkll.slidr.model.SlidrConfig import com.r0adkll.slidr.model.SlidrListener import com.r0adkll.slidr.model.SlidrPosition -import kotlinx.android.synthetic.main.activity_album.* +import kotlinx.android.synthetic.main.activity_lock_screen.* class LockScreenActivity : AbsMusicServiceActivity() { private var fragment: LockScreenPlayerControlsFragment? = null @@ -102,7 +102,7 @@ class LockScreenActivity : AbsMusicServiceActivity() { .checkIgnoreMediaStore(this) .generatePalette(this).build() .dontAnimate() - .into(object : RetroMusicColoredTarget(image) { + .into(object : RetroMusicColoredTarget(image ) { override fun onColorReady(color: Int) { fragment?.setDark(color) } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt index 6cb70c83..ef162ee1 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt @@ -14,7 +14,6 @@ import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter import code.name.monkey.retromusic.extensions.applyToolbar import code.name.monkey.retromusic.helper.MusicPlayerRemote -import code.name.monkey.retromusic.util.DensityUtil import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.ViewUtil import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator @@ -106,8 +105,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() { } private fun checkForPadding() { - val height = DensityUtil.dip2px(this, 102f) - recyclerView.setPadding(0, 0, 0, (height)) + } override fun onQueueChanged() { diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt index 0ffe9a5f..98d5aa15 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt @@ -162,10 +162,8 @@ open class AlbumAdapter(protected val activity: AppCompatActivity, inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { init { - setImageTransitionName(activity.getString(code.name.monkey.retromusic.R.string.transition_album_art)) - if (menu != null) { - menu!!.visibility = View.GONE - } + setImageTransitionName(activity.getString(R.string.transition_album_art)) + menu?.visibility = View.GONE } override fun onClick(v: View?) { diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/artist/ArtistAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/artist/ArtistAdapter.kt index 51d89b2c..75cb7332 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/artist/ArtistAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/artist/ArtistAdapter.kt @@ -125,7 +125,7 @@ class ArtistAdapter(val activity: AppCompatActivity, inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { init { - setImageTransitionName(activity.getString(code.name.monkey.retromusic.R.string.transition_artist_image)) + setImageTransitionName(activity.getString(R.string.transition_artist_image)) menu?.visibility = View.GONE } diff --git a/app/src/main/java/code/name/monkey/retromusic/model/Song.kt b/app/src/main/java/code/name/monkey/retromusic/model/Song.kt index 6382f60c..711bd890 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/Song.kt +++ b/app/src/main/java/code/name/monkey/retromusic/model/Song.kt @@ -17,11 +17,37 @@ import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize -open class Song(val id: Int, val title: String, val trackNumber: Int, val year: Int, val duration: Long, val data: String, val dateModified: Long, val albumId: Int, val albumName: String, val artistId: Int, val artistName: String, val composer: String?) : Parcelable { +open class Song( + val id: Int, + val title: String, + val trackNumber: Int, + val year: Int, + val duration: Long, + val data: String, + val dateModified: Long, + val albumId: Int, + val albumName: String, + val artistId: Int, + val artistName: String, + val composer: String? +) : Parcelable { companion object { @JvmStatic - val emptySong = Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", "") + val emptySong = Song( + -1, + "", + -1, + -1, + -1, + "", + -1, + -1, + "", + -1, + "", + "" + ) } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java index 3de177e5..5560ca6d 100755 --- a/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java @@ -62,10 +62,10 @@ public class NavigationUtil { public static void goToAlbumOptions(@NonNull Activity activity, int albumId, - @NonNull ActivityOptions activityOptions) { + @NonNull ActivityOptions options) { Intent intent = new Intent(activity, AlbumDetailsActivity.class); intent.putExtra(AlbumDetailsActivity.EXTRA_ALBUM_ID, albumId); - ActivityCompat.startActivity(activity, intent, activityOptions.toBundle()); + ActivityCompat.startActivity(activity, intent, options.toBundle()); } public static void goToArtistOptions(@NotNull AppCompatActivity activity, diff --git a/app/src/main/res/layout/activity_playing_queue.xml b/app/src/main/res/layout/activity_playing_queue.xml index 503ac4b8..3bebd9e3 100755 --- a/app/src/main/res/layout/activity_playing_queue.xml +++ b/app/src/main/res/layout/activity_playing_queue.xml @@ -47,6 +47,7 @@ android:layout_height="match_parent" android:clipToPadding="false" android:layoutAnimation="@anim/layout_animation_fall_down" + android:paddingBottom="96dp" android:scrollbars="none" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index aa8ffee5..c27c949b 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -76,4 +76,8 @@ + + + + \ No newline at end of file