统一部分内部多类型跳转
This commit is contained in:
@ -6,22 +6,17 @@
|
||||
package com.gh.gamecenter.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.common.util.DataLogUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.SlideEntity;
|
||||
import com.gh.gamecenter.subject.refactor.SubjectActivity;
|
||||
import com.gh.gamecenter.entity.LinkEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -34,7 +29,7 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
|
||||
|
||||
private Context mContext;
|
||||
// private List<Integer> imageIdList;
|
||||
private List<SlideEntity> mSlideEntityList;
|
||||
private List<LinkEntity> mSlideEntityList;
|
||||
|
||||
private int mSize;
|
||||
private boolean mIsInfiniteLoop;
|
||||
@ -43,7 +38,7 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
|
||||
|
||||
// private ImageIndicator indicator;
|
||||
|
||||
public ImagePagerAdapter(Context context, List<SlideEntity> slideEntityList, boolean isInfiniteLoop, String source) {
|
||||
public ImagePagerAdapter(Context context, List<LinkEntity> slideEntityList, boolean isInfiniteLoop, String source) {
|
||||
mContext = context;
|
||||
mSlideEntityList = slideEntityList;
|
||||
mSize = getSize(slideEntityList);
|
||||
@ -51,7 +46,7 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
|
||||
mSource = source;
|
||||
}
|
||||
|
||||
public int getSize(List<SlideEntity> sourceList) {
|
||||
public int getSize(List<LinkEntity> sourceList) {
|
||||
return sourceList == null ? 0 : sourceList.size();
|
||||
}
|
||||
|
||||
@ -70,7 +65,7 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
|
||||
int index = getPosition(position);
|
||||
if (index >= mSlideEntityList.size()) return view;
|
||||
|
||||
final SlideEntity slideEntity = mSlideEntityList.get(index);
|
||||
final LinkEntity slideEntity = mSlideEntityList.get(index);
|
||||
|
||||
ImageUtils.display(mContext.getResources(), (SimpleDraweeView) view,
|
||||
slideEntity.getImage(), R.drawable.preload);
|
||||
@ -81,35 +76,17 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
|
||||
|
||||
// 首页轮播图数据统计
|
||||
DataLogUtils.uploadLunbotuLog(mContext, slideEntity.getType(),
|
||||
slideEntity.getName(), String.valueOf(getPosition(position) % mSlideEntityList.size() + 1));
|
||||
slideEntity.getText(), String.valueOf(getPosition(position) % mSlideEntityList.size() + 1));
|
||||
|
||||
String entrance = StringUtils.buildString("(游戏-专题:滚动图["
|
||||
, slideEntity.getName()
|
||||
, slideEntity.getText()
|
||||
, "=", slideEntity.getType()
|
||||
, "=", String.valueOf(getPosition(position) + 1)
|
||||
, "])");
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "轮播图", mSource, String.valueOf(getPosition(position) % mSlideEntityList.size() + 1));
|
||||
|
||||
switch (slideEntity.getType()) {
|
||||
case "game":
|
||||
GameDetailActivity.startGameDetailActivity(mContext, slideEntity.getLink(), entrance);
|
||||
break;
|
||||
case "news":
|
||||
// 统计阅读量
|
||||
NewsUtils.statNewsViews(mContext, slideEntity.getLink());
|
||||
|
||||
Intent intent = NewsDetailActivity.getIntentById(mContext, slideEntity.getLink(), entrance);
|
||||
mContext.startActivity(intent);
|
||||
break;
|
||||
case "column":
|
||||
SubjectActivity.startSubjectActivity(mContext, slideEntity.getLink(),
|
||||
slideEntity.getName(), false, entrance);
|
||||
break;
|
||||
default:
|
||||
DialogUtils.showLowVersionDialog(mContext);
|
||||
break;
|
||||
}
|
||||
DirectUtils.directToLinkPage(mContext, slideEntity, entrance, "(首页游戏)");
|
||||
|
||||
});
|
||||
|
||||
@ -141,7 +118,7 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void checkResetData(List<SlideEntity> list) {
|
||||
public void checkResetData(List<LinkEntity> list) {
|
||||
if (mSlideEntityList != list) {
|
||||
mSlideEntityList = list;
|
||||
mSize = getSize(list);
|
||||
|
||||
Reference in New Issue
Block a user