Search in sources :

Example 51 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class VolumeOptionMenuController method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
    if (!mFragment.isAdded()) {
        return false;
    }
    final int menuId = menuItem.getItemId();
    if (menuId == R.id.storage_mount) {
        if (mStorageEntry.isUnmounted()) {
            new MountTask(mFragment.getActivity(), mStorageEntry.getVolumeInfo()).execute();
            return true;
        }
        return false;
    }
    if (menuId == R.id.storage_unmount) {
        if (mStorageEntry.isMounted()) {
            if (mStorageEntry.isPublic()) {
                new UnmountTask(mFragment.getActivity(), mStorageEntry.getVolumeInfo()).execute();
                return true;
            }
            if (mStorageEntry.isPrivate() && !mStorageEntry.isDefaultInternalStorage()) {
                final Bundle args = new Bundle();
                args.putString(VolumeInfo.EXTRA_VOLUME_ID, mStorageEntry.getId());
                new SubSettingLauncher(mContext).setDestination(PrivateVolumeUnmount.class.getCanonicalName()).setTitleRes(R.string.storage_menu_unmount).setSourceMetricsCategory(SettingsEnums.DEVICEINFO_STORAGE).setArguments(args).launch();
                return true;
            }
        }
        return false;
    }
    if (menuId == R.id.storage_rename) {
        if ((mStorageEntry.isPrivate() && !mStorageEntry.isDefaultInternalStorage()) || mStorageEntry.isPublic()) {
            StorageRenameFragment.show(mFragment, mStorageEntry.getVolumeInfo());
            return true;
        }
        return false;
    }
    if (menuId == R.id.storage_format) {
        if (mStorageEntry.isDiskInfoUnsupported() || mStorageEntry.isPublic()) {
            StorageWizardFormatConfirm.showPublic(mFragment.getActivity(), mStorageEntry.getDiskId());
            return true;
        }
        return false;
    }
    if (menuId == R.id.storage_format_as_portable) {
        if (mStorageEntry.isPrivate()) {
            final Bundle args = new Bundle();
            args.putString(VolumeInfo.EXTRA_VOLUME_ID, mStorageEntry.getId());
            new SubSettingLauncher(mContext).setDestination(PrivateVolumeFormat.class.getCanonicalName()).setTitleRes(R.string.storage_menu_format).setSourceMetricsCategory(SettingsEnums.DEVICEINFO_STORAGE).setArguments(args).launch();
            return true;
        }
        return false;
    }
    if (menuId == R.id.storage_format_as_internal) {
        if (mStorageEntry.isPublic()) {
            StorageWizardFormatConfirm.showPrivate(mFragment.getActivity(), mStorageEntry.getDiskId());
            return true;
        }
        return false;
    }
    if (menuId == R.id.storage_migrate) {
        if (mStorageEntry.isPrivate()) {
            final Intent intent = new Intent(mContext, StorageWizardMigrateConfirm.class);
            intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mStorageEntry.getId());
            mContext.startActivity(intent);
            return true;
        }
        return false;
    }
    if (menuId == R.id.storage_forget) {
        if (mStorageEntry.isVolumeRecordMissed()) {
            StorageUtils.launchForgetMissingVolumeRecordFragment(mContext, mStorageEntry);
            return true;
        }
        return false;
    }
    return false;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) UnmountTask(com.android.settings.deviceinfo.storage.StorageUtils.UnmountTask) Intent(android.content.Intent) MountTask(com.android.settings.deviceinfo.storage.StorageUtils.MountTask)

Example 52 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSettings method launchConfigNewNetworkFragment.

private void launchConfigNewNetworkFragment(WifiEntry wifiEntry) {
    final Bundle bundle = new Bundle();
    bundle.putString(WifiNetworkDetailsFragment.KEY_CHOSEN_WIFIENTRY_KEY, wifiEntry.getKey());
    new SubSettingLauncher(getContext()).setTitleText(wifiEntry.getTitle()).setDestination(ConfigureWifiEntryFragment.class.getName()).setArguments(bundle).setSourceMetricsCategory(getMetricsCategory()).setResultListener(NetworkProviderSettings.this, CONFIG_NETWORK_REQUEST).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) ConfigureWifiEntryFragment(com.android.settings.wifi.ConfigureWifiEntryFragment)

Example 53 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class ChangeScreenLockPreferenceController method onGearClick.

@Override
public void onGearClick(GearPreference p) {
    if (TextUtils.equals(p.getKey(), getPreferenceKey())) {
        mMetricsFeatureProvider.logClickedPreference(p, p.getExtras().getInt(DashboardFragment.CATEGORY));
        new SubSettingLauncher(mContext).setDestination(ScreenLockSettings.class.getName()).setSourceMetricsCategory(mHost.getMetricsCategory()).launch();
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) ScreenLockSettings(com.android.settings.security.screenlock.ScreenLockSettings)

Example 54 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class LockUnificationPreferenceController method ununifyLocks.

private void ununifyLocks() {
    final Bundle extras = new Bundle();
    extras.putInt(Intent.EXTRA_USER_ID, mProfileUserId);
    extras.putParcelable(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, mCurrentDevicePassword);
    new SubSettingLauncher(mContext).setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()).setSourceMetricsCategory(mHost.getMetricsCategory()).setArguments(extras).setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 55 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class ChangeProfileScreenLockPreferenceController method handlePreferenceTreeClick.

@Override
public boolean handlePreferenceTreeClick(Preference preference) {
    if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
        return false;
    }
    if (Utils.startQuietModeDialogIfNecessary(mContext, mUm, mProfileChallengeUserId)) {
        return false;
    }
    final Bundle extras = new Bundle();
    extras.putInt(Intent.EXTRA_USER_ID, mProfileChallengeUserId);
    new SubSettingLauncher(mContext).setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()).setSourceMetricsCategory(mHost.getMetricsCategory()).setArguments(extras).setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE).launch();
    return true;
}
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