New issue
Advanced search Search tips

Issue 848753 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 12
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Switch preferences are not animated

Project Member Reported by bsazonov@chromium.org, Jun 1 2018

Issue description

Animations are not shown for all ChromeSwitchPreference instances in Settings.

ChromeSwitchPreference is used in:
Sync customization menu: "Sync" and "Sync everything".
Autofill: "Autofill forms".
Privacy: "Usage and crash reports", "Do not track", "Tap to Search".
Site settings: for group enablers.
Languages: "Offer to translate pages in other languages".
Data saver: "On/Off".

 
Actual_NoAnimation.mp4
1.1 MB View Download
Expected_Animation.mp4
1.0 MB View Download
On Android O+, this is caused by call to setWidgetLayoutResource, which disables view recycling: https://android.googlesource.com/platform/frameworks/base/+/bb2ce1010eb4ea732cdfab396dec272ed2737ab8/core/java/android/preference/Preference.java#527. Without view recycling, ChromeSwitchPreference always gets new view in onBindView, which breaks animations.
Project Member

Comment 2 by bugdroid1@chromium.org, Jun 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2d4deb6e7a41a480ab9745da235349822c7ff9b7

commit 2d4deb6e7a41a480ab9745da235349822c7ff9b7
Author: Boris Sazonov <bsazonov@chromium.org>
Date: Mon Jun 04 11:50:42 2018

[Android] Fix ChromeSwitchPreference animations

This CL fixes ChromeSwitchPreference animations on Android O+ by adding
explicit call to setRecycleEnabled(true). Animations can't work without
view recycling, as view will get recreated on every preference change.
In ChromeSwitchPreference view recycling is disabled by
setWidgetLayoutResource call, so explicit call to setRecycleEnabled
fixes the issue. setRecycleEnabled has been added in API level 26, thus
the build version check.

Bug:  848753 
Change-Id: I21e896723c8cfeec02c38f7e123fb5de8f29ce78
Reviewed-on: https://chromium-review.googlesource.com/1082219
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564060}
[modify] https://crrev.com/2d4deb6e7a41a480ab9745da235349822c7ff9b7/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java

Status: Fixed (was: Started)
Labels: Hotlist-Polish

Sign in to add a comment