Use source stats in the home to filter since it is available in public mode
This commit is contained in:
parent
bb45820ae8
commit
97793a7fc8
@ -55,7 +55,7 @@ class SourcesActivity : AppCompatActivity(), DIAware {
|
|||||||
binding.recyclerView.layoutManager = mLayoutManager
|
binding.recyclerView.layoutManager = mLayoutManager
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
val response = repository.getSources()
|
val response = repository.getSourcesDetails()
|
||||||
if (response.isNotEmpty()) {
|
if (response.isNotEmpty()) {
|
||||||
items = response
|
items = response
|
||||||
val mAdapter = SourcesListAdapter(
|
val mAdapter = SourcesListAdapter(
|
||||||
|
@ -68,7 +68,7 @@ class UpsertSourceActivity : AppCompatActivity(), DIAware {
|
|||||||
|
|
||||||
private fun initFields(items: Map<String, SelfossModel.Spout>) {
|
private fun initFields(items: Map<String, SelfossModel.Spout>) {
|
||||||
binding.nameInput.setText(existingSource!!.title)
|
binding.nameInput.setText(existingSource!!.title)
|
||||||
binding.tags.setText(existingSource!!.tags.joinToString(", "))
|
binding.tags.setText(existingSource!!.tags?.joinToString(", "))
|
||||||
binding.sourceUri.setText(existingSource!!.params?.url)
|
binding.sourceUri.setText(existingSource!!.params?.url)
|
||||||
binding.spoutsSpinner.setSelection(items.keys.indexOf(existingSource!!.spout))
|
binding.spoutsSpinner.setSelection(items.keys.indexOf(existingSource!!.spout))
|
||||||
binding.progress.visibility = View.GONE
|
binding.progress.visibility = View.GONE
|
||||||
|
@ -61,7 +61,7 @@ class SourcesListAdapter(
|
|||||||
c.circularBitmapDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
|
c.circularBitmapDrawable(itm.getIcon(repository.baseUrl), binding.itemImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itm.error.isNotBlank()) {
|
if (itm.error.isNullOrBlank()) {
|
||||||
binding.errorText.visibility = View.VISIBLE
|
binding.errorText.visibility = View.VISIBLE
|
||||||
binding.errorText.text = itm.error
|
binding.errorText.text = itm.error
|
||||||
} else {
|
} else {
|
||||||
|
@ -84,7 +84,7 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
|
|||||||
) {
|
) {
|
||||||
val sourceGroup = binding.sourcesGroup
|
val sourceGroup = binding.sourcesGroup
|
||||||
|
|
||||||
repository.getSources().forEach { source ->
|
repository.getSourcesStats().forEach { source ->
|
||||||
val c = Chip(context)
|
val c = Chip(context)
|
||||||
c.ellipsize = TextUtils.TruncateAt.END
|
c.ellipsize = TextUtils.TruncateAt.END
|
||||||
|
|
||||||
@ -141,9 +141,9 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
|
|||||||
selectedChip = c
|
selectedChip = c
|
||||||
}
|
}
|
||||||
|
|
||||||
c.isEnabled = source.error.isBlank()
|
c.isEnabled = source.error.isNullOrBlank()
|
||||||
|
|
||||||
if (source.error.isNotBlank() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (!source.error.isNullOrBlank() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
c.tooltipText = source.error
|
c.tooltipText = source.error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user