[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:
@@ -53,6 +53,7 @@
|
|||||||
android:layout_height="@dimen/chartview_layout_height"
|
android:layout_height="@dimen/chartview_layout_height"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
android:alpha="0"
|
||||||
android:contentDescription="@string/hourly_battery_usage_chart"
|
android:contentDescription="@string/hourly_battery_usage_chart"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
settings:textColor="?android:attr/textColorSecondary" />
|
settings:textColor="?android:attr/textColorSecondary" />
|
||||||
|
@@ -32,6 +32,8 @@ import android.util.Pair;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.loader.app.LoaderManager;
|
import androidx.loader.app.LoaderManager;
|
||||||
import androidx.loader.content.Loader;
|
import androidx.loader.content.Loader;
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
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
|
@Override
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user