use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.
the class AppConversationListPreferenceController method populateConversationPreference.
protected void populateConversationPreference(final ConversationChannelWrapper conversation, final Preference pref) {
ShortcutInfo si = conversation.getShortcutInfo();
pref.setTitle(si != null ? si.getLabel() : conversation.getNotificationChannel().getName());
pref.setSummary(conversation.getNotificationChannel().getGroup() != null ? mContext.getString(R.string.notification_conversation_summary, conversation.getParentChannelLabel(), conversation.getGroupLabel()) : conversation.getParentChannelLabel());
if (si != null) {
pref.setIcon(mBackend.getConversationDrawable(mContext, si, mAppRow.pkg, mAppRow.uid, conversation.getNotificationChannel().isImportantConversation()));
}
pref.setKey(conversation.getNotificationChannel().getId());
Bundle channelArgs = new Bundle();
channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, mAppRow.uid);
channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mAppRow.pkg);
channelArgs.putString(Settings.EXTRA_CHANNEL_ID, conversation.getNotificationChannel().getParentChannelId());
channelArgs.putString(Settings.EXTRA_CONVERSATION_ID, conversation.getNotificationChannel().getConversationId());
channelArgs.putBoolean(ARG_FROM_SETTINGS, true);
pref.setIntent(new SubSettingLauncher(mContext).setDestination(ChannelNotificationSettings.class.getName()).setArguments(channelArgs).setExtras(channelArgs).setTitleText(pref.getTitle()).setSourceMetricsCategory(SettingsEnums.NOTIFICATION_APP_NOTIFICATION).toIntent());
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PrivateVolumeSettings method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(Preference pref) {
// TODO: launch better intents for specific volume
final int userId = (pref instanceof StorageItemPreference ? ((StorageItemPreference) pref).userHandle : -1);
int itemTitleId;
try {
itemTitleId = Integer.parseInt(pref.getKey());
} catch (NumberFormatException e) {
itemTitleId = 0;
}
Intent intent = null;
switch(itemTitleId) {
case R.string.storage_detail_apps:
{
Bundle args = new Bundle();
args.putString(ManageApplications.EXTRA_CLASSNAME, StorageUseActivity.class.getName());
args.putString(ManageApplications.EXTRA_VOLUME_UUID, mVolume.getFsUuid());
args.putString(ManageApplications.EXTRA_VOLUME_NAME, mVolume.getDescription());
args.putInt(ManageApplications.EXTRA_STORAGE_TYPE, ManageApplications.STORAGE_TYPE_LEGACY);
intent = new SubSettingLauncher(getActivity()).setDestination(ManageApplications.class.getName()).setArguments(args).setTitleRes(R.string.apps_storage).setSourceMetricsCategory(getMetricsCategory()).toIntent();
}
break;
case R.string.storage_detail_images:
{
intent = getIntentForStorage(AUTHORITY_MEDIA, "images_root");
}
break;
case R.string.storage_detail_videos:
{
intent = getIntentForStorage(AUTHORITY_MEDIA, "videos_root");
}
break;
case R.string.storage_detail_audio:
{
intent = getIntentForStorage(AUTHORITY_MEDIA, "audio_root");
}
break;
case R.string.storage_detail_system:
{
SystemInfoFragment.show(this);
return true;
}
case R.string.storage_detail_other:
{
OtherInfoFragment.show(this, mStorageManager.getBestVolumeDescription(mVolume), mSharedVolume, userId);
return true;
}
case R.string.storage_detail_cached:
{
ConfirmClearCacheFragment.show(this);
return true;
}
case R.string.storage_menu_explore:
{
intent = mSharedVolume.buildBrowseIntent();
}
break;
case 0:
{
UserInfoFragment.show(this, pref.getTitle(), pref.getSummary());
return true;
}
}
if (intent != null) {
intent.putExtra(Intent.EXTRA_USER_ID, userId);
Utils.launchIntent(this, intent);
return true;
}
return super.onPreferenceTreeClick(pref);
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class StorageSettings method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(Preference pref) {
final String key = pref.getKey();
if (pref instanceof StorageVolumePreference) {
// Picked a normal volume
final VolumeInfo vol = mStorageManager.findVolumeById(key);
if (vol == null) {
return false;
}
if (vol.getState() == VolumeInfo.STATE_UNMOUNTED) {
VolumeUnmountedFragment.show(this, vol.getId());
return true;
} else if (vol.getState() == VolumeInfo.STATE_UNMOUNTABLE) {
DiskInitFragment.show(this, R.string.storage_dialog_unmountable, vol.getDiskId());
return true;
}
if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
final Bundle args = new Bundle();
args.putString(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())) {
new SubSettingLauncher(getContext()).setDestination(StorageDashboardFragment.class.getCanonicalName()).setTitleRes(R.string.storage_settings).setSourceMetricsCategory(getMetricsCategory()).setArguments(args).launch();
} else {
// TODO: Go to the StorageDashboardFragment once it fully handles all of the
// SD card cases and other private internal storage cases.
PrivateVolumeSettings.setVolumeSize(args, PrivateStorageInfo.getTotalSize(vol, sTotalInternalStorage));
new SubSettingLauncher(getContext()).setDestination(PrivateVolumeSettings.class.getCanonicalName()).setTitleRes(-1).setSourceMetricsCategory(getMetricsCategory()).setArguments(args).launch();
}
return true;
} else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
return handlePublicVolumeClick(getContext(), vol);
} else if (vol.getType() == VolumeInfo.TYPE_STUB) {
return handleStubVolumeClick(getContext(), vol);
}
} else if (key.startsWith("disk:")) {
// Picked an unsupported disk
DiskInitFragment.show(this, R.string.storage_dialog_unsupported, key);
return true;
} else {
// Picked a missing private volume
final Bundle args = new Bundle();
args.putString(VolumeRecord.EXTRA_FS_UUID, key);
new SubSettingLauncher(getContext()).setDestination(PrivateVolumeForget.class.getCanonicalName()).setTitleRes(R.string.storage_menu_forget).setSourceMetricsCategory(getMetricsCategory()).setArguments(args).launch();
return true;
}
return false;
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class StorageSettings method handlePublicVolumeClick.
@VisibleForTesting
static boolean handlePublicVolumeClick(Context context, VolumeInfo vol) {
final Intent intent = vol.buildBrowseIntent();
if (vol.isMountedReadable() && intent != null) {
context.startActivity(intent);
return true;
} else {
final Bundle args = new Bundle();
args.putString(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
new SubSettingLauncher(context).setDestination(PublicVolumeSettings.class.getCanonicalName()).setTitleRes(-1).setSourceMetricsCategory(METRICS_CATEGORY).setArguments(args).launch();
return true;
}
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppManagementFragment method show.
public static void show(Context context, AppPreference pref, int sourceMetricsCategory) {
final Bundle args = new Bundle();
args.putString(ARG_PACKAGE_NAME, pref.getPackageName());
new SubSettingLauncher(context).setDestination(AppManagementFragment.class.getName()).setArguments(args).setTitleText(pref.getLabel()).setSourceMetricsCategory(sourceMetricsCategory).setUserHandle(new UserHandle(pref.getUserId())).launch();
}
Aggregations