Fixing crash during rotation
> Different views with same IDs were saving state > Fixing scroll getting reset on rotation Change-Id: Iae42419b83ee5ffa1bb43959f0931c8dfb761f32
This commit is contained in:
parent
4df1653331
commit
bb702584fa
|
@ -39,6 +39,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/main_content"
|
||||
android:saveEnabled="false"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center"
|
||||
android:focusable="true"
|
||||
|
@ -60,6 +61,7 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:saveEnabled="false"
|
||||
android:layout_height="@dimen/all_apps_search_bar_height"
|
||||
android:layout_gravity="start|top"
|
||||
android:orientation="horizontal"
|
||||
|
|
|
@ -587,16 +587,18 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
|
|||
@Override
|
||||
public void onSearchResult(String query, ArrayList<ComponentKey> apps) {
|
||||
if (apps != null) {
|
||||
mApps.setOrderedFilter(apps);
|
||||
if (mApps.setOrderedFilter(apps)) {
|
||||
mAppsRecyclerView.onSearchResultsChanged();
|
||||
}
|
||||
mAdapter.setLastSearchQuery(query);
|
||||
mAppsRecyclerView.onSearchResultsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSearchResult() {
|
||||
mApps.setOrderedFilter(null);
|
||||
mAppsRecyclerView.onSearchResultsChanged();
|
||||
if (mApps.setOrderedFilter(null)) {
|
||||
mAppsRecyclerView.onSearchResultsChanged();
|
||||
}
|
||||
|
||||
// Clear the search query
|
||||
mSearchQueryBuilder.clear();
|
||||
|
|
|
@ -278,11 +278,14 @@ public class AlphabeticalAppsList {
|
|||
/**
|
||||
* Sets the sorted list of filtered components.
|
||||
*/
|
||||
public void setOrderedFilter(ArrayList<ComponentKey> f) {
|
||||
public boolean setOrderedFilter(ArrayList<ComponentKey> f) {
|
||||
if (mSearchResults != f) {
|
||||
boolean same = mSearchResults != null && mSearchResults.equals(f);
|
||||
mSearchResults = f;
|
||||
updateAdapterItems();
|
||||
return !same;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue