use of forpdateam.ru.forpda.ui.views.ExtendedWebView in project ForPDA by RadiationX.
the class WebViewsProvider method pull.
public ExtendedWebView pull(Context context) {
ExtendedWebView webView;
if (!availableWebViews.isEmpty()) {
webView = availableWebViews.poll();
} else {
webView = new ExtendedWebView(context);
webView.setTag("WebView_tag ".concat(Long.toString(System.currentTimeMillis())));
}
Log.d("WebViewsProvider", "Pull " + webView);
return webView;
}
use of forpdateam.ru.forpda.ui.views.ExtendedWebView in project ForPDA by RadiationX.
the class WebViewsProvider method destroy.
public void destroy() {
webViewCleaner.cancel();
webViewCleaner.purge();
for (ExtendedWebView webView : availableWebViews) {
webView.destroy();
}
availableWebViews.clear();
}
use of forpdateam.ru.forpda.ui.views.ExtendedWebView in project ForPDA by RadiationX.
the class SearchFragment method onLoadData.
private void onLoadData(SearchResult searchResult) {
setRefreshing(false);
recyclerView.scrollToPosition(0);
hidePopupWindows();
data = searchResult;
Log.d("SUKA", "SEARCH SIZE " + searchResult.getItems().size());
if (data.getItems().isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_search).setTitle(R.string.funny_search_nodata_title).setDesc(R.string.funny_search_nodata_desc);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
Log.d("SUKA", "" + data.getSettings().getResult() + " : " + data.getSettings().getResourceType());
if (data.getSettings().getResult().equals(SearchSettings.RESULT_POSTS.first) && data.getSettings().getResourceType().equals(SearchSettings.RESOURCE_FORUM.first)) {
for (int i = 0; i < refreshLayout.getChildCount(); i++) {
if (refreshLayout.getChildAt(i) instanceof RecyclerView) {
refreshLayout.removeViewAt(i);
fixTargetView();
break;
}
}
if (refreshLayout.getChildCount() <= 1) {
if (scrollButtonEnable) {
fab.setVisibility(View.VISIBLE);
}
refreshLayout.addView(webView);
Log.d(LOG_TAG, "add webview");
}
if (webViewClient == null) {
webViewClient = new CustomWebViewClient();
webView.setWebViewClient(webViewClient);
webView.setWebChromeClient(new CustomWebChromeClient());
}
Log.d("SUKA", "SEARCH SHOW WEBVIEW");
webView.loadDataWithBaseURL("https://4pda.ru/forum/", data.getHtml(), "text/html", "utf-8", null);
} else {
for (int i = 0; i < refreshLayout.getChildCount(); i++) {
if (refreshLayout.getChildAt(i) instanceof ExtendedWebView) {
refreshLayout.removeViewAt(i);
fixTargetView();
}
}
if (refreshLayout.getChildCount() <= 1) {
fab.setVisibility(View.GONE);
refreshLayout.addView(recyclerView);
Log.d(LOG_TAG, "add recyclerview");
}
Log.d("SUKA", "SEARCH SHOW RECYCLERVIEW");
adapter.clear();
adapter.addAll(data.getItems());
}
paginationHelper.updatePagination(data.getPagination());
setSubtitle(paginationHelper.getTitle());
}
Aggregations