use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by SudaMod.
the class BatteryInfoTest method assertHistoryAndLinearProjection.
private void assertHistoryAndLinearProjection(BatteryInfo info) {
mockBatteryStatsHistory();
UsageView view = mock(UsageView.class);
doReturn(mContext).when(view).getContext();
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());
// Check that we have two points and the first is correct.
assertThat(pointsActual.getValue().size()).isEqualTo(2);
assertThat(pointsActual.getValue().keyAt(0)).isEqualTo(2000);
assertThat(pointsActual.getValue().valueAt(0)).isEqualTo(97);
}
use of com.android.settings.graph.UsageView in project android_packages_apps_Settings by SudaMod.
the class BatteryHistoryDetail method updateEverything.
private void updateEverything() {
BatteryInfo.getBatteryInfo(getContext(), info -> {
final View view = getView();
info.bindHistory((UsageView) view.findViewById(R.id.battery_usage), mChargingParser, mScreenOn, mGpsParser, mFlashlightParser, mCameraParser, mWifiParser, mCpuParser, mPhoneParser);
((TextView) view.findViewById(R.id.charge)).setText(info.batteryPercentString);
((TextView) view.findViewById(R.id.estimation)).setText(info.remainingLabel);
bindData(mChargingParser, R.string.battery_stats_charging_label, R.id.charging_group);
bindData(mScreenOn, R.string.battery_stats_screen_on_label, R.id.screen_on_group);
bindData(mGpsParser, R.string.battery_stats_gps_on_label, R.id.gps_group);
bindData(mFlashlightParser, R.string.battery_stats_flashlight_on_label, R.id.flashlight_group);
bindData(mCameraParser, R.string.battery_stats_camera_on_label, R.id.camera_group);
bindData(mWifiParser, R.string.battery_stats_wifi_running_label, R.id.wifi_group);
bindData(mCpuParser, R.string.battery_stats_wake_lock_label, R.id.cpu_group);
bindData(mPhoneParser, R.string.battery_stats_phone_signal_label, R.id.cell_network_group);
}, mStats, false);
}
use of com.android.settings.graph.UsageView in project platform_packages_apps_Settings by BlissRoms.
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 platform_packages_apps_Settings by BlissRoms.
the class BatteryInfoTest method assertHistoryAndLinearProjection.
private void assertHistoryAndLinearProjection(BatteryInfo info) {
mockBatteryStatsHistory();
UsageView view = mock(UsageView.class);
doReturn(mContext).when(view).getContext();
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());
// Check that we have two points and the first is correct.
assertThat(pointsActual.getValue().size()).isEqualTo(2);
assertThat(pointsActual.getValue().keyAt(0)).isEqualTo(2000);
assertThat(pointsActual.getValue().valueAt(0)).isEqualTo(97);
}
use of com.android.settings.graph.UsageView in project platform_packages_apps_Settings by BlissRoms.
the class BatteryHistoryDetail method updateEverything.
private void updateEverything() {
BatteryInfo.getBatteryInfo(getContext(), info -> {
final View view = getView();
info.bindHistory((UsageView) view.findViewById(R.id.battery_usage), mChargingParser, mScreenOn, mGpsParser, mFlashlightParser, mCameraParser, mWifiParser, mCpuParser, mPhoneParser);
((TextView) view.findViewById(R.id.charge)).setText(info.batteryPercentString);
((TextView) view.findViewById(R.id.estimation)).setText(info.remainingLabel);
bindData(mChargingParser, R.string.battery_stats_charging_label, R.id.charging_group);
bindData(mScreenOn, R.string.battery_stats_screen_on_label, R.id.screen_on_group);
bindData(mGpsParser, R.string.battery_stats_gps_on_label, R.id.gps_group);
bindData(mFlashlightParser, R.string.battery_stats_flashlight_on_label, R.id.flashlight_group);
bindData(mCameraParser, R.string.battery_stats_camera_on_label, R.id.camera_group);
bindData(mWifiParser, R.string.battery_stats_wifi_running_label, R.id.wifi_group);
bindData(mCpuParser, R.string.battery_stats_wake_lock_label, R.id.cpu_group);
bindData(mPhoneParser, R.string.battery_stats_phone_signal_label, R.id.cell_network_group);
}, mStats, false);
}
Aggregations