|
|
@@ -21,7 +21,6 @@ import com.sheep.gamegroup.model.entity.Article;
|
|
|
import com.sheep.gamegroup.model.entity.ArticleTag;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.Lp;
|
|
|
-import com.sheep.gamegroup.module.ad_htxd.model.ArticleAd;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.DownloadUtil;
|
|
|
@@ -41,7 +40,6 @@ import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
@@ -59,7 +57,6 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
|
|
public class FgtFindChild extends BaseListFragment5<Article> {
|
|
|
|
|
|
private int type;
|
|
|
- private boolean showAd;
|
|
|
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
@@ -69,7 +66,7 @@ public class FgtFindChild extends BaseListFragment5<Article> {
|
|
|
|
|
|
@Override
|
|
|
protected RecyclerView.Adapter getAdapter() {
|
|
|
- return new CommonRecycler(showAd ? allList : list);
|
|
|
+ return new CommonRecycler(list);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -87,33 +84,6 @@ public class FgtFindChild extends BaseListFragment5<Article> {
|
|
|
return Article.class;
|
|
|
}
|
|
|
|
|
|
- private List<Article> allList = new ArrayList<>();//显示广告时使用allList,否则使用list
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void loadList(List<Article> addList) {
|
|
|
- if (showAd) {
|
|
|
- ListUtil.addAll(allList, addList);
|
|
|
-// if (1 == page) {
|
|
|
- int index = (page - 1) * (per_page + 1) + ArticleAd.INDEX;
|
|
|
- Article item = ListUtil.getItem(allList, index);
|
|
|
- if (!(item instanceof ArticleAd)) {//倒数第几个不是广告的情况下才添加
|
|
|
- ArticleAd.fetchNativeData(articleAd -> ListUtil.insertIndex(allList, articleAd, index), ok -> {
|
|
|
- if (ok) {
|
|
|
- notifyDataSetChanged();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-// }
|
|
|
- }
|
|
|
- super.loadList(addList);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void clear() {
|
|
|
- if (showAd)
|
|
|
- allList.clear();
|
|
|
- super.clear();
|
|
|
- }
|
|
|
|
|
|
public static FgtFindChild newInstance(ArticleTag articleTag) {
|
|
|
FgtFindChild fgt = new FgtFindChild();
|
|
|
@@ -269,7 +239,6 @@ public class FgtFindChild extends BaseListFragment5<Article> {
|
|
|
ArticleTag articleTag = DataUtil.getObject(bundle, ArticleTag.class);
|
|
|
if (articleTag != null) {
|
|
|
type = articleTag.getId();
|
|
|
- showAd = ArticleAd.showAd;//修改回之前的所有栏目都展示 && TextUtils.equals(articleTag.getName(), "资讯");//只有资讯才显示
|
|
|
}
|
|
|
}
|
|
|
EventBus.getDefault().register(this);
|
|
|
@@ -336,7 +305,7 @@ public class FgtFindChild extends BaseListFragment5<Article> {
|
|
|
|
|
|
@Override
|
|
|
public int getItemViewType(int position) {
|
|
|
- Article article = (showAd ? allList : list).get(position);
|
|
|
+ Article article = list.get(position);
|
|
|
return article.getType();
|
|
|
}
|
|
|
|