Merge \"Revert equal check in DashboardAdapter.setCondition().\" into nyc-mr1-dev
am: 3468853cef
Change-Id: I136422e5b2dccf4f17ab5645bd6af48a1c47dc9a
This commit is contained in:
@@ -53,6 +53,8 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
|||||||
public static final String TAG = "DashboardAdapter";
|
public static final String TAG = "DashboardAdapter";
|
||||||
private static final String STATE_SUGGESTION_LIST = "suggestion_list";
|
private static final String STATE_SUGGESTION_LIST = "suggestion_list";
|
||||||
private static final String STATE_CATEGORY_LIST = "category_list";
|
private static final String STATE_CATEGORY_LIST = "category_list";
|
||||||
|
private static final String STATE_IS_SHOWING_ALL = "is_showing_all";
|
||||||
|
private static final String STATE_SUGGESTION_MODE = "suggestion_mode";
|
||||||
private static final int NS_SPACER = 0;
|
private static final int NS_SPACER = 0;
|
||||||
private static final int NS_SUGGESTION = 1000;
|
private static final int NS_SUGGESTION = 1000;
|
||||||
private static final int NS_ITEMS = 2000;
|
private static final int NS_ITEMS = 2000;
|
||||||
@@ -92,12 +94,16 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
|||||||
mConditions = conditions;
|
mConditions = conditions;
|
||||||
|
|
||||||
setHasStableIds(true);
|
setHasStableIds(true);
|
||||||
setShowingAll(true);
|
|
||||||
|
|
||||||
|
boolean showAll = true;
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mSuggestions = savedInstanceState.getParcelableArrayList(STATE_SUGGESTION_LIST);
|
mSuggestions = savedInstanceState.getParcelableArrayList(STATE_SUGGESTION_LIST);
|
||||||
mCategories = savedInstanceState.getParcelableArrayList(STATE_CATEGORY_LIST);
|
mCategories = savedInstanceState.getParcelableArrayList(STATE_CATEGORY_LIST);
|
||||||
|
showAll = savedInstanceState.getBoolean(STATE_IS_SHOWING_ALL, true);
|
||||||
|
mSuggestionMode = savedInstanceState.getInt(
|
||||||
|
STATE_SUGGESTION_MODE, SUGGESTION_MODE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
setShowingAll(showAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tile> getSuggestions() {
|
public List<Tile> getSuggestions() {
|
||||||
@@ -149,10 +155,8 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setConditions(List<Condition> conditions) {
|
public void setConditions(List<Condition> conditions) {
|
||||||
if (!Objects.equals(mConditions, conditions)) {
|
mConditions = conditions;
|
||||||
mConditions = conditions;
|
recountItems();
|
||||||
recountItems();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowingAll() {
|
public boolean isShowingAll() {
|
||||||
@@ -441,9 +445,16 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSaveInstanceState(Bundle outState) {
|
void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putParcelableArrayList(STATE_SUGGESTION_LIST, new ArrayList<Tile>(mSuggestions));
|
if (mSuggestions != null) {
|
||||||
outState.putParcelableArrayList(STATE_CATEGORY_LIST,
|
outState.putParcelableArrayList(STATE_SUGGESTION_LIST,
|
||||||
new ArrayList<DashboardCategory>(mCategories));
|
new ArrayList<Tile>(mSuggestions));
|
||||||
|
}
|
||||||
|
if (mCategories != null) {
|
||||||
|
outState.putParcelableArrayList(STATE_CATEGORY_LIST,
|
||||||
|
new ArrayList<DashboardCategory>(mCategories));
|
||||||
|
}
|
||||||
|
outState.putBoolean(STATE_IS_SHOWING_ALL, mIsShowingAll);
|
||||||
|
outState.putInt(STATE_SUGGESTION_MODE, mSuggestionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class IconCache {
|
private static class IconCache {
|
||||||
|
Reference in New Issue
Block a user