Use Drawer in Settings app
- get rid of PreferenceActivity as much as we can and use fragments instead - add Drawer widget - add Dashboard high level entry into the Drawer (but this is work in progress and would be done in another CL) - add bypass of fragment's Header validation when launched from the Drawer but *force* validation if external call thru an Intent Be aware that WifiPickerActivity should remain for now a PreferenceActivity. It is used by SetupWizard and should not trigger running the SettingsActivity's header building code. SetupWizard is a Home during the provisionnig process and then deactivate itself as a Home but would make the Home header to appear in the Drawer (because momentarily we would have two Home). Also, verified that: - the WiFi settings still work when called from SetupWizard - when you have multiple Launchers, the Home header will appear in the list of Headers in the Drawer Change-Id: I407a5e0fdd843ad7615d3d511c416a44e3d97c90
This commit is contained in:
@@ -20,6 +20,7 @@ import static android.provider.Settings.Secure.TTS_DEFAULT_RATE;
|
||||
import static android.provider.Settings.Secure.TTS_DEFAULT_SYNTH;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.tts.TtsEnginePreference.RadioButtonGroupState;
|
||||
|
||||
@@ -30,9 +31,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.speech.tts.UtteranceProgressListener;
|
||||
@@ -212,7 +211,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
// Set up the default rate.
|
||||
try {
|
||||
mDefaultRate = Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE);
|
||||
mDefaultRate = android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_RATE);
|
||||
} catch (SettingNotFoundException e) {
|
||||
// Default rate setting not found, initialize it
|
||||
mDefaultRate = TextToSpeech.Engine.DEFAULT_RATE;
|
||||
@@ -222,12 +221,12 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
mCurrentEngine = mTts.getCurrentEngine();
|
||||
|
||||
PreferenceActivity preferenceActivity = null;
|
||||
if (getActivity() instanceof PreferenceActivity) {
|
||||
preferenceActivity = (PreferenceActivity) getActivity();
|
||||
SettingsActivity activity = null;
|
||||
if (getActivity() instanceof SettingsActivity) {
|
||||
activity = (SettingsActivity) getActivity();
|
||||
} else {
|
||||
throw new IllegalStateException("TextToSpeechSettings used outside a " +
|
||||
"PreferenceActivity");
|
||||
"Settings");
|
||||
}
|
||||
|
||||
mEnginePreferenceCategory.removeAll();
|
||||
@@ -235,7 +234,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
||||
List<EngineInfo> engines = mEnginesHelper.getEngines();
|
||||
for (EngineInfo engine : engines) {
|
||||
TtsEnginePreference enginePref = new TtsEnginePreference(getActivity(), engine,
|
||||
this, preferenceActivity);
|
||||
this, activity);
|
||||
mEnginePreferenceCategory.addPreference(enginePref);
|
||||
}
|
||||
|
||||
@@ -422,7 +421,8 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
||||
// Default rate
|
||||
mDefaultRate = Integer.parseInt((String) objValue);
|
||||
try {
|
||||
Settings.Secure.putInt(getContentResolver(), TTS_DEFAULT_RATE, mDefaultRate);
|
||||
android.provider.Settings.Secure.putInt(getContentResolver(),
|
||||
TTS_DEFAULT_RATE, mDefaultRate);
|
||||
if (mTts != null) {
|
||||
mTts.setSpeechRate(mDefaultRate / 100.0f);
|
||||
}
|
||||
@@ -565,7 +565,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
||||
return;
|
||||
}
|
||||
|
||||
Settings.Secure.putString(getContentResolver(), TTS_DEFAULT_SYNTH, engine);
|
||||
android.provider.Settings.Secure.putString(getContentResolver(), TTS_DEFAULT_SYNTH, engine);
|
||||
|
||||
mAvailableStrLocals = data.getStringArrayListExtra(
|
||||
TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
|
||||
|
Reference in New Issue
Block a user