Skip to content

fix: Retain chip state and search results after re-selecting the chip #1828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2019

Conversation

liveHarshit
Copy link
Member

Fixes #1818

  • Remove duplication

Screenshots for the change:

@auto-label auto-label bot added the fix label May 27, 2019
@liveHarshit
Copy link
Member Author

@anhanh11001 Please review

Copy link
Contributor

@anhanh11001 anhanh11001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onCheckedChanged function is redundant, I think it can be shorten by this:

    override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
        days.forEach {
            if (it == buttonView?.text) {
                searchViewModel.savedTime = if (isChecked) it else null
                eventDate = if (isChecked) it else getString(R.string.anytime)
                setChips(date = it)
                refreshEvents()
                return@forEach
            }
        }
        eventTypesList?.forEach {
            if (it.name == buttonView?.text) {
                searchViewModel.savedType = if (isChecked) it.name else null
                eventType = if (isChecked) it.name else getString(R.string.anything)
                refreshEvents()
                return@forEach
            }
        }
    }

@liveHarshit
Copy link
Member Author

@anhanh11001 Updated

@iamareebjamal iamareebjamal merged commit 0c51baa into fossasia:development May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chip state is not retainable
3 participants