use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.
the class WifiSlice method getWifiEntryAction.
protected SliceAction getWifiEntryAction(WifiSliceItem wifiSliceItem, IconCompat icon, CharSequence title) {
final int requestCode = wifiSliceItem.getKey().hashCode();
if (wifiSliceItem.getConnectedState() != WifiEntry.CONNECTED_STATE_DISCONNECTED) {
final Bundle bundle = new Bundle();
bundle.putString(WifiNetworkDetailsFragment.KEY_CHOSEN_WIFIENTRY_KEY, wifiSliceItem.getKey());
final Intent intent = new SubSettingLauncher(mContext).setTitleRes(R.string.pref_title_network_details).setDestination(WifiNetworkDetailsFragment.class.getName()).setArguments(bundle).setSourceMetricsCategory(SettingsEnums.WIFI).toIntent();
return getActivityAction(requestCode, intent, icon, title);
}
if (wifiSliceItem.shouldEditBeforeConnect()) {
final Intent intent = new Intent(mContext, WifiDialogActivity.class).putExtra(WifiDialogActivity.KEY_CHOSEN_WIFIENTRY_KEY, wifiSliceItem.getKey());
return getActivityAction(requestCode, intent, icon, title);
}
final Intent intent = new Intent(mContext, ConnectToWifiHandler.class).putExtra(ConnectToWifiHandler.KEY_CHOSEN_WIFIENTRY_KEY, wifiSliceItem.getKey()).putExtra(ConnectToWifiHandler.KEY_WIFI_SLICE_URI, getUri());
return getBroadcastAction(requestCode, intent, icon, title);
}
use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.
the class AdvancedPowerUsageDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Intent intent = getIntent();
final Uri data = intent == null ? null : intent.getData();
final String packageName = data == null ? null : data.getSchemeSpecificPart();
if (packageName != null) {
final Bundle args = new Bundle(4);
final PackageManager packageManager = getPackageManager();
args.putString(EXTRA_PACKAGE_NAME, packageName);
args.putString(EXTRA_POWER_USAGE_PERCENT, Utils.formatPercentage(0));
if (intent.getBooleanExtra("request_ignore_background_restriction", false)) {
args.putString(":settings:fragment_args_key", "background_activity");
}
try {
args.putInt(EXTRA_UID, packageManager.getPackageUid(packageName, 0));
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Cannot find package: " + packageName, e);
}
new SubSettingLauncher(this).setDestination(AdvancedPowerUsageDetail.class.getName()).setTitleRes(R.string.battery_details_title).setArguments(args).setSourceMetricsCategory(SettingsEnums.APPLICATIONS_INSTALLED_APP_DETAILS).launch();
}
finish();
}
use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.
the class AdvancedPowerUsageDetail method startBatteryDetailPage.
private static void startBatteryDetailPage(Activity caller, InstrumentedPreferenceFragment fragment, LaunchBatteryDetailPageArgs launchArgs) {
final Bundle args = new Bundle();
if (launchArgs.mPackageName == null) {
// populate data for system app
args.putString(EXTRA_LABEL, launchArgs.mAppLabel);
args.putInt(EXTRA_ICON_ID, launchArgs.mIconId);
args.putString(EXTRA_PACKAGE_NAME, null);
} else {
// populate data for normal app
args.putString(EXTRA_PACKAGE_NAME, launchArgs.mPackageName);
}
args.putInt(EXTRA_UID, launchArgs.mUid);
args.putLong(EXTRA_BACKGROUND_TIME, launchArgs.mBackgroundTimeMs);
args.putLong(EXTRA_FOREGROUND_TIME, launchArgs.mForegroundTimeMs);
args.putString(EXTRA_SLOT_TIME, launchArgs.mSlotInformation);
args.putString(EXTRA_POWER_USAGE_PERCENT, launchArgs.mUsagePercent);
args.putInt(EXTRA_POWER_USAGE_AMOUNT, launchArgs.mConsumedPower);
final int userId = launchArgs.mIsUserEntry ? ActivityManager.getCurrentUser() : UserHandle.getUserId(launchArgs.mUid);
new SubSettingLauncher(caller).setDestination(AdvancedPowerUsageDetail.class.getName()).setTitleRes(R.string.battery_details_title).setArguments(args).setSourceMetricsCategory(fragment.getMetricsCategory()).setUserHandle(new UserHandle(userId)).launch();
}
use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.
the class UserSettings method openUserDetails.
private void openUserDetails(UserInfo userInfo, boolean newUser) {
Bundle extras = new Bundle();
extras.putInt(UserDetailsSettings.EXTRA_USER_ID, userInfo.id);
extras.putBoolean(AppRestrictionsFragment.EXTRA_NEW_USER, newUser);
final Context context = getContext();
SubSettingLauncher launcher = new SubSettingLauncher(context).setDestination(UserDetailsSettings.class.getName()).setArguments(extras).setTitleText(getUserName(context, userInfo)).setSourceMetricsCategory(getMetricsCategory());
if (mGuestUserAutoCreated && userInfo.isGuest()) {
launcher.setResultListener(this, REQUEST_EDIT_GUEST);
}
launcher.launch();
}
use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.
the class ChannelNotificationSettings method onResume.
@Override
public void onResume() {
super.onResume();
if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null) {
Log.w(TAG, "Missing package or uid or packageinfo or channel");
finish();
return;
}
getActivity().setTitle(mChannel.getName());
if (!TextUtils.isEmpty(mChannel.getConversationId()) && !mChannel.isDemoted()) {
Intent intent = new SubSettingLauncher(mContext).setDestination(ConversationNotificationSettings.class.getName()).setArguments(getArguments()).setExtras(getIntent() != null ? getIntent().getExtras() : null).setSourceMetricsCategory(SettingsEnums.NOTIFICATION_TOPIC_NOTIFICATION).toIntent();
if (mPreferenceFilter != null) {
intent.setClass(mContext, ChannelPanelActivity.class);
}
startActivity(intent);
finish();
return;
}
for (NotificationPreferenceController controller : mControllers) {
controller.onResume(mAppRow, mChannel, mChannelGroup, null, null, mSuspendedAppsAdmin, mPreferenceFilter);
controller.displayPreference(getPreferenceScreen());
}
updatePreferenceStates();
animatePanel();
}
Aggregations