|
|
@@ -8,7 +8,6 @@ import android.content.ClipboardManager;
|
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
-import android.graphics.Color;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.os.Build;
|
|
|
import android.os.Handler;
|
|
|
@@ -34,7 +33,6 @@ import android.view.WindowManager;
|
|
|
import android.view.animation.Animation;
|
|
|
import android.view.animation.OvershootInterpolator;
|
|
|
import android.view.animation.TranslateAnimation;
|
|
|
-import android.widget.AdapterView;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
@@ -65,7 +63,6 @@ import com.sheep.gamegroup.model.entity.RecyleObj;
|
|
|
import com.sheep.gamegroup.model.entity.RecyleType;
|
|
|
import com.sheep.gamegroup.model.entity.Release_task;
|
|
|
import com.sheep.gamegroup.model.entity.RequestParamEty;
|
|
|
-import com.sheep.gamegroup.model.entity.RobTask;
|
|
|
import com.sheep.gamegroup.model.entity.SlideshowEty;
|
|
|
import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
|
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
@@ -77,14 +74,12 @@ import com.sheep.gamegroup.presenter.SmallSheepPresenter;
|
|
|
import com.sheep.gamegroup.presenter.TryMakeMoneyContract;
|
|
|
import com.sheep.gamegroup.presenter.TryMakeMoneyPresenter;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
-import com.sheep.gamegroup.util.ConfigUtil;
|
|
|
import com.sheep.gamegroup.util.DataKey;
|
|
|
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.MyListview;
|
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
@@ -97,7 +92,6 @@ 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.AdpHomeListListview;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpTryMakemoney;
|
|
|
import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
|
|
|
import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
|
|
|
@@ -143,25 +137,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
LinearLayout homepageItemNoticeLayout;
|
|
|
@BindView(R.id.banner)
|
|
|
Banner banner;
|
|
|
-
|
|
|
- @BindView(R.id.icon_img_iv)
|
|
|
- ImageView iconImgIv;
|
|
|
- @BindView(R.id.name_tv)
|
|
|
- TextView nameTv;
|
|
|
- @BindView(R.id.sheep_num_tv)
|
|
|
- TextView sheepNumTv;
|
|
|
- @BindView(R.id.withdrawal)
|
|
|
- TextView withdrawal;
|
|
|
- @BindView(R.id.my_price)
|
|
|
- TextView myPrice;
|
|
|
- @BindView(R.id.try_play_layout)
|
|
|
- LinearLayout tryPlayLayout;
|
|
|
- @BindView(R.id.invitation_layout)
|
|
|
- LinearLayout invitationLayout;
|
|
|
- @BindView(R.id.lying_layout)
|
|
|
- LinearLayout lyingLayout;
|
|
|
- @BindView(R.id.card_layout)
|
|
|
- LinearLayout card_layout;
|
|
|
@BindView(R.id.scrollView)
|
|
|
NestedScrollView scrollView;
|
|
|
@BindView(R.id.newbie_task)
|
|
|
@@ -170,14 +145,10 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
SmartRefreshLayout refresh;
|
|
|
@BindView(R.id.recyclerview)
|
|
|
RecyclerView recyclerview;
|
|
|
- @BindView(R.id.recharge)
|
|
|
- TextView recharge;
|
|
|
@BindView(R.id.home_list_gridview_gv)
|
|
|
MyGridview home_list_gridview_gv;
|
|
|
- @BindView(R.id.home_list_gridview_listview)
|
|
|
- MyListview home_list_gridview_listview;
|
|
|
- @BindView(R.id.home_list_gridview_layout)
|
|
|
- LinearLayout home_list_gridview_layout;
|
|
|
+ @BindView(R.id.home_notice_ll)
|
|
|
+ View home_notice_ll;
|
|
|
@BindView(R.id.check_net_ll)
|
|
|
View check_net_ll;
|
|
|
@BindView(R.id.bg_newbie_task)
|
|
|
@@ -234,15 +205,11 @@ 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 List<HomeListEntity> homeListEntitysListview = new ArrayList<>();
|
|
|
private AdpHomeListGrideview adpHomeListGrideview;
|
|
|
- private AdpHomeListListview adpHomeListListview;
|
|
|
- private Release_task taskEty;
|
|
|
private AdpTryMakemoney mAdapter;
|
|
|
|
|
|
private static final int LIST_COUNT = 2;//tryMakeMoneyAdp 总共有2条数据
|
|
|
private static final RecyleObj NULL = RecyleObj.make(RecyleType.NONE, null);//空数据
|
|
|
- public static final int WHAT_LOAD_USER_INFO = 0;//加载用户信息
|
|
|
public static final int WHAT_LOAD_RUN_TASK = 1;//加载正在进行的任务列表
|
|
|
public static final int WHAT_TRY_SHOW_HB = 7;//尝试显示红包
|
|
|
|
|
|
@@ -251,9 +218,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
public void handleMessage(Message msg) {
|
|
|
super.handleMessage(msg);
|
|
|
switch (msg.what) {
|
|
|
- case WHAT_LOAD_USER_INFO:
|
|
|
- loadUserInfo();
|
|
|
- break;
|
|
|
case WHAT_LOAD_RUN_TASK:
|
|
|
tryMakeMoneyAdp.clear();
|
|
|
//正在进行中的任务列表
|
|
|
@@ -735,22 +699,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void loadUserInfo() {
|
|
|
-
|
|
|
- if (myPrice == null || userEntity == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- ViewUtil.setText(nameTv, userEntity.getNickname());
|
|
|
- ViewUtil.setText(sheepNumTv, String.format(Locale.CHINA, "绵羊号:%s", userEntity.getInvitation_code()));
|
|
|
- if (ConfigUtil.isSmallDebug()) {
|
|
|
- sheepNumTv.append("\n邀请人:");
|
|
|
- sheepNumTv.append(userEntity.getParent_code());
|
|
|
- }
|
|
|
- ViewUtil.setText(myPrice, String.format(Locale.CHINA, "%s\u0020元", userEntity.getBalance()));
|
|
|
- GlideImageLoader.setAvatar(iconImgIv, userEntity.getAvatar(), Color.argb(128, 255, 255, 255));
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
public void initListener() {
|
|
|
scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
|
|
|
@@ -847,9 +795,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
public void initData() {
|
|
|
//用户信息
|
|
|
userEntity = DataUtil.getInstance().getUserEntity();
|
|
|
- if (userEntity != null) {
|
|
|
- loadUserInfo();
|
|
|
- }
|
|
|
//任务
|
|
|
// List<TaskReleaseEty> cacheTaskReleaseEtyList = DataUtil.getInstance().getCacheList(ApiKey.release_task, TaskReleaseEty.class);
|
|
|
// if (cacheTaskReleaseEtyList != null) {
|
|
|
@@ -886,22 +831,25 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
}
|
|
|
//首页list
|
|
|
List<HomeListEntity> cacheHomeListEtyList = DataUtil.getInstance().getCacheList(ApiKey.home_list, HomeListEntity.class);
|
|
|
+ addHomeList(cacheHomeListEtyList);
|
|
|
+ refreshData();
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加homeList数据
|
|
|
+ private void addHomeList(List<HomeListEntity> cacheHomeListEtyList) {
|
|
|
if (ListUtil.isEmpty(cacheHomeListEtyList)) {
|
|
|
- ViewUtil.setVisibility(home_list_gridview_layout, false);
|
|
|
+ ViewUtil.setVisibility(home_list_gridview_gv, false);
|
|
|
ViewUtil.setVisibility(full_home_list_rv, false);
|
|
|
} else {
|
|
|
- ViewUtil.setVisibility(home_list_gridview_layout, true);
|
|
|
+ ViewUtil.setVisibility(home_list_gridview_gv, true);
|
|
|
+ homeListEntitys.clear();
|
|
|
+ homeListEntitysGridview.clear();
|
|
|
fullHomeList.clear();
|
|
|
CommonUtil.getInstance().splitHomeList(cacheHomeListEtyList, homeListEntitys, fullHomeList);
|
|
|
ViewUtil.setVisibility(full_home_list_rv, !fullHomeList.isEmpty());
|
|
|
boolean isShowQB = false;
|
|
|
boolean isShowMd = false;
|
|
|
for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
- /*if (i < 4) {
|
|
|
- homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
- } else {
|
|
|
- homeListEntitysListview.add(homeListEntitys.get(i));
|
|
|
- }*/
|
|
|
homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
|
|
|
isShowQB = !isShowQB;
|
|
|
@@ -915,10 +863,16 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
SheepApp.getInstance().setShowMidong(isShowMd);
|
|
|
ViewUtil.notifyDataSetChanged(full_home_list_rv);
|
|
|
adpHomeListGrideview.notifyDataSetChanged();
|
|
|
- adpHomeListListview.notifyDataSetChanged();
|
|
|
- ViewUtil.setVisibility(home_list_gridview_listview, !homeListEntitysListview.isEmpty());
|
|
|
}
|
|
|
- refreshData();
|
|
|
+ checkFullHomeList();
|
|
|
+ }
|
|
|
+
|
|
|
+ //fullHomeList有数据时,要让fullHomeList上下遮盖相邻组件
|
|
|
+ private void checkFullHomeList() {
|
|
|
+ if (/*SkinUtil.curPlugin == Plugin.skin_new_year && */!fullHomeList.isEmpty()) {
|
|
|
+ LayoutParamsUtil.resetLayoutParams(home_notice_ll, new Lp().setTopMargin(0));
|
|
|
+ LayoutParamsUtil.resetLayoutParams(full_home_list_rv, new Lp().setTopMargin(-G.getRealPix(8)).setBottomMargin(-G.getRealPix(4)));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1004,25 +958,20 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
|
|
|
recyclerview.setAdapter(tryMakeMoneyAdp);
|
|
|
|
|
|
- adpHomeListListview = new AdpHomeListListview(homeListEntitysListview, activity);
|
|
|
adpHomeListGrideview = new AdpHomeListGrideview(homeListEntitysGridview, activity);
|
|
|
- home_list_gridview_listview.setAdapter(adpHomeListListview);
|
|
|
home_list_gridview_gv.setAdapter(adpHomeListGrideview);
|
|
|
|
|
|
- home_list_gridview_gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
- @Override
|
|
|
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- HomeListEntity homeListEntity = ListUtil.getItem(homeListEntitysGridview, position);
|
|
|
- if (homeListEntity == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- UMConfigUtils.IdEvent.HOME_LIST.commit(homeListEntity.getId());
|
|
|
- if ("-2".equals(homeListEntity.getJump())) {
|
|
|
- setValueList(!homeListEntity.isSelect());
|
|
|
- } else {
|
|
|
- CommonUtil.getInstance()
|
|
|
- .goWhere(activity, homeListEntity, "首页");
|
|
|
- }
|
|
|
+ home_list_gridview_gv.setOnItemClickListener((parent, view, position, id) -> {
|
|
|
+ HomeListEntity homeListEntity = ListUtil.getItem(homeListEntitysGridview, position);
|
|
|
+ if (homeListEntity == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UMConfigUtils.IdEvent.HOME_LIST.commit(homeListEntity.getId());
|
|
|
+ if ("-2".equals(homeListEntity.getJump())) {
|
|
|
+ setValueList(!homeListEntity.isSelect());
|
|
|
+ } else {
|
|
|
+ CommonUtil.getInstance()
|
|
|
+ .goWhere(activity, homeListEntity, "首页");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -1044,49 +993,30 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
}
|
|
|
|
|
|
|
|
|
- @OnClick({R.id.recharge, R.id.withdrawal, R.id.view_rob_duty,
|
|
|
- R.id.newbie_task, R.id.icon_img_iv, R.id.user_layout,
|
|
|
- R.id.homepage_item_money_tv
|
|
|
+ @OnClick({R.id.view_rob_duty,
|
|
|
+ R.id.newbie_task, R.id.homepage_item_money_tv
|
|
|
})
|
|
|
public void onViewClicked(View view) {
|
|
|
switch (view.getId()) {
|
|
|
case R.id.homepage_item_money_tv:
|
|
|
Jump2View.getInstance().goTryplayView(activity, null);
|
|
|
break;
|
|
|
- case R.id.withdrawal://提现
|
|
|
- Jump2View.getInstance().tryGoWithdrawal(activity, userEntity);
|
|
|
- break;
|
|
|
case R.id.newbie_task://新手任务
|
|
|
DialogNewbieTaskList.tryShowDialog(activity);
|
|
|
NEWBIE_TASK.onEvent();
|
|
|
break;
|
|
|
- case R.id.icon_img_iv://头像
|
|
|
- if (TestUtil.isTest()) {
|
|
|
- TestUtil.test(activity);
|
|
|
- } else
|
|
|
- Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
|
- break;
|
|
|
- case R.id.user_layout://个人信息
|
|
|
- Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
|
- break;
|
|
|
- case R.id.recharge://充值
|
|
|
- Jump2View.getInstance().goRechargeAct(activity, "首页");
|
|
|
- break;
|
|
|
case R.id.view_rob_duty://抢任务弹框
|
|
|
- CommonUtil.getInstance().robTask(new Action1<RobTask>() {
|
|
|
- @Override
|
|
|
- public void call(RobTask robTask) {
|
|
|
- if (robTask != null) {
|
|
|
- DataUtil.putAsInt(DataKey.KEY_ORDER, robTask.getOrder());
|
|
|
- try {
|
|
|
- ViewUtil.newInstance().showRobDutyDialog(activity, robTask);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- G.showToast(e.getMessage());
|
|
|
- }
|
|
|
- } else {
|
|
|
- G.showToast(R.string.task_sold_out_focus_publish);
|
|
|
+ CommonUtil.getInstance().robTask(robTask -> {
|
|
|
+ if (robTask != null) {
|
|
|
+ DataUtil.putAsInt(DataKey.KEY_ORDER, robTask.getOrder());
|
|
|
+ try {
|
|
|
+ ViewUtil.newInstance().showRobDutyDialog(activity, robTask);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ G.showToast(e.getMessage());
|
|
|
}
|
|
|
+ } else {
|
|
|
+ G.showToast(R.string.task_sold_out_focus_publish);
|
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
@@ -1104,7 +1034,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
return;
|
|
|
}
|
|
|
DataUtil.getInstance().setUserEntity(userEntity);
|
|
|
- mHandler.sendEmptyMessage(WHAT_LOAD_USER_INFO);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1256,48 +1185,14 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.home_list);
|
|
|
if (isNewData) {
|
|
|
List<HomeListEntity> homeListEntityList = baseMessage.getDataList(HomeListEntity.class);
|
|
|
- if (ListUtil.isEmpty(homeListEntityList)) {
|
|
|
- ViewUtil.setVisibility(home_list_gridview_layout, false);
|
|
|
- ViewUtil.setVisibility(full_home_list_rv, false);
|
|
|
- } else {
|
|
|
- ViewUtil.setVisibility(home_list_gridview_layout, true);
|
|
|
- homeListEntitys.clear();
|
|
|
- homeListEntitysGridview.clear();
|
|
|
- homeListEntitysListview.clear();
|
|
|
- fullHomeList.clear();
|
|
|
- CommonUtil.getInstance().splitHomeList(homeListEntityList, homeListEntitys, fullHomeList);
|
|
|
- ViewUtil.setVisibility(full_home_list_rv, !fullHomeList.isEmpty());
|
|
|
- boolean isShowQB = false;
|
|
|
- boolean isShowMd = false;
|
|
|
- for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
-// if (i < 4) {
|
|
|
-// homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
-// } else {
|
|
|
-// homeListEntitysListview.add(homeListEntitys.get(i));
|
|
|
-// }
|
|
|
- homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
- if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
|
|
|
- isShowQB = !isShowQB;
|
|
|
- }
|
|
|
- if (homeListEntitys.get(i).getJump().equals("14")) {//幂动科技
|
|
|
- isShowMd = !isShowMd;
|
|
|
- }
|
|
|
- }
|
|
|
- addNewTask();
|
|
|
- SheepApp.getInstance().setShowQB(isShowQB);
|
|
|
- SheepApp.getInstance().setShowMidong(isShowMd);
|
|
|
- ViewUtil.notifyDataSetChanged(full_home_list_rv);
|
|
|
- adpHomeListGrideview.notifyDataSetChanged();
|
|
|
- adpHomeListListview.notifyDataSetChanged();
|
|
|
- ViewUtil.setVisibility(home_list_gridview_listview, !homeListEntitysListview.isEmpty());
|
|
|
- }
|
|
|
+ addHomeList(homeListEntityList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void failhomeList(BaseMessage baseMessage) {
|
|
|
if (homeListEntitys.isEmpty() && fullHomeList.isEmpty())
|
|
|
- ViewUtil.setVisibility(home_list_gridview_layout, false);
|
|
|
+ ViewUtil.setVisibility(home_list_gridview_gv, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1306,21 +1201,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
@Override
|
|
|
public void onResume() {
|
|
|
super.onResume();
|
|
|
- UserEntity result = DataUtil.getInstance().getUserEntity();
|
|
|
- if (result == null) {
|
|
|
- CommonUtil.getInstance().updateUserInfo(new Action1<UserEntity>() {
|
|
|
- @Override
|
|
|
- public void call(UserEntity item) {
|
|
|
- if (item != null) {
|
|
|
- userEntity = item;
|
|
|
- loadUserInfo();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- userEntity = result;
|
|
|
- loadUserInfo();
|
|
|
- }
|
|
|
+ CommonUtil.getInstance().callActionWithUserInfo(item -> userEntity = item);
|
|
|
if (onResumeCount > 0)
|
|
|
refreshTaskList();
|
|
|
onResumeCount++;
|