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

Commit 8ebd4a5f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix b/241885070: Unexpected texts moving when going back to battery usage page"

parents aaaed2f0 5316bb71
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -273,7 +273,7 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro
            mDailyTimestampFullTexts = null;
            mDailyViewModel = null;
            mHourlyViewModels = null;
            addFooterPreferenceIfNeeded(false);
            refreshUi();
            return;
        }
        mDailyTimestampFullTexts = generateTimestampDayOfWeekTexts(
@@ -336,14 +336,20 @@ public class BatteryChartPreferenceControllerV2 extends AbstractPreferenceContro

    @VisibleForTesting
    boolean refreshUi() {
        if (mBatteryUsageMap == null || mDailyChartView == null || mHourlyChartView == null) {
        if (mDailyChartView == null || mHourlyChartView == null) {
            // Chart views are not initialized.
            return false;
        }

        if (mDailyViewModel == null || mHourlyViewModels == null) {
            // Fail to get battery level data, show an empty hourly chart view.
            mDailyChartView.setVisibility(View.GONE);
            mHourlyChartView.setVisibility(View.VISIBLE);
            mHourlyChartView.setViewModel(null);
            addFooterPreferenceIfNeeded(false);
            return false;
        }
        if (mBatteryUsageMap == null) {
            // Battery usage data is not ready, wait for data ready to refresh UI.
            return false;
        }

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