|
|
@@ -19,6 +19,7 @@ import android.support.v4.app.NotificationManagerCompat;
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
import android.support.v4.widget.NestedScrollView;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
|
+import android.support.v7.widget.GridLayoutManager;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.TextUtils;
|
|
|
@@ -43,6 +44,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.kfzs.duanduan.utils.NumberFormatUtils;
|
|
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
|
@@ -67,6 +69,7 @@ import com.sheep.gamegroup.model.entity.SlideshowEty;
|
|
|
import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
|
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
+import com.sheep.gamegroup.module.home.adapter.AdpHomeList;
|
|
|
import com.sheep.gamegroup.module.plugin.model.Plugin;
|
|
|
import com.sheep.gamegroup.module.skin.util.SkinUtil;
|
|
|
import com.sheep.gamegroup.presenter.SmallSheepContract;
|
|
|
@@ -79,7 +82,6 @@ import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
-import com.sheep.gamegroup.util.MyGridview;
|
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
@@ -91,10 +93,8 @@ import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
|
|
|
import com.sheep.gamegroup.view.activity.ActMsg;
|
|
|
import com.sheep.gamegroup.view.activity.NotificationsUtils;
|
|
|
import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
|
-import com.sheep.gamegroup.view.adapter.AdpHomeListGrideview;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpTryMakemoney;
|
|
|
import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
|
|
|
-import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
|
|
|
import com.sheep.gamegroup.view.dialog.DialogNotificationOfArrival;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
@@ -125,8 +125,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
import rx.functions.Action1;
|
|
|
|
|
|
-import static com.sheep.gamegroup.util.UMConfigUtils.Event.NEWBIE_TASK;
|
|
|
-
|
|
|
public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.View, TryMakeMoneyContract.View {
|
|
|
|
|
|
@BindView(R.id.upview1)
|
|
|
@@ -143,8 +141,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
SmartRefreshLayout refresh;
|
|
|
@BindView(R.id.recyclerview)
|
|
|
RecyclerView recyclerview;
|
|
|
- @BindView(R.id.home_list_gridview_gv)
|
|
|
- MyGridview home_list_gridview_gv;
|
|
|
+ @BindView(R.id.home_list_rv)
|
|
|
+ RecyclerView home_list_rv;
|
|
|
@BindView(R.id.home_notice_ll)
|
|
|
View home_notice_ll;
|
|
|
@BindView(R.id.check_net_ll)
|
|
|
@@ -196,8 +194,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
|
|
|
private List<HomeListEntity> homeListEntitys = new ArrayList<>();
|
|
|
private List<HomeListEntity> fullHomeList = new ArrayList<>();
|
|
|
- private List<HomeListEntity> homeListEntitysGridview = new ArrayList<>();
|
|
|
- private AdpHomeListGrideview adpHomeListGrideview;
|
|
|
+ private List<HomeListEntity> homeListList = new ArrayList<>();
|
|
|
+ private AdpHomeList<HomeListEntity> adpHomeList;
|
|
|
private AdpTryMakemoney mAdapter;
|
|
|
|
|
|
private static final int LIST_COUNT = 2;//tryMakeMoneyAdp 总共有2条数据
|
|
|
@@ -830,16 +828,17 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
//添加homeList数据
|
|
|
private void addHomeList(List<HomeListEntity> cacheHomeListEtyList) {
|
|
|
if (ListUtil.isEmpty(cacheHomeListEtyList)) {
|
|
|
- ViewUtil.setVisibility(home_list_gridview_gv, false);
|
|
|
+ ViewUtil.setVisibility(home_list_rv, false);
|
|
|
} else {
|
|
|
+ ViewUtil.setVisibility(home_list_rv, true);
|
|
|
homeListEntitys.clear();
|
|
|
- homeListEntitysGridview.clear();
|
|
|
+ homeListList.clear();
|
|
|
fullHomeList.clear();
|
|
|
CommonUtil.getInstance().splitHomeList(cacheHomeListEtyList, homeListEntitys, fullHomeList);
|
|
|
boolean isShowQB = false;
|
|
|
boolean isShowMd = false;
|
|
|
for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
- homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
+ homeListList.add(homeListEntitys.get(i));
|
|
|
if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
|
|
|
isShowQB = !isShowQB;
|
|
|
}
|
|
|
@@ -851,7 +850,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
SheepApp.getInstance().setShowQB(isShowQB);
|
|
|
SheepApp.getInstance().setShowMidong(isShowMd);
|
|
|
ViewUtil.notifyDataSetChanged(full_home_list_rv);
|
|
|
- adpHomeListGrideview.notifyDataSetChanged();
|
|
|
+ adpHomeList.notifyDataSetChanged();
|
|
|
}
|
|
|
checkFullHomeList();
|
|
|
}
|
|
|
@@ -950,20 +949,23 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
|
|
|
recyclerview.setAdapter(tryMakeMoneyAdp);
|
|
|
|
|
|
- adpHomeListGrideview = new AdpHomeListGrideview(homeListEntitysGridview);
|
|
|
- home_list_gridview_gv.setAdapter(adpHomeListGrideview);
|
|
|
+ adpHomeList = new AdpHomeList<>(homeListList);
|
|
|
|
|
|
- home_list_gridview_gv.setOnItemClickListener((parent, view, position, id) -> {
|
|
|
- HomeListEntity homeListEntity = ListUtil.getItem(homeListEntitysGridview, position);
|
|
|
- if (homeListEntity == null) {
|
|
|
+ GridLayoutManager manager = new GridLayoutManager(SheepApp.getInstance(), 4);
|
|
|
+ home_list_rv.setHasFixedSize(true);
|
|
|
+ home_list_rv.setNestedScrollingEnabled(false);
|
|
|
+ home_list_rv.setLayoutManager(manager);
|
|
|
+ adpHomeList.bindToRecyclerView(home_list_rv);
|
|
|
+ adpHomeList.setOnItemClickListener((adapter, view, position) -> {
|
|
|
+ HomeListEntity item = ListUtil.getItem(homeListList, position);
|
|
|
+ if (item == null) {
|
|
|
return;
|
|
|
}
|
|
|
- UMConfigUtils.IdEvent.HOME_LIST.commit(homeListEntity.getId());
|
|
|
- if ("-2".equals(homeListEntity.getJump())) {
|
|
|
- setValueList(!homeListEntity.isSelect());
|
|
|
+ UMConfigUtils.IdEvent.HOME_LIST.commit(item.getId());
|
|
|
+ if ("-2".equals(item.getJump())) {
|
|
|
+ setValueList(!item.isSelect());
|
|
|
} else {
|
|
|
- CommonUtil.getInstance()
|
|
|
- .goWhere(activity, homeListEntity, "首页");
|
|
|
+ CommonUtil.getInstance().goWhere(activity, item, "首页");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -1178,9 +1180,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
|
|
|
@Override
|
|
|
public void failhomeList(BaseMessage baseMessage) {
|
|
|
- if (homeListEntitys.isEmpty() && fullHomeList.isEmpty())
|
|
|
- ViewUtil.setVisibility(home_list_gridview_gv, false);
|
|
|
-
|
|
|
+ ViewUtil.setVisibility(home_list_rv, !homeListList.isEmpty());
|
|
|
+ ViewUtil.setVisibility(full_home_list_rv, !fullHomeList.isEmpty());
|
|
|
}
|
|
|
|
|
|
private int onResumeCount = 0;
|
|
|
@@ -1529,7 +1530,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (CommonUtil.getInstance().addNewTask(activity, userEntity) && homeListEntitysGridview != null) {
|
|
|
+ if (CommonUtil.getInstance().addNewTask(activity, userEntity) && homeListList != null) {
|
|
|
HomeListEntity homeListEntityNewTask = new HomeListEntity();
|
|
|
homeListEntityNewTask.setTitle(getString(R.string.fresh_task));
|
|
|
homeListEntityNewTask.setDesc(getString(R.string.fresh_task));
|
|
|
@@ -1550,17 +1551,17 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
|
|
|
private void setValueList(boolean flag) {
|
|
|
boolean isNewYear = SkinUtil.getSkinByTime() == Plugin.skin_new_year;
|
|
|
- homeListEntitysGridview.clear();
|
|
|
+ homeListList.clear();
|
|
|
for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
if (flag) {
|
|
|
- homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
+ homeListList.add(homeListEntitys.get(i));
|
|
|
} else {
|
|
|
if (i < 8) {
|
|
|
- homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
+ homeListList.add(homeListEntitys.get(i));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (homeListEntitysGridview.size() > 8) {
|
|
|
+ if (homeListList.size() > 8) {
|
|
|
HomeListEntity homeListEntity = new HomeListEntity();
|
|
|
homeListEntity.setJump("-2");
|
|
|
homeListEntity.setSelect(flag);
|
|
|
@@ -1573,13 +1574,13 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
homeListEntity.setDesc("查看更多");
|
|
|
homeListEntity.setIcon(ViewUtil.getNetImgByName((isNewYear ? "ic_new_year_" : "") + "homepage_chakangd"));
|
|
|
}
|
|
|
- homeListEntitysGridview.set(7, homeListEntity);
|
|
|
+ homeListList.set(7, homeListEntity);
|
|
|
}
|
|
|
/* 为了避免第一次点击时网络图片未加载到本地导致UI混乱,第一次点击不执行此动画,转而使用View自带的变换动画 */
|
|
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && clickCount > 1) {
|
|
|
// TransitionManager.beginDelayedTransition(home_list_gridview_gv, new ChangeBounds());
|
|
|
// }
|
|
|
- adpHomeListGrideview.notifyDataSetChanged();
|
|
|
+ adpHomeList.notifyDataSetChanged();
|
|
|
}
|
|
|
|
|
|
@BindView(R.id.home_search_msg_tv)
|