Search in sources :

Example 1 with BrandAdapter

use of forpdateam.ru.forpda.ui.fragments.devdb.adapters.BrandAdapter in project ForPDA by RadiationX.

the class BrandFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewsReady();
    setCardsBackground();
    refreshLayoutStyle(refreshLayout);
    refreshLayout.setOnRefreshListener(this::loadData);
    PauseOnScrollListener pauseOnScrollListener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
    recyclerView.addOnScrollListener(pauseOnScrollListener);
    adapter = new BrandAdapter();
    recyclerView.setColumnWidth(App.get().dpToPx(144));
    recyclerView.setAdapter(adapter);
    try {
        GridLayoutManager gridLayoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
        recyclerView.addItemDecoration(new SpacingItemDecoration(gridLayoutManager, App.px8));
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    adapter.setItemClickListener(this);
}
Also used : BrandAdapter(forpdateam.ru.forpda.ui.fragments.devdb.adapters.BrandAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) PauseOnScrollListener(forpdateam.ru.forpda.ui.views.PauseOnScrollListener)

Example 2 with BrandAdapter

use of forpdateam.ru.forpda.ui.fragments.devdb.adapters.BrandAdapter in project ForPDA by RadiationX.

the class SearchFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewsReady();
    setCardsBackground();
    refreshLayoutStyle(refreshLayout);
    refreshLayout.setOnRefreshListener(this::loadData);
    PauseOnScrollListener pauseOnScrollListener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
    recyclerView.addOnScrollListener(pauseOnScrollListener);
    adapter = new BrandAdapter();
    recyclerView.setColumnWidth(App.get().dpToPx(144));
    recyclerView.setAdapter(adapter);
    try {
        GridLayoutManager gridLayoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
        recyclerView.addItemDecoration(new BrandFragment.SpacingItemDecoration(gridLayoutManager, App.px8));
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    adapter.setItemClickListener(this);
    SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
    if (null != searchManager) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
    }
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            startSearch(query);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });
    searchView.setQueryHint(getString(R.string.search_keywords));
    LinearLayout searchEditFrame = (LinearLayout) searchView.findViewById(R.id.search_edit_frame);
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) searchEditFrame.getLayoutParams();
    params.leftMargin = 0;
    View searchSrcText = searchView.findViewById(R.id.search_src_text);
    searchSrcText.setPadding(0, searchSrcText.getPaddingTop(), 0, searchSrcText.getPaddingBottom());
    searchMenuItem.expandActionView();
}
Also used : SearchManager(android.app.SearchManager) SearchView(android.support.v7.widget.SearchView) AutoFitRecyclerView(forpdateam.ru.forpda.ui.views.messagepanel.AutoFitRecyclerView) View(android.view.View) BrandAdapter(forpdateam.ru.forpda.ui.fragments.devdb.adapters.BrandAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) SearchView(android.support.v7.widget.SearchView) PauseOnScrollListener(forpdateam.ru.forpda.ui.views.PauseOnScrollListener) LinearLayout(android.widget.LinearLayout)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 BrandAdapter (forpdateam.ru.forpda.ui.fragments.devdb.adapters.BrandAdapter)2 PauseOnScrollListener (forpdateam.ru.forpda.ui.views.PauseOnScrollListener)2 SearchManager (android.app.SearchManager)1 SearchView (android.support.v7.widget.SearchView)1 View (android.view.View)1 LinearLayout (android.widget.LinearLayout)1 AutoFitRecyclerView (forpdateam.ru.forpda.ui.views.messagepanel.AutoFitRecyclerView)1