Settings - update for new UI (no more Drawer)

- follow the UX spec by no more using a Drawer
- the Dashboard is now a Fragment that contains the list of Headers
- the search results are also put into a Fragment that is replacing
the initial one (Dashboard or other) when expanding the SearchView
- use a SearchView for query input
- when tapping on a Header or a Search Result, re-launch Settings as
an Activity so that we are benefiting from the Activity stack for
UP affordance and BACK button
- manage UP affordance to show it only when needed
- move some Actions to the Menu in the ActionBar for allowing space
to the Search action and removing some clutter
- fix an issue with the Index and WiFiEnabler and their cached Context
that was not updated when there was a Configuration change
- simplify the SettingsActivity code by extracting some inner classes

Change-Id: I50b5f77bb44a7fade1886114dbbc820609a5e63d
This commit is contained in:
Fabrice Di Meglio
2014-03-21 19:24:43 -07:00
parent 5f3442af6f
commit d25314d330
19 changed files with 1213 additions and 1148 deletions

View File

@@ -96,7 +96,7 @@ public class Index {
private static Index sInstance;
private final AtomicBoolean mIsAvailable = new AtomicBoolean(false);
private final UpdateData mDataToProcess = new UpdateData();
private final Context mContext;
private Context mContext;
/**
* A private class to describe the update data for the Index database
@@ -124,6 +124,8 @@ public class Index {
public static Index getInstance(Context context) {
if (sInstance == null) {
sInstance = new Index(context);
} else {
sInstance.setContext(context);
}
return sInstance;
}
@@ -132,6 +134,10 @@ public class Index {
mContext = context;
}
public void setContext(Context context) {
mContext = context;
}
public boolean isAvailable() {
return mIsAvailable.get();
}
@@ -675,6 +681,17 @@ public class Index {
return (data != null) ? data.toString() : null;
}
private int getResId(Context context, AttributeSet set, int[] attrs, int resId) {
final TypedArray sa = context.obtainStyledAttributes(set, attrs);
final TypedValue tv = sa.peekValue(resId);
if (tv != null && tv.type == TypedValue.TYPE_STRING) {
return tv.resourceId;
} else {
return 0;
}
}
/**
* A private class for updating the Index database
*/