use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSlice method getAccessPointAction.
private SliceAction getAccessPointAction(AccessPoint accessPoint, boolean isCaptivePortal, IconCompat icon, CharSequence title) {
final int requestCode = accessPoint.hashCode();
if (isCaptivePortal) {
final Intent intent = new Intent(mContext, ConnectToWifiHandler.class).putExtra(ConnectivityManager.EXTRA_NETWORK, mWifiManager.getCurrentNetwork());
return getBroadcastAction(requestCode, intent, icon, title);
}
final Bundle extras = new Bundle();
accessPoint.saveWifiState(extras);
if (accessPoint.isActive()) {
final Intent intent = new SubSettingLauncher(mContext).setTitleRes(R.string.pref_title_network_details).setDestination(WifiNetworkDetailsFragment.class.getName()).setArguments(extras).setSourceMetricsCategory(SettingsEnums.WIFI).toIntent();
return getActivityAction(requestCode, intent, icon, title);
} else if (WifiUtils.getConnectingType(accessPoint) != WifiUtils.CONNECT_TYPE_OTHERS) {
final Intent intent = new Intent(mContext, ConnectToWifiHandler.class).putExtra(WifiDialogActivity.KEY_ACCESS_POINT_STATE, extras);
return getBroadcastAction(requestCode, intent, icon, title);
} else {
final Intent intent = new Intent(mContext, WifiDialogActivity.class).putExtra(WifiDialogActivity.KEY_ACCESS_POINT_STATE, extras);
return getActivityAction(requestCode, intent, icon, title);
}
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageList method onViewCreated.
@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
super.onViewCreated(v, savedInstanceState);
mHeader = setPinnedHeaderView(R.layout.apps_filter_spinner);
mHeader.findViewById(R.id.filter_settings).setOnClickListener(btn -> {
final Bundle args = new Bundle();
args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, mTemplate);
new SubSettingLauncher(getContext()).setDestination(BillingCycleSettings.class.getName()).setTitleRes(R.string.billing_cycle).setSourceMetricsCategory(getMetricsCategory()).setArguments(args).launch();
});
mCycleSpinner = mHeader.findViewById(R.id.filter_spinner);
mCycleSpinner.setVisibility(View.GONE);
mCycleAdapter = new CycleAdapter(mCycleSpinner.getContext(), new SpinnerInterface() {
@Override
public void setAdapter(CycleAdapter cycleAdapter) {
mCycleSpinner.setAdapter(cycleAdapter);
}
@Override
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
mCycleSpinner.setOnItemSelectedListener(listener);
}
@Override
public Object getSelectedItem() {
return mCycleSpinner.getSelectedItem();
}
@Override
public void setSelection(int position) {
mCycleSpinner.setSelection(position);
}
}, mCycleListener);
mLoadingViewController = new LoadingViewController(getView().findViewById(R.id.loading_container), getListView());
mLoadingViewController.showLoadingViewDelayed();
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageList method startAppDataUsage.
@VisibleForTesting
void startAppDataUsage(AppItem item) {
final Bundle args = new Bundle();
args.putParcelable(AppDataUsage.ARG_APP_ITEM, item);
args.putParcelable(AppDataUsage.ARG_NETWORK_TEMPLATE, mTemplate);
if (mCycles == null) {
mCycles = new ArrayList<>();
for (NetworkCycleChartData data : mCycleData) {
if (mCycles.isEmpty()) {
mCycles.add(data.getEndTime());
}
mCycles.add(data.getStartTime());
}
}
args.putSerializable(AppDataUsage.ARG_NETWORK_CYCLES, mCycles);
args.putLong(AppDataUsage.ARG_SELECTED_CYCLE, mCycleData.get(mCycleSpinner.getSelectedItemPosition()).getEndTime());
new SubSettingLauncher(getContext()).setDestination(AppDataUsage.class.getName()).setTitleRes(R.string.data_usage_app_summary_title).setArguments(args).setSourceMetricsCategory(getMetricsCategory()).launch();
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BillingCyclePreference method getIntent.
@Override
public Intent getIntent() {
Bundle args = new Bundle();
args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, mTemplate);
return new SubSettingLauncher(getContext()).setDestination(BillingCycleSettings.class.getName()).setArguments(args).setTitleRes(R.string.billing_cycle).setSourceMetricsCategory(SettingsEnums.PAGE_UNKNOWN).toIntent();
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RegionSearchPicker method onListItemClick.
private void onListItemClick(RegionItem item) {
final String regionId = item.getId();
final FilteredCountryTimeZones countryTimeZones = mTimeZoneData.lookupCountryTimeZones(regionId);
final Activity activity = getActivity();
if (countryTimeZones == null || countryTimeZones.getTimeZoneIds().isEmpty()) {
Log.e(TAG, "Region has no time zones: " + regionId);
activity.setResult(Activity.RESULT_CANCELED);
activity.finish();
return;
}
List<String> timeZoneIds = countryTimeZones.getTimeZoneIds();
// Choose the time zone associated the region if there is only one time zone in that region
if (timeZoneIds.size() == 1) {
final Intent resultData = new Intent().putExtra(EXTRA_RESULT_REGION_ID, regionId).putExtra(EXTRA_RESULT_TIME_ZONE_ID, timeZoneIds.get(0));
getActivity().setResult(Activity.RESULT_OK, resultData);
getActivity().finish();
} else {
// Launch the zone picker and let the user choose a time zone from the list of
// time zones associated with the region.
final Bundle args = new Bundle();
args.putString(RegionZonePicker.EXTRA_REGION_ID, regionId);
new SubSettingLauncher(getContext()).setDestination(RegionZonePicker.class.getCanonicalName()).setArguments(args).setSourceMetricsCategory(getMetricsCategory()).setResultListener(this, REQUEST_CODE_ZONE_PICKER).launch();
}
}
Aggregations