mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Merge pull request #190 from Bnyro/translation
Subs and video count translation, video duration in search view
This commit is contained in:
commit
2b0eb19b5d
@ -1,6 +1,7 @@
|
||||
package com.github.libretube.adapters
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -52,6 +53,8 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){
|
||||
private fun bindWatch(item: SearchItem) {
|
||||
val thumbnailImage = v.findViewById<ImageView>(R.id.search_thumbnail)
|
||||
Picasso.get().load(item.thumbnail).into(thumbnailImage)
|
||||
val thumbnailDuration = v.findViewById<TextView>(R.id.search_thumbnail_duration)
|
||||
thumbnailDuration.text = DateUtils.formatElapsedTime(item.duration!!)
|
||||
val channelImage = v.findViewById<ImageView>(R.id.search_channel_image)
|
||||
Picasso.get().load(item.uploaderAvatar).into(channelImage)
|
||||
val title = v.findViewById<TextView>(R.id.search_description)
|
||||
@ -89,7 +92,7 @@ class CustomViewHolder1(private val v: View): RecyclerView.ViewHolder(v){
|
||||
val channelName = v.findViewById<TextView>(R.id.search_channel_name)
|
||||
channelName.text = item.name
|
||||
val channelViews = v.findViewById<TextView>(R.id.search_views)
|
||||
channelViews.text = item.subscribers.formatShort() + " subscribers • "+ item.videos + " videos"
|
||||
channelViews.text = v.context.getString(R.string.subscribers, item.subscribers.formatShort()) + " • " + v.context.getString(R.string.videoCount, item.videos.toString())
|
||||
v.setOnClickListener {
|
||||
val activity = v.context as MainActivity
|
||||
val bundle = bundleOf("channel_id" to item.url)
|
||||
|
@ -34,6 +34,18 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_thumbnail_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:textSize="11dp"
|
||||
android:textColor="@color/duration_text_color"
|
||||
android:background="@color/duration_background_color"
|
||||
android:padding="0.5dp"/>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
|
@ -63,6 +63,7 @@
|
||||
<string name="lightTheme">Light Theme</string>
|
||||
<string name="darkTheme">Dark Theme</string>
|
||||
<string name="subscribers">%1$s subscribers</string>
|
||||
<string name="videoCount">%1$s videos</string>
|
||||
<string name="noInternet">No Internet Connection</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="comments">Comments</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user