mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
thumbnail
This commit is contained in:
parent
60ea36c0db
commit
b57ef5a256
@ -41,11 +41,6 @@ class Home : Fragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
val searchButton = view.findViewById<com.google.android.material.floatingactionbutton
|
|
||||||
.FloatingActionButton>(R.id.search_fab)
|
|
||||||
searchButton.setOnClickListener {
|
|
||||||
findNavController().navigate(R.id.searchFragment)
|
|
||||||
}
|
|
||||||
val recyclerView = view.findViewById<RecyclerView>(R.id.recview)
|
val recyclerView = view.findViewById<RecyclerView>(R.id.recview)
|
||||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
val grid = sharedPreferences.getString(
|
val grid = sharedPreferences.getString(
|
||||||
|
@ -8,6 +8,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.MainActivity
|
import com.github.libretube.MainActivity
|
||||||
@ -46,12 +47,14 @@ class PlaylistsAdapter(
|
|||||||
val playlist = playlists[position]
|
val playlist = playlists[position]
|
||||||
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.playlist_thumbnail)
|
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.playlist_thumbnail)
|
||||||
Picasso.get().load(playlist.thumbnail).into(thumbnailImage)
|
Picasso.get().load(playlist.thumbnail).into(thumbnailImage)
|
||||||
|
// set imageview drawable as empty playlist if imageview empty
|
||||||
|
// if (thumbnailImage.drawable == null) thumbnailImage.setImageResource(R.mipmap.empty_playlist)
|
||||||
holder.v.findViewById<TextView>(R.id.playlist_title).text = playlist.name
|
holder.v.findViewById<TextView>(R.id.playlist_title).text = playlist.name
|
||||||
holder.v.findViewById<ImageView>(R.id.delete_playlist).setOnClickListener {
|
holder.v.findViewById<ImageView>(R.id.delete_playlist).setOnClickListener {
|
||||||
val builder = MaterialAlertDialogBuilder(holder.v.context)
|
val builder = MaterialAlertDialogBuilder(holder.v.context)
|
||||||
builder.setTitle(R.string.deletePlaylist)
|
builder.setTitle(R.string.deletePlaylist)
|
||||||
builder.setMessage(R.string.areYouSure)
|
builder.setMessage(R.string.areYouSure)
|
||||||
builder.setPositiveButton(R.string.yes) { dialog, which ->
|
builder.setPositiveButton(R.string.yes) { _, _ ->
|
||||||
val sharedPref = holder.v.context.getSharedPreferences(
|
val sharedPref = holder.v.context.getSharedPreferences(
|
||||||
"token",
|
"token",
|
||||||
Context.MODE_PRIVATE
|
Context.MODE_PRIVATE
|
||||||
@ -59,7 +62,7 @@ class PlaylistsAdapter(
|
|||||||
val token = sharedPref?.getString("token", "")!!
|
val token = sharedPref?.getString("token", "")!!
|
||||||
deletePlaylist(playlist.id!!, token, position)
|
deletePlaylist(playlist.id!!, token, position)
|
||||||
}
|
}
|
||||||
builder.setNegativeButton(R.string.cancel) { dialog, which ->
|
builder.setNegativeButton(R.string.cancel) { _, _ ->
|
||||||
}
|
}
|
||||||
builder.show()
|
builder.show()
|
||||||
}
|
}
|
||||||
|
@ -32,15 +32,4 @@
|
|||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/search_fab"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
app:tint="?android:attr/colorBackground"
|
|
||||||
app:backgroundTint="?attr/colorSecondary"
|
|
||||||
app:srcCompat="@drawable/ic_search" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -21,6 +21,7 @@
|
|||||||
app:cardCornerRadius="8dp"
|
app:cardCornerRadius="8dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="16:9"
|
app:layout_constraintDimensionRatio="16:9"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user