Update battery states text

- Update progress bar bottom text when battery states changed(charging,
 discharging, power saver and low battery)

Bug: 183689347
Bug: 177407113
Test: make SettingsRoboTests
Change-Id: I0397eb1dea7fcb14357750f84d1d5b1a7dc7d19a
This commit is contained in:
Wesley.CW Wang
2021-04-06 15:14:59 +08:00
committed by Wesley Wang
parent 1f7c6f03b9
commit 11d74e7231
5 changed files with 145 additions and 5 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.fuelgauge.batterytip;
import android.annotation.Nullable;
import android.content.Context;
import android.os.Bundle;
@@ -162,6 +163,19 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
return mNeedUpdate;
}
/**
* @return current battery tips, null if unavailable.
*/
@Nullable
public BatteryTip getCurrentBatteryTip() {
if (mBatteryTips == null) {
return null;
}
return mBatteryTips.stream().anyMatch(BatteryTip::isVisible)
? mBatteryTips.stream().filter(BatteryTip::isVisible).findFirst().get() : null;
}
/**
* Listener to give the control back to target fragment
*/