fix #282, show a placeholder while the files are loading

This commit is contained in:
tibbi 2021-03-28 21:38:37 +02:00
parent 7e25e8fb76
commit da05b5e396
8 changed files with 17 additions and 12 deletions

View file

@ -8,6 +8,7 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.activities.SimpleActivity
import com.simplemobiletools.musicplayer.activities.TracksActivity
import com.simplemobiletools.musicplayer.adapters.AlbumsAdapter
@ -37,6 +38,7 @@ class AlbumsFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
albums.sort()
activity.runOnUiThread {
albums_placeholder.text = context.getString(R.string.no_items_found)
albums_placeholder.beVisibleIf(albums.isEmpty())
val adapter = albums_list.adapter
if (adapter == null) {

View file

@ -7,6 +7,7 @@ import com.google.gson.Gson
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.activities.AlbumsActivity
import com.simplemobiletools.musicplayer.activities.SimpleActivity
import com.simplemobiletools.musicplayer.adapters.ArtistsAdapter
@ -28,7 +29,9 @@ class ArtistsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
artists.sort()
activity.runOnUiThread {
artists_placeholder.text = context.getString(R.string.no_items_found)
artists_placeholder.beVisibleIf(artists.isEmpty())
val adapter = artists_list.adapter
if (adapter == null) {
ArtistsAdapter(activity, artists, artists_list, artists_fastscroller) {

View file

@ -9,6 +9,7 @@ import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.underlineText
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.activities.SimpleActivity
import com.simplemobiletools.musicplayer.activities.TracksActivity
import com.simplemobiletools.musicplayer.adapters.PlaylistsAdapter
@ -45,6 +46,7 @@ class PlaylistsFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
playlists.sort()
activity.runOnUiThread {
playlists_placeholder.text = context.getString(R.string.no_items_found)
playlists_placeholder.beVisibleIf(playlists.isEmpty())
playlists_placeholder_2.beVisibleIf(playlists.isEmpty())
val adapter = playlists_list.adapter

View file

@ -8,6 +8,7 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.activities.SimpleActivity
import com.simplemobiletools.musicplayer.activities.TrackActivity
import com.simplemobiletools.musicplayer.adapters.TracksAdapter
@ -42,6 +43,7 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
tracks.sort()
activity.runOnUiThread {
tracks_placeholder.text = context.getString(R.string.no_items_found)
tracks_placeholder.beVisibleIf(tracks.isEmpty())
val adapter = tracks_list.adapter
if (adapter == null) {

View file

@ -15,10 +15,9 @@
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_items_found"
android:text="@string/loading_files"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="gone" />
android:textStyle="italic" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/albums_list"

View file

@ -15,10 +15,9 @@
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_items_found"
android:text="@string/loading_files"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="gone" />
android:textStyle="italic" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/artists_list"

View file

@ -34,10 +34,9 @@
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_items_found"
android:text="@string/loading_files"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="gone" />
android:textStyle="italic" />
<TextView
android:id="@+id/playlists_placeholder_2"

View file

@ -15,10 +15,9 @@
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:text="@string/no_items_found"
android:text="@string/loading_files"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="gone" />
android:textStyle="italic" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/tracks_list"