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:
Fabrice Di Meglio
2014-01-17 19:17:58 -08:00
parent af79ddb358
commit 263bcc8b73
76 changed files with 2475 additions and 1494 deletions

View File

@@ -87,8 +87,6 @@ import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
@@ -548,8 +546,8 @@ public class DataUsageSummary extends Fragment {
return true;
}
case R.id.data_usage_menu_metered: {
final PreferenceActivity activity = (PreferenceActivity) getActivity();
activity.startPreferencePanel(DataUsageMeteredSettings.class.getCanonicalName(), null,
final SettingsActivity sa = (SettingsActivity) getActivity();
sa.startPreferencePanel(DataUsageMeteredSettings.class.getCanonicalName(), null,
R.string.data_usage_metered_title, null, this, 0);
return true;
}
@@ -886,14 +884,16 @@ public class DataUsageSummary extends Fragment {
private boolean getDataRoaming() {
final ContentResolver resolver = getActivity().getContentResolver();
return Settings.Global.getInt(resolver, Settings.Global.DATA_ROAMING, 0) != 0;
return android.provider.Settings.Global.getInt(resolver,
android.provider.Settings.Global.DATA_ROAMING, 0) != 0;
}
private void setDataRoaming(boolean enabled) {
// TODO: teach telephony DataConnectionTracker to watch and apply
// updates when changed.
final ContentResolver resolver = getActivity().getContentResolver();
Settings.Global.putInt(resolver, Settings.Global.DATA_ROAMING, enabled ? 1 : 0);
android.provider.Settings.Global.putInt(resolver,
android.provider.Settings.Global.DATA_ROAMING, enabled ? 1 : 0);
mMenuDataRoaming.setChecked(enabled);
}