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();
}
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);
}
}
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);
}
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);
}
}
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);
}
}
Aggregations