Search in sources :

Example 71 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.

the class ZenModeRuleSettingsBase method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.addOnSwitchChangeListener(this);
    mSwitchBar.show();
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 72 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.

the class RunningProcessesView method startServiceDetailsActivity.

// utility method used to start sub activity
private void startServiceDetailsActivity(RunningState.MergedItem mi) {
    if (mOwner != null && mi != null) {
        // start new fragment to display extended information
        Bundle args = new Bundle();
        if (mi.mProcess != null) {
            args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
            args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
        }
        args.putInt(RunningServiceDetails.KEY_USER_ID, mi.mUserId);
        args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
        SettingsActivity sa = (SettingsActivity) mOwner.getActivity();
        sa.startPreferencePanel(mOwner, RunningServiceDetails.class.getName(), args, R.string.runningservicedetails_settings_title, null, null, 0);
    }
}
Also used : Bundle(android.os.Bundle) SettingsActivity(com.android.settings.SettingsActivity)

Example 73 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.

the class TextToSpeechSettings method initSettings.

private void initSettings() {
    final ContentResolver resolver = getContentResolver();
    // Set up the default rate and pitch.
    mDefaultRate = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE, TextToSpeech.Engine.DEFAULT_RATE);
    mDefaultPitch = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH, TextToSpeech.Engine.DEFAULT_PITCH);
    mDefaultRatePref.setProgress(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, mDefaultRate));
    mDefaultRatePref.setOnPreferenceChangeListener(this);
    mDefaultRatePref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_RATE, MAX_SPEECH_RATE));
    mDefaultPitchPref.setProgress(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, mDefaultPitch));
    mDefaultPitchPref.setOnPreferenceChangeListener(this);
    mDefaultPitchPref.setMax(getSeekBarProgressFromValue(KEY_DEFAULT_PITCH, MAX_SPEECH_PITCH));
    if (mTts != null) {
        mCurrentEngine = mTts.getCurrentEngine();
        mTts.setSpeechRate(mDefaultRate / 100.0f);
        mTts.setPitch(mDefaultPitch / 100.0f);
    }
    SettingsActivity activity = null;
    if (getActivity() instanceof SettingsActivity) {
        activity = (SettingsActivity) getActivity();
    } else {
        throw new IllegalStateException("TextToSpeechSettings used outside a " + "Settings");
    }
    if (mCurrentEngine != null) {
        EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
        Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE);
        ((GearPreference) mEnginePreference).setOnGearClickListener(this);
        mEnginePreference.setSummary(info.label);
    }
    checkVoiceData(mCurrentEngine);
}
Also used : GearPreference(com.android.settings.widget.GearPreference) EngineInfo(android.speech.tts.TextToSpeech.EngineInfo) SeekBarPreference(com.android.settings.widget.SeekBarPreference) ListPreference(android.support.v7.preference.ListPreference) LayoutPreference(com.android.settings.applications.LayoutPreference) GearPreference(com.android.settings.widget.GearPreference) Preference(android.support.v7.preference.Preference) SettingsActivity(com.android.settings.SettingsActivity) ContentResolver(android.content.ContentResolver)

Example 74 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.

the class TtsEnginePreferenceFragment method initSettings.

private void initSettings() {
    if (mTts != null) {
        mCurrentEngine = mTts.getCurrentEngine();
    }
    mEnginePreferenceCategory.removeAll();
    SettingsActivity activity = (SettingsActivity) getActivity();
    List<EngineInfo> engines = mEnginesHelper.getEngines();
    for (EngineInfo engine : engines) {
        TtsEnginePreference enginePref = new TtsEnginePreference(getPrefContext(), engine, this, activity);
        mEnginePreferenceCategory.addPreference(enginePref);
    }
}
Also used : EngineInfo(android.speech.tts.TextToSpeech.EngineInfo) SettingsActivity(com.android.settings.SettingsActivity)

Example 75 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by SudaMod.

the class UserSettings method onManageUserClicked.

private void onManageUserClicked(int userId, boolean newUser) {
    mAddingUser = false;
    if (userId == UserPreference.USERID_GUEST_DEFAULTS) {
        Bundle extras = new Bundle();
        extras.putBoolean(UserDetailsSettings.EXTRA_USER_GUEST, true);
        ((SettingsActivity) getActivity()).startPreferencePanel(this, UserDetailsSettings.class.getName(), extras, R.string.user_guest, null, null, 0);
        return;
    }
    UserInfo info = mUserManager.getUserInfo(userId);
    if (info.isRestricted() && mUserCaps.mIsAdmin) {
        Bundle extras = new Bundle();
        extras.putInt(RestrictedProfileSettings.EXTRA_USER_ID, userId);
        extras.putBoolean(RestrictedProfileSettings.EXTRA_NEW_USER, newUser);
        ((SettingsActivity) getActivity()).startPreferencePanel(this, RestrictedProfileSettings.class.getName(), extras, R.string.user_restrictions_title, null, null, 0);
    } else if (info.id == UserHandle.myUserId()) {
        // Jump to owner info panel
        OwnerInfoSettings.show(this);
    } else if (mUserCaps.mIsAdmin) {
        Bundle extras = new Bundle();
        extras.putInt(UserDetailsSettings.EXTRA_USER_ID, userId);
        ((SettingsActivity) getActivity()).startPreferencePanel(this, UserDetailsSettings.class.getName(), extras, -1, /* No title res id */
        info.name, /* title */
        null, /* resultTo */
        0);
    }
}
Also used : Bundle(android.os.Bundle) UserInfo(android.content.pm.UserInfo) 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)18 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