|
@@ -49,7 +49,6 @@ import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
import com.sheep.gamegroup.util.RequestCodeConstants;
|
|
import com.sheep.gamegroup.util.RequestCodeConstants;
|
|
|
-import com.sheep.gamegroup.util.StringUtils;
|
|
|
|
|
import com.sheep.gamegroup.util.TagListUtil;
|
|
import com.sheep.gamegroup.util.TagListUtil;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
|
|
import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
|
|
@@ -161,35 +160,20 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
private boolean isAutoDownload;
|
|
private boolean isAutoDownload;
|
|
|
private GameGroup gameGroup;
|
|
private GameGroup gameGroup;
|
|
|
|
|
|
|
|
|
|
+ boolean hasWelfare;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
Intent intent = getIntent();
|
|
Intent intent = getIntent();
|
|
|
id = intent.getIntExtra("id", 0);
|
|
id = intent.getIntExtra("id", 0);
|
|
|
isAutoDownload = intent.getBooleanExtra(AUTO_DOWNLOAD, false);
|
|
isAutoDownload = intent.getBooleanExtra(AUTO_DOWNLOAD, false);
|
|
|
- boolean hasWelfare = intent.getBooleanExtra(KEY_HAS_WELFARE, false);//有没有福利
|
|
|
|
|
|
|
+ hasWelfare = intent.getBooleanExtra(KEY_HAS_WELFARE, false);//有没有福利
|
|
|
gameGroup = DataUtil.getObject(intent, GameGroup.class);
|
|
gameGroup = DataUtil.getObject(intent, GameGroup.class);
|
|
|
EventBus.getDefault().register(this);
|
|
EventBus.getDefault().register(this);
|
|
|
//tagList
|
|
//tagList
|
|
|
TagListUtil.setTagList(recyclerView, tagList);
|
|
TagListUtil.setTagList(recyclerView, tagList);
|
|
|
//viewPager
|
|
//viewPager
|
|
|
mAdapter = new TitleFragmentListAdapter2(getSupportFragmentManager());
|
|
mAdapter = new TitleFragmentListAdapter2(getSupportFragmentManager());
|
|
|
- fgtGameDetail = FgtGameDetail.newInstance(id);
|
|
|
|
|
- fgtGameComment = FgtGameComment.newInstance(id);
|
|
|
|
|
- fgtGameDetail.setSmartRefreshLayout(refresh);
|
|
|
|
|
- fgtGameComment.setSmartRefreshLayout(refresh);
|
|
|
|
|
- fgtGameComment.setListAction1(fgtGameDetail);
|
|
|
|
|
- mAdapter.add(fgtGameDetail, "详情");
|
|
|
|
|
-
|
|
|
|
|
- if(hasWelfare){
|
|
|
|
|
- FgtGameWelfare fgtGameWelfare = FgtGameWelfare.newInstance(id);
|
|
|
|
|
- fgtGameWelfare.setSmartRefreshLayout(refresh);
|
|
|
|
|
- mAdapter.add(fgtGameWelfare, "福利");
|
|
|
|
|
- pingJiaIndex = 2;//评价的位置为2;
|
|
|
|
|
- } else {
|
|
|
|
|
- pingJiaIndex = 1;//评价的位置可能为1;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- mAdapter.add(fgtGameComment, "评价");
|
|
|
|
|
viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
|
viewPager.setAdapter(mAdapter);
|
|
viewPager.setAdapter(mAdapter);
|
|
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
|
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
|
|
@@ -269,12 +253,13 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private int pingJiaIndex = 1;
|
|
private int pingJiaIndex = 1;
|
|
|
|
|
+
|
|
|
//加载游戏数据
|
|
//加载游戏数据
|
|
|
private void loadData(final GameEntity gameEntity) {
|
|
private void loadData(final GameEntity gameEntity) {
|
|
|
this.gameEntity = gameEntity;
|
|
this.gameEntity = gameEntity;
|
|
|
//更新关注状态
|
|
//更新关注状态
|
|
|
updateFocusTv();
|
|
updateFocusTv();
|
|
|
- tryInitGift();
|
|
|
|
|
|
|
+ tryInitFragment();
|
|
|
//更新评价数量
|
|
//更新评价数量
|
|
|
if (gameEntity.getApp().getComment_num() > 0) {
|
|
if (gameEntity.getApp().getComment_num() > 0) {
|
|
|
TabLayout.Tab tab = tabLayout.getTabAt(pingJiaIndex);
|
|
TabLayout.Tab tab = tabLayout.getTabAt(pingJiaIndex);
|
|
@@ -350,15 +335,32 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private FgtGameGift fgtGameGift;
|
|
private FgtGameGift fgtGameGift;
|
|
|
|
|
+
|
|
|
//重新初始化viewPager的数据
|
|
//重新初始化viewPager的数据
|
|
|
- private void tryInitGift() {
|
|
|
|
|
|
|
+ private void tryInitFragment() {
|
|
|
|
|
+ mAdapter.clearData();
|
|
|
|
|
+ fgtGameDetail = FgtGameDetail.newInstance(id);
|
|
|
|
|
+ fgtGameComment = FgtGameComment.newInstance(id);
|
|
|
|
|
+ fgtGameDetail.setSmartRefreshLayout(refresh);
|
|
|
|
|
+ fgtGameComment.setSmartRefreshLayout(refresh);
|
|
|
|
|
+ fgtGameComment.setListAction1(fgtGameDetail);
|
|
|
|
|
+ mAdapter.add(fgtGameDetail, "详情");
|
|
|
|
|
+
|
|
|
|
|
+ if (hasWelfare) {
|
|
|
|
|
+ FgtGameWelfare fgtGameWelfare = FgtGameWelfare.newInstance(id);
|
|
|
|
|
+ fgtGameWelfare.setSmartRefreshLayout(refresh);
|
|
|
|
|
+ mAdapter.add(fgtGameWelfare, "福利");
|
|
|
|
|
+ }
|
|
|
if (fgtGameGift != null || !gameEntity.isGift()) {
|
|
if (fgtGameGift != null || !gameEntity.isGift()) {
|
|
|
- return;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fgtGameGift = FgtGameGift.newInstance(id);
|
|
|
|
|
+ fgtGameGift.setSmartRefreshLayout(refresh);
|
|
|
|
|
+ fgtGameGift.loadData(gameEntity);
|
|
|
|
|
+ mAdapter.add(fgtGameGift, "礼包");
|
|
|
}
|
|
}
|
|
|
- fgtGameGift = FgtGameGift.newInstance(id);
|
|
|
|
|
- fgtGameGift.setSmartRefreshLayout(refresh);
|
|
|
|
|
- fgtGameGift.loadData(gameEntity);
|
|
|
|
|
- mAdapter.add(fgtGameGift, "礼包");
|
|
|
|
|
|
|
+ mAdapter.add(fgtGameComment, "评价");
|
|
|
|
|
+ pingJiaIndex = mAdapter.getCount() - 1;
|
|
|
mAdapter.notifyDataSetChanged();
|
|
mAdapter.notifyDataSetChanged();
|
|
|
viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
|
}
|
|
}
|
|
@@ -626,32 +628,33 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
super.onAutoComplete(url, objects);
|
|
super.onAutoComplete(url, objects);
|
|
|
LogUtil.println("initPlay", "onAutoComplete", url, objects);
|
|
LogUtil.println("initPlay", "onAutoComplete", url, objects);
|
|
|
File file = new File(video_url);
|
|
File file = new File(video_url);
|
|
|
- if(file.exists()) {
|
|
|
|
|
|
|
+ if (file.exists()) {
|
|
|
long totalSpace = file.getTotalSpace();
|
|
long totalSpace = file.getTotalSpace();
|
|
|
LogUtil.println("initPlay", "exists file", totalSpace);
|
|
LogUtil.println("initPlay", "exists file", totalSpace);
|
|
|
}
|
|
}
|
|
|
if (videoPlayer != null)
|
|
if (videoPlayer != null)
|
|
|
videoPlayer.startPlayLogic();
|
|
videoPlayer.startPlayLogic();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void onPlayError(String url, Object... objects) {
|
|
public void onPlayError(String url, Object... objects) {
|
|
|
super.onPlayError(url, objects);
|
|
super.onPlayError(url, objects);
|
|
|
File file = new File(video_url);
|
|
File file = new File(video_url);
|
|
|
long curPosition = GSYVideoManager.instance().getCurPlayerManager().getCurrentPosition();
|
|
long curPosition = GSYVideoManager.instance().getCurPlayerManager().getCurrentPosition();
|
|
|
LogUtil.println("initPlay", "onPlayError", url, curPosition);
|
|
LogUtil.println("initPlay", "onPlayError", url, curPosition);
|
|
|
- if(file.exists()){
|
|
|
|
|
|
|
+ if (file.exists()) {
|
|
|
LogUtil.println("initPlay", "retry play");
|
|
LogUtil.println("initPlay", "retry play");
|
|
|
if (videoPlayer != null) {
|
|
if (videoPlayer != null) {
|
|
|
- if(curPosition > 0) {
|
|
|
|
|
|
|
+ if (curPosition > 0) {
|
|
|
videoPlayer.setSeekOnStart(curPosition);
|
|
videoPlayer.setSeekOnStart(curPosition);
|
|
|
videoPlayer.startPlayLogic();
|
|
videoPlayer.startPlayLogic();
|
|
|
} else {
|
|
} else {
|
|
|
- ViewUtil.delay(new AbsObserver<Integer>(){
|
|
|
|
|
|
|
+ ViewUtil.delay(new AbsObserver<Integer>() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onNext(Integer integer) {
|
|
public void onNext(Integer integer) {
|
|
|
super.onNext(integer);
|
|
super.onNext(integer);
|
|
|
try {
|
|
try {
|
|
|
- if(videoPlayer != null)
|
|
|
|
|
|
|
+ if (videoPlayer != null)
|
|
|
videoPlayer.startPlayLogic();
|
|
videoPlayer.startPlayLogic();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -684,14 +687,15 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
videoPlayer.onVideoResume();
|
|
videoPlayer.onVideoResume();
|
|
|
super.onResume();
|
|
super.onResume();
|
|
|
isPlay = true;
|
|
isPlay = true;
|
|
|
- if(onResumeCount > 0){
|
|
|
|
|
- if(gameEntity != null && gc_game_app_detail_bt2 != null) {
|
|
|
|
|
|
|
+ if (onResumeCount > 0) {
|
|
|
|
|
+ if (gameEntity != null && gc_game_app_detail_bt2 != null) {
|
|
|
//强制更新下载按钮
|
|
//强制更新下载按钮
|
|
|
CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, gc_game_app_detail_bt2, 0);
|
|
CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, gc_game_app_detail_bt2, 0);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
onResumeCount++;
|
|
onResumeCount++;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private int onResumeCount = 0;
|
|
private int onResumeCount = 0;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|