|
|
@@ -1,24 +1,28 @@
|
|
|
package com.sheep.gamegroup.module.game.activity;
|
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
|
|
|
+import static com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST;
|
|
|
+import static com.sheep.jiuyan.samllsheep.utils.ClassFileHelper.DIR;
|
|
|
+
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
-import androidx.annotation.NonNull;
|
|
|
-import androidx.annotation.Nullable;
|
|
|
-import com.google.android.material.tabs.TabLayout;
|
|
|
-import androidx.fragment.app.Fragment;
|
|
|
-import androidx.viewpager.widget.ViewPager;
|
|
|
-import androidx.appcompat.widget.AppCompatRatingBar;
|
|
|
-import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
-import androidx.recyclerview.widget.RecyclerView;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import androidx.annotation.NonNull;
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
+import androidx.fragment.app.Fragment;
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
+import androidx.viewbinding.ViewBinding;
|
|
|
+
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.google.android.material.tabs.TabLayout;
|
|
|
import com.kfzs.duanduan.utils.NumberFormatUtils;
|
|
|
import com.kfzs.duanduan.utils.StatusBarUtils;
|
|
|
-import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
|
|
import com.sheep.gamegroup.absBase.AbsGetDownloadListener;
|
|
|
@@ -34,10 +38,8 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.GameEntity;
|
|
|
import com.sheep.gamegroup.model.entity.GameListTag;
|
|
|
import com.sheep.gamegroup.model.entity.Lp;
|
|
|
-import com.sheep.gamegroup.model.entity.WebParams;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.module.game.adapter.AdpGameGroupGameCompare;
|
|
|
-import com.sheep.gamegroup.module.game.fragment.FgtGameComment;
|
|
|
import com.sheep.gamegroup.module.game.fragment.FgtGameDetail;
|
|
|
import com.sheep.gamegroup.module.game.fragment.FgtGameGift;
|
|
|
import com.sheep.gamegroup.module.game.fragment.FgtGameWelfare;
|
|
|
@@ -57,15 +59,14 @@ import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
|
|
|
import com.sheep.gamegroup.view.activity.ActPlayVideo;
|
|
|
import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter2;
|
|
|
-import com.sheep.jiuyan.samllsheep.Config;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.databinding.ActGameGroupOrGameDetailBinding;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
|
|
|
import com.shuyu.gsyvideoplayer.GSYVideoManager;
|
|
|
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
|
|
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack;
|
|
|
-import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
|
|
|
|
|
|
import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
@@ -77,15 +78,9 @@ import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
|
|
|
-import butterknife.BindView;
|
|
|
-import butterknife.OnClick;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
-import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
|
|
|
-import static com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST;
|
|
|
-import static com.sheep.jiuyan.samllsheep.utils.ClassFileHelper.DIR;
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* Created by realicing on 2019/1/22.
|
|
|
@@ -108,59 +103,62 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
return R.layout.act_game_group_or_game_detail;
|
|
|
}
|
|
|
|
|
|
- @BindView(R.id.gc_game_app_discount_desc_btn)
|
|
|
- View gc_game_app_discount_desc_btn;
|
|
|
- @BindView(R.id.refresh)
|
|
|
- SmartRefreshLayout refresh;
|
|
|
- @BindView(R.id.tabLayout)
|
|
|
- TabLayout tabLayout;
|
|
|
- @BindView(R.id.viewPager)
|
|
|
- ViewPager viewPager;
|
|
|
- @BindView(R.id.gc_game_app_detail_iv)
|
|
|
- ImageView gc_game_app_detail_iv;
|
|
|
- @BindView(R.id.gc_game_app_detail_iv2)
|
|
|
- ImageView gc_game_app_detail_iv2;
|
|
|
- @BindView(R.id.detail_player)
|
|
|
- StandardGSYVideoPlayer videoPlayer;
|
|
|
- @BindView(R.id.gc_game_app_detail_play_iv)
|
|
|
- ImageView gc_game_app_detail_play_iv;
|
|
|
- @BindView(R.id.gc_game_app_detail_icon)
|
|
|
- ImageView gc_game_app_detail_icon;
|
|
|
- @BindView(R.id.write_comment)
|
|
|
- ImageView write_comment;
|
|
|
- @BindView(R.id.gc_game_app_detail_score_tv)
|
|
|
- TextView gc_game_app_detail_score_tv;
|
|
|
- @BindView(R.id.gc_game_app_detail_info_tv)
|
|
|
- TextView gc_game_app_detail_info_tv;
|
|
|
- @BindView(R.id.gc_game_app_detail_bt1)
|
|
|
- TextView gc_game_app_detail_bt1;
|
|
|
- @BindView(R.id.gc_game_app_detail_name)
|
|
|
- TextView gc_game_app_detail_name;
|
|
|
- @BindView(R.id.gc_game_app_detail_line)
|
|
|
- View gc_game_app_detail_line;
|
|
|
- @BindView(R.id.gc_game_app_detail_bt2)
|
|
|
- TextView gc_game_app_detail_bt2;
|
|
|
- @BindView(R.id.gc_game_app_detail_bt3)
|
|
|
- TextView gc_game_app_detail_bt3;
|
|
|
- @BindView(R.id.gc_game_app_detail_bt4)
|
|
|
- TextView gc_game_app_detail_bt4;
|
|
|
- @BindView(R.id.gc_game_app_hot_iv)
|
|
|
- View gc_game_app_hot_iv;
|
|
|
- @BindView(R.id.gc_game_app_detail_tag_list)
|
|
|
- RecyclerView recyclerView;
|
|
|
- //游戏组界面:比一比
|
|
|
- @BindView(R.id.gc_game_app_detail_game_list)
|
|
|
- View gc_game_app_detail_game_list;
|
|
|
- @BindView(R.id.item_gc_game_app_list_bottom)
|
|
|
- View item_gc_game_app_list_bottom;
|
|
|
- @BindView(R.id.item_gc_game_app_list_rv)
|
|
|
- RecyclerView item_gc_game_app_list_rv;
|
|
|
- @BindView(R.id.item_gc_game_app_list_tv)
|
|
|
- TextView item_gc_game_app_list_tv;
|
|
|
+ ActGameGroupOrGameDetailBinding binding;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected ViewBinding getViewBinding() {
|
|
|
+ binding = ActGameGroupOrGameDetailBinding.inflate(LayoutInflater.from(this));
|
|
|
+ return binding;
|
|
|
+ }
|
|
|
+ // @BindView(R.id.refresh)
|
|
|
+// SmartRefreshLayout refresh;
|
|
|
+// @BindView(R.id.tabLayout)
|
|
|
+// TabLayout tabLayout;
|
|
|
+// @BindView(R.id.viewPager)
|
|
|
+// ViewPager viewPager;
|
|
|
+// @BindView(R.id.binding.gcGameAppDetailIv)
|
|
|
+// ImageView binding.gcGameAppDetailIv;
|
|
|
+// @BindView(R.id.binding.gcGameAppDetailIv2)
|
|
|
+// ImageView binding.gcGameAppDetailIv2;
|
|
|
+// @BindView(R.id.detail_player)
|
|
|
+// StandardGSYVideoPlayer binding.detailPlayer;
|
|
|
+// @BindView(R.id.binding.gcGameAppDetailPlayIv)
|
|
|
+// ImageView binding.gcGameAppDetailPlayIv;
|
|
|
+// @BindView(R.id.gc_game_app_detail_icon)
|
|
|
+// ImageView gc_game_app_detail_icon;
|
|
|
+// @BindView(R.id.binding.gcGameAppDetailScoreTv)
|
|
|
+// TextView binding.gcGameAppDetailScoreTv;
|
|
|
+// @BindView(R.id.gc_game_app_detail_info_tv)
|
|
|
+// TextView gc_game_app_detail_info_tv;
|
|
|
+// @BindView(R.id.gc_game_app_detail_bt1)
|
|
|
+// TextView gc_game_app_detail_bt1;
|
|
|
+// @BindView(R.id.gc_game_app_detail_name)
|
|
|
+// TextView gc_game_app_detail_name;
|
|
|
+// @BindView(R.id.gc_game_app_detail_line)
|
|
|
+// View gc_game_app_detail_line;
|
|
|
+// @BindView(R.id.binding.gcGameAppDetailBt2)
|
|
|
+// TextView binding.gcGameAppDetailBt2;
|
|
|
+// @BindView(R.id.gc_game_app_detail_bt3)
|
|
|
+// TextView gc_game_app_detail_bt3;
|
|
|
+// @BindView(R.id.gc_game_app_detail_bt4)
|
|
|
+// TextView gc_game_app_detail_bt4;
|
|
|
+// @BindView(R.id.gc_game_app_detail_tag_list)
|
|
|
+// RecyclerView recyclerView;
|
|
|
+// //游戏组界面:比一比
|
|
|
+// @BindView(R.id.gc_game_app_detail_game_list)
|
|
|
+// View gc_game_app_detail_game_list;
|
|
|
+// @BindView(R.id.item_gc_game_app_list_bottom)
|
|
|
+// View item_gc_game_app_list_bottom;
|
|
|
+// @BindView(R.id.binding.gcGameAppDetailGameList.itemGcGameAppListRv)
|
|
|
+// RecyclerView binding.gcGameAppDetailGameList.itemGcGameAppListRv;
|
|
|
+// @BindView(R.id.item_gc_game_app_list_tv)
|
|
|
+// TextView item_gc_game_app_list_tv;
|
|
|
|
|
|
private TitleFragmentListAdapter2 mAdapter;
|
|
|
private FgtGameDetail fgtGameDetail;
|
|
|
- private FgtGameComment fgtGameComment;
|
|
|
+ //评论的fragment
|
|
|
+// @Deprecated
|
|
|
+// private FgtGameComment fgtGameComment;
|
|
|
|
|
|
private int id;
|
|
|
private boolean isAutoDownload;
|
|
|
@@ -171,22 +169,24 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
Intent intent = getIntent();
|
|
|
+ ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) binding.ivBack.getLayoutParams();
|
|
|
+ params.setMargins(params.leftMargin, StatusBarUtils.getStatusBarHeight(this), params.rightMargin, params.bottomMargin);
|
|
|
id = intent.getIntExtra("id", 0);
|
|
|
isAutoDownload = intent.getBooleanExtra(AUTO_DOWNLOAD, false);
|
|
|
hasWelfare = intent.getBooleanExtra(KEY_HAS_WELFARE, false);//有没有福利
|
|
|
gameGroup = DataUtil.getObject(intent, GameGroup.class);
|
|
|
EventBus.getDefault().register(this);
|
|
|
//tagList
|
|
|
- TagListUtil.setTagList(recyclerView, tagList);
|
|
|
+ TagListUtil.setTagList(binding.gcGameAppDetailTagList, tagList);
|
|
|
//viewPager
|
|
|
mAdapter = new TitleFragmentListAdapter2(getSupportFragmentManager());
|
|
|
- viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
|
- viewPager.setAdapter(mAdapter);
|
|
|
- tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
|
|
|
- tabLayout.setupWithViewPager(viewPager);
|
|
|
- CommonUtil.getInstance().reflex(tabLayout, this);
|
|
|
+ binding.viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
|
+ binding.viewPager.setAdapter(mAdapter);
|
|
|
+ binding.tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(binding.viewPager));
|
|
|
+ binding.tabLayout.setupWithViewPager(binding.viewPager);
|
|
|
+ CommonUtil.getInstance().reflex(binding.tabLayout, this);
|
|
|
//refresh
|
|
|
- refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
|
|
+ binding.refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
|
|
|
|
|
@Override
|
|
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
|
|
@@ -198,20 +198,20 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
loadMoreData();
|
|
|
}
|
|
|
});
|
|
|
- RefreshUtil.newInstance().publicParameterLoadMore(refresh, this);
|
|
|
+ RefreshUtil.newInstance().publicParameterLoadMore(binding.refresh, this);
|
|
|
|
|
|
- ViewUtil.setImage(write_comment, ViewUtil.getNetImgByName("write_comment"));
|
|
|
+// ViewUtil.setImage(binding.write_comment, ViewUtil.getNetImgByName("write_comment"));
|
|
|
boolean isGameGroupNull = gameGroup == null;
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_game_list, !isGameGroupNull);
|
|
|
- ViewUtil.setVisibility(item_gc_game_app_list_bottom, !isGameGroupNull);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_bt2, isGameGroupNull);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_line, isGameGroupNull);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailGameList.getRoot(), !isGameGroupNull);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailGameList.itemGcGameAppListBottom, !isGameGroupNull);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailBt2, isGameGroupNull);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailLine, isGameGroupNull);
|
|
|
if (isGameGroupNull) {
|
|
|
} else {//游戏组,不显示下载按钮
|
|
|
- ViewUtil.setText(item_gc_game_app_list_tv, "下载通道");
|
|
|
- item_gc_game_app_list_rv.setHasFixedSize(true);
|
|
|
- item_gc_game_app_list_rv.setNestedScrollingEnabled(false);
|
|
|
- item_gc_game_app_list_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailGameList.itemGcGameAppListTv, "下载通道");
|
|
|
+ binding.gcGameAppDetailGameList.itemGcGameAppListRv.setHasFixedSize(true);
|
|
|
+ binding.gcGameAppDetailGameList.itemGcGameAppListRv.setNestedScrollingEnabled(false);
|
|
|
+ binding.gcGameAppDetailGameList.itemGcGameAppListRv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
if (!ListUtil.isEmpty(gameGroup.getApplications())) {
|
|
|
if (AdpGameGroupGameCompare.canDownload) {
|
|
|
for (Applications item : gameGroup.getApplications()) {
|
|
|
@@ -220,7 +220,7 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
BaseQuickAdapter baseQuickAdapter = new AdpGameGroupGameCompare(gameGroup.getApplications());
|
|
|
- baseQuickAdapter.bindToRecyclerView(item_gc_game_app_list_rv);
|
|
|
+ baseQuickAdapter.bindToRecyclerView(binding.gcGameAppDetailGameList.itemGcGameAppListRv);
|
|
|
baseQuickAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
Applications item = ListUtil.getItem(gameGroup.getApplications(), position);
|
|
|
if (item != null) {
|
|
|
@@ -235,9 +235,9 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
|
|
|
//重置view
|
|
|
private void resetView() {
|
|
|
- ViewUtil.setDefaultText(gc_game_app_detail_name);
|
|
|
- ViewUtil.setDefaultText(gc_game_app_detail_score_tv);
|
|
|
- ViewUtil.setDefaultText(gc_game_app_detail_info_tv);
|
|
|
+ ViewUtil.setDefaultText(binding.gcGameAppDetailName);
|
|
|
+ ViewUtil.setDefaultText(binding.gcGameAppDetailScoreTv);
|
|
|
+ ViewUtil.setDefaultText(binding.gcGameAppDetailInfoTv);
|
|
|
}
|
|
|
|
|
|
//检查数据
|
|
|
@@ -251,15 +251,16 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
|
|
|
private GameEntity gameEntity;
|
|
|
|
|
|
- //更新关注状态
|
|
|
+ //更新关注状态,已过时
|
|
|
+ @Deprecated
|
|
|
private void updateFocusTv() {
|
|
|
- if (gc_game_app_detail_bt1 != null && gameEntity != null) {
|
|
|
- gc_game_app_detail_bt1.setText(gameEntity.isIs_focus_game() ? R.string.has_focus : R.string.focus);
|
|
|
- gc_game_app_detail_bt1.setSelected(gameEntity.isIs_focus_game());
|
|
|
- }
|
|
|
+// if (binding.gcGameAppDetailBt1 != null && gameEntity != null) {
|
|
|
+// binding.gcGameAppDetailBt1.setText(gameEntity.isIs_focus_game() ? R.string.has_focus : R.string.focus);
|
|
|
+// binding.gcGameAppDetailBt1.setSelected(gameEntity.isIs_focus_game());
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
- private int pingJiaIndex = 1;
|
|
|
+// private int pingJiaIndex = 1;
|
|
|
|
|
|
//加载游戏数据
|
|
|
private void loadData(final GameEntity gameEntity) {
|
|
|
@@ -269,126 +270,127 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
tryInitFragment();
|
|
|
//更新评价数量
|
|
|
if (gameEntity.getApp().getComment_num() > 0) {
|
|
|
- TabLayout.Tab tab = tabLayout.getTabAt(pingJiaIndex);
|
|
|
- if (tab != null)
|
|
|
- tab.setText(String.format(Locale.CHINA, "评价(%d)", gameEntity.getApp().getComment_num()));
|
|
|
- CommonUtil.getInstance().reflex(tabLayout, this, true);
|
|
|
+// TabLayout.Tab tab = binding.tabLayout.getTabAt(pingJiaIndex);
|
|
|
+// if (tab != null)
|
|
|
+// tab.setText(String.format(Locale.CHINA, "评价(%d)", gameEntity.getApp().getComment_num()));
|
|
|
+ CommonUtil.getInstance().reflex(binding.tabLayout, this, true);
|
|
|
}
|
|
|
+ //检查有没有封面图,这个图可能是图片也可能是视频
|
|
|
String mainBublicize = gameEntity.getApp().getMain_publicize();
|
|
|
//加载游戏背景
|
|
|
if (TextUtils.isEmpty(mainBublicize)) {
|
|
|
- ViewUtil.setImage(gc_game_app_detail_iv, gameEntity.getApp().getPictures());
|
|
|
- ViewUtil.setVisibility(videoPlayer, false);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_iv, true);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_iv2, false);
|
|
|
+ ViewUtil.setImage(binding.gcGameAppDetailIv, gameEntity.getApp().getPictures());
|
|
|
+ ViewUtil.setVisibility(binding.detailPlayer, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailIv, true);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailIv2, false);
|
|
|
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_play_iv, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailPlayIv, false);
|
|
|
} else if (gameEntity.getApp().mainPublicizeIsVideo()) {
|
|
|
- ViewUtil.setVisibility(videoPlayer, false);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_iv, false);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_iv2, true);
|
|
|
- ViewUtil.setImage(gc_game_app_detail_iv2, ActPlayVideo.getCoverByUrl(mainBublicize));
|
|
|
+ ViewUtil.setVisibility(binding.detailPlayer, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailIv, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailIv2, true);
|
|
|
+ ViewUtil.setImage(binding.gcGameAppDetailIv2, ActPlayVideo.getCoverByUrl(mainBublicize));
|
|
|
//播放按钮
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_play_iv, true);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailPlayIv, true);
|
|
|
String fileName = FileUtil.getLastSplitEnd(mainBublicize, '/') + ".mp4";
|
|
|
String filePath = new File(DIR, fileName).getAbsolutePath();
|
|
|
//开始下载视频
|
|
|
Jump2View.getInstance().startDownloadService(mainBublicize, filePath);
|
|
|
- gc_game_app_detail_play_iv.setOnClickListener(view -> loadVideo(filePath));
|
|
|
+ binding.gcGameAppDetailPlayIv.setOnClickListener(view -> loadVideo(filePath));
|
|
|
} else {//否则当做图片显示
|
|
|
- ViewUtil.setVisibility(videoPlayer, false);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_iv, false);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_iv2, true);
|
|
|
+ ViewUtil.setVisibility(binding.detailPlayer, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailIv, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailIv2, true);
|
|
|
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_play_iv, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailPlayIv, false);
|
|
|
|
|
|
- ViewUtil.setImage(gc_game_app_detail_iv2, mainBublicize);
|
|
|
+ ViewUtil.setImage(binding.gcGameAppDetailIv2, mainBublicize);
|
|
|
}
|
|
|
//加载游戏图标
|
|
|
- ViewUtil.setGameImage(gc_game_app_detail_icon, gameEntity.getApp().getIcon());
|
|
|
+ ViewUtil.setGameImage(binding.gcGameAppDetailIcon, gameEntity.getApp().getIcon());
|
|
|
//加载游戏名字
|
|
|
- ViewUtil.setText(gc_game_app_detail_name, gameGroup == null ? gameEntity.getApp().getName() : gameGroup.getName());
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailName, gameGroup == null ? gameEntity.getApp().getName() : gameGroup.getName());
|
|
|
//加载游戏大小与多少人在玩信息
|
|
|
- ViewUtil.setText(gc_game_app_detail_info_tv, gameGroup == null ? gameEntity.getApp().getInfoContainGameFrom() : gameGroup.getInfo(null));
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailInfoTv, gameGroup == null ? gameEntity.getApp().getPlayInfo() : gameGroup.getInfo(null));
|
|
|
//加载游戏标签
|
|
|
if (gameEntity.getApp().getTags() != null) {
|
|
|
tagList.clear();
|
|
|
tagList.addAll(gameEntity.getApp().getTags());
|
|
|
ListUtil.removeNull(tagList);
|
|
|
- if (recyclerView.getAdapter() != null)
|
|
|
- recyclerView.getAdapter().notifyDataSetChanged();
|
|
|
+ if (binding.gcGameAppDetailTagList.getAdapter() != null)
|
|
|
+ binding.gcGameAppDetailTagList.getAdapter().notifyDataSetChanged();
|
|
|
}
|
|
|
//下载按钮
|
|
|
if (gameEntity.getApp().getMobile_appointment() == 1) {
|
|
|
- CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, gc_game_app_detail_bt2, 0);
|
|
|
+ CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, binding.gcGameAppDetailBt2, 0);
|
|
|
} else if (gameEntity.getApp().getMobile_appointment() == 2) {
|
|
|
- ViewUtil.setText(gc_game_app_detail_bt2, "立即预约");
|
|
|
- ViewUtil.setOnClickListener(gc_game_app_detail_bt2, v -> {
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailBt2, "立即预约");
|
|
|
+ ViewUtil.setOnClickListener(binding.gcGameAppDetailBt2, v -> {
|
|
|
if (gameEntity.getApp().getMobile_appointment() == 3) return;
|
|
|
new GameAppointHelper(this, gameEntity, t -> {
|
|
|
- ViewUtil.setText(gc_game_app_detail_bt2, "已预约");
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailBt2, "已预约");
|
|
|
gameEntity.getApp().setMobile_appointment(3);
|
|
|
}).showAppointDialog();
|
|
|
});
|
|
|
} else if (gameEntity.getApp().getMobile_appointment() == 3) {
|
|
|
- ViewUtil.setText(gc_game_app_detail_bt2, "已预约");
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailBt2, "已预约");
|
|
|
} else {
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_bt2, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailBt2, false);
|
|
|
}
|
|
|
fgtGameDetail.loadData(gameEntity);
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_bt3, gameEntity.getApp().hasGameDiscountId());
|
|
|
- ViewUtil.setVisibility(gc_game_app_hot_iv, gameEntity.getApp().getIsHot() == 1);
|
|
|
- ViewUtil.setVisibility(gc_game_app_discount_desc_btn, gameEntity.getApp().hasGameDiscountId());
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailBt3, gameEntity.getApp().hasGameDiscountId());
|
|
|
|
|
|
if (isAutoDownload && gameEntity.getApp().getMobile_appointment() == 1) {//可以进行自动下载
|
|
|
if (!PackageUtil.isAppInstalled(SheepApp.getInstance(), gameEntity.getApp().getPackage_name())) {//未安装的情况才进行下载
|
|
|
- gc_game_app_detail_bt2.performLongClick();
|
|
|
+ binding.gcGameAppDetailBt2.performLongClick();
|
|
|
}
|
|
|
}
|
|
|
if (gameGroup == null) {
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_bt4, gameEntity.getApp().getActivity_id() > 0);
|
|
|
- ViewUtil.setOnClickListener(gc_game_app_detail_bt4, v -> {
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailBt4, gameEntity.getApp().getActivity_id() > 0);
|
|
|
+ ViewUtil.setOnClickListener(binding.gcGameAppDetailBt4, v -> {
|
|
|
Jump2View.getInstance().goWeb(this, gameEntity.getApp().getActivity_url(), "活动");
|
|
|
});
|
|
|
}
|
|
|
+ updateScore(gameEntity.getApp().getScore());
|
|
|
}
|
|
|
|
|
|
//更新评分
|
|
|
public void updateScore(float score) {
|
|
|
- int progress = (int) score;
|
|
|
//加载游戏评分
|
|
|
- ViewUtil.setText(gc_game_app_detail_score_tv, NumberFormatUtils.retain1(score));
|
|
|
+ ViewUtil.setText(binding.gcGameAppDetailScoreTv, NumberFormatUtils.retain1(score));
|
|
|
}
|
|
|
|
|
|
+ //礼包的fragment
|
|
|
private FgtGameGift fgtGameGift;
|
|
|
|
|
|
//重新初始化viewPager的数据
|
|
|
private void tryInitFragment() {
|
|
|
mAdapter.clearData();
|
|
|
+ //详情
|
|
|
fgtGameDetail = FgtGameDetail.newInstance(id);
|
|
|
- fgtGameComment = FgtGameComment.newInstance(id);
|
|
|
- fgtGameDetail.setSmartRefreshLayout(refresh);
|
|
|
- fgtGameComment.setSmartRefreshLayout(refresh);
|
|
|
- fgtGameComment.setListAction1(fgtGameDetail);
|
|
|
+// fgtGameComment = FgtGameComment.newInstance(id);
|
|
|
+ fgtGameDetail.setSmartRefreshLayout(binding.refresh);
|
|
|
+// fgtGameComment.setSmartRefreshLayout(binding.refresh);
|
|
|
+// fgtGameComment.setListAction1(fgtGameDetail);
|
|
|
mAdapter.add(fgtGameDetail, "详情");
|
|
|
|
|
|
if (hasWelfare) {
|
|
|
FgtGameWelfare fgtGameWelfare = FgtGameWelfare.newInstance(id);
|
|
|
- fgtGameWelfare.setSmartRefreshLayout(refresh);
|
|
|
+ fgtGameWelfare.setSmartRefreshLayout(binding.refresh);
|
|
|
mAdapter.add(fgtGameWelfare, "福利");
|
|
|
}
|
|
|
if (gameEntity.isGift()) {
|
|
|
fgtGameGift = FgtGameGift.newInstance(id);
|
|
|
- fgtGameGift.setSmartRefreshLayout(refresh);
|
|
|
+ fgtGameGift.setSmartRefreshLayout(binding.refresh);
|
|
|
fgtGameGift.loadData(gameEntity);
|
|
|
mAdapter.add(fgtGameGift, "礼包");
|
|
|
}
|
|
|
- mAdapter.add(fgtGameComment, "评价");
|
|
|
- pingJiaIndex = mAdapter.getCount() - 1;
|
|
|
+// mAdapter.add(fgtGameComment, "评价");
|
|
|
+// pingJiaIndex = mAdapter.getCount() - 1;
|
|
|
mAdapter.notifyDataSetChanged();
|
|
|
- CommonUtil.getInstance().reflex(tabLayout, this);
|
|
|
- if (viewPager != null) {
|
|
|
- viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
|
+ CommonUtil.getInstance().reflex(binding.tabLayout, this);
|
|
|
+ if (binding.viewPager != null) {
|
|
|
+ binding.viewPager.setOffscreenPageLimit(mAdapter.getCount());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -411,7 +413,7 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
checkData(gameEntity);
|
|
|
} else if (gameEntity != null) {
|
|
|
//更新下载按钮
|
|
|
- CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, gc_game_app_detail_bt2, 0);
|
|
|
+ CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, binding.gcGameAppDetailBt2, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -439,7 +441,7 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
|
|
|
//刷新数据
|
|
|
public void refreshData() {
|
|
|
- refreshData(viewPager.getCurrentItem());
|
|
|
+ refreshData(binding.viewPager.getCurrentItem());
|
|
|
}
|
|
|
|
|
|
//刷新数据
|
|
|
@@ -462,7 +464,7 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
//加载更多数据
|
|
|
private void loadMoreData() {
|
|
|
if (mAdapter.getCount() == 0) return;
|
|
|
- Fragment item = mAdapter.getItem(viewPager.getCurrentItem());
|
|
|
+ Fragment item = mAdapter.getItem(binding.viewPager.getCurrentItem());
|
|
|
if (item instanceof ILoadMore) {//可加载更多,就调用当前fragment刷新数据
|
|
|
((ILoadMore) item).loadMoreData();
|
|
|
} else {
|
|
|
@@ -471,9 +473,9 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void notifyDataSetChanged() {
|
|
|
- if (refresh != null) {
|
|
|
- refresh.finishRefresh();
|
|
|
- refresh.finishLoadMore();
|
|
|
+ if (binding.refresh != null) {
|
|
|
+ binding.refresh.finishRefresh();
|
|
|
+ binding.refresh.finishLoadMore();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -521,7 +523,10 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @OnClick(R.id.gc_game_app_detail_bt3)
|
|
|
+ void initClick() {
|
|
|
+ binding.gcGameAppDetailBt3.setOnClickListener(this::onGoDirectionalPay);
|
|
|
+ }
|
|
|
+
|
|
|
public void onGoDirectionalPay(View v) {
|
|
|
CommonUtil.getInstance().getUserInfo(false, user -> {
|
|
|
if (user == null) return;
|
|
|
@@ -533,11 +538,6 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @OnClick(R.id.gc_game_app_discount_desc_btn)
|
|
|
- public void onGoDiscountDesc() {
|
|
|
- Jump2View.getInstance().goWeb(this, new WebParams(Config.getUrlByPath(Config.PATH_DISCOUNT_DESC), "金丹玩法"));
|
|
|
- }
|
|
|
-
|
|
|
private AbsGetDownloadListener absGetDownloadListener = new AbsGetDownloadListener(false) {
|
|
|
@Override
|
|
|
public String getDownloadUrl(String packageName) {
|
|
|
@@ -546,12 +546,12 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public TextView getTextView2(String packageName) {
|
|
|
- return getDownloadUrl(packageName) != null ? gc_game_app_detail_bt2 : null;
|
|
|
+ return getDownloadUrl(packageName) != null ? binding.gcGameAppDetailBt2 : null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public TextView getTextView(String downloadUrl) {
|
|
|
- return gameEntity != null && TextUtils.equals(downloadUrl, gameEntity.downLinks()) ? gc_game_app_detail_bt2 : null;
|
|
|
+ return gameEntity != null && TextUtils.equals(downloadUrl, gameEntity.downLinks()) ? binding.gcGameAppDetailBt2 : null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -572,12 +572,12 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public TextView getTextView2(String packageName) {
|
|
|
- return item_gc_game_app_list_rv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + getDownloadUrl(packageName));
|
|
|
+ return binding.gcGameAppDetailGameList.itemGcGameAppListRv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + getDownloadUrl(packageName));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public TextView getTextView(String downloadUrl) {
|
|
|
- return item_gc_game_app_list_rv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + downloadUrl);
|
|
|
+ return binding.gcGameAppDetailGameList.itemGcGameAppListRv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + downloadUrl);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -597,7 +597,7 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
@Subscribe
|
|
|
public void onEventMainThread(BigEvent event) {
|
|
|
if (event.getEventTypes() == EventTypes.COMMENT_REFRESH) {
|
|
|
- refreshData(pingJiaIndex);
|
|
|
+// refreshData(pingJiaIndex);
|
|
|
} else {
|
|
|
absGetDownloadListener.onEventMainThread(event);
|
|
|
if (AdpGameGroupGameCompare.canDownload)
|
|
|
@@ -611,8 +611,8 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
switch (requestCode) {
|
|
|
case RequestCodeConstants.REQUEST_CODE_REFRESH:
|
|
|
if (resultCode == RESULT_OK)//发表评论成功
|
|
|
- refreshData(pingJiaIndex);//需要刷新第二页的评论
|
|
|
- break;
|
|
|
+// refreshData(pingJiaIndex);//需要刷新第二页的评论
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -624,13 +624,13 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void loadVideo(String filePath) {
|
|
|
- ViewUtil.setVisibility(videoPlayer, true);
|
|
|
+ ViewUtil.setVisibility(binding.detailPlayer, true);
|
|
|
//不显示播放按钮
|
|
|
- ViewUtil.setVisibility(gc_game_app_detail_play_iv, false);
|
|
|
+ ViewUtil.setVisibility(binding.gcGameAppDetailPlayIv, false);
|
|
|
video_url = filePath;
|
|
|
video_title = gameEntity.getApp().getName();
|
|
|
video_cover_url = ActPlayVideo.getCoverByUrl(gameEntity.getApp().getMain_publicize());
|
|
|
- LayoutParamsUtil.resetLayoutParams(videoPlayer, new Lp().setHeight(gc_game_app_detail_iv2.getHeight()));
|
|
|
+ LayoutParamsUtil.resetLayoutParams(binding.detailPlayer, new Lp().setHeight(binding.gcGameAppDetailIv2.getHeight()));
|
|
|
initPlay();
|
|
|
}
|
|
|
|
|
|
@@ -687,8 +687,8 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
long totalSpace = file.getTotalSpace();
|
|
|
LogUtil.println("initPlay", "exists file", totalSpace);
|
|
|
}
|
|
|
- if (videoPlayer != null)
|
|
|
- videoPlayer.startPlayLogic();
|
|
|
+ if (binding.detailPlayer != null)
|
|
|
+ binding.detailPlayer.startPlayLogic();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -699,18 +699,18 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
LogUtil.println("initPlay", "onPlayError", url, curPosition);
|
|
|
if (file.exists()) {
|
|
|
LogUtil.println("initPlay", "retry play");
|
|
|
- if (videoPlayer != null) {
|
|
|
+ if (binding.detailPlayer != null) {
|
|
|
if (curPosition > 0) {
|
|
|
- videoPlayer.setSeekOnStart(curPosition);
|
|
|
- videoPlayer.startPlayLogic();
|
|
|
+ binding.detailPlayer.setSeekOnStart(curPosition);
|
|
|
+ binding.detailPlayer.startPlayLogic();
|
|
|
} else {
|
|
|
ViewUtil.delay(new AbsObserver<Integer>() {
|
|
|
@Override
|
|
|
public void onNext(Integer integer) {
|
|
|
super.onNext(integer);
|
|
|
try {
|
|
|
- if (videoPlayer != null)
|
|
|
- videoPlayer.startPlayLogic();
|
|
|
+ if (binding.detailPlayer != null)
|
|
|
+ binding.detailPlayer.startPlayLogic();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -720,32 +720,32 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }).build(videoPlayer);
|
|
|
+ }).build(binding.detailPlayer);
|
|
|
isInit = true;
|
|
|
} else {
|
|
|
- videoPlayer.setUp(getVideoUrl(), true, getVideoTitle());
|
|
|
+ binding.detailPlayer.setUp(getVideoUrl(), true, getVideoTitle());
|
|
|
}
|
|
|
- if (videoPlayer != null) {
|
|
|
- videoPlayer.startPlayLogic();
|
|
|
- ViewUtil.setVisibility(videoPlayer.getThumbImageViewLayout(), true);
|
|
|
- ViewUtil.setVisibility2(videoPlayer.getTitleTextView(), false);
|
|
|
- ViewUtil.setVisibility2(videoPlayer.getBackButton(), false);
|
|
|
- if (videoPlayer.getFullscreenButton() != null)
|
|
|
- videoPlayer.getFullscreenButton().setOnClickListener(v -> Jump2View.getInstance().goActPlayVideo(video_url, video_title, video_cover_url));//跳转播放
|
|
|
+ if (binding.detailPlayer != null) {
|
|
|
+ binding.detailPlayer.startPlayLogic();
|
|
|
+ ViewUtil.setVisibility(binding.detailPlayer.getThumbImageViewLayout(), true);
|
|
|
+ ViewUtil.setVisibility2(binding.detailPlayer.getTitleTextView(), false);
|
|
|
+ ViewUtil.setVisibility2(binding.detailPlayer.getBackButton(), false);
|
|
|
+ if (binding.detailPlayer.getFullscreenButton() != null)
|
|
|
+ binding.detailPlayer.getFullscreenButton().setOnClickListener(v -> Jump2View.getInstance().goActPlayVideo(video_url, video_title, video_cover_url));//跳转播放
|
|
|
}
|
|
|
ViewUtil.setImage(coverImageView, getVideoCoverUrl());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void onResume() {
|
|
|
- if (videoPlayer != null)
|
|
|
- videoPlayer.onVideoResume();
|
|
|
+ if (binding.detailPlayer != null)
|
|
|
+ binding.detailPlayer.onVideoResume();
|
|
|
super.onResume();
|
|
|
isPlay = true;
|
|
|
if (onResumeCount > 0) {
|
|
|
- if (gameEntity != null && gc_game_app_detail_bt2 != null && gameEntity.getApp().getMobile_appointment() == 1) {
|
|
|
+ if (gameEntity != null && binding.gcGameAppDetailBt2 != null && gameEntity.getApp().getMobile_appointment() == 1) {
|
|
|
//强制更新下载按钮
|
|
|
- CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, gc_game_app_detail_bt2, 0);
|
|
|
+ CommonUtil.getInstance().palyGameDetailBtnValue(false, gameEntity, binding.gcGameAppDetailBt2, 0);
|
|
|
}
|
|
|
}
|
|
|
onResumeCount++;
|
|
|
@@ -755,8 +755,8 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
protected void onPause() {
|
|
|
- if (videoPlayer != null)
|
|
|
- videoPlayer.onVideoPause();
|
|
|
+ if (binding.detailPlayer != null)
|
|
|
+ binding.detailPlayer.onVideoPause();
|
|
|
super.onPause();
|
|
|
isPlay = false;
|
|
|
}
|
|
|
@@ -764,8 +764,8 @@ public class ActGameGroupOrGameDetail extends BaseActivity {
|
|
|
@Override
|
|
|
public void onBackPressed() {
|
|
|
//释放所有
|
|
|
- if (videoPlayer != null)
|
|
|
- videoPlayer.setVideoAllCallBack(null);
|
|
|
+ if (binding.detailPlayer != null)
|
|
|
+ binding.detailPlayer.setVideoAllCallBack(null);
|
|
|
super.onBackPressed();
|
|
|
}
|
|
|
}
|