Search in sources :

Example 1 with SummaryTip

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));
}
Also used : HighUsageTip(com.android.settings.fuelgauge.batterytip.tips.HighUsageTip) RestrictAppTip(com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip) SummaryTip(com.android.settings.fuelgauge.batterytip.tips.SummaryTip) ArrayList(java.util.ArrayList) UnrestrictAppTip(com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip) Before(org.junit.Before)

Example 2 with SummaryTip

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;
}
Also used : SummaryTip(com.android.settings.fuelgauge.batterytip.tips.SummaryTip) ArrayList(java.util.ArrayList) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)

Example 3 with SummaryTip

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);
}
Also used : SummaryTip(com.android.settings.fuelgauge.batterytip.tips.SummaryTip)

Example 4 with SummaryTip

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;
}
Also used : SummaryTip(com.android.settings.fuelgauge.batterytip.tips.SummaryTip) CardPreference(com.android.settings.widget.CardPreference) Before(org.junit.Before)

Aggregations

SummaryTip (com.android.settings.fuelgauge.batterytip.tips.SummaryTip)4 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)1 HighUsageTip (com.android.settings.fuelgauge.batterytip.tips.HighUsageTip)1 LowBatteryTip (com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)1 RestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip)1 UnrestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip)1 CardPreference (com.android.settings.widget.CardPreference)1