layout improvements

This commit is contained in:
Bnyro 2022-08-15 09:59:48 +02:00
parent 4ec0a98caf
commit 6914e9500a
14 changed files with 31 additions and 43 deletions

View File

@ -1,7 +1,7 @@
package com.github.libretube.util package com.github.libretube.util
import java.util.*
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
import java.util.*
class ResettableLazyManager { class ResettableLazyManager {
// we synchronize to make sure the timing of a reset() call and new inits do not collide // we synchronize to make sure the timing of a reset() call and new inits do not collide

View File

@ -72,7 +72,8 @@ class AddToPlaylistDialog : DialogFragment() {
if (viewModel.lastSelectedPlaylistId != null) { if (viewModel.lastSelectedPlaylistId != null) {
var selectionIndex = 0 var selectionIndex = 0
response.forEachIndexed { index, playlist -> response.forEachIndexed { index, playlist ->
if (playlist.id == viewModel.lastSelectedPlaylistId) selectionIndex = index if (playlist.id == viewModel.lastSelectedPlaylistId) selectionIndex =
index
} }
binding.playlistsSpinner.setSelection(selectionIndex) binding.playlistsSpinner.setSelection(selectionIndex)
} }

View File

@ -68,8 +68,12 @@ class LibraryFragment : BaseFragment() {
} }
if (token != "") { if (token != "") {
binding.boogh.setImageResource(R.drawable.ic_list)
binding.textLike.text = getString(R.string.emptyList)
binding.loginOrRegister.visibility = View.GONE binding.loginOrRegister.visibility = View.GONE
fetchPlaylists() fetchPlaylists()
binding.playlistRefresh.isEnabled = true binding.playlistRefresh.isEnabled = true
binding.playlistRefresh.setOnRefreshListener { binding.playlistRefresh.setOnRefreshListener {
fetchPlaylists() fetchPlaylists()
@ -123,7 +127,6 @@ class LibraryFragment : BaseFragment() {
playlistsAdapter.registerAdapterDataObserver(object : playlistsAdapter.registerAdapterDataObserver(object :
RecyclerView.AdapterDataObserver() { RecyclerView.AdapterDataObserver() {
override fun onChanged() { override fun onChanged() {
Log.e(TAG(), playlistsAdapter.itemCount.toString())
if (playlistsAdapter.itemCount == 0) { if (playlistsAdapter.itemCount == 0) {
binding.loginOrRegister.visibility = View.VISIBLE binding.loginOrRegister.visibility = View.VISIBLE
} }
@ -135,8 +138,6 @@ class LibraryFragment : BaseFragment() {
} else { } else {
runOnUiThread { runOnUiThread {
binding.loginOrRegister.visibility = View.VISIBLE binding.loginOrRegister.visibility = View.VISIBLE
binding.boogh.setImageResource(R.drawable.ic_list)
binding.textLike.text = getString(R.string.emptyList)
} }
} }
} }

View File

@ -95,6 +95,7 @@ import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
import com.google.android.exoplayer2.util.RepeatModeUtil import com.google.android.exoplayer2.util.RepeatModeUtil
import com.google.android.exoplayer2.video.VideoSize import com.google.android.exoplayer2.video.VideoSize
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlin.math.abs
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -102,7 +103,6 @@ import org.chromium.net.CronetEngine
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException
import java.util.concurrent.Executors import java.util.concurrent.Executors
import kotlin.math.abs
class PlayerFragment : BaseFragment() { class PlayerFragment : BaseFragment() {

View File

@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" style="@style/ItemRow">
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView <de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/search_channel_image" android:id="@+id/search_channel_image"

View File

@ -4,11 +4,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8dp" android:background="?android:attr/selectableItemBackground"
android:layout_marginTop="4dp" android:paddingHorizontal="8dp"
android:layout_marginRight="8dp" android:paddingVertical="4dp">
android:layout_marginBottom="4dp"
android:background="?android:attr/selectableItemBackground">
<de.hdodenhof.circleimageview.CircleImageView <de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/subscription_channel_image" android:id="@+id/subscription_channel_image"

View File

@ -80,7 +80,7 @@
android:id="@+id/search_recycler" android:id="@+id/search_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="10dp" /> android:layout_marginVertical="10dp" />
</LinearLayout> </LinearLayout>

View File

@ -30,7 +30,6 @@
android:id="@+id/watchHistoryRecView" android:id="@+id/watchHistoryRecView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -2,12 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_search" style="@style/ItemRow">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline" android:id="@+id/guideline"

View File

@ -2,10 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" style="@style/ItemRow">
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline" android:id="@+id/guideline"

View File

@ -3,11 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/playlist" android:id="@+id/playlist"
android:layout_width="match_parent" style="@style/ItemRow">
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline" android:id="@+id/guideline"

View File

@ -2,11 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_search" style="@style/ItemRow">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline" android:id="@+id/guideline"

View File

@ -2,11 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_search" style="@style/ItemRow">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline" android:id="@+id/guideline"

View File

@ -162,4 +162,17 @@
</style> </style>
<style name="ItemRow">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingLeft">6dp</item>
<item name="android:paddingRight">6dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:background">?attr/selectableItemBackground</item>
<item name="android:orientation">horizontal</item>
</style>
</resources> </resources>