Search in sources :

Example 76 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConnectedUsbDeviceUpdater method initUsbPreference.

public void initUsbPreference(Context context) {
    mUsbPreference = new Preference(context, null);
    mUsbPreference.setTitle(R.string.usb_pref);
    mUsbPreference.setIcon(R.drawable.ic_usb);
    mUsbPreference.setOnPreferenceClickListener((Preference p) -> {
        // New version - uses a separate screen.
        new SubSettingLauncher(mFragment.getContext()).setDestination(UsbDetailsFragment.class.getName()).setTitleRes(R.string.device_details_title).setSourceMetricsCategory(mFragment.getMetricsCategory()).launch();
        return true;
    });
    forceUpdate();
}
Also used : Preference(androidx.preference.Preference) SubSettingLauncher(com.android.settings.core.SubSettingLauncher)

Example 77 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AutoSelectPreferenceController method setChecked.

@Override
public boolean setChecked(boolean isChecked) {
    if (isChecked) {
        final long startMillis = SystemClock.elapsedRealtime();
        showAutoSelectProgressBar();
        mSwitchPreference.setEnabled(false);
        ThreadUtils.postOnBackgroundThread(() -> {
            // set network selection mode in background
            mTelephonyManager.setNetworkSelectionModeAutomatic();
            final int mode = mTelephonyManager.getNetworkSelectionMode();
            // Update UI in UI thread
            final long durationMillis = SystemClock.elapsedRealtime() - startMillis;
            mUiHandler.postDelayed(() -> {
                mSwitchPreference.setEnabled(true);
                mSwitchPreference.setChecked(mode == TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
                for (OnNetworkSelectModeListener lsn : mListeners) {
                    lsn.onNetworkSelectModeChanged();
                }
                dismissProgressBar();
            }, Math.max(MINIMUM_DIALOG_TIME_MILLIS - durationMillis, 0));
        });
        return false;
    } else {
        final Bundle bundle = new Bundle();
        bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
        new SubSettingLauncher(mContext).setDestination(NetworkSelectSettings.class.getName()).setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT).setTitleRes(R.string.choose_network_title).setArguments(bundle).launch();
        return false;
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) NetworkSelectSettings(com.android.settings.network.telephony.NetworkSelectSettings)

Example 78 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class RunningProcessesView method startServiceDetailsActivity.

// utility method used to start sub activity
private void startServiceDetailsActivity(RunningState.MergedItem mi) {
    if (mOwner != null && mi != null) {
        // start new fragment to display extended information
        Bundle args = new Bundle();
        if (mi.mProcess != null) {
            args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
            args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
        }
        args.putInt(RunningServiceDetails.KEY_USER_ID, mi.mUserId);
        args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
        new SubSettingLauncher(getContext()).setDestination(RunningServiceDetails.class.getName()).setArguments(args).setTitleRes(R.string.runningservicedetails_settings_title).setSourceMetricsCategory(mOwner.getMetricsCategory()).launch();
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 79 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppInfoDashboardFragment method startAppInfoFragment.

public static void startAppInfoFragment(Class<?> fragment, int title, Bundle args, SettingsPreferenceFragment caller, AppEntry appEntry) {
    // start new fragment to display extended information
    if (args == null) {
        args = new Bundle();
    }
    args.putString(ARG_PACKAGE_NAME, appEntry.info.packageName);
    args.putInt(ARG_PACKAGE_UID, appEntry.info.uid);
    new SubSettingLauncher(caller.getContext()).setDestination(fragment.getName()).setArguments(args).setTitleRes(title).setResultListener(caller, SUB_INFO_FRAGMENT).setSourceMetricsCategory(caller.getMetricsCategory()).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 80 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class RestrictedAppDetails method startRestrictedAppDetails.

public static void startRestrictedAppDetails(InstrumentedPreferenceFragment fragment, List<AppInfo> appInfos) {
    final Bundle args = new Bundle();
    args.putParcelableList(EXTRA_APP_INFO_LIST, appInfos);
    new SubSettingLauncher(fragment.getContext()).setDestination(RestrictedAppDetails.class.getName()).setArguments(args).setTitleRes(R.string.restricted_app_title).setSourceMetricsCategory(fragment.getMetricsCategory()).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Aggregations

SubSettingLauncher (com.android.settings.core.SubSettingLauncher)135 Bundle (android.os.Bundle)116 Intent (android.content.Intent)24 VisibleForTesting (androidx.annotation.VisibleForTesting)16 Preference (androidx.preference.Preference)14 UserHandle (android.os.UserHandle)10 ManageApplications (com.android.settings.applications.manageapplications.ManageApplications)10 Context (android.content.Context)9 PendingIntent (android.app.PendingIntent)6 PackageManager (android.content.pm.PackageManager)5 ComponentName (android.content.ComponentName)4 PersistableBundle (android.os.PersistableBundle)4 ApplicationsState (com.android.settingslib.applications.ApplicationsState)4 UserManager (android.os.UserManager)3 View (android.view.View)3 NetworkSelectSettings (com.android.settings.network.telephony.NetworkSelectSettings)3 Activity (android.app.Activity)2 NotificationChannel (android.app.NotificationChannel)2 Drawable (android.graphics.drawable.Drawable)2 Uri (android.net.Uri)2