fix playlists not showing

This commit is contained in:
Bnyro 2022-07-02 16:30:47 +02:00
parent ff77c69eb1
commit ebaa7374cb
5 changed files with 69 additions and 72 deletions

View File

@ -9,6 +9,7 @@ import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
import com.github.libretube.activities.requireMainActivityRestart
import com.github.libretube.databinding.DialogLoginBinding
import com.github.libretube.obj.Login
import com.github.libretube.util.PreferenceHelper
@ -89,6 +90,7 @@ class LoginDialog : DialogFragment() {
Toast.makeText(context, R.string.loggedIn, Toast.LENGTH_SHORT).show()
PreferenceHelper.setToken(requireContext(), response.token!!)
PreferenceHelper.setUsername(requireContext(), login.username!!)
requireMainActivityRestart = true
dialog?.dismiss()
}
}

View File

@ -7,6 +7,7 @@ import android.widget.Toast
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import com.github.libretube.R
import com.github.libretube.activities.requireMainActivityRestart
import com.github.libretube.databinding.DialogLogoutBinding
import com.github.libretube.util.PreferenceHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -25,6 +26,7 @@ class LogoutDialog : DialogFragment() {
binding.user.text =
binding.user.text.toString() + " (" + user + ")"
binding.logout.setOnClickListener {
requireMainActivityRestart = true
Toast.makeText(context, R.string.loggedout, Toast.LENGTH_SHORT).show()
PreferenceHelper.setToken(requireContext(), "")
dialog?.dismiss()

View File

@ -2,7 +2,6 @@ package com.github.libretube.preferences
import android.content.Intent
import android.os.Bundle
import androidx.navigation.fragment.findNavController
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.github.libretube.R

View File

@ -2,7 +2,6 @@ package com.github.libretube.preferences
import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat

View File

@ -6,95 +6,90 @@
android:layout_height="match_parent"
tools:context=".fragments.LibraryFragment">
<LinearLayout
<RelativeLayout
android:id="@+id/loginOrRegister2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<LinearLayout
android:id="@+id/showWatchHistory"
android:layout_width="match_parent"
<ImageView
android:id="@+id/boogh"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_login" />
<TextView
android:id="@+id/text_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_time_outlined" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text="@string/watch_history"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:id="@+id/loginOrRegister2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/boogh"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
android:gravity="center"
android:text="@string/please_login"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<ImageView
android:id="@+id/boogh"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_login" />
<com.github.libretube.util.CustomSwipeToRefresh
android:id="@+id/playlist_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/boogh"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/please_login"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<com.github.libretube.util.CustomSwipeToRefresh
android:id="@+id/playlist_refresh"
<ScrollView
android:id="@+id/scrollview_playlist"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scrollview_playlist"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/showWatchHistory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_time_outlined" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text="@string/watch_history"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:descendantFocusability="blocksDescendants">
<RelativeLayout
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/playlist_recView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants">
android:nestedScrollingEnabled="false" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/playlist_recView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</com.github.libretube.util.CustomSwipeToRefresh>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</com.github.libretube.util.CustomSwipeToRefresh>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/create_playlist"