Search in sources :

Example 1 with PauseOnScrollListener

use of forpdateam.ru.forpda.ui.views.PauseOnScrollListener in project ForPDA by RadiationX.

the class QmsContactsFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewsReady();
    initFabBehavior();
    refreshLayoutStyle(refreshLayout);
    refreshLayout.setOnRefreshListener(this::loadData);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    PauseOnScrollListener pauseOnScrollListener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
    recyclerView.addOnScrollListener(pauseOnScrollListener);
    fab.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_fab_create));
    fab.setOnClickListener(view1 -> TabManager.get().add(QmsChatFragment.class));
    fab.setVisibility(View.VISIBLE);
    adapter = new QmsContactsAdapter();
    adapter.setOnItemClickListener(this);
    recyclerView.setAdapter(adapter);
    bindView();
    QmsHelper.get().subscribeQms(notification);
}
Also used : PauseOnScrollListener(forpdateam.ru.forpda.ui.views.PauseOnScrollListener) QmsContactsAdapter(forpdateam.ru.forpda.ui.fragments.qms.adapters.QmsContactsAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) QmsChatFragment(forpdateam.ru.forpda.ui.fragments.qms.chat.QmsChatFragment)

Example 2 with PauseOnScrollListener

use of forpdateam.ru.forpda.ui.views.PauseOnScrollListener 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 3 with PauseOnScrollListener

use of forpdateam.ru.forpda.ui.views.PauseOnScrollListener 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)

Example 4 with PauseOnScrollListener

use of forpdateam.ru.forpda.ui.views.PauseOnScrollListener in project ForPDA by RadiationX.

the class SearchFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewsReady();
    fab.setOnClickListener(v -> {
        if (webView.getDirection() == ExtendedWebView.DIRECTION_DOWN) {
            webView.pageDown(true);
        } else if (webView.getDirection() == ExtendedWebView.DIRECTION_UP) {
            webView.pageUp(true);
        }
    });
    webView.setOnDirectionListener(direction -> {
        if (webView.getDirection() == ExtendedWebView.DIRECTION_DOWN) {
            fab.setImageDrawable(App.getVecDrawable(fab.getContext(), R.drawable.ic_arrow_down));
        } else if (webView.getDirection() == ExtendedWebView.DIRECTION_UP) {
            fab.setImageDrawable(App.getVecDrawable(fab.getContext(), R.drawable.ic_arrow_up));
        }
    });
    webView.setJsLifeCycleListener(this);
    webView.addJavascriptInterface(this, ThemeFragmentWeb.JS_INTERFACE);
    webView.addJavascriptInterface(this, JS_INTERFACE);
    webView.addJavascriptInterface(this, JS_POSTS_FUNCTIONS);
    webView.setRelativeFontSize(Preferences.Main.getWebViewSize(getContext()));
    fab.setSize(FloatingActionButton.SIZE_MINI);
    if (scrollButtonEnable) {
        fab.setVisibility(View.VISIBLE);
    } else {
        fab.setVisibility(View.GONE);
    }
    fab.setScaleX(0.0f);
    fab.setScaleY(0.0f);
    fab.setAlpha(0.0f);
    setCardsBackground();
    App.get().addPreferenceChangeObserver(searchPreferenceObserver);
    paginationHelper.setListener(new PaginationHelper.PaginationListener() {

        @Override
        public boolean onTabSelected(TabLayout.Tab tab) {
            return refreshLayout.isRefreshing();
        }

        @Override
        public void onSelectedPage(int pageNumber) {
            settings.setSt(pageNumber);
            loadData();
        }
    });
    // searchSettingsView.setVisibility(View.GONE);
    dialog = new BottomSheetDialog(getContext());
    // dialog.setPeekHeight(App.getKeyboardHeight());
    // dialog.getWindow().getDecorView().setFitsSystemWindows(true);
    setItems(resourceSpinner, (String[]) resourceItems.toArray(), 0);
    setItems(resultSpinner, (String[]) resultItems.toArray(), 0);
    setItems(sortSpinner, (String[]) sortItems.toArray(), 0);
    setItems(sourceSpinner, (String[]) sourceItems.toArray(), 1);
    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();
            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());
    fillSettingsData();
    searchItem.expandActionView();
    submitButton.setOnClickListener(v -> startSearch());
    saveSettingsButton.setOnClickListener(v -> saveSettings());
    // recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.addItemDecoration(new BrandFragment.SpacingItemDecoration(App.px8, true));
    PauseOnScrollListener pauseOnScrollListener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
    recyclerView.addOnScrollListener(pauseOnScrollListener);
    recyclerView.setAdapter(adapter);
    refreshLayoutStyle(refreshLayout);
    refreshLayoutLongTrigger(refreshLayout);
    refreshLayout.setOnRefreshListener(this::loadData);
    adapter.setOnItemClickListener(this);
    if (App.get().getPreferences().getBoolean("search.tooltip.settings", true)) {
        for (int toolbarChildIndex = 0; toolbarChildIndex < toolbar.getChildCount(); toolbarChildIndex++) {
            View childView = toolbar.getChildAt(toolbarChildIndex);
            if (childView instanceof ActionMenuView) {
                ActionMenuView menuView = (ActionMenuView) childView;
                for (int menuChildIndex = 0; menuChildIndex < menuView.getChildCount(); menuChildIndex++) {
                    try {
                        ActionMenuItemView itemView = (ActionMenuItemView) menuView.getChildAt(menuChildIndex);
                        if (settingsMenuItem == itemView.getItemData()) {
                            tooltip = new SimpleTooltip.Builder(getContext()).anchorView(itemView).text(R.string.tooltip_search_settings).gravity(Gravity.BOTTOM).animated(false).modal(true).transparentOverlay(false).backgroundColor(Color.BLACK).textColor(Color.WHITE).padding((float) App.px16).build();
                            tooltip.show();
                            break;
                        }
                    } catch (ClassCastException ignore) {
                    }
                }
                break;
            }
        }
        App.get().getPreferences().edit().putBoolean("search.tooltip.settings", false).apply();
    }
}
Also used : SimpleTooltip(io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip) SearchManager(android.app.SearchManager) BrandFragment(forpdateam.ru.forpda.ui.fragments.devdb.BrandFragment) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SearchView(android.support.v7.widget.SearchView) ExtendedWebView(forpdateam.ru.forpda.ui.views.ExtendedWebView) ActionMenuItemView(android.support.v7.view.menu.ActionMenuItemView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ActionMenuView(android.support.v7.widget.ActionMenuView) RecyclerView(android.support.v7.widget.RecyclerView) SuppressLint(android.annotation.SuppressLint) BottomSheetDialog(android.support.design.widget.BottomSheetDialog) SearchView(android.support.v7.widget.SearchView) TabLayout(android.support.design.widget.TabLayout) PauseOnScrollListener(forpdateam.ru.forpda.ui.views.PauseOnScrollListener) ActionMenuView(android.support.v7.widget.ActionMenuView) PaginationHelper(forpdateam.ru.forpda.ui.views.pagination.PaginationHelper) LinearLayout(android.widget.LinearLayout) ActionMenuItemView(android.support.v7.view.menu.ActionMenuItemView)

Example 5 with PauseOnScrollListener

use of forpdateam.ru.forpda.ui.views.PauseOnScrollListener in project ForPDA by RadiationX.

the class NewsMainFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewsReady();
    setCardsBackground();
    refreshLayout.setOnRefreshListener(this::loadData);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.addItemDecoration(new BrandFragment.SpacingItemDecoration(App.px8, true));
    PauseOnScrollListener pauseOnScrollListener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
    recyclerView.addOnScrollListener(pauseOnScrollListener);
    adapter = new NewsListAdapter();
    adapter.setOnClickListener(this);
    recyclerView.setAdapter(adapter);
}
Also used : BrandFragment(forpdateam.ru.forpda.ui.fragments.devdb.BrandFragment) PauseOnScrollListener(forpdateam.ru.forpda.ui.views.PauseOnScrollListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) NewsListAdapter(forpdateam.ru.forpda.ui.fragments.news.main.timeline.NewsListAdapter)

Aggregations

PauseOnScrollListener (forpdateam.ru.forpda.ui.views.PauseOnScrollListener)5 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 SearchManager (android.app.SearchManager)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 SearchView (android.support.v7.widget.SearchView)2 View (android.view.View)2 LinearLayout (android.widget.LinearLayout)2 BrandFragment (forpdateam.ru.forpda.ui.fragments.devdb.BrandFragment)2 BrandAdapter (forpdateam.ru.forpda.ui.fragments.devdb.adapters.BrandAdapter)2 SuppressLint (android.annotation.SuppressLint)1 BottomSheetDialog (android.support.design.widget.BottomSheetDialog)1 TabLayout (android.support.design.widget.TabLayout)1 ActionMenuItemView (android.support.v7.view.menu.ActionMenuItemView)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1 RecyclerView (android.support.v7.widget.RecyclerView)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 NewsListAdapter (forpdateam.ru.forpda.ui.fragments.news.main.timeline.NewsListAdapter)1 QmsContactsAdapter (forpdateam.ru.forpda.ui.fragments.qms.adapters.QmsContactsAdapter)1 QmsChatFragment (forpdateam.ru.forpda.ui.fragments.qms.chat.QmsChatFragment)1