mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-08 08:49:55 +00:00
Add: Enable/disable repositories
This commit is contained in:
parent
d64d670173
commit
e672710e14
@ -13,7 +13,11 @@ import com.looker.droidify.ui.activities.PrefsActivityX
|
||||
import com.looker.droidify.ui.items.RepoItem
|
||||
import com.looker.droidify.ui.viewmodels.RepositoriesViewModelX
|
||||
import com.mikepenz.fastadapter.FastAdapter
|
||||
import com.mikepenz.fastadapter.IAdapter
|
||||
import com.mikepenz.fastadapter.adapters.ItemAdapter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class PrefsRepositoriesFragment : BaseNavFragment() {
|
||||
private lateinit var binding: FragmentRepositoriesXBinding
|
||||
@ -46,6 +50,17 @@ class PrefsRepositoriesFragment : BaseNavFragment() {
|
||||
reposFastAdapter = FastAdapter.with(reposItemAdapter)
|
||||
reposFastAdapter?.setHasStableIds(false)
|
||||
|
||||
reposFastAdapter?.onClickListener =
|
||||
{ _: View?, _: IAdapter<RepoItem>?, item: RepoItem?, _: Int? ->
|
||||
item?.item?.let {
|
||||
it.enabled = !it.enabled
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
syncConnection.binder?.setEnabled(it, it.enabled)
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
binding.recyclerView.apply {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
adapter = reposFastAdapter
|
||||
|
Loading…
x
Reference in New Issue
Block a user