mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-08 05:26:10 +00:00
Fix adding new tag. Fixes #1281
This commit is contained in:
parent
76358a0f82
commit
a77c9dbea7
2 changed files with 9 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import com.habitrpg.android.habitica.models.user.User
|
|||
import com.habitrpg.android.habitica.ui.activities.TaskFormActivity
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import com.habitrpg.android.habitica.ui.views.tasks.TaskFilterDialog
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.functions.Consumer
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
|
@ -158,9 +159,11 @@ class TasksFragment : BaseMainFragment(), SearchView.OnQueryTextListener {
|
|||
|
||||
private fun showFilterDialog() {
|
||||
context?.let {
|
||||
var disposable: Disposable? = null
|
||||
val dialog = TaskFilterDialog(it, HabiticaBaseApplication.userComponent)
|
||||
if (user != null) {
|
||||
dialog.setTags(user?.tags?.createSnapshot() ?: emptyList())
|
||||
disposable = tagRepository.getTags(user?.id ?: "").subscribe(Consumer {tagsList -> dialog.setTags(tagsList)}, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
dialog.setActiveTags(taskFilterHelper.tags)
|
||||
if (activeFragment != null) {
|
||||
|
|
@ -182,6 +185,11 @@ class TasksFragment : BaseMainFragment(), SearchView.OnQueryTextListener {
|
|||
updateFilterIcon()
|
||||
}
|
||||
})
|
||||
dialog.setOnDismissListener {
|
||||
if (disposable?.isDisposed == false) {
|
||||
disposable?.dispose()
|
||||
}
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ class TaskFilterDialog(context: Context, component: UserComponent?) : AlertDialo
|
|||
}
|
||||
|
||||
private fun createTagViews() {
|
||||
tagsList.removeAllViews()
|
||||
val colorStateList = ColorStateList(
|
||||
arrayOf(intArrayOf(-android.R.attr.state_checked), //disabled
|
||||
intArrayOf(android.R.attr.state_checked) //enabled
|
||||
|
|
|
|||
Loading…
Reference in a new issue