mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
commit
ec9fa1c067
@ -46,12 +46,17 @@ class PlaylistsAdapter(
|
||||
val playlist = playlists[position]
|
||||
val thumbnailImage = holder.v.findViewById<ImageView>(R.id.playlist_thumbnail)
|
||||
Picasso.get().load(playlist.thumbnail).into(thumbnailImage)
|
||||
// set imageview drawable as empty playlist if imageview empty
|
||||
if (thumbnailImage.drawable == null) {
|
||||
thumbnailImage.setImageResource(R.drawable.ic_empty_playlist)
|
||||
thumbnailImage.setBackgroundColor(R.attr.colorSurface)
|
||||
}
|
||||
holder.v.findViewById<TextView>(R.id.playlist_title).text = playlist.name
|
||||
holder.v.findViewById<ImageView>(R.id.delete_playlist).setOnClickListener {
|
||||
val builder = MaterialAlertDialogBuilder(holder.v.context)
|
||||
builder.setTitle(R.string.deletePlaylist)
|
||||
builder.setMessage(R.string.areYouSure)
|
||||
builder.setPositiveButton(R.string.yes) { dialog, which ->
|
||||
builder.setPositiveButton(R.string.yes) { _, _ ->
|
||||
val sharedPref = holder.v.context.getSharedPreferences(
|
||||
"token",
|
||||
Context.MODE_PRIVATE
|
||||
@ -59,7 +64,7 @@ class PlaylistsAdapter(
|
||||
val token = sharedPref?.getString("token", "")!!
|
||||
deletePlaylist(playlist.id!!, token, position)
|
||||
}
|
||||
builder.setNegativeButton(R.string.cancel) { dialog, which ->
|
||||
builder.setNegativeButton(R.string.cancel) { _, _ ->
|
||||
}
|
||||
builder.show()
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import android.widget.ProgressBar
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -42,11 +41,6 @@ class Home : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
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 sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||
val grid = sharedPreferences.getString(
|
||||
|
11
app/src/main/res/drawable/ic_empty_playlist.xml
Normal file
11
app/src/main/res/drawable/ic_empty_playlist.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="143dp"
|
||||
android:height="144dp"
|
||||
android:viewportWidth="143"
|
||||
android:viewportHeight="144"
|
||||
android:tint="?android:attr/colorControlNormal" >
|
||||
<path
|
||||
android:pathData="M35.74,87.66L35.74,41.39c0,-1.44 0.54,-2.7 1.61,-3.78 1.07,-1.08 2.32,-1.62 3.75,-1.62h45.95v5.4L41.11,41.39L41.11,87.66ZM46.47,98.47L46.47,52.2c0,-1.44 0.54,-2.7 1.61,-3.78 1.07,-1.08 2.32,-1.62 3.75,-1.62h45.95v5.4L51.83,52.2L51.83,98.47ZM101.89,108.01L62.56,108.01c-1.43,0 -2.68,-0.54 -3.75,-1.62 -1.07,-1.08 -1.61,-2.34 -1.61,-3.78L57.2,63c0,-1.44 0.54,-2.7 1.61,-3.78 1.07,-1.08 2.32,-1.62 3.75,-1.62h39.33c1.43,0 2.68,0.54 3.75,1.62 1.07,1.08 1.61,2.34 1.61,3.78v39.61c0,1.44 -0.54,2.7 -1.61,3.78 -1.07,1.08 -2.32,1.62 -3.75,1.62zM101.89,102.61L101.89,63L62.56,63L62.56,102.61ZM62.56,63v39.61z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#120807"/>
|
||||
</vector>
|
@ -32,15 +32,4 @@
|
||||
|
||||
</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>
|
@ -21,6 +21,7 @@
|
||||
app:cardCornerRadius="8dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:strokeWidth="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="16:9"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user