diff --git a/app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt b/app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt index de9a1733a..d6e9e3e5f 100644 --- a/app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/LoginDialog.kt @@ -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() } } diff --git a/app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt b/app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt index 5ee1b4b37..cfaec73d7 100644 --- a/app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/LogoutDialog.kt @@ -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() diff --git a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt index eb9208e24..5ca268ca5 100644 --- a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt @@ -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 diff --git a/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt b/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt index 09c642a23..0ec1da15d 100644 --- a/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt @@ -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 diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 797826685..886a21367 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -6,95 +6,90 @@ android:layout_height="match_parent" tools:context=".fragments.LibraryFragment"> - + android:layout_centerHorizontal="true" + android:layout_centerVertical="true"> - + + - - - - - - - - + android:gravity="center" + android:text="@string/please_login" + android:textSize="20sp" + android:textStyle="bold" /> + - + - - - - - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + + + + android:descendantFocusability="blocksDescendants"> - + android:nestedScrollingEnabled="false" /> - - - - - - - - + + + +