use of forpdateam.ru.forpda.ui.views.FunnyContent 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());
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class NotesFragment method loadCacheData.
@Override
public void loadCacheData() {
super.loadCacheData();
if (!realm.isClosed()) {
setRefreshing(true);
RealmResults<NoteItemBd> results = realm.where(NoteItemBd.class).findAllSorted("id", Sort.DESCENDING);
if (results.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_bookmark).setTitle(R.string.funny_notes_nodata_title);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
ArrayList<NoteItem> nonBdResult = new ArrayList<>();
for (NoteItemBd item : results) {
nonBdResult.add(new NoteItem(item));
}
adapter.addAll(nonBdResult);
}
setRefreshing(false);
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class QmsBlackListFragment method onLoadContacts.
private void onLoadContacts(ArrayList<QmsContact> data) {
setRefreshing(false);
if (data.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_contacts).setTitle(R.string.funny_blacklist_nodata_title).setDesc(R.string.funny_blacklist_nodata_desc);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
recyclerView.scrollToPosition(0);
currentData = data;
adapter.addAll(currentData);
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class QmsContactsFragment method bindView.
private void bindView() {
if (realm.isClosed())
return;
results = realm.where(QmsContactBd.class).findAll();
if (results.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_contacts).setTitle(R.string.funny_contacts_nodata_title);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
ArrayList<QmsContact> currentItems = new ArrayList<>();
for (QmsContactBd qmsContactBd : results) {
QmsContact contact = new QmsContact(qmsContactBd);
currentItems.add(contact);
}
int count = 0;
for (QmsContact contact : currentItems) {
if (contact.getCount() > 0) {
count += contact.getCount();
}
}
ClientHelper.setQmsCount(count);
ClientHelper.get().notifyCountsChanged();
adapter.addAll(currentItems);
}
Aggregations