|
@@ -19,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;
|
|
@@ -61,9 +58,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;
|
|
@@ -79,12 +74,15 @@ 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.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
import org.greenrobot.eventbus.EventBus;
|
|
@@ -116,8 +114,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.banner)
|
|
|
|
|
+ Banner banner;
|
|
|
|
|
|
|
|
@BindView(R.id.icon_img_iv)
|
|
@BindView(R.id.icon_img_iv)
|
|
|
ImageView iconImgIv;
|
|
ImageView iconImgIv;
|
|
@@ -137,10 +135,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)
|
|
@@ -175,6 +169,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<>();
|
|
@@ -231,7 +226,9 @@ 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);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -387,12 +384,13 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
//轮播
|
|
//轮播
|
|
|
List<SlideshowEty> cacheSlideshowEtyList = CommonUtil.getInstance().getCacheList(ApiKey.slideshow, SlideshowEty.class);
|
|
List<SlideshowEty> cacheSlideshowEtyList = CommonUtil.getInstance().getCacheList(ApiKey.slideshow, SlideshowEty.class);
|
|
|
if(ListUtil.isEmpty(cacheSlideshowEtyList)){
|
|
if(ListUtil.isEmpty(cacheSlideshowEtyList)){
|
|
|
- homepage_item_banner_layout.setVisibility(View.GONE);
|
|
|
|
|
|
|
+ banner.setVisibility(View.GONE);
|
|
|
pagePresenter.slideshow(null);
|
|
pagePresenter.slideshow(null);
|
|
|
} else {
|
|
} else {
|
|
|
for (SlideshowEty slideshowEty : cacheSlideshowEtyList) {
|
|
for (SlideshowEty slideshowEty : cacheSlideshowEtyList) {
|
|
|
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();
|
|
|
}
|
|
}
|
|
@@ -695,11 +693,12 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
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 {
|
|
} else {
|
|
|
- homepage_item_banner_layout.setVisibility(View.GONE);
|
|
|
|
|
|
|
+ banner.setVisibility(View.GONE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -928,105 +927,132 @@ 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 String convert2(SlideshowEty slideshowEty, int position) {
|
|
|
|
|
- return slideshowEty.getUrl();
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- private ImageGlarryDrawable<SlideshowEty> mImageGlarryStr;
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onStop() {
|
|
|
|
|
+ super.onStop();
|
|
|
|
|
+ //结束轮播
|
|
|
|
|
+ banner.stopAutoPlay();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
+ default:
|
|
|
|
|
+ G.showToast(R.string.coming_soon);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|