mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Long press Repo to copy URL (#934)
This commit is contained in:
parent
b5fb0997c4
commit
805f80b2ac
2 changed files with 19 additions and 0 deletions
|
@ -1,10 +1,17 @@
|
|||
package com.lagradost.cloudstream3.ui.settings.extensions
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.lagradost.cloudstream3.CommonActivity.activity
|
||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.databinding.RepositoryItemBinding
|
||||
import com.lagradost.cloudstream3.databinding.RepositoryItemTvBinding
|
||||
|
@ -112,6 +119,17 @@ class RepoAdapter(
|
|||
repositoryItemRoot.setOnClickListener {
|
||||
clickCallback(repositoryData)
|
||||
}
|
||||
|
||||
repositoryItemRoot.setOnLongClickListener {
|
||||
val clipboardManager =
|
||||
activity?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager?
|
||||
clipboardManager?.setPrimaryClip(ClipData.newPlainText("RepoUrl", repositoryData.url))
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||
showToast(R.string.copyRepoUrl, Toast.LENGTH_SHORT)
|
||||
}
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
|
||||
mainText.text = repositoryData.name
|
||||
subText.text = repositoryData.url
|
||||
}
|
||||
|
|
|
@ -174,6 +174,7 @@
|
|||
<string name="sort_clear">Clear</string>
|
||||
<string name="sort_save">Save</string>
|
||||
<string name="copyTitle">Title copied!</string>
|
||||
<string name="copyRepoUrl">Repo URL copied!</string>
|
||||
<string name="subscribe_tooltip">New episode notification</string>
|
||||
<string name="result_search_tooltip">Search in other extensions</string>
|
||||
<string name="recommendations_tooltip">Show recommendations</string>
|
||||
|
|
Loading…
Reference in a new issue