Remember search input after hitting "Back" from app details.
Move logic which parses intent and forceably sets the text of our search input to onCreate(), not onResume(). onCreate() is invoked each time a new intent is sent to open up this activity. That is, each time a new category is opened or a new search request is received. onResume() is called much more often than this, including when the user is directed to a new activity and then returns to the search screen after hitting back. In this case we don't want to remove the search query the user had and replace it with the data in the original intent.
This commit is contained in:
parent
ba503812e4
commit
bb7fca7382
@ -26,6 +26,7 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
||||
|
||||
public static final String EXTRA_CATEGORY = "org.fdroid.fdroid.views.apps.AppListActivity.EXTRA_CATEGORY";
|
||||
public static final String EXTRA_SEARCH_TERMS = "org.fdroid.fdroid.views.apps.AppListActivity.EXTRA_SEARCH_TERMS";
|
||||
|
||||
private RecyclerView appView;
|
||||
private AppListAdapter appAdapter;
|
||||
private String category;
|
||||
@ -78,12 +79,11 @@ public class AppListActivity extends AppCompatActivity implements LoaderManager.
|
||||
appView.setHasFixedSize(true);
|
||||
appView.setLayoutManager(new LinearLayoutManager(this));
|
||||
appView.setAdapter(appAdapter);
|
||||
|
||||
parseIntentForSearchQuery();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
private void parseIntentForSearchQuery() {
|
||||
Intent intent = getIntent();
|
||||
category = intent.hasExtra(EXTRA_CATEGORY) ? intent.getStringExtra(EXTRA_CATEGORY) : null;
|
||||
searchTerms = intent.hasExtra(EXTRA_SEARCH_TERMS) ? intent.getStringExtra(EXTRA_SEARCH_TERMS) : null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user