Removed Create Playlist Btn and Refresh in Library if not logged in

This commit is contained in:
Bnyro 2022-05-10 12:20:15 +02:00
parent ba740e6b92
commit 1fc315e31f
2 changed files with 4 additions and 2 deletions

View File

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

View File

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