mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-20 20:57:06 +08:00
Implement click functionality on cast names to initiate a Google search (#1465)
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package com.lagradost.cloudstream3.ui.result
|
||||
|
||||
import android.app.SearchManager
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -10,6 +12,8 @@ import com.lagradost.cloudstream3.ActorData
|
||||
import com.lagradost.cloudstream3.ActorRole
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.databinding.CastItemBinding
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
||||
|
||||
class ActorAdaptor(
|
||||
@ -101,6 +105,21 @@ class ActorAdaptor(
|
||||
callback(position)
|
||||
}
|
||||
|
||||
itemView.setOnLongClickListener {
|
||||
if (isLayout(PHONE)) {
|
||||
Intent(Intent.ACTION_WEB_SEARCH).apply {
|
||||
putExtra(SearchManager.QUERY, actor.actor.name)
|
||||
}.also { intent ->
|
||||
itemView.context.packageManager?.let { pm ->
|
||||
if (intent.resolveActivity(pm) != null) {
|
||||
itemView.context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
binding.apply {
|
||||
actorImage.loadImage(mainImg)
|
||||
|
||||
@ -137,7 +156,7 @@ class ActorAdaptor(
|
||||
} else {
|
||||
voiceActorName.text = actor.voiceActor?.name
|
||||
if (!vaImage.isNullOrEmpty())
|
||||
voiceActorImageHolder.isVisible = true
|
||||
voiceActorImageHolder.isVisible = true
|
||||
voiceActorImage.loadImage(vaImage)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user