Search in sources :

Example 31 with SubSettingLauncher

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

the class DataUsagePreference method getIntent.

@Override
public Intent getIntent() {
    final Bundle args = new Bundle();
    final SubSettingLauncher launcher;
    args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, mTemplate);
    args.putInt(DataUsageList.EXTRA_SUB_ID, mSubId);
    args.putInt(DataUsageList.EXTRA_NETWORK_TYPE, mTemplate.isMatchRuleMobile() ? ConnectivityManager.TYPE_MOBILE : ConnectivityManager.TYPE_WIFI);
    launcher = new SubSettingLauncher(getContext()).setArguments(args).setDestination(DataUsageList.class.getName()).setSourceMetricsCategory(SettingsEnums.PAGE_UNKNOWN);
    if (mTemplate.isMatchRuleMobile()) {
        launcher.setTitleRes(R.string.app_cellular_data_usage);
    } else {
        launcher.setTitleRes(mTitleRes);
    }
    return launcher.toIntent();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 32 with SubSettingLauncher

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

the class BluetoothDevicesSlice method getPairNewDeviceAction.

private SliceAction getPairNewDeviceAction() {
    final Drawable drawable = mContext.getDrawable(R.drawable.ic_add_24dp);
    drawable.setTint(Utils.getColorAccentDefaultColor(mContext));
    final IconCompat icon = Utils.createIconWithDrawable(drawable);
    final String title = mContext.getString(R.string.bluetooth_pairing_pref_title);
    final Intent intent = new SubSettingLauncher(mContext).setDestination(BluetoothPairingDetail.class.getName()).setTitleRes(R.string.bluetooth_pairing_page_title).setSourceMetricsCategory(SettingsEnums.BLUETOOTH_PAIRING).toIntent();
    final PendingIntent pi = PendingIntent.getActivity(mContext, intent.hashCode(), intent, PendingIntent.FLAG_IMMUTABLE);
    return SliceAction.createDeeplink(pi, icon, ListBuilder.ICON_IMAGE, title);
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) IconCompat(androidx.core.graphics.drawable.IconCompat) Drawable(android.graphics.drawable.Drawable) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 33 with SubSettingLauncher

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

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)

Example 34 with SubSettingLauncher

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

the class BatteryOptimizationPreferenceController method handlePreferenceTreeClick.

@Override
public boolean handlePreferenceTreeClick(Preference preference) {
    if (!KEY_BACKGROUND_ACTIVITY.equals(preference.getKey())) {
        return false;
    }
    final Bundle args = new Bundle();
    args.putString(ManageApplications.EXTRA_CLASSNAME, Settings.HighPowerApplicationsActivity.class.getName());
    new SubSettingLauncher(mSettingsActivity).setDestination(ManageApplications.class.getName()).setArguments(args).setTitleRes(R.string.high_power_apps).setSourceMetricsCategory(mFragment.getMetricsCategory()).launch();
    return true;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) ManageApplications(com.android.settings.applications.manageapplications.ManageApplications)

Example 35 with SubSettingLauncher

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

the class RecentConversationsPreferenceController method getSubSettingLauncher.

SubSettingLauncher getSubSettingLauncher(ConversationChannel conversation, CharSequence title) {
    Bundle channelArgs = new Bundle();
    channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, conversation.getUid());
    channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, conversation.getShortcutInfo().getPackage());
    channelArgs.putString(Settings.EXTRA_CHANNEL_ID, conversation.getNotificationChannel().getId());
    channelArgs.putString(Settings.EXTRA_CONVERSATION_ID, conversation.getShortcutInfo().getId());
    return new SubSettingLauncher(mContext).setDestination(ChannelNotificationSettings.class.getName()).setArguments(channelArgs).setExtras(channelArgs).setUserHandle(UserHandle.getUserHandleForUid(conversation.getUid())).setTitleText(title).setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS);
}
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