material-components / material-components/material-components-android

[Chip] Chip doesn't expand with animation when checked

Open
#606 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting Design Feedback feature request Issue: Design Spec Mismatch Widget: Chip
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Description: When I check a Chip in a ChipGroup the animation does not work properly.

Expected behavior:
ezgif com-video-to-gif (1)

Source code:
stateChipGroup.setOnCheckedChangeListener { group, checkedId -> if (checkedId == View.NO_ID) { //user tried to uncheck the checked button group.check(lastCheckedId) return@setOnCheckedChangeListener } lastCheckedId = checkedId val chip = stateChipGroup.findViewById<View?>(checkedId) if (chip != null && chip is Chip) { when (chip.text) { getString(R.string.enabled) -> { sharedPref?.edit { putInt(CHIP_KEY_STATE, BEACON_VISIBLE) commit() } } getString(R.string.disabled) -> { sharedPref?.edit { putInt(CHIP_KEY_STATE, BEACON_INVISIBLE) commit() } } getString(R.string.both) -> { sharedPref?.edit { putInt(CHIP_KEY_STATE, BEACON_BOTH) commit() } } } vm.updateRecyclerView() } }

Current behavior
ezgif com-video-to-gif (2)

Android API version: Android API version here

Material Library version: 1.1.0-alpha08

Device: OnePlus 7 Pro, OnePlus 3t

To help us triage faster, please check to make sure you are using the latest version of the library.
Cannot since app crashes due to error #605

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the checked ChipGroup behavior from the issue's Kotlin source snippet on the reported Android setup, using Material Library 1.1.0-alpha08. Compare the expected and current animations shown in the linked recordings, and verify that checking a Chip expands it with the intended animation without triggering the crash noted in issue #605.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.