|
@@ -3,6 +3,7 @@ package com.kfzs.duanduan.fragment;
|
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
import android.content.DialogInterface;
|
|
|
|
|
+import android.graphics.Color;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
|
import android.os.Looper;
|
|
import android.os.Looper;
|
|
@@ -18,11 +19,8 @@ import android.view.LayoutInflater;
|
|
|
import android.view.MotionEvent;
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
|
-import android.widget.AdapterView;
|
|
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
|
-import android.widget.RadioGroup;
|
|
|
|
|
-import android.widget.RelativeLayout;
|
|
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -34,6 +32,8 @@ import com.kfzs.duanduan.BaseCompatFragment;
|
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
|
import com.kfzs.duanduan.react.ReactUtil;
|
|
import com.kfzs.duanduan.react.ReactUtil;
|
|
|
import com.kfzs.duanduan.react.SharedPreferences;
|
|
import com.kfzs.duanduan.react.SharedPreferences;
|
|
|
|
|
+import com.kfzs.duanduan.utils.NumberFormatUtils;
|
|
|
|
|
+import com.mdad.sdk.mdsdk.AdManager;
|
|
|
import com.sheep.gamegroup.di.components.DaggerSmallSheepComponent;
|
|
import com.sheep.gamegroup.di.components.DaggerSmallSheepComponent;
|
|
|
import com.sheep.gamegroup.di.modules.SmallSheepModule;
|
|
import com.sheep.gamegroup.di.modules.SmallSheepModule;
|
|
|
import com.sheep.gamegroup.di.modules.TryMakeMoneyModule;
|
|
import com.sheep.gamegroup.di.modules.TryMakeMoneyModule;
|
|
@@ -59,9 +59,7 @@ import com.sheep.gamegroup.presenter.SmallSheepPresenter;
|
|
|
import com.sheep.gamegroup.presenter.TryMakeMoneyContract;
|
|
import com.sheep.gamegroup.presenter.TryMakeMoneyContract;
|
|
|
import com.sheep.gamegroup.presenter.TryMakeMoneyPresenter;
|
|
import com.sheep.gamegroup.presenter.TryMakeMoneyPresenter;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
-import com.sheep.gamegroup.util.Conversion2;
|
|
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
-import com.sheep.gamegroup.util.ImageGlarryDrawable;
|
|
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.MyDbManager;
|
|
import com.sheep.gamegroup.util.MyDbManager;
|
|
@@ -71,17 +69,23 @@ import com.sheep.gamegroup.util.PreferenceUtils;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
|
|
+import com.sheep.gamegroup.util.ViewUtil;
|
|
|
|
|
+import com.sheep.gamegroup.util.glide.GlideCircleTransformWithBorder;
|
|
|
import com.sheep.gamegroup.view.activity.NotificationsUtils;
|
|
import com.sheep.gamegroup.view.activity.NotificationsUtils;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListGrideview;
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListGrideview;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListListview;
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListListview;
|
|
|
import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
|
|
import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
|
|
|
-import com.sheep.gamegroup.view.customview.SheepViewPager;
|
|
|
|
|
import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
|
|
import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sunfusheng.marqueeview.MarqueeView;
|
|
import com.sunfusheng.marqueeview.MarqueeView;
|
|
|
|
|
+import com.youth.banner.Banner;
|
|
|
|
|
+import com.youth.banner.BannerConfig;
|
|
|
|
|
+import com.youth.banner.listener.OnBannerListener;
|
|
|
|
|
+import com.youth.banner.loader.ImageLoader;
|
|
|
|
|
|
|
|
|
|
+import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
@@ -111,10 +115,8 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
MarqueeView homepageItemNoticeMv;
|
|
MarqueeView homepageItemNoticeMv;
|
|
|
@BindView(R.id.homepage_item_notice_layout)
|
|
@BindView(R.id.homepage_item_notice_layout)
|
|
|
LinearLayout homepageItemNoticeLayout;
|
|
LinearLayout homepageItemNoticeLayout;
|
|
|
- @BindView(R.id.homepage_item_banner_layout)
|
|
|
|
|
- RelativeLayout homepage_item_banner_layout;
|
|
|
|
|
- @BindView(R.id.icon_layout)
|
|
|
|
|
- RelativeLayout icon_layout;
|
|
|
|
|
|
|
+ @BindView(R.id.banner)
|
|
|
|
|
+ Banner banner;
|
|
|
|
|
|
|
|
@BindView(R.id.icon_img_iv)
|
|
@BindView(R.id.icon_img_iv)
|
|
|
ImageView iconImgIv;
|
|
ImageView iconImgIv;
|
|
@@ -122,14 +124,10 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
TextView nameTv;
|
|
TextView nameTv;
|
|
|
@BindView(R.id.sheep_num_tv)
|
|
@BindView(R.id.sheep_num_tv)
|
|
|
TextView sheepNumTv;
|
|
TextView sheepNumTv;
|
|
|
- @BindView(R.id.user_layout)
|
|
|
|
|
- LinearLayout userLayout;
|
|
|
|
|
@BindView(R.id.withdrawal)
|
|
@BindView(R.id.withdrawal)
|
|
|
TextView withdrawal;
|
|
TextView withdrawal;
|
|
|
@BindView(R.id.my_price)
|
|
@BindView(R.id.my_price)
|
|
|
TextView myPrice;
|
|
TextView myPrice;
|
|
|
- @BindView(R.id.my_all_price)
|
|
|
|
|
- TextView myAllPrice;
|
|
|
|
|
@BindView(R.id.try_play_layout)
|
|
@BindView(R.id.try_play_layout)
|
|
|
LinearLayout tryPlayLayout;
|
|
LinearLayout tryPlayLayout;
|
|
|
@BindView(R.id.invitation_layout)
|
|
@BindView(R.id.invitation_layout)
|
|
@@ -138,10 +136,6 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
LinearLayout lyingLayout;
|
|
LinearLayout lyingLayout;
|
|
|
@BindView(R.id.card_layout)
|
|
@BindView(R.id.card_layout)
|
|
|
LinearLayout card_layout;
|
|
LinearLayout card_layout;
|
|
|
- @BindView(R.id.viewpager_banner)
|
|
|
|
|
- SheepViewPager viewpager_banner;
|
|
|
|
|
- @BindView(R.id.group_banner)
|
|
|
|
|
- RadioGroup group_banner;
|
|
|
|
|
@BindView(R.id.scrollView)
|
|
@BindView(R.id.scrollView)
|
|
|
NestedScrollView scrollView;
|
|
NestedScrollView scrollView;
|
|
|
@BindView(R.id.newbie_task)
|
|
@BindView(R.id.newbie_task)
|
|
@@ -176,6 +170,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
private int position = 0;
|
|
private int position = 0;
|
|
|
private List<TaskReleaseEty> releaseEtyLists = new ArrayList<>();
|
|
private List<TaskReleaseEty> releaseEtyLists = new ArrayList<>();
|
|
|
private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
|
|
private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
|
|
|
|
|
+ private List<String> slideshowTitleList = new ArrayList<>();
|
|
|
private List<BulletinEnty> bulletinEntyLists = new ArrayList<>();
|
|
private List<BulletinEnty> bulletinEntyLists = new ArrayList<>();
|
|
|
|
|
|
|
|
private List<HomeListEntity> homeListEntitys = new ArrayList<>();
|
|
private List<HomeListEntity> homeListEntitys = new ArrayList<>();
|
|
@@ -190,13 +185,13 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
super.handleMessage(msg);
|
|
super.handleMessage(msg);
|
|
|
switch (msg.what) {
|
|
switch (msg.what) {
|
|
|
case 0:
|
|
case 0:
|
|
|
- refalsh();
|
|
|
|
|
|
|
+ loadUserInfo();
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
|
tryMakeMoneyAdp.setIs_succession(3);
|
|
tryMakeMoneyAdp.setIs_succession(3);
|
|
|
- if(releaseEtyLists != null && releaseEtyLists.size()>0){
|
|
|
|
|
|
|
+ if (releaseEtyLists != null && releaseEtyLists.size() > 0) {
|
|
|
|
|
|
|
|
- tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RELEASE_TASK, releaseEtyLists), position>2?1:position);
|
|
|
|
|
|
|
+ tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RELEASE_TASK, releaseEtyLists), position > 2 ? 1 : position);
|
|
|
}
|
|
}
|
|
|
tryMakeMoneyAdp.notifyDataSetChanged();
|
|
tryMakeMoneyAdp.notifyDataSetChanged();
|
|
|
checkAndInitView();
|
|
checkAndInitView();
|
|
@@ -216,6 +211,9 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
TestUtil.testChange(activity, (TextView) getViewById(R.id.test_change));
|
|
TestUtil.testChange(activity, (TextView) getViewById(R.id.test_change));
|
|
|
TestUtil.testChangeUser(activity, (TextView) getViewById(R.id.test_change_user));
|
|
TestUtil.testChangeUser(activity, (TextView) getViewById(R.id.test_change_user));
|
|
|
GlideImageLoader.setImage(bg_newbie_task, "http://cdngame.kuaifazs.com/bg_newbie_task.png");
|
|
GlideImageLoader.setImage(bg_newbie_task, "http://cdngame.kuaifazs.com/bg_newbie_task.png");
|
|
|
|
|
+ if (pagePresenter != null) {
|
|
|
|
|
+ initData();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -229,29 +227,25 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
.build()
|
|
.build()
|
|
|
.inject(this);
|
|
.inject(this);
|
|
|
recyclerInitView();
|
|
recyclerInitView();
|
|
|
-
|
|
|
|
|
|
|
+ LinearLayout.LayoutParams bannerLayoutParams = (LinearLayout.LayoutParams) banner.getLayoutParams();
|
|
|
|
|
+ bannerLayoutParams.height = G.WIDTH * 25 / 72;
|
|
|
|
|
+ banner.setLayoutParams(bannerLayoutParams);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- private void refalsh() {
|
|
|
|
|
|
|
+ private void loadUserInfo() {
|
|
|
|
|
|
|
|
if (myPrice == null || userEntity == null) {
|
|
if (myPrice == null || userEntity == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- myPrice.setText(userEntity.getBalance() + " 元");
|
|
|
|
|
- myAllPrice.setText("累计资产 " + userEntity.getTotal_asset() + " 元");
|
|
|
|
|
- nameTv.setText(userEntity.getNickname() + "");//绵羊号:123456789
|
|
|
|
|
- sheepNumTv.setText("绵羊号:" + userEntity.getInvitation_code());
|
|
|
|
|
|
|
+ ViewUtil.setText(nameTv, userEntity.getNickname());
|
|
|
|
|
+ ViewUtil.setText(sheepNumTv, String.format(Locale.CHINA, "绵羊号:%s", userEntity.getInvitation_code()));
|
|
|
if (ReactUtil.isSmallDebug()) {
|
|
if (ReactUtil.isSmallDebug()) {
|
|
|
- sheepNumTv.append("\n\n邀请人:");
|
|
|
|
|
|
|
+ sheepNumTv.append("\n邀请人:");
|
|
|
sheepNumTv.append(userEntity.getParent_code());
|
|
sheepNumTv.append(userEntity.getParent_code());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- Glide.with(activity)
|
|
|
|
|
- .load(userEntity.getAvatar())
|
|
|
|
|
- .apply(new RequestOptions().circleCrop().placeholder(R.drawable.icon))
|
|
|
|
|
- .into(iconImgIv);
|
|
|
|
|
|
|
+ ViewUtil.setText(myPrice, String.format(Locale.CHINA, "%s\u0020元", userEntity.getBalance()));
|
|
|
|
|
+ GlideImageLoader.setAvatar(iconImgIv, userEntity.getAvatar(), Color.argb(128, 255, 255, 255));
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -299,7 +293,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
|
refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onRefresh() {
|
|
public void onRefresh() {
|
|
|
- initData();
|
|
|
|
|
|
|
+ refreshData();
|
|
|
refresh.setRefreshing(false);
|
|
refresh.setRefreshing(false);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -310,18 +304,141 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
SysAppUtil.checkNet(new Action1<Integer>() {
|
|
SysAppUtil.checkNet(new Action1<Integer>() {
|
|
|
@Override
|
|
@Override
|
|
|
public void call(Integer result) {
|
|
public void call(Integer result) {
|
|
|
- if(result != 0){//无网络
|
|
|
|
|
- if(check_net_ll != null)
|
|
|
|
|
|
|
+ if (result != 0) {//无网络
|
|
|
|
|
+ if (check_net_ll != null)
|
|
|
check_net_ll.setVisibility(View.VISIBLE);
|
|
check_net_ll.setVisibility(View.VISIBLE);
|
|
|
} else {
|
|
} else {
|
|
|
- if(check_net_ll != null)
|
|
|
|
|
|
|
+ if (check_net_ll != null)
|
|
|
|
|
+ check_net_ll.setVisibility(View.GONE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ initACacheData();
|
|
|
|
|
+ }
|
|
|
|
|
+ private void initACacheData(){
|
|
|
|
|
+ if (upview1 != null) {
|
|
|
|
|
+ //停止滚动
|
|
|
|
|
+ upview1.stopFlipping();
|
|
|
|
|
+ upview1.startFlipping();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (homepageItemNoticeMv != null) {
|
|
|
|
|
+ //停止滚动
|
|
|
|
|
+ homepageItemNoticeMv.stopFlipping();
|
|
|
|
|
+ homepageItemNoticeMv.startFlipping();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //用户信息
|
|
|
|
|
+ userEntity = CommonUtil.getInstance().getCacheResult(ApiKey.get_info, UserEntity.class);
|
|
|
|
|
+ if(userEntity == null){//onResume中从网络获取
|
|
|
|
|
+ } else {
|
|
|
|
|
+ loadUserInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //实时动态
|
|
|
|
|
+ List<MoreDataEntity> cacheMoreDataEtyList = CommonUtil.getInstance().getCacheList(ApiKey.award_detail, MoreDataEntity.class);
|
|
|
|
|
+ if(ListUtil.isEmpty(cacheMoreDataEtyList)){
|
|
|
|
|
+ pagePresenter.getAwardDetail();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ invite(cacheMoreDataEtyList);
|
|
|
|
|
+ }
|
|
|
|
|
+ //正在运行的任务
|
|
|
|
|
+ position = 0;
|
|
|
|
|
+ releaseEtyLists.clear();
|
|
|
|
|
+ tryMakeMoneyAdp.clear();
|
|
|
|
|
+ tryMakeMoneyAdp.addType(1);
|
|
|
|
|
+ for (int i = 0; i < 2; i++) {
|
|
|
|
|
+ tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<TaskAcceptedEty> cacheTaskAcceptedEtyList = CommonUtil.getInstance().getCacheList(ApiKey.new_run_task(3), TaskAcceptedEty.class);
|
|
|
|
|
+ if (ListUtil.isEmpty(cacheTaskAcceptedEtyList)) {//onResume中从网络获取
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RUN_TASK, cacheTaskAcceptedEtyList), position);
|
|
|
|
|
+ tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
|
|
|
|
|
+ position++;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<TaskReleaseEty> cacheTaskReleaseEtyList = CommonUtil.getInstance().getCacheList(ApiKey.release_task, TaskReleaseEty.class);
|
|
|
|
|
+ if (ListUtil.isEmpty(cacheTaskReleaseEtyList)) {//onResume中从网络获取
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ releaseEtyLists.addAll(cacheTaskReleaseEtyList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ tryMakeMoneyAdp.setIs_succession(3);
|
|
|
|
|
+ tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RELEASE_TASK, releaseEtyLists), position);
|
|
|
|
|
+ tryMakeMoneyAdp.notifyDataSetChanged();
|
|
|
|
|
+
|
|
|
|
|
+ //公告
|
|
|
|
|
+ List<BulletinEnty> cacheBulletinEtyList = CommonUtil.getInstance().getCacheList(ApiKey.bulletin, BulletinEnty.class);
|
|
|
|
|
+ if(ListUtil.isEmpty(cacheBulletinEtyList)){
|
|
|
|
|
+ homepageItemNoticeLayout.setVisibility(View.GONE);
|
|
|
|
|
+ pagePresenter.bulletin(null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bulletinEntyLists.clear();
|
|
|
|
|
+ bulletinEntyLists.addAll(cacheBulletinEtyList);
|
|
|
|
|
+ inviteNotice(bulletinEntyLists);
|
|
|
|
|
+ }
|
|
|
|
|
+ //轮播
|
|
|
|
|
+ List<SlideshowEty> cacheSlideshowEtyList = CommonUtil.getInstance().getCacheList(ApiKey.slideshow, SlideshowEty.class);
|
|
|
|
|
+ if(ListUtil.isEmpty(cacheSlideshowEtyList)){
|
|
|
|
|
+ banner.setVisibility(View.GONE);
|
|
|
|
|
+ pagePresenter.slideshow(null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (SlideshowEty slideshowEty : cacheSlideshowEtyList) {
|
|
|
|
|
+ slideshowEty.setObjects(CommonUtil.getInstance().getValue(slideshowEty.getExt()));
|
|
|
|
|
+ slideshowEtyLists.add(slideshowEty);
|
|
|
|
|
+ slideshowTitleList.add(slideshowEty.getTitle());
|
|
|
|
|
+ }
|
|
|
|
|
+ bindBanner();
|
|
|
|
|
+ }
|
|
|
|
|
+ //首页list
|
|
|
|
|
+ List<HomeListEntity> cacheHomeListEtyList = CommonUtil.getInstance().getCacheList(ApiKey.home_list, HomeListEntity.class);
|
|
|
|
|
+ if(ListUtil.isEmpty(cacheHomeListEtyList)){
|
|
|
|
|
+ home_list_gridview_layout.setVisibility(View.GONE);
|
|
|
|
|
+ pagePresenter.homeList();//首页list
|
|
|
|
|
+ } else {
|
|
|
|
|
+ home_list_gridview_layout.setVisibility(View.VISIBLE);
|
|
|
|
|
+ homeListEntitys.addAll(cacheHomeListEtyList);
|
|
|
|
|
+ boolean isShowQB = false;
|
|
|
|
|
+ for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
|
|
+ if (i < 4) {
|
|
|
|
|
+ homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ homeListEntitysListview.add(homeListEntitys.get(i));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
|
|
|
|
|
+ isShowQB = !isShowQB;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (homeListEntitys.get(i).getJump().equals("14")) {//幂动科技
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ SheepApp.getInstance().setShowQB(isShowQB);
|
|
|
|
|
+ adpHomeListGrideview.notifyDataSetChanged();
|
|
|
|
|
+ adpHomeListListview.notifyDataSetChanged();
|
|
|
|
|
+ home_list_gridview_listview.setVisibility(homeListEntitysListview.isEmpty() ? View.GONE : View.VISIBLE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //详情分享地址
|
|
|
|
|
+ CommonUtil.getInstance().initUrlConfigByNet(activity);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void refreshData() {
|
|
|
|
|
+ SysAppUtil.checkNet(new Action1<Integer>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void call(Integer result) {
|
|
|
|
|
+ if (result != 0) {//无网络
|
|
|
|
|
+ if (check_net_ll != null)
|
|
|
|
|
+ check_net_ll.setVisibility(View.VISIBLE);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (check_net_ll != null)
|
|
|
check_net_ll.setVisibility(View.GONE);
|
|
check_net_ll.setVisibility(View.GONE);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
mInitData();
|
|
mInitData();
|
|
|
}
|
|
}
|
|
|
- private void mInitData(){
|
|
|
|
|
|
|
+ private void mInitData() {
|
|
|
if (upview1 != null) {
|
|
if (upview1 != null) {
|
|
|
//停止滚动
|
|
//停止滚动
|
|
|
upview1.stopFlipping();
|
|
upview1.stopFlipping();
|
|
@@ -338,10 +455,9 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
pagePresenter.getAwardDetail();
|
|
pagePresenter.getAwardDetail();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- initWechatIsOpen();
|
|
|
|
|
recyclerInitData();//任务
|
|
recyclerInitData();//任务
|
|
|
- pagePresenter.bulletin(null);//轮播
|
|
|
|
|
- pagePresenter.slideshow(null);//公告
|
|
|
|
|
|
|
+ pagePresenter.bulletin(null);//公告
|
|
|
|
|
+ pagePresenter.slideshow(null);//轮播
|
|
|
pagePresenter.homeList();//首页list
|
|
pagePresenter.homeList();//首页list
|
|
|
|
|
|
|
|
//详情分享地址
|
|
//详情分享地址
|
|
@@ -357,7 +473,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
//recyclerView 解决滑动不流畅问题
|
|
//recyclerView 解决滑动不流畅问题
|
|
|
recyclerview.setHasFixedSize(true);
|
|
recyclerview.setHasFixedSize(true);
|
|
|
recyclerview.setNestedScrollingEnabled(false);
|
|
recyclerview.setNestedScrollingEnabled(false);
|
|
|
- tryMakeMoneyAdp = new TryMakeMoneyAdp(activity);
|
|
|
|
|
|
|
+ tryMakeMoneyAdp = new TryMakeMoneyAdp(activity, 1);//1代表来自主页
|
|
|
for (int i = 0; i < 2; i++) {
|
|
for (int i = 0; i < 2; i++) {
|
|
|
tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
|
|
tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
|
|
|
}
|
|
}
|
|
@@ -389,20 +505,15 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
1,
|
|
1,
|
|
|
0,
|
|
0,
|
|
|
0,
|
|
0,
|
|
|
- -1+"",
|
|
|
|
|
|
|
+ -1 + "",
|
|
|
3));
|
|
3));
|
|
|
|
|
|
|
|
tryMakeMoneyPresenter.releaseTask(parameEty);
|
|
tryMakeMoneyPresenter.releaseTask(parameEty);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取微信挂机是否开启状态
|
|
|
|
|
- */
|
|
|
|
|
- private void initWechatIsOpen() {
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
@OnClick({R.id.recharge, R.id.withdrawal,
|
|
@OnClick({R.id.recharge, R.id.withdrawal,
|
|
|
- R.id.newbie_task, R.id.icon_layout, R.id.info_layout
|
|
|
|
|
|
|
+ R.id.newbie_task, R.id.icon_img_iv, R.id.user_layout
|
|
|
})
|
|
})
|
|
|
public void onViewClicked(View view) {
|
|
public void onViewClicked(View view) {
|
|
|
switch (view.getId()) {
|
|
switch (view.getId()) {
|
|
@@ -413,17 +524,17 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
DialogNewbieTaskList.tryShowDialog(activity);
|
|
DialogNewbieTaskList.tryShowDialog(activity);
|
|
|
NEWBIE_TASK.onEvent();
|
|
NEWBIE_TASK.onEvent();
|
|
|
break;
|
|
break;
|
|
|
- case R.id.icon_layout://头像
|
|
|
|
|
- if(TestUtil.isTest()) {
|
|
|
|
|
|
|
+ case R.id.icon_img_iv://头像
|
|
|
|
|
+ if (TestUtil.isTest()) {
|
|
|
TestUtil.test(activity);
|
|
TestUtil.test(activity);
|
|
|
- }else
|
|
|
|
|
|
|
+ } else
|
|
|
Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
|
break;
|
|
break;
|
|
|
- case R.id.info_layout://其它信息
|
|
|
|
|
|
|
+ case R.id.user_layout://个人信息
|
|
|
Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
|
break;
|
|
break;
|
|
|
case R.id.recharge://充值
|
|
case R.id.recharge://充值
|
|
|
- Jump2View.getInstance().goRechargeAct(activity,"首页");
|
|
|
|
|
|
|
+ Jump2View.getInstance().goRechargeAct(activity, "首页");
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -435,12 +546,20 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
}
|
|
}
|
|
|
BaseMessage baseMessage = (BaseMessage) o;
|
|
BaseMessage baseMessage = (BaseMessage) o;
|
|
|
userEntity = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
|
|
userEntity = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
|
|
|
|
|
+ if(userEntity == null){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ new Handler().postDelayed(new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ //幂动科技
|
|
|
|
|
+ CommonUtil.getInstance().initMiDong(activity, userEntity.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 500);
|
|
|
//保存用户id信息
|
|
//保存用户id信息
|
|
|
PreferenceUtils.setPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_OPENID, userEntity.getOpen_id());
|
|
PreferenceUtils.setPrefString(SheepApp.mContext, UMConfigUtils.LOGIN_OPENID, userEntity.getOpen_id());
|
|
|
//保存用户邀请人邀请码
|
|
//保存用户邀请人邀请码
|
|
|
PreferenceUtils.setPrefString(SheepApp.mContext, "invitation_code", userEntity.getParent_code());
|
|
PreferenceUtils.setPrefString(SheepApp.mContext, "invitation_code", userEntity.getParent_code());
|
|
|
- //统计用户登录信息
|
|
|
|
|
- UMConfigUtils.onProfileSignIn();
|
|
|
|
|
try {
|
|
try {
|
|
|
MyDbManager.getInstance().saveOrUpdateUser(userEntity);
|
|
MyDbManager.getInstance().saveOrUpdateUser(userEntity);
|
|
|
|
|
|
|
@@ -490,7 +609,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
BaseMessage baseMessage = (BaseMessage) o;
|
|
BaseMessage baseMessage = (BaseMessage) o;
|
|
|
List<TaskAcceptedEty> taskAcceptedEty = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), TaskAcceptedEty.class);
|
|
List<TaskAcceptedEty> taskAcceptedEty = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), TaskAcceptedEty.class);
|
|
|
AutoTaskListUtil.getInstance().loadList(taskAcceptedEty);
|
|
AutoTaskListUtil.getInstance().loadList(taskAcceptedEty);
|
|
|
- if(taskAcceptedEty != null && taskAcceptedEty.size()>0){
|
|
|
|
|
|
|
+ if (taskAcceptedEty != null && taskAcceptedEty.size() > 0) {
|
|
|
tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RUN_TASK, taskAcceptedEty), position);
|
|
tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RUN_TASK, taskAcceptedEty), position);
|
|
|
tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
|
|
tryMakeMoneyAdp.addPresenter(tryMakeMoneyPresenter);
|
|
|
position++;
|
|
position++;
|
|
@@ -578,16 +697,17 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
List<SlideshowEty> slideshowEtyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), SlideshowEty.class);
|
|
List<SlideshowEty> slideshowEtyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), SlideshowEty.class);
|
|
|
- if (slideshowEtyList != null && slideshowEtyList.size()>0) {
|
|
|
|
|
|
|
+ if (slideshowEtyList != null && slideshowEtyList.size() > 0) {
|
|
|
slideshowEtyLists.clear();
|
|
slideshowEtyLists.clear();
|
|
|
- for(SlideshowEty slideshowEty:slideshowEtyList){
|
|
|
|
|
|
|
+ for (SlideshowEty slideshowEty : slideshowEtyList) {
|
|
|
slideshowEty.setObjects(CommonUtil.getInstance().getValue(slideshowEty.getExt()));
|
|
slideshowEty.setObjects(CommonUtil.getInstance().getValue(slideshowEty.getExt()));
|
|
|
slideshowEtyLists.add(slideshowEty);
|
|
slideshowEtyLists.add(slideshowEty);
|
|
|
|
|
+ slideshowTitleList.add(slideshowEty.getTitle());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bindBanner();
|
|
bindBanner();
|
|
|
- }else {
|
|
|
|
|
- homepage_item_banner_layout.setVisibility(View.GONE);
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ banner.setVisibility(View.GONE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -605,11 +725,11 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
List<BulletinEnty> bulletinEntyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), BulletinEnty.class);
|
|
List<BulletinEnty> bulletinEntyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), BulletinEnty.class);
|
|
|
- if (bulletinEntyList != null && bulletinEntyList.size() >0) {
|
|
|
|
|
|
|
+ if (bulletinEntyList != null && bulletinEntyList.size() > 0) {
|
|
|
bulletinEntyLists.clear();
|
|
bulletinEntyLists.clear();
|
|
|
bulletinEntyLists.addAll(bulletinEntyList);
|
|
bulletinEntyLists.addAll(bulletinEntyList);
|
|
|
inviteNotice(bulletinEntyLists);
|
|
inviteNotice(bulletinEntyLists);
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
homepageItemNoticeLayout.setVisibility(View.GONE);
|
|
homepageItemNoticeLayout.setVisibility(View.GONE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -621,25 +741,25 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
@Override
|
|
@Override
|
|
|
public void successhomeList(BaseMessage baseMessage) {
|
|
public void successhomeList(BaseMessage baseMessage) {
|
|
|
checkAndInitView();
|
|
checkAndInitView();
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
List<HomeListEntity> homeListEntity = JSONArray.parseArray(
|
|
List<HomeListEntity> homeListEntity = JSONArray.parseArray(
|
|
|
JSONArray.toJSONString(baseMessage.getData()),
|
|
JSONArray.toJSONString(baseMessage.getData()),
|
|
|
HomeListEntity.class
|
|
HomeListEntity.class
|
|
|
);
|
|
);
|
|
|
- if(homeListEntity != null && homeListEntity.size()> 0){
|
|
|
|
|
|
|
+ if (homeListEntity != null && homeListEntity.size() > 0) {
|
|
|
home_list_gridview_layout.setVisibility(View.VISIBLE);
|
|
home_list_gridview_layout.setVisibility(View.VISIBLE);
|
|
|
homeListEntitys.clear();
|
|
homeListEntitys.clear();
|
|
|
homeListEntitysGridview.clear();
|
|
homeListEntitysGridview.clear();
|
|
|
homeListEntitysListview.clear();
|
|
homeListEntitysListview.clear();
|
|
|
homeListEntitys.addAll(homeListEntity);
|
|
homeListEntitys.addAll(homeListEntity);
|
|
|
boolean isShowQB = false;
|
|
boolean isShowQB = false;
|
|
|
- for (int i=0;i<homeListEntitys.size();i++){
|
|
|
|
|
- if(i<4){
|
|
|
|
|
|
|
+ for (int i = 0; i < homeListEntitys.size(); i++) {
|
|
|
|
|
+ if (i < 4) {
|
|
|
homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
homeListEntitysGridview.add(homeListEntitys.get(i));
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
homeListEntitysListview.add(homeListEntitys.get(i));
|
|
homeListEntitysListview.add(homeListEntitys.get(i));
|
|
|
}
|
|
}
|
|
|
- if(homeListEntitys.get(i).getJump().equals("6")){//6Q币充值
|
|
|
|
|
|
|
+ if (homeListEntitys.get(i).getJump().equals("6")) {//6Q币充值
|
|
|
isShowQB = !isShowQB;
|
|
isShowQB = !isShowQB;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -647,23 +767,23 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
adpHomeListGrideview.notifyDataSetChanged();
|
|
adpHomeListGrideview.notifyDataSetChanged();
|
|
|
adpHomeListListview.notifyDataSetChanged();
|
|
adpHomeListListview.notifyDataSetChanged();
|
|
|
home_list_gridview_listview.setVisibility(homeListEntitysListview.isEmpty() ? View.GONE : View.VISIBLE);
|
|
home_list_gridview_listview.setVisibility(homeListEntitysListview.isEmpty() ? View.GONE : View.VISIBLE);
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
home_list_gridview_layout.setVisibility(View.GONE);
|
|
home_list_gridview_layout.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void checkAndInitView() {
|
|
private void checkAndInitView() {
|
|
|
- if(recyclerview == null)
|
|
|
|
|
|
|
+ if (recyclerview == null)
|
|
|
recyclerview = mContentView.findViewById(R.id.recyclerview);
|
|
recyclerview = mContentView.findViewById(R.id.recyclerview);
|
|
|
- if(scrollView == null)
|
|
|
|
|
|
|
+ if (scrollView == null)
|
|
|
scrollView = mContentView.findViewById(R.id.scrollView);
|
|
scrollView = mContentView.findViewById(R.id.scrollView);
|
|
|
- if(home_list_gridview_layout == null)
|
|
|
|
|
|
|
+ if (home_list_gridview_layout == null)
|
|
|
home_list_gridview_layout = mContentView.findViewById(R.id.home_list_gridview_layout);
|
|
home_list_gridview_layout = mContentView.findViewById(R.id.home_list_gridview_layout);
|
|
|
- if(home_list_gridview_listview == null)
|
|
|
|
|
|
|
+ if (home_list_gridview_listview == null)
|
|
|
home_list_gridview_listview = mContentView.findViewById(R.id.home_list_gridview_listview);
|
|
home_list_gridview_listview = mContentView.findViewById(R.id.home_list_gridview_listview);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -677,10 +797,10 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
@Override
|
|
@Override
|
|
|
public void onResume() {
|
|
public void onResume() {
|
|
|
super.onResume();
|
|
super.onResume();
|
|
|
- if (pagePresenter != null) {
|
|
|
|
|
- initData();
|
|
|
|
|
|
|
+ if(pagePresenter != null) {
|
|
|
|
|
+ pagePresenter.getUserInfo();
|
|
|
|
|
+ recyclerInitData();//任务
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -745,7 +865,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
public void onEventMainThread(BigEvent event) {
|
|
public void onEventMainThread(BigEvent event) {
|
|
|
switch (event.getEventTypes()) {
|
|
switch (event.getEventTypes()) {
|
|
|
case ONFRESH_FGT_FAMLLSHEEP:
|
|
case ONFRESH_FGT_FAMLLSHEEP:
|
|
|
- initData();
|
|
|
|
|
|
|
+ refreshData();
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -756,7 +876,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
UserEntity enity = userEntity;
|
|
UserEntity enity = userEntity;
|
|
|
enity.setNickname(done.getNikeName());
|
|
enity.setNickname(done.getNikeName());
|
|
|
userEntity = enity;
|
|
userEntity = enity;
|
|
|
- refalsh();
|
|
|
|
|
|
|
+ loadUserInfo();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
@@ -765,7 +885,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
enity.setBalance(done.getBalance());
|
|
enity.setBalance(done.getBalance());
|
|
|
enity.setTotal_asset(done.getTotal_asset());
|
|
enity.setTotal_asset(done.getTotal_asset());
|
|
|
userEntity = enity;
|
|
userEntity = enity;
|
|
|
- refalsh();
|
|
|
|
|
|
|
+ loadUserInfo();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -774,7 +894,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
UserEntity enity = userEntity;
|
|
UserEntity enity = userEntity;
|
|
|
enity.setAvatar(done.getAvatar());
|
|
enity.setAvatar(done.getAvatar());
|
|
|
userEntity = enity;
|
|
userEntity = enity;
|
|
|
- refalsh();
|
|
|
|
|
|
|
+ loadUserInfo();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -789,7 +909,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
|
// TODO: inflate a fragment view
|
|
// TODO: inflate a fragment view
|
|
|
View rootView = super.onCreateView(inflater, container, savedInstanceState);
|
|
View rootView = super.onCreateView(inflater, container, savedInstanceState);
|
|
|
- if(rootView != null)
|
|
|
|
|
|
|
+ if (rootView != null)
|
|
|
unbinder = ButterKnife.bind(this, rootView);
|
|
unbinder = ButterKnife.bind(this, rootView);
|
|
|
return rootView;
|
|
return rootView;
|
|
|
}
|
|
}
|
|
@@ -806,7 +926,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
try {
|
|
try {
|
|
|
userEntity = MyDbManager.getInstance().dbFindUser();
|
|
userEntity = MyDbManager.getInstance().dbFindUser();
|
|
|
if (userEntity != null) {
|
|
if (userEntity != null) {
|
|
|
- refalsh();
|
|
|
|
|
|
|
+ loadUserInfo();
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -816,110 +936,141 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
@Override
|
|
@Override
|
|
|
public void onStart() {
|
|
public void onStart() {
|
|
|
super.onStart();
|
|
super.onStart();
|
|
|
|
|
+ //开始轮播
|
|
|
|
|
+ banner.startAutoPlay();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Conversion2<SlideshowEty, String, String> conversion2 = new Conversion2<SlideshowEty, String, String>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public String convert1(SlideshowEty slideshowEty, int position) {
|
|
|
|
|
- return slideshowEty.getTitle();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onStop() {
|
|
|
|
|
+ super.onStop();
|
|
|
|
|
+ //结束轮播
|
|
|
|
|
+ banner.stopAutoPlay();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public String convert2(SlideshowEty slideshowEty, int position) {
|
|
|
|
|
- return slideshowEty.getUrl();
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- private ImageGlarryDrawable<SlideshowEty> mImageGlarryStr;
|
|
|
|
|
private void bindBanner() {
|
|
private void bindBanner() {
|
|
|
- homepage_item_banner_layout.setVisibility(View.VISIBLE);
|
|
|
|
|
- if (mImageGlarryStr != null) {
|
|
|
|
|
- mImageGlarryStr.init(slideshowEtyLists, ImageView.ScaleType.CENTER_CROP, conversion2);
|
|
|
|
|
|
|
+ banner.setVisibility(View.VISIBLE);
|
|
|
|
|
+ //设置图片加载器
|
|
|
|
|
+ banner.setImageLoader(new ImageLoader() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void displayImage(Context context, Object o, ImageView imageView) {
|
|
|
|
|
+ if (o instanceof SlideshowEty)
|
|
|
|
|
+ Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().dontAnimate()).into(imageView);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .setDelayTime(4000)
|
|
|
|
|
+ .setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
|
|
|
|
|
+ //设置图片集合
|
|
|
|
|
+ .setImages(slideshowEtyLists).setBannerTitles(slideshowTitleList)
|
|
|
|
|
+ .setOnBannerListener(new OnBannerListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void OnBannerClick(int i) {
|
|
|
|
|
+ clickBanner(i);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ //banner设置方法全部调用完毕时最后调用
|
|
|
|
|
+ banner.start();
|
|
|
|
|
+// //设置banner样式
|
|
|
|
|
+// banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
|
|
|
|
|
+// //设置图片加载器
|
|
|
|
|
+// banner.setImageLoader(new GlideImageLoader());
|
|
|
|
|
+// //设置图片集合
|
|
|
|
|
+// banner.setImages(images);
|
|
|
|
|
+// //设置banner动画效果
|
|
|
|
|
+// banner.setBannerAnimation(Transformer.DepthPage);
|
|
|
|
|
+// //设置标题集合(当banner样式有显示title时)
|
|
|
|
|
+// banner.setBannerTitles(titles);
|
|
|
|
|
+// //设置自动轮播,默认为true
|
|
|
|
|
+// banner.isAutoPlay(true);
|
|
|
|
|
+// //设置轮播时间
|
|
|
|
|
+// banner.setDelayTime(1500);
|
|
|
|
|
+// //设置指示器位置(当banner模式中有指示器时)
|
|
|
|
|
+// banner.setIndicatorGravity(BannerConfig.CENTER);
|
|
|
|
|
+// //banner设置方法全部调用完毕时最后调用
|
|
|
|
|
+// banner.start();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void clickBanner(int position) {
|
|
|
|
|
+ SlideshowEty clickedGameObj = ListUtil.getIndex(slideshowEtyLists, position);
|
|
|
|
|
+ if (clickedGameObj == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- mImageGlarryStr = new ImageGlarryDrawable<>((Activity) mContext, viewpager_banner, group_banner);
|
|
|
|
|
- mImageGlarryStr.init(slideshowEtyLists, ImageView.ScaleType.CENTER_CROP, conversion2);
|
|
|
|
|
- mImageGlarryStr.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
- SlideshowEty clickedGameObj = ListUtil.getIndex(slideshowEtyLists, position);
|
|
|
|
|
- if(clickedGameObj == null){
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ UMConfigUtils.onEvent(UMConfigUtils.Event.BANNER_CLICK_HORIZONTAL);
|
|
|
|
|
+ UMConfigUtils.IdEvent.BANNER.commit(clickedGameObj.getId());
|
|
|
|
|
+ switch (clickedGameObj.getType()) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goTryplayView(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ try {
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goTaskDetailView(activity, EntityUtils.getExtInfo(clickedGameObj.getExt()).getId());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
- UMConfigUtils.onEvent(UMConfigUtils.Event.BANNER_CLICK_HORIZONTAL);
|
|
|
|
|
- UMConfigUtils.IdEvent.BANNER.commit(clickedGameObj.getId());
|
|
|
|
|
- switch (clickedGameObj.getType()) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
|
|
|
|
|
- case 1:
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goTryplayView(activity, null);
|
|
|
|
|
- break;
|
|
|
|
|
- case 2:
|
|
|
|
|
- try {
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goTaskDetailView(activity, EntityUtils.getExtInfo(clickedGameObj.getExt()).getId());
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- case 3:
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goCreditCardTaskList(activity, 3);
|
|
|
|
|
- break;
|
|
|
|
|
- case 4:
|
|
|
|
|
- if(!TextUtils.isEmpty(clickedGameObj.getObjects())){
|
|
|
|
|
- Ext ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
|
|
|
|
|
- if(ext.getTitle() == null)//外部浏览器加载H5
|
|
|
|
|
- Jump2View.getInstance().goWeb(activity, ext.getUrl());
|
|
|
|
|
- else//内部WebView加载H5
|
|
|
|
|
- Jump2View.getInstance().goWeb(activity, ext.getUrl(), ext.getTitle());
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goCreditCardTaskList(activity, 3);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ if (!TextUtils.isEmpty(clickedGameObj.getObjects())) {
|
|
|
|
|
+ Ext ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
|
|
|
|
|
+ if (ext.getTitle() == null)//外部浏览器加载H5
|
|
|
|
|
+ Jump2View.getInstance().goWeb(activity, ext.getUrl());
|
|
|
|
|
+ else//内部WebView加载H5
|
|
|
|
|
+ Jump2View.getInstance().goWeb(activity, ext.getUrl(), ext.getTitle());
|
|
|
|
|
|
|
|
- break;
|
|
|
|
|
- case 5:
|
|
|
|
|
- if(!TextUtils.isEmpty(clickedGameObj.getObjects())){
|
|
|
|
|
-
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goWeb(
|
|
|
|
|
- activity,
|
|
|
|
|
- clickedGameObj.getObjects(),
|
|
|
|
|
- "微信二维码辅助好友注册任务");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- break;
|
|
|
|
|
- case 6://连续任务
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goTryplayView(activity, 1);
|
|
|
|
|
- break;
|
|
|
|
|
- case 9://打卡赚钱
|
|
|
|
|
- showToast("打卡赚钱");
|
|
|
|
|
- Jump2View.getInstance().goSignCardAct(activity, null);
|
|
|
|
|
- break;
|
|
|
|
|
- case 7://玩转游戏
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goMainGame(activity);
|
|
|
|
|
- break;
|
|
|
|
|
- case 11://游戏任务
|
|
|
|
|
- Jump2View.getInstance()
|
|
|
|
|
- .goGameMakeMoney(activity, 0);
|
|
|
|
|
- break;
|
|
|
|
|
- case 12://闲玩任务
|
|
|
|
|
- Jump2View.getInstance().goXianwanWeb(activity,null, null);
|
|
|
|
|
- break;
|
|
|
|
|
- case 13://游戏代充
|
|
|
|
|
- Jump2View.getInstance().goGameRecharge(activity,null);
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- G.showToast(R.string.coming_soon);
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ if (!TextUtils.isEmpty(clickedGameObj.getObjects())) {
|
|
|
|
|
+
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goWeb(
|
|
|
|
|
+ activity,
|
|
|
|
|
+ clickedGameObj.getObjects(),
|
|
|
|
|
+ "微信二维码辅助好友注册任务");
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 6://连续任务
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goTryplayView(activity, 1);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 9://打卡赚钱
|
|
|
|
|
+ showToast("打卡赚钱");
|
|
|
|
|
+ Jump2View.getInstance().goSignCardAct(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 7://玩转游戏
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goMainGame(activity);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 11://游戏任务
|
|
|
|
|
+ Jump2View.getInstance()
|
|
|
|
|
+ .goGameMakeMoney(activity, 0);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 12://闲玩任务
|
|
|
|
|
+ Jump2View.getInstance().goXianwanWeb(activity, null, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 13://游戏代充
|
|
|
|
|
+ Jump2View.getInstance().goGameRecharge(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 14://幂动科技
|
|
|
|
|
+ Jump2View.getInstance().goMiDong(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ G.showToast(R.string.coming_soon);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 公共
|
|
* 公共
|
|
|
*/
|
|
*/
|
|
|
- private void inviteNotice(final List<BulletinEnty> bulletinEntyList) {
|
|
|
|
|
|
|
+ private void inviteNotice(final List<BulletinEnty> bulletinEntyList) {
|
|
|
homepageItemNoticeLayout.setVisibility(View.VISIBLE);
|
|
homepageItemNoticeLayout.setVisibility(View.VISIBLE);
|
|
|
// List<String> infoList = new ArrayList<>();
|
|
// List<String> infoList = new ArrayList<>();
|
|
|
// for(BulletinEnty bulletinEnty: bulletinEntyList){
|
|
// for(BulletinEnty bulletinEnty: bulletinEntyList){
|
|
@@ -927,11 +1078,17 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
// }
|
|
// }
|
|
|
// homepageItemNoticeMv.startWithList(infoList, R.anim.anim_left_in,R.anim.anim_right_out);
|
|
// homepageItemNoticeMv.startWithList(infoList, R.anim.anim_left_in,R.anim.anim_right_out);
|
|
|
homepageItemNoticeMv.removeAllViews();
|
|
homepageItemNoticeMv.removeAllViews();
|
|
|
- for (BulletinEnty entity : bulletinEntyList) {
|
|
|
|
|
|
|
+ for (final BulletinEnty entity : bulletinEntyList) {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.append(entity.getContent()).append(" ");
|
|
sb.append(entity.getContent()).append(" ");
|
|
|
TextView moreView = (TextView) LayoutInflater.from(activity).inflate(R.layout.x_item_view, null);
|
|
TextView moreView = (TextView) LayoutInflater.from(activity).inflate(R.layout.x_item_view, null);
|
|
|
moreView.setText(sb.toString());
|
|
moreView.setText(sb.toString());
|
|
|
|
|
+
|
|
|
|
|
+ moreView.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
|
+ onClickNotice(entity);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
homepageItemNoticeMv.addView(moreView);
|
|
homepageItemNoticeMv.addView(moreView);
|
|
|
}
|
|
}
|
|
|
if (!homepageItemNoticeMv.isAutoStart()) {
|
|
if (!homepageItemNoticeMv.isAutoStart()) {
|
|
@@ -939,23 +1096,42 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
homepageItemNoticeMv.startFlipping();
|
|
homepageItemNoticeMv.startFlipping();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 点击一条公告
|
|
|
|
|
+ */
|
|
|
|
|
+ private void onClickNotice(BulletinEnty item) {
|
|
|
|
|
+ switch (item.getJumpType()){// 跳转类型:11,任务 98,内部h5 99,外部h5
|
|
|
|
|
+ case 11:
|
|
|
|
|
+ Jump2View.getInstance().goTaskDetailView(activity, NumberFormatUtils.parseInteger(item.getJumpValue()));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 98:
|
|
|
|
|
+ Jump2View.getInstance().goWeb(activity, item.getJumpValue(), null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 99:
|
|
|
|
|
+ Jump2View.getInstance().goWeb(activity, item.getJumpValue());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 14://幂动科技
|
|
|
|
|
+ Jump2View.getInstance().goMiDong(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 提示用户开启推送通知权限
|
|
* 提示用户开启推送通知权限
|
|
|
* 1)只提示一次,如果用户取消,以后都不在提示
|
|
* 1)只提示一次,如果用户取消,以后都不在提示
|
|
|
*/
|
|
*/
|
|
|
- private void showPDialog(){
|
|
|
|
|
- boolean isShowDialog = SharedPreferences.getInstance().getBoolean("isShowDialog",true);
|
|
|
|
|
- if(isShowDialog && !NotificationsUtils.isNotificationEnabled(mContext)){//没有开启通知权限
|
|
|
|
|
|
|
+ private void showPDialog() {
|
|
|
|
|
+ boolean isShowDialog = SharedPreferences.getInstance().getBoolean("isShowDialog", true);
|
|
|
|
|
+ if (isShowDialog && !NotificationsUtils.isNotificationEnabled(mContext)) {//没有开启通知权限
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
|
|
builder.setTitle("提示");
|
|
builder.setTitle("提示");
|
|
|
builder.setMessage("是否开启推送?");
|
|
builder.setMessage("是否开启推送?");
|
|
|
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
- SharedPreferences.getInstance().putBoolean("isShowDialog",false);
|
|
|
|
|
|
|
+ SharedPreferences.getInstance().putBoolean("isShowDialog", false);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|