use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AddNetworkFragment method handleCancelAction.
@VisibleForTesting
void handleCancelAction() {
final Activity activity = getActivity();
activity.setResult(Activity.RESULT_CANCELED);
activity.finish();
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsageGraph method calculateLocalPaths.
@VisibleForTesting
void calculateLocalPaths(SparseIntArray paths, SparseIntArray localPaths) {
final long startTime = System.currentTimeMillis();
if (getWidth() == 0) {
return;
}
localPaths.clear();
// Store the local coordinates of the most recent point.
int lx = 0;
int ly = PATH_DELIM;
boolean skippedLastPoint = false;
for (int i = 0; i < paths.size(); i++) {
int x = paths.keyAt(i);
int y = paths.valueAt(i);
if (y == PATH_DELIM) {
if (i == 1) {
localPaths.put(getX(x + 1) - 1, getY(0));
continue;
}
if (i == paths.size() - 1 && skippedLastPoint) {
// Add back skipped point to complete the path.
localPaths.put(lx, ly);
}
skippedLastPoint = false;
localPaths.put(lx + 1, PATH_DELIM);
} else {
lx = getX(x);
ly = getY(y);
// Skip this point if it is not far enough from the last one added.
if (localPaths.size() > 0) {
int lastX = localPaths.keyAt(localPaths.size() - 1);
int lastY = localPaths.valueAt(localPaths.size() - 1);
if (lastY != PATH_DELIM && !hasDiff(lastX, lx) && !hasDiff(lastY, ly)) {
skippedLastPoint = true;
continue;
}
}
skippedLastPoint = false;
localPaths.put(lx, ly);
}
}
BatteryUtils.logRuntime(LOG_TAG, "calculateLocalPaths", startTime);
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsageGraph method drawFilledPath.
@VisibleForTesting
void drawFilledPath(Canvas canvas, SparseIntArray localPaths, Paint paint) {
if (localPaths.size() == 0) {
return;
}
mPath.reset();
float lastStartX = localPaths.keyAt(0);
mPath.moveTo(localPaths.keyAt(0), localPaths.valueAt(0));
for (int i = 1; i < localPaths.size(); i++) {
int x = localPaths.keyAt(i);
int y = localPaths.valueAt(i);
if (y == PATH_DELIM) {
mPath.lineTo(localPaths.keyAt(i - 1), getHeight());
mPath.lineTo(lastStartX, getHeight());
mPath.close();
if (++i < localPaths.size()) {
lastStartX = localPaths.keyAt(i);
mPath.moveTo(localPaths.keyAt(i), localPaths.valueAt(i));
}
} else {
mPath.lineTo(x, y);
}
}
canvas.drawPath(mPath, paint);
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiTetherApBandPreferenceController method updatePreferenceEntries.
@VisibleForTesting
void updatePreferenceEntries() {
Resources res = mContext.getResources();
int entriesRes = R.array.wifi_ap_band_config_full;
int summariesRes = R.array.wifi_ap_band_summary_full;
// change the list options if this is a dual mode device
if (isDualMode) {
entriesRes = R.array.wifi_ap_band_dual_mode;
summariesRes = R.array.wifi_ap_band_dual_mode_summary;
}
mBandEntries = res.getStringArray(entriesRes);
mBandSummaries = res.getStringArray(summariesRes);
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccessibilityHearingAidPreferenceController method launchBluetoothDeviceDetailSetting.
@VisibleForTesting
void launchBluetoothDeviceDetailSetting(final CachedBluetoothDevice device) {
if (device == null) {
return;
}
final Bundle args = new Bundle();
args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS, device.getDevice().getAddress());
new SubSettingLauncher(mContext).setDestination(BluetoothDeviceDetailsFragment.class.getName()).setArguments(args).setTitleRes(R.string.device_details_title).setSourceMetricsCategory(SettingsEnums.ACCESSIBILITY).launch();
}
Aggregations