mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-21 05:06:53 +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
|
package com.lagradost.cloudstream3.ui.result
|
||||||
|
|
||||||
|
import android.app.SearchManager
|
||||||
|
import android.content.Intent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -10,6 +12,8 @@ import com.lagradost.cloudstream3.ActorData
|
|||||||
import com.lagradost.cloudstream3.ActorRole
|
import com.lagradost.cloudstream3.ActorRole
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
import com.lagradost.cloudstream3.databinding.CastItemBinding
|
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
|
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
||||||
|
|
||||||
class ActorAdaptor(
|
class ActorAdaptor(
|
||||||
@ -101,6 +105,21 @@ class ActorAdaptor(
|
|||||||
callback(position)
|
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 {
|
binding.apply {
|
||||||
actorImage.loadImage(mainImg)
|
actorImage.loadImage(mainImg)
|
||||||
|
|
||||||
@ -137,7 +156,7 @@ class ActorAdaptor(
|
|||||||
} else {
|
} else {
|
||||||
voiceActorName.text = actor.voiceActor?.name
|
voiceActorName.text = actor.voiceActor?.name
|
||||||
if (!vaImage.isNullOrEmpty())
|
if (!vaImage.isNullOrEmpty())
|
||||||
voiceActorImageHolder.isVisible = true
|
voiceActorImageHolder.isVisible = true
|
||||||
voiceActorImage.loadImage(vaImage)
|
voiceActorImage.loadImage(vaImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user