use of com.android.settings.fuelgauge.batterytip.tips.SummaryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipDialogFragmentTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
FakeFeatureFactory.setupForTest();
ShadowUtils.setApplicationLabel(PACKAGE_NAME, DISPLAY_NAME);
List<AppInfo> highUsageTips = new ArrayList<>();
mAppInfo = new AppInfo.Builder().setScreenOnTimeMs(SCREEN_TIME_MS).setPackageName(PACKAGE_NAME).build();
highUsageTips.add(mAppInfo);
mHighUsageTip = new HighUsageTip(SCREEN_TIME_MS, highUsageTips);
final List<AppInfo> restrictApps = new ArrayList<>();
restrictApps.add(mAppInfo);
mRestrictedOneAppTip = new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>(restrictApps));
restrictApps.add(mAppInfo);
mRestrictTwoAppsTip = new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>(restrictApps));
mUnrestrictAppTip = new UnrestrictAppTip(BatteryTip.StateType.NEW, mAppInfo);
mSummaryTip = spy(new SummaryTip(BatteryTip.StateType.NEW, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN));
}
use of com.android.settings.fuelgauge.batterytip.tips.SummaryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipLoader method getFakeData.
private List<BatteryTip> getFakeData() {
final List<BatteryTip> tips = new ArrayList<>();
tips.add(new SummaryTip(BatteryTip.StateType.NEW, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN));
tips.add(new LowBatteryTip(BatteryTip.StateType.NEW, false, /* powerSaveModeOn */
"Fake data"));
return tips;
}
use of com.android.settings.fuelgauge.batterytip.tips.SummaryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPrefContext = screen.getContext();
mCardPreference = screen.findPreference(getPreferenceKey());
// Add summary tip in advance to avoid UI flakiness
final SummaryTip summaryTip = new SummaryTip(BatteryTip.StateType.NEW, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN);
summaryTip.updatePreference(mCardPreference);
}
use of com.android.settings.fuelgauge.batterytip.tips.SummaryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mCardPreference = spy(new CardPreference(mContext));
when(mPreferenceScreen.getContext()).thenReturn(mContext);
doReturn(mCardPreference).when(mPreferenceScreen).findPreference(KEY_PREF);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mOldBatteryTips = new ArrayList<>();
mOldBatteryTips.add(new SummaryTip(BatteryTip.StateType.NEW, AVERAGE_TIME_MS));
mNewBatteryTips = new ArrayList<>();
mNewBatteryTips.add(new SummaryTip(BatteryTip.StateType.INVISIBLE, AVERAGE_TIME_MS));
mBatteryTipPreferenceController = buildBatteryTipPreferenceController();
mBatteryTipPreferenceController.mCardPreference = mCardPreference;
mBatteryTipPreferenceController.mPrefContext = mContext;
}
Aggregations