[Expressive Battery] Tweak the animation of Battery Usage screen.

Fix the blinking while tapping chart to select time intervals.
- setHasStableIds(true) to avoid BatteryChartView create viewHolder again when SettingsPreferenceGroupAdapter invoke notifyDataSetChanged()

Recover the fade-in animation when display the hourly chart for the first time.
- set the default alpha of hourly chart in xml to 0.

Bug: 378997970
Bug: 349652542
Flag: EXEMPT bug fix
Test: visual
Change-Id: Ia6c131452fca65db7149664c7e18ca68e9703def
This commit is contained in:
mxyyiyi
2024-12-18 21:38:27 +08:00
parent d7a54332f0
commit c369a8df5a
2 changed files with 10 additions and 0 deletions

View File

@@ -32,6 +32,8 @@ import android.util.Pair;
import androidx.annotation.VisibleForTesting;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
@@ -149,6 +151,13 @@ public class PowerUsageAdvanced extends PowerUsageBase {
}
}
@Override
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
final RecyclerView.Adapter adapter = super.onCreateAdapter(preferenceScreen);
adapter.setHasStableIds(true);
return adapter;
}
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();