Search in sources :

Example 66 with SubSettingLauncher

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);
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) AccessPoint(com.android.settingslib.wifi.AccessPoint)

Example 67 with SubSettingLauncher

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();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) SpinnerInterface(com.android.settings.datausage.CycleAdapter.SpinnerInterface) OnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener) LoadingViewController(com.android.settings.widget.LoadingViewController)

Example 68 with SubSettingLauncher

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();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) NetworkCycleChartData(com.android.settingslib.net.NetworkCycleChartData) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 69 with SubSettingLauncher

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();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 70 with SubSettingLauncher

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();
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) Activity(android.app.Activity) Intent(android.content.Intent) FilteredCountryTimeZones(com.android.settings.datetime.timezone.model.FilteredCountryTimeZones)

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