Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b27fd92 authored by ykhung's avatar ykhung Committed by YUKAI HUNG
Browse files

Fix UI flashes issue when entering to the app in the cold start

1. fix the chart % info will flash issue by deferring the showing time
until the chart content is ready to show (set default as invisible)
2. fix the category title will flash issue by set the default value as
empty to avoid refresh the title twice in the start time

Bug: 177406865
Test: make SettingsRoboTests
Change-Id: If8f247cf5b01c529bc5e4d18fcf409ba296cc2f4
parent e704cef0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
        android:layout_width="match_parent"
        android:layout_height="165dp"
        android:layout_marginBottom="16dp"
        android:visibility="invisible"
        android:textAppearance="?android:attr/textAppearanceSmall"
        settings:textColor="?android:attr/textColorSecondary" />
    <TextView
+1 −2
Original line number Diff line number Diff line
@@ -25,8 +25,7 @@
        android:key="battery_graph"/>

    <PreferenceCategory
        android:key="app_list"
        android:title="@string/power_usage_list_summary"/>
        android:key="app_list"/>

    <com.android.settingslib.widget.FooterPreference
        android:title="@string/battery_usage_screen_footer"
+1 −0
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
        super.displayPreference(screen);
        mPrefContext = screen.getContext();
        mAppListGroup = screen.findPreference(mPreferenceKey);
        mAppListGroup.setTitle(mPrefContext.getString(R.string.power_usage_list_summary));
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
        } else {
            mTextPaint = null;
        }
        setVisibility(View.VISIBLE);
        requestLayout();
    }

+3 −3
Original line number Diff line number Diff line
@@ -214,13 +214,11 @@ public final class ConvertUtils {
                        currentEntry.mBackgroundUsageTimeInMs,
                        nextEntry.mBackgroundUsageTimeInMs,
                        nextTwoEntry.mBackgroundUsageTimeInMs);
                final double consumePower =
                double consumePower =
                    getDiffValue(
                        currentEntry.mConsumePower,
                        nextEntry.mConsumePower,
                        nextTwoEntry.mConsumePower);
                totalConsumePower += consumePower;

                // Excludes entry since we don't have enough data to calculate.
                if (foregroundUsageTimeInMs == 0
                        && backgroundUsageTimeInMs == 0
@@ -246,7 +244,9 @@ public final class ConvertUtils {
                        Math.round(foregroundUsageTimeInMs * ratio);
                    backgroundUsageTimeInMs =
                        Math.round(backgroundUsageTimeInMs * ratio);
                    consumePower = consumePower * ratio;
                }
                totalConsumePower += consumePower;
                batteryDiffEntryList.add(
                    new BatteryDiffEntry(
                        context,
Loading