Merge pull request #195 from Bnyro/library

Removed Create Playlist Btn and Refresh in Library if not logged in
This commit is contained in:
Farbod 2022-05-12 11:29:43 +04:30 committed by GitHub
commit ec7fe98908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -48,8 +48,8 @@ class Library : Fragment() {
playlistRecyclerView.layoutManager = LinearLayoutManager(view.context)
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
token = sharedPref?.getString("token","")!!
refreshLayout = view.findViewById(R.id.playlist_refresh)
if(token!="") {
refreshLayout = view.findViewById(R.id.playlist_refresh)
view.findViewById<ImageView>(R.id.boogh2).visibility=View.GONE
view.findViewById<TextView>(R.id.textLike2).visibility=View.GONE
fetchPlaylists(view)
@ -67,6 +67,8 @@ class Library : Fragment() {
createPlaylist("$playlistName", view);
}
} else{
refreshLayout?.isEnabled = false
view.findViewById<Button>(R.id.create_playlist).visibility = View.GONE
with(view.findViewById<ImageView>(R.id.boogh2)){
visibility=View.VISIBLE
setImageResource(R.drawable.ic_login)

View File

@ -56,7 +56,7 @@
android:text="@string/createPlaylist"
android:layout_gravity="center"
android:layout_margin="8dp"
android:drawableLeft="@drawable/ic_add"/>
android:drawableLeft="@drawable/ic_add" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"