Add ability to force rebuild list
So that you can change between filters that have the same sort order. Test: robotests, manually switch between notifications (off) to notifications (all) Fixes: 169943424 Change-Id: I62bbe90f30abada2ec342487a1fa420e451b3caf
This commit is contained in:
@@ -768,7 +768,7 @@ public class ManageApplications extends InstrumentedFragment
|
|||||||
int i = item.getItemId();
|
int i = item.getItemId();
|
||||||
if (i == R.id.sort_order_alpha || i == R.id.sort_order_size) {
|
if (i == R.id.sort_order_alpha || i == R.id.sort_order_size) {
|
||||||
if (mApplications != null) {
|
if (mApplications != null) {
|
||||||
mApplications.rebuild(menuId);
|
mApplications.rebuild(menuId, false);
|
||||||
}
|
}
|
||||||
} else if (i == R.id.show_system || i == R.id.hide_system) {
|
} else if (i == R.id.show_system || i == R.id.hide_system) {
|
||||||
mShowSystem = !mShowSystem;
|
mShowSystem = !mShowSystem;
|
||||||
@@ -1097,13 +1097,13 @@ public class ManageApplications extends InstrumentedFragment
|
|||||||
// Notification filters require resorting the list
|
// Notification filters require resorting the list
|
||||||
if (mManageApplications.mListType == LIST_TYPE_NOTIFICATION) {
|
if (mManageApplications.mListType == LIST_TYPE_NOTIFICATION) {
|
||||||
if (FILTER_APPS_FREQUENT == appFilter.getFilterType()) {
|
if (FILTER_APPS_FREQUENT == appFilter.getFilterType()) {
|
||||||
rebuild(R.id.sort_order_frequent_notification);
|
rebuild(R.id.sort_order_frequent_notification, false);
|
||||||
} else if (FILTER_APPS_RECENT == appFilter.getFilterType()) {
|
} else if (FILTER_APPS_RECENT == appFilter.getFilterType()) {
|
||||||
rebuild(R.id.sort_order_recent_notification);
|
rebuild(R.id.sort_order_recent_notification, false);
|
||||||
} else if (FILTER_APPS_BLOCKED == appFilter.getFilterType()) {
|
} else if (FILTER_APPS_BLOCKED == appFilter.getFilterType()) {
|
||||||
rebuild(R.id.sort_order_alpha);
|
rebuild(R.id.sort_order_alpha, true);
|
||||||
} else {
|
} else {
|
||||||
rebuild(R.id.sort_order_alpha);
|
rebuild(R.id.sort_order_alpha, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rebuild();
|
rebuild();
|
||||||
@@ -1121,7 +1121,7 @@ public class ManageApplications extends InstrumentedFragment
|
|||||||
}
|
}
|
||||||
rebuild();
|
rebuild();
|
||||||
} else {
|
} else {
|
||||||
rebuild(sort);
|
rebuild(sort, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,8 +1149,8 @@ public class ManageApplications extends InstrumentedFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuild(int sort) {
|
public void rebuild(int sort, boolean force) {
|
||||||
if (sort == mLastSortMode) {
|
if (sort == mLastSortMode && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mManageApplications.mSortOrder = sort;
|
mManageApplications.mSortOrder = sort;
|
||||||
|
@@ -455,10 +455,13 @@ public class ManageApplicationsTest {
|
|||||||
ManageApplications.ApplicationsAdapter adapter = new ManageApplications.ApplicationsAdapter(
|
ManageApplications.ApplicationsAdapter adapter = new ManageApplications.ApplicationsAdapter(
|
||||||
mState, mFragment, mock(AppFilterItem.class), mock(Bundle.class));
|
mState, mFragment, mock(AppFilterItem.class), mock(Bundle.class));
|
||||||
|
|
||||||
adapter.rebuild(mSortRecent.getItemId());
|
adapter.rebuild(mSortRecent.getItemId(), false);
|
||||||
assertThat(mFragment.mSortOrder).isEqualTo(mSortRecent.getItemId());
|
assertThat(mFragment.mSortOrder).isEqualTo(mSortRecent.getItemId());
|
||||||
|
|
||||||
adapter.rebuild(mSortFrequent.getItemId());
|
adapter.rebuild(mSortFrequent.getItemId(), false);
|
||||||
|
assertThat(mFragment.mSortOrder).isEqualTo(mSortFrequent.getItemId());
|
||||||
|
|
||||||
|
adapter.rebuild(mSortFrequent.getItemId(), true);
|
||||||
assertThat(mFragment.mSortOrder).isEqualTo(mSortFrequent.getItemId());
|
assertThat(mFragment.mSortOrder).isEqualTo(mSortFrequent.getItemId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user