Cleanup
This commit is contained in:
parent
a3c26c63d4
commit
0483097fc3
@ -218,8 +218,8 @@ class EditMangaDialog : DialogController {
|
|||||||
private fun ChipGroup.setChips(items: List<String>) {
|
private fun ChipGroup.setChips(items: List<String>) {
|
||||||
removeAllViews()
|
removeAllViews()
|
||||||
|
|
||||||
items.forEach { item ->
|
items.asSequence().map { item ->
|
||||||
val chip = Chip(context).apply {
|
Chip(context).apply {
|
||||||
text = item
|
text = item
|
||||||
|
|
||||||
isCloseIconVisible = true
|
isCloseIconVisible = true
|
||||||
@ -228,15 +228,16 @@ class EditMangaDialog : DialogController {
|
|||||||
removeView(this)
|
removeView(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.forEach {
|
||||||
addView(chip)
|
addView(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
val addTagChip = Chip(context).apply {
|
val addTagChip = Chip(context).apply {
|
||||||
setText(R.string.add_tag)
|
setText(R.string.add_tag)
|
||||||
|
|
||||||
chipIcon = ContextCompat.getDrawable(context, R.drawable.ic_add_24dp)
|
chipIcon = ContextCompat.getDrawable(context, R.drawable.ic_add_24dp)?.apply {
|
||||||
chipIcon?.setTint(context.getResourceColor(R.attr.colorAccent))
|
setTint(context.getResourceColor(R.attr.colorAccent))
|
||||||
|
}
|
||||||
textStartPadding = 0F
|
textStartPadding = 0F
|
||||||
|
|
||||||
clicks().onEach {
|
clicks().onEach {
|
||||||
|
@ -85,7 +85,13 @@ class EditMergedSettingsHeaderAdapter(private val controller: EditMergedSettings
|
|||||||
|
|
||||||
val mergedMangas = controller.mergedMangas
|
val mergedMangas = controller.mergedMangas
|
||||||
|
|
||||||
val mangaInfoAdapter: ArrayAdapter<String> = ArrayAdapter(itemView.context, android.R.layout.simple_spinner_item, mergedMangas.map { sourceManager.getOrStub(it.second.mangaSourceId).toString() + " " + it.first?.title })
|
val mangaInfoAdapter: ArrayAdapter<String> = ArrayAdapter(
|
||||||
|
itemView.context,
|
||||||
|
android.R.layout.simple_spinner_item,
|
||||||
|
mergedMangas.map {
|
||||||
|
sourceManager.getOrStub(it.second.mangaSourceId).toString() + " " + it.first?.title
|
||||||
|
}
|
||||||
|
)
|
||||||
mangaInfoAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
mangaInfoAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
binding.mangaInfoSpinner.adapter = mangaInfoAdapter
|
binding.mangaInfoSpinner.adapter = mangaInfoAdapter
|
||||||
|
|
||||||
@ -102,11 +108,16 @@ class EditMergedSettingsHeaderAdapter(private val controller: EditMergedSettings
|
|||||||
position: Int,
|
position: Int,
|
||||||
id: Long
|
id: Long
|
||||||
) {
|
) {
|
||||||
controller.mergedMangas.find { mergedManga -> mergedManga.second.id == mergedMangas.getOrNull(position)?.second?.id }?.second?.let { newInfoManga ->
|
val mergedInfoManga = controller.mergedMangas
|
||||||
|
.find { mergedManga ->
|
||||||
|
mergedManga.second.id == mergedMangas.getOrNull(position)?.second?.id
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mergedInfoManga != null) {
|
||||||
controller.mergedMangas.onEach {
|
controller.mergedMangas.onEach {
|
||||||
it.second.isInfoManga = false
|
it.second.isInfoManga = false
|
||||||
}
|
}
|
||||||
newInfoManga.isInfoManga = true
|
mergedInfoManga.second.isInfoManga = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user