diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt index f9560e3c..dda06624 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt @@ -623,6 +623,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), fragment: Fragment, tag: String ) { + supportFragmentManager.commit { replace(R.id.fragment_container, fragment, tag) } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt index 0e0b79f4..e7a36f29 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt @@ -40,7 +40,7 @@ class HomeAdapter( .inflate(R.layout.section_recycler_view, parent, false) return when (viewType) { RECENT_ARTISTS, TOP_ARTISTS -> ArtistViewHolder(layout) - PLAYLISTS -> PlaylistViewHolder(layout) + FAVOURITES -> PlaylistViewHolder(layout) SUGGESTIONS -> { SuggestionsViewHolder( LayoutInflater.from(activity).inflate( @@ -89,19 +89,19 @@ class HomeAdapter( val viewHolder = holder as ArtistViewHolder viewHolder.bindView(list[position].arrayList as List, R.string.top_artists) } - PLAYLISTS -> { - val viewHolder = holder as PlaylistViewHolder - viewHolder.bindView( - list[position].arrayList as List, - R.string.favorites - ) - } SUGGESTIONS -> { val viewHolder = holder as SuggestionsViewHolder viewHolder.bindView( list[position].arrayList as List ) } + FAVOURITES -> { + val viewHolder = holder as PlaylistViewHolder + viewHolder.bindView( + list[position].arrayList as List, + R.string.favorites + ) + } } } @@ -116,7 +116,7 @@ class HomeAdapter( companion object { - @IntDef(RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, PLAYLISTS, SUGGESTIONS) + @IntDef(RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, SUGGESTIONS, FAVOURITES) @Retention(AnnotationRetention.SOURCE) annotation class HomeSection @@ -124,8 +124,8 @@ class HomeAdapter( const val TOP_ALBUMS = 1 const val RECENT_ARTISTS = 2 const val TOP_ARTISTS = 0 - const val SUGGESTIONS = 4 - const val PLAYLISTS = 5 + const val SUGGESTIONS = 5 + const val FAVOURITES = 4 } private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/LibraryViewModel.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/LibraryViewModel.kt index 1e842402..1e85bfe3 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/LibraryViewModel.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/LibraryViewModel.kt @@ -55,8 +55,8 @@ class LibraryViewModel(application: Application) : _repository.topAlbums(), _repository.recentArtists(), _repository.recentAlbums(), - _repository.favoritePlaylist(), - _repository.suggestions() + _repository.suggestions(), + _repository.favoritePlaylist() ) for (r in result) { if (r != null) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumsFragment.kt index 249e0fec..47d3fd52 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/albums/AlbumsFragment.kt @@ -15,7 +15,6 @@ class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment(), MainActivityFragmentCallbacks { - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) mainActivity.libraryViewModel.allAlbums() diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt b/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt index 315b62bb..eb6b2e15 100644 --- a/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt +++ b/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt @@ -110,7 +110,7 @@ class RepositoryImpl constructor(private val context: Context) : Repository { val playlists = PlaylistLoader.getFavoritePlaylist(context) return if (playlists.isNotEmpty()) Home( playlists, - HomeAdapter.PLAYLISTS, + HomeAdapter.FAVOURITES, R.drawable.ic_favorite_white_24dp ) else null } diff --git a/app/src/main/res/anim/item_animation_fall_down.xml b/app/src/main/res/anim/item_animation_fall_down.xml new file mode 100644 index 00000000..f486805c --- /dev/null +++ b/app/src/main/res/anim/item_animation_fall_down.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/layout_animation_fall_down.xml b/app/src/main/res/anim/layout_animation_fall_down.xml new file mode 100644 index 00000000..6736b9f7 --- /dev/null +++ b/app/src/main/res/anim/layout_animation_fall_down.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_folder.xml b/app/src/main/res/layout/fragment_folder.xml index 0f7ff63a..ffe3abd5 100644 --- a/app/src/main/res/layout/fragment_folder.xml +++ b/app/src/main/res/layout/fragment_folder.xml @@ -54,6 +54,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" + android:layoutAnimation="@anim/layout_animation_fall_down" android:overScrollMode="never" android:scrollbars="none" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> diff --git a/app/src/main/res/layout/fragment_main_activity_recycler_view.xml b/app/src/main/res/layout/fragment_main_activity_recycler_view.xml index d546767b..9a925d89 100644 --- a/app/src/main/res/layout/fragment_main_activity_recycler_view.xml +++ b/app/src/main/res/layout/fragment_main_activity_recycler_view.xml @@ -11,6 +11,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:clipToPadding="false" + android:layoutAnimation="@anim/layout_animation_fall_down" android:overScrollMode="never" android:scrollbars="none" app:layout_dodgeInsetEdges="bottom" diff --git a/app/src/main/res/layout/home_content.xml b/app/src/main/res/layout/home_content.xml index f97294c1..31fa3b89 100644 --- a/app/src/main/res/layout/home_content.xml +++ b/app/src/main/res/layout/home_content.xml @@ -37,6 +37,7 @@ android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layoutAnimation="@anim/layout_animation_fall_down" android:nestedScrollingEnabled="false" android:overScrollMode="never" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"