fix #282, show a placeholder while the files are loading
This commit is contained in:
parent
7e25e8fb76
commit
da05b5e396
8 changed files with 17 additions and 12 deletions
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue