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);
}
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);
}
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();
}
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();
}
}
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);
}
Aggregations