|
|
@@ -90,6 +90,7 @@ import com.sheep.gamegroup.util.DeviceUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
+import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.util.MainTab;
|
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
import com.sheep.gamegroup.util.StringUtils;
|
|
|
@@ -144,6 +145,10 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
|
|
|
public static WeakReference<View> listRef;
|
|
|
|
|
|
+ @BindView(R.id.home_list_progress_block)
|
|
|
+ View home_list_progress_block;
|
|
|
+ @BindView(R.id.home_list_progress_bar)
|
|
|
+ View home_list_progress_bar;
|
|
|
@BindView(R.id.upview1)
|
|
|
MarqueeView upview1;
|
|
|
@BindView(R.id.homepage_item_notice_mv)
|
|
|
@@ -160,6 +165,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
RecyclerView recyclerview;
|
|
|
@BindView(R.id.home_list_rv)
|
|
|
RecyclerView home_list_rv;
|
|
|
+ @BindView(R.id.bar_list_rv)
|
|
|
+ RecyclerView bar_list_rv;
|
|
|
@BindView(R.id.home_notice_ll)
|
|
|
View home_notice_ll;
|
|
|
@BindView(R.id.check_net_ll)
|
|
|
@@ -176,8 +183,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
TextView homepage_item_juan_tv;
|
|
|
@BindView(R.id.recyclerview_line)
|
|
|
View recyclerview_line;
|
|
|
- @BindView(R.id.full_home_list_rv)
|
|
|
- RecyclerView full_home_list_rv;
|
|
|
@BindView(R.id.test_change)
|
|
|
TextView test_change;
|
|
|
@BindView(R.id.test_change_user)
|
|
|
@@ -209,9 +214,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
private List<String> slideshowTitleList = new ArrayList<>();
|
|
|
private List<BulletinEnty> bulletinEntyLists = new ArrayList<>();
|
|
|
|
|
|
- private List<HomeListEntity> homeListEntitys = new ArrayList<>();
|
|
|
- private List<HomeListEntity> fullHomeList = new ArrayList<>();
|
|
|
private List<HomeListEntity> homeListList = new ArrayList<>();
|
|
|
+ private List<HomeListEntity> barListList = new ArrayList<>();
|
|
|
private AdpHomeList<HomeListEntity> adpHomeList;
|
|
|
private AdpTryMakemoney mAdapter;
|
|
|
|
|
|
@@ -247,7 +251,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
tryMakeMoneyAdp.notifyDataSetChanged();
|
|
|
break;
|
|
|
case WHAT_TRY_SHOW_HB:
|
|
|
- ((ActMain)getActivity()).switchFragment(0);
|
|
|
+ ((ActMain) getActivity()).switchFragment(0);
|
|
|
showRedPackage(activity);
|
|
|
break;
|
|
|
case WHAT_TRY_SHOW_NEWBIE_GUIDE:
|
|
|
@@ -635,29 +639,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
}
|
|
|
});
|
|
|
CommonUtil.getInstance().reflex(tabLayout, activity);
|
|
|
- //只显示图片并且充满的homeList
|
|
|
- fullHomeList.clear();
|
|
|
- full_home_list_rv.setHasFixedSize(true);
|
|
|
- full_home_list_rv.setNestedScrollingEnabled(false);
|
|
|
- full_home_list_rv.setLayoutManager(new LinearLayoutManager(activity));
|
|
|
- full_home_list_rv.setAdapter(new AdbCommonRecycler<HomeListEntity>(activity, fullHomeList) {
|
|
|
- @Override
|
|
|
- public int getViewIdByType(int type) {
|
|
|
- return R.layout.item_image_full_home_list;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void convert(ViewHolder holder, final HomeListEntity item) {
|
|
|
- ImageView imageView = holder.getView(R.id.image);
|
|
|
- GlideImageLoader.setImage(imageView, item.getIcon());
|
|
|
- imageView.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- CommonUtil.getInstance().goWhere(activity, item, "首页");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
new GoodsRecommendsBarHelper(getContext(), goods_recommends_bar);
|
|
|
}
|
|
|
|
|
|
@@ -815,44 +796,29 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
|
|
|
//添加homeList数据
|
|
|
private void addHomeList(List<HomeListEntity> cacheHomeListEtyList) {
|
|
|
- if (ListUtil.isEmpty(cacheHomeListEtyList)) {
|
|
|
- ViewUtil.setVisibility(home_list_rv, false);
|
|
|
- } else {
|
|
|
- ViewUtil.setVisibility(home_list_rv, true);
|
|
|
- homeListEntitys.clear();
|
|
|
- homeListList.clear();
|
|
|
- fullHomeList.clear();
|
|
|
- CommonUtil.getInstance().splitHomeList(cacheHomeListEtyList, homeListEntitys, fullHomeList);
|
|
|
-// if(TestUtil.isDev())
|
|
|
-// homeListEntitys = homeListEntitys.subList(0, 7);
|
|
|
- boolean isShowQB = false;
|
|
|
- boolean isShowMd = false;
|
|
|
- for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
- homeListList.add(homeListEntitys.get(i));
|
|
|
- if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
|
|
|
- isShowQB = !isShowQB;
|
|
|
- }
|
|
|
- if (homeListEntitys.get(i).getJump().equals("14")) {//幂动科技
|
|
|
- isShowMd = !isShowMd;
|
|
|
- }
|
|
|
+ barListList.clear();
|
|
|
+ homeListList.clear();
|
|
|
+ boolean isShowQB = false;
|
|
|
+ boolean isShowMd = false;
|
|
|
+ for (int i = 0; i < cacheHomeListEtyList.size(); i++) {
|
|
|
+ HomeListEntity item = cacheHomeListEtyList.get(i);
|
|
|
+ if ("1024".equals(item.getDesc()) || "17".equals(item.getJump())) {
|
|
|
+ barListList.add(item);
|
|
|
+ } else {
|
|
|
+ homeListList.add(item);
|
|
|
+ }
|
|
|
+ if (item.getJump().equals("6")) {//6Q币充值
|
|
|
+ isShowQB = !isShowQB;
|
|
|
+ }
|
|
|
+ if (item.getJump().equals("14")) {//幂动科技
|
|
|
+ isShowMd = !isShowMd;
|
|
|
}
|
|
|
- addNewTask();
|
|
|
- SheepApp.getInstance().setShowQB(isShowQB);
|
|
|
- ViewUtil.notifyDataSetChanged(full_home_list_rv);
|
|
|
- adpHomeList.notifyDataSetChanged();
|
|
|
- }
|
|
|
- checkFullHomeList();
|
|
|
- }
|
|
|
-
|
|
|
- //fullHomeList有数据时,要让fullHomeList上下遮盖相邻组件
|
|
|
- private void checkFullHomeList() {
|
|
|
- if (!fullHomeList.isEmpty()) {
|
|
|
- LayoutParamsUtil.resetLayoutParams(full_home_list_rv, new Lp(G.DENSITY).setTopMargin(-3).setBottomMargin(0));
|
|
|
- LayoutParamsUtil.resetLayoutParams(home_notice_ll, new Lp().setTopMargin(0));
|
|
|
- } else {
|
|
|
- LayoutParamsUtil.resetLayoutParams(full_home_list_rv, new Lp().setTopMargin(G.getRealPix(6)).setBottomMargin(0));
|
|
|
- LayoutParamsUtil.resetLayoutParams(home_notice_ll, new Lp(G.DENSITY).setTopMargin(12));
|
|
|
}
|
|
|
+ addNewTask();
|
|
|
+ SheepApp.getInstance().setShowQB(isShowQB);
|
|
|
+ ViewUtil.notifyDataSetChanged(home_list_rv);
|
|
|
+ ViewUtil.notifyDataSetChanged(bar_list_rv);
|
|
|
+ ViewUtil.setVisibility(home_list_progress_bar, homeListList.size() > 8);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -938,9 +904,30 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
|
|
|
recyclerview.setAdapter(tryMakeMoneyAdp);
|
|
|
|
|
|
- adpHomeList = new AdpHomeList<>(R.layout.item_my_list_but, homeListList);
|
|
|
+ bar_list_rv.setHasFixedSize(true);
|
|
|
+ bar_list_rv.setNestedScrollingEnabled(false);
|
|
|
+ bar_list_rv.setLayoutManager(new LinearLayoutManager(activity));
|
|
|
+ bar_list_rv.setAdapter(new AdbCommonRecycler<HomeListEntity>(activity, barListList) {
|
|
|
+ @Override
|
|
|
+ public int getViewIdByType(int type) {
|
|
|
+ return R.layout.item_image_full_home_list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void convert(ViewHolder holder, final HomeListEntity item) {
|
|
|
+ ImageView imageView = holder.getView(R.id.image);
|
|
|
+ GlideImageLoader.setImage(imageView, item.getIcon());
|
|
|
+ imageView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ CommonUtil.getInstance().goWhere(activity, item, "首页");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- GridLayoutManager manager = new GridLayoutManager(SheepApp.getInstance(), 4);
|
|
|
+ adpHomeList = new AdpHomeList<>(R.layout.item_my_list_but, ScreenUtil.getScreenWidth(getContext()) / 4, homeListList);
|
|
|
+ GridLayoutManager manager = new GridLayoutManager(SheepApp.getInstance(), 2, LinearLayoutManager.HORIZONTAL, false);
|
|
|
home_list_rv.setHasFixedSize(true);
|
|
|
home_list_rv.setNestedScrollingEnabled(false);
|
|
|
home_list_rv.setLayoutManager(manager);
|
|
|
@@ -957,6 +944,20 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
CommonUtil.getInstance().goWhere(activity, item, "首页");
|
|
|
}
|
|
|
});
|
|
|
+ home_list_rv.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
+
|
|
|
+ float distance = getResources().getDimension(R.dimen.radius_25);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
|
|
+ int extent = recyclerView.computeHorizontalScrollExtent();
|
|
|
+ int range = recyclerView.computeHorizontalScrollRange();
|
|
|
+ int offset = recyclerView.computeHorizontalScrollOffset();
|
|
|
+ float percentage = (offset / (float) (range - extent));
|
|
|
+ float move = percentage * distance;
|
|
|
+ home_list_progress_block.setX(move);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private void refreshTaskList() {
|
|
|
@@ -1177,8 +1178,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
public void failhomeList(BaseMessage baseMessage) {
|
|
|
if (this.getActivity() != null && this.getActivity().isDestroyed() || this.isDetached())
|
|
|
return;
|
|
|
- ViewUtil.setVisibility(home_list_rv, !homeListList.isEmpty());
|
|
|
- ViewUtil.setVisibility(full_home_list_rv, !fullHomeList.isEmpty());
|
|
|
+ ViewUtil.setVisibility(home_list_rv, true);
|
|
|
}
|
|
|
|
|
|
private int onResumeCount = 0;
|
|
|
@@ -1513,23 +1513,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @BindView(R.id.home_list_more_iv)
|
|
|
- ImageView home_list_more_iv;
|
|
|
-
|
|
|
- @OnClick(R.id.home_list_more_iv)
|
|
|
- public void toggleHomeList() {//homeList展开或者收缩
|
|
|
- boolean isHomeListExtend = homeListList.size() > 8;
|
|
|
- isHomeListExtend = !isHomeListExtend;
|
|
|
- ViewUtil.setImage(home_list_more_iv, isHomeListExtend ? R.drawable.bg_to_top : R.drawable.bg_to_bottom);
|
|
|
- if (isHomeListExtend) {
|
|
|
- homeListList.clear();
|
|
|
- homeListList.addAll(homeListEntitys);
|
|
|
- } else {
|
|
|
- getHomeList();
|
|
|
- }
|
|
|
- adpHomeList.notifyDataSetChanged();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 新手任务
|
|
|
*/
|
|
|
@@ -1540,21 +1523,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
homeListEntityNewTask.setDesc(SheepApp.getInstance().getString(R.string.fresh_task));
|
|
|
homeListEntityNewTask.setJump("-1");
|
|
|
homeListEntityNewTask.setIcon(ViewUtil.getNetImgByName("homepage_xinshourw"));
|
|
|
- homeListEntitys.add(0, homeListEntityNewTask);
|
|
|
- }
|
|
|
- ViewUtil.setVisibility(home_list_more_iv, ListUtil.size(homeListEntitys) > 8);
|
|
|
- getHomeList();
|
|
|
- adpHomeList.notifyDataSetChanged();
|
|
|
- }
|
|
|
-
|
|
|
- private void getHomeList() {
|
|
|
- homeListList.clear();
|
|
|
- for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
- if (i < 8) {
|
|
|
- homeListList.add(homeListEntitys.get(i));
|
|
|
- } else {
|
|
|
- break;
|
|
|
- }
|
|
|
+ homeListList.add(0, homeListEntityNewTask);
|
|
|
}
|
|
|
}
|
|
|
|