Search in sources :

Example 1 with Header

use of com.simplecity.amp_library.model.Header in project Shuttle by timusus.

the class SearchActivity method onCreate.

@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    ThemeUtils.setTheme(this);
    if (!ShuttleUtils.hasLollipop() && ShuttleUtils.hasKitKat()) {
        getWindow().setFlags(FLAG_TRANSLUCENT_STATUS, FLAG_TRANSLUCENT_STATUS);
        mTintManager = new SystemBarTintManager(this);
    }
    if (!ShuttleUtils.hasKitKat()) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    if (SettingsManager.getInstance().canTintNavBar()) {
        getWindow().setNavigationBarColor(ColorUtils.getPrimaryColorDark(this));
    }
    super.onCreate(savedInstanceState);
    final String query = getIntent().getStringExtra(SearchManager.QUERY);
    filterString = !TextUtils.isEmpty(query) ? query.toLowerCase().trim() : "";
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    setContentView(R.layout.activity_search);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Get the ActionBar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(null);
    ThemeUtils.themeActionBar(this);
    ThemeUtils.themeStatusBar(this, mTintManager);
    adapter = new SearchAdapter();
    adapter.setListener(this);
    recyclerView = (FastScrollRecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    ThemeUtils.themeRecyclerView(recyclerView);
    recyclerView.setThumbColor(ColorUtils.getAccentColor());
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            ThemeUtils.themeRecyclerView(recyclerView);
            super.onScrollStateChanged(recyclerView, newState);
        }
    });
    if (requestManager == null) {
        requestManager = Glide.with(this);
    }
    dummySelector = new MultiSelector();
    songsHeader = new SearchHeaderView(new Header(getString(R.string.tracks_title)));
    albumsHeader = new SearchHeaderView(new Header(getString(R.string.albums_title)));
    artistsHeader = new SearchHeaderView(new Header(getString(R.string.artists_title)));
    prefixHighlighter = new PrefixHighlighter(this);
}
Also used : SearchAdapter(com.simplecity.amp_library.ui.adapters.SearchAdapter) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SuppressLint(android.annotation.SuppressLint) SearchHeaderView(com.simplecity.amp_library.ui.modelviews.SearchHeaderView) Header(com.simplecity.amp_library.model.Header) PrefixHighlighter(com.simplecity.amp_library.format.PrefixHighlighter) MultiSelector(com.bignerdranch.android.multiselector.MultiSelector) FastScrollRecyclerView(com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 ActionBar (android.support.v7.app.ActionBar)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 MultiSelector (com.bignerdranch.android.multiselector.MultiSelector)1 SystemBarTintManager (com.readystatesoftware.systembartint.SystemBarTintManager)1 PrefixHighlighter (com.simplecity.amp_library.format.PrefixHighlighter)1 Header (com.simplecity.amp_library.model.Header)1 SearchAdapter (com.simplecity.amp_library.ui.adapters.SearchAdapter)1 SearchHeaderView (com.simplecity.amp_library.ui.modelviews.SearchHeaderView)1 FastScrollRecyclerView (com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView)1