Search is back. Now with recycler view and the ability to set a different xml file for song, album, artist and header results if needed. Also improved its appearance by adding elevation (inspired by Googles Inbox).
This commit is contained in:
parent
a91804657d
commit
428dd22296
14 changed files with 447 additions and 111 deletions
|
|
@ -29,6 +29,7 @@ public class SearchActivity extends AbsBaseActivity {
|
|||
public static final String TAG = SearchActivity.class.getSimpleName();
|
||||
private RecyclerView recyclerView;
|
||||
private SearchView searchView;
|
||||
private SearchAdapter searchAdapter;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
|
|
@ -40,7 +41,7 @@ public class SearchActivity extends AbsBaseActivity {
|
|||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
SearchAdapter searchAdapter = new SearchAdapter(this);
|
||||
searchAdapter = new SearchAdapter(this);
|
||||
recyclerView.setAdapter(searchAdapter);
|
||||
|
||||
recyclerView.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
|
@ -151,6 +152,7 @@ public class SearchActivity extends AbsBaseActivity {
|
|||
}
|
||||
|
||||
private void search(String query) {
|
||||
|
||||
if (searchAdapter != null)
|
||||
searchAdapter.search(query);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue