use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by DirtyUnicorns.
the class BatteryInfoTest method assertHistoryAndEnhancedProjection.
private void assertHistoryAndEnhancedProjection(BatteryInfo info) {
mockBatteryStatsHistory();
UsageView view = mock(UsageView.class);
doReturn(mContext).when(view).getContext();
SparseIntArray pointsExpected = new SparseIntArray();
pointsExpected.append(2000, 96);
pointsExpected.append(2500, 95);
pointsExpected.append(3000, 94);
doReturn(pointsExpected).when(mFeatureFactory.powerUsageFeatureProvider).getEnhancedBatteryPredictionCurve(any(Context.class), anyLong());
info.bindHistory(view);
verify(view, times(2)).configureGraph(anyInt(), anyInt());
verify(view, times(1)).addPath(any(SparseIntArray.class));
ArgumentCaptor<SparseIntArray> pointsActual = ArgumentCaptor.forClass(SparseIntArray.class);
verify(view, times(1)).addProjectedPath(pointsActual.capture());
assertThat(pointsActual.getValue()).isEqualTo(pointsExpected);
}
use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by DirtyUnicorns.
the class ChartDataUsagePreference method onBindViewHolder.
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
UsageView chart = (UsageView) holder.findViewById(R.id.data_usage);
if (mNetwork == null)
return;
int top = getTop();
chart.clearPaths();
chart.configureGraph(toInt(mEnd - mStart), top);
calcPoints(chart);
chart.setBottomLabels(new CharSequence[] { Utils.formatDateRange(getContext(), mStart, mStart), Utils.formatDateRange(getContext(), mEnd, mEnd) });
bindNetworkPolicy(chart, mPolicy, top);
}
use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by crdroidandroid.
the class ChartDataUsagePreference method onBindViewHolder.
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
UsageView chart = (UsageView) holder.findViewById(R.id.data_usage);
if (mNetwork == null)
return;
int top = getTop();
chart.clearPaths();
chart.configureGraph(toInt(mEnd - mStart), top);
calcPoints(chart);
chart.setBottomLabels(new CharSequence[] { Utils.formatDateRange(getContext(), mStart, mStart), Utils.formatDateRange(getContext(), mEnd, mEnd) });
bindNetworkPolicy(chart, mPolicy, top);
}
use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by crdroidandroid.
the class BatteryInfoTest method assertHistoryAndEnhancedProjection.
private void assertHistoryAndEnhancedProjection(BatteryInfo info) {
mockBatteryStatsHistory();
UsageView view = mock(UsageView.class);
doReturn(mContext).when(view).getContext();
SparseIntArray pointsExpected = new SparseIntArray();
pointsExpected.append(2000, 96);
pointsExpected.append(2500, 95);
pointsExpected.append(3000, 94);
doReturn(pointsExpected).when(mFeatureFactory.powerUsageFeatureProvider).getEnhancedBatteryPredictionCurve(any(Context.class), anyLong());
info.bindHistory(view);
verify(view, times(2)).configureGraph(anyInt(), anyInt());
verify(view, times(1)).addPath(any(SparseIntArray.class));
ArgumentCaptor<SparseIntArray> pointsActual = ArgumentCaptor.forClass(SparseIntArray.class);
verify(view, times(1)).addProjectedPath(pointsActual.capture());
assertThat(pointsActual.getValue()).isEqualTo(pointsExpected);
}
use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by SudaMod.
the class BatteryInfoTest method assertOnlyHistory.
private void assertOnlyHistory(BatteryInfo info) {
mockBatteryStatsHistory();
UsageView view = mock(UsageView.class);
doReturn(mContext).when(view).getContext();
info.bindHistory(view);
verify(view, times(1)).configureGraph(anyInt(), anyInt());
verify(view, times(1)).addPath(any(SparseIntArray.class));
verify(view, never()).addProjectedPath(any(SparseIntArray.class));
}
Aggregations