show a placeholder if the playlist is empty

This commit is contained in:
tibbi 2017-04-07 23:02:35 +02:00
parent 2063ed206c
commit 3250790f76
3 changed files with 28 additions and 0 deletions

View file

@ -65,6 +65,7 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
previous_btn.setOnClickListener { sendIntent(PREVIOUS) }
play_pause_btn.setOnClickListener { sendIntent(PLAYPAUSE) }
next_btn.setOnClickListener { sendIntent(NEXT) }
songs_playlist_empty_add_folder.setOnClickListener { addFolderToPlaylist() }
checkWhatsNewDialog()
storeStoragePaths()
}
@ -249,6 +250,8 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
}
}
markCurrentSong()
songs_playlist_empty.beVisibleIf(songs.isEmpty())
songs_playlist_empty_add_folder.beVisibleIf(songs.isEmpty())
}
override fun onDestroy() {

View file

@ -165,6 +165,7 @@ class SongAdapter(val activity: SimpleActivity, var songs: ArrayList<Song>, val
itemCnt = songs.size
activity.dbHelper.removeSongsFromPlaylist(paths, -1)
activity.deleteFiles(files) { }
activity.sendIntent(REFRESH_LIST)
}
}
@ -189,6 +190,7 @@ class SongAdapter(val activity: SimpleActivity, var songs: ArrayList<Song>, val
itemCnt = songs.size
activity.dbHelper.removeSongsFromPlaylist(paths)
actMode?.finish()
activity.sendIntent(REFRESH_LIST)
}
fun updateSongs(newSongs: ArrayList<Song>) {

View file

@ -120,5 +120,28 @@
android:paddingLeft="@dimen/normal_margin"
android:paddingStart="@dimen/normal_margin"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/songs_playlist_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.7"
android:gravity="center"
android:text="@string/playlist_empty"
android:textSize="@dimen/bigger_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/songs_playlist_empty_add_folder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/songs_playlist_empty"
android:layout_centerHorizontal="true"
android:alpha="0.7"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:padding="@dimen/normal_margin"
android:text="@string/add_folder_to_playlist"
android:textAllCaps="true"
android:textSize="@dimen/normal_text_size"/>
</RelativeLayout>
</RelativeLayout>