Search in sources :

Example 1 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UserDictionaryAddWordFragment method onItemSelected.

@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int pos, final long id) {
    final LocaleRenderer locale = (LocaleRenderer) parent.getItemAtPosition(pos);
    if (locale.isMoreLanguages()) {
        SettingsActivity sa = (SettingsActivity) getActivity();
        sa.startPreferenceFragment(new UserDictionaryLocalePicker(this), true);
    } else {
        mContents.updateLocale(locale.getLocaleString());
    }
}
Also used : LocaleRenderer(com.android.settings.inputmethod.UserDictionaryAddWordContents.LocaleRenderer) SettingsActivity(com.android.settings.SettingsActivity)

Example 2 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiSettings method setOffMessage.

private void setOffMessage() {
    if (isUiRestricted()) {
        if (!isUiRestrictedByOnlyAdmin()) {
            addMessagePreference(R.string.wifi_empty_list_user_restricted);
        }
        getPreferenceScreen().removeAll();
        return;
    }
    TextView emptyTextView = getEmptyTextView();
    if (emptyTextView == null) {
        return;
    }
    final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off);
    // Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead,
    // read the system settings directly. Because when the device is in Airplane mode, even if
    // Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
    final ContentResolver resolver = getActivity().getContentResolver();
    final boolean wifiScanningMode = Settings.Global.getInt(resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
    if (!wifiScanningMode) {
        // Show only the brief text if the user is not allowed to configure scanning settings,
        // or the scanning mode has been turned off.
        emptyTextView.setText(briefText, BufferType.SPANNABLE);
    } else {
        // Append the description of scanning settings with link.
        final StringBuilder contentBuilder = new StringBuilder();
        contentBuilder.append(briefText);
        contentBuilder.append("\n\n");
        contentBuilder.append(getText(R.string.wifi_scan_notify_text));
        LinkifyUtils.linkify(emptyTextView, contentBuilder, new LinkifyUtils.OnClickListener() {

            @Override
            public void onClick() {
                final SettingsActivity activity = (SettingsActivity) WifiSettings.this.getActivity();
                activity.startPreferencePanel(ScanningSettings.class.getName(), null, R.string.location_scanning_screen_title, null, null, 0);
            }
        });
    }
    getPreferenceScreen().removeAll();
}
Also used : LinkifyUtils(com.android.settings.LinkifyUtils) TextView(android.widget.TextView) SettingsActivity(com.android.settings.SettingsActivity) ContentResolver(android.content.ContentResolver)

Example 3 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PowerUsageDetail method startApplicationDetailsActivity.

// utility method used to start sub activity
private void startApplicationDetailsActivity() {
    // start new fragment to display extended information
    Bundle args = new Bundle();
    args.putString(InstalledAppDetails.ARG_PACKAGE_NAME, mPackages[0]);
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.startPreferencePanel(InstalledAppDetails.class.getName(), args, R.string.application_info_label, null, null, 0);
}
Also used : InstalledAppDetails(com.android.settings.applications.InstalledAppDetails) Bundle(android.os.Bundle) SettingsActivity(com.android.settings.SettingsActivity)

Example 4 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ColorPickerPreference method showFragment.

private void showFragment(Bundle state) {
    SettingsActivity sa = null;
    if (getContext() instanceof ContextThemeWrapper) {
        if (((ContextThemeWrapper) getContext()).getBaseContext() instanceof SettingsActivity) {
            sa = (SettingsActivity) ((ContextThemeWrapper) getContext()).getBaseContext();
        }
    }
    if (sa == null) {
        return;
    }
    Bundle arguments;
    if (state != null) {
        arguments = new Bundle(state);
    } else {
        SharedPreferences prefs = sa.getSharedPreferences("color_picker_fragment", Activity.MODE_PRIVATE);
        boolean showHelpScreen = prefs.getBoolean("show_help_screen", true);
        arguments = new Bundle();
        arguments.putInt("new_color", mValue);
        arguments.putInt("old_color", mValue);
        arguments.putBoolean("help_screen_visible", showHelpScreen);
    }
    arguments.putInt("initial_color", mValue);
    arguments.putInt("reset_color_1", mResetColor1);
    arguments.putInt("reset_color_2", mResetColor2);
    arguments.putCharSequence("reset_color_1_title", mResetColor1Title);
    arguments.putCharSequence("reset_color_2_title", mResetColor2Title);
    arguments.putBoolean("alpha_slider_visible", mAlphaSliderVisible);
    mPickerFragment = new ColorPickerFragment();
    mPickerFragment.setArguments(arguments);
    mPickerFragment.setOnColorChangedListener(this);
    FragmentTransaction transaction = sa.getFragmentManager().beginTransaction();
    transaction.replace(R.id.main_content, mPickerFragment);
    transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    transaction.addToBackStack(":settings:prefs");
    transaction.setBreadCrumbTitle(R.string.color_picker_fragment_title);
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) ContextThemeWrapper(android.view.ContextThemeWrapper) SharedPreferences(android.content.SharedPreferences) Bundle(android.os.Bundle) ColorPickerFragment(net.margaritov.preference.colorpicker.fragment.ColorPickerFragment) SettingsActivity(com.android.settings.SettingsActivity)

Example 5 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConvertToFbe method convert.

private void convert() {
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.startPreferencePanel(ConfirmConvertToFbe.class.getName(), null, R.string.convert_to_file_encryption, null, null, 0);
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Aggregations

SettingsActivity (com.android.settings.SettingsActivity)246 Bundle (android.os.Bundle)71 Intent (android.content.Intent)37 ArrayList (java.util.ArrayList)27 Preference (android.support.v7.preference.Preference)25 AnomalySummaryPreferenceController (com.android.settings.fuelgauge.anomaly.AnomalySummaryPreferenceController)17 SwitchBarController (com.android.settings.widget.SwitchBarController)16 ContentResolver (android.content.ContentResolver)15 TextView (android.widget.TextView)15 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)15 Test (org.junit.Test)15 Context (android.content.Context)14 View (android.view.View)14 LinkifyUtils (com.android.settings.LinkifyUtils)14 RemoteException (android.os.RemoteException)13 EngineInfo (android.speech.tts.TextToSpeech.EngineInfo)13 PreferenceScreen (android.support.v7.preference.PreferenceScreen)13 RecyclerView (android.support.v7.widget.RecyclerView)12 LayoutPreference (com.android.settings.applications.LayoutPreference)12 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)11