Search in sources :

Example 1 with ArrowDrawable

use of com.lapism.arrow.ArrowDrawable in project Talon-for-Twitter by klinker24.

the class GiphySearch method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    } catch (Exception e) {
    }
    setContentView(R.layout.giffy_search_activity);
    recycler = (RecyclerView) findViewById(R.id.recycler_view);
    progressSpinner = findViewById(R.id.list_progress);
    backArrow = (ImageView) findViewById(R.id.imageView_arrow_back);
    toolbar = (SearchView) findViewById(R.id.searchView);
    searchText = (EditText) findViewById(R.id.editText_input);
    final ArrowDrawable drawable = new ArrowDrawable(this);
    drawable.animate(ArrowDrawable.STATE_ARROW);
    backArrow.setImageDrawable(drawable);
    toolbar.setOnSearchMenuListener(new SearchView.SearchMenuListener() {

        @Override
        public void onMenuClick() {
            setResult(Activity.RESULT_CANCELED);
            finish();
        }
    });
    toolbar.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            executeQuery(query);
            backArrow.performClick();
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });
    recycler.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            adapter.releaseVideo();
        }
    });
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            drawable.animate(ArrowDrawable.STATE_ARROW);
            loadTrending();
        }
    }, 750);
}
Also used : ArrowDrawable(com.lapism.arrow.ArrowDrawable) SearchView(com.lapism.searchview.view.SearchView) Handler(android.os.Handler) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

Handler (android.os.Handler)1 RecyclerView (android.support.v7.widget.RecyclerView)1 ArrowDrawable (com.lapism.arrow.ArrowDrawable)1 SearchView (com.lapism.searchview.view.SearchView)1