Search in sources :

Example 26 with VisibleForTesting

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();
}
Also used : Activity(android.app.Activity) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 27 with VisibleForTesting

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);
}
Also used : Paint(android.graphics.Paint) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 28 with VisibleForTesting

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);
}
Also used : Paint(android.graphics.Paint) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 29 with VisibleForTesting

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);
}
Also used : Resources(android.content.res.Resources) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 30 with VisibleForTesting

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();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) BluetoothDeviceDetailsFragment(com.android.settings.bluetooth.BluetoothDeviceDetailsFragment) VisibleForTesting(androidx.annotation.VisibleForTesting)

Aggregations

VisibleForTesting (androidx.annotation.VisibleForTesting)385 Intent (android.content.Intent)36 ArrayList (java.util.ArrayList)36 Context (android.content.Context)34 Bundle (android.os.Bundle)30 Uri (android.net.Uri)18 View (android.view.View)18 Preference (androidx.preference.Preference)18 TextView (android.widget.TextView)16 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)16 MetricsFeatureProvider (com.android.settingslib.core.instrumentation.MetricsFeatureProvider)16 SuppressLint (android.annotation.SuppressLint)15 Activity (android.app.Activity)14 RemoteException (android.os.RemoteException)14 SubscriptionInfo (android.telephony.SubscriptionInfo)12 ImageView (android.widget.ImageView)12 BluetoothDevice (android.bluetooth.BluetoothDevice)11 ComponentName (android.content.ComponentName)11 Drawable (android.graphics.drawable.Drawable)11 SharedPreferences (android.content.SharedPreferences)10