|
@@ -27,6 +27,7 @@ import com.sheep.gamegroup.helper.DownloadHelper;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.GameEntity;
|
|
import com.sheep.gamegroup.model.entity.GameEntity;
|
|
|
import com.sheep.gamegroup.model.entity.GameListTag;
|
|
import com.sheep.gamegroup.model.entity.GameListTag;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.WebParams;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.ApiUtil;
|
|
import com.sheep.gamegroup.util.ApiUtil;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
@@ -41,6 +42,7 @@ import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter2;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtGcGameAppComment;
|
|
import com.sheep.gamegroup.view.fragment.FgtGcGameAppComment;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtGcGameAppDetail;
|
|
import com.sheep.gamegroup.view.fragment.FgtGcGameAppDetail;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtGcGameAppWelfare;
|
|
import com.sheep.gamegroup.view.fragment.FgtGcGameAppWelfare;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.Config;
|
|
|
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;
|
|
@@ -53,6 +55,7 @@ import java.util.List;
|
|
|
import java.util.Locale;
|
|
import java.util.Locale;
|
|
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
|
|
|
+import butterknife.OnClick;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
|
@@ -71,6 +74,7 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
StatusBarUtils.setTranslucent(this);
|
|
StatusBarUtils.setTranslucent(this);
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected int getLayoutId() {
|
|
protected int getLayoutId() {
|
|
|
return R.layout.act_gc_game_app_detail;
|
|
return R.layout.act_gc_game_app_detail;
|
|
@@ -100,6 +104,8 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
TextView gc_game_app_detail_fl_tv;
|
|
TextView gc_game_app_detail_fl_tv;
|
|
|
@BindView(R.id.gc_game_app_detail_bt2)
|
|
@BindView(R.id.gc_game_app_detail_bt2)
|
|
|
TextView 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_tag_list)
|
|
@BindView(R.id.gc_game_app_detail_tag_list)
|
|
|
RecyclerView recyclerView;
|
|
RecyclerView recyclerView;
|
|
|
|
|
|
|
@@ -108,6 +114,7 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
private FgtGcGameAppComment fgtGcGameAppComment;
|
|
private FgtGcGameAppComment fgtGcGameAppComment;
|
|
|
|
|
|
|
|
private int id;
|
|
private int id;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
id = getIntent().getIntExtra("id", 0);
|
|
id = getIntent().getIntExtra("id", 0);
|
|
@@ -167,9 +174,10 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
|
|
|
|
|
//更新关注状态
|
|
//更新关注状态
|
|
|
private void updateFocusTv() {
|
|
private void updateFocusTv() {
|
|
|
- if(gc_game_app_detail_bt1 != null && gameEntity != null)
|
|
|
|
|
|
|
+ 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.setText(gameEntity.isIs_focus_game() ? R.string.has_focus : R.string.focus);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//加载游戏数据
|
|
//加载游戏数据
|
|
|
private void loadData(final GameEntity gameEntity) {
|
|
private void loadData(final GameEntity gameEntity) {
|
|
|
this.gameEntity = gameEntity;
|
|
this.gameEntity = gameEntity;
|
|
@@ -177,14 +185,14 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
updateFocusTv();
|
|
updateFocusTv();
|
|
|
tryInitWelfare();
|
|
tryInitWelfare();
|
|
|
//更新评价数量
|
|
//更新评价数量
|
|
|
- if(gameEntity.getApp().getComment_num() > 0) {
|
|
|
|
|
|
|
+ if (gameEntity.getApp().getComment_num() > 0) {
|
|
|
TabLayout.Tab tab = tabLayout.getTabAt(1);
|
|
TabLayout.Tab tab = tabLayout.getTabAt(1);
|
|
|
if (tab != null)
|
|
if (tab != null)
|
|
|
tab.setText(String.format(Locale.CHINA, "评价(%d)", gameEntity.getApp().getComment_num()));
|
|
tab.setText(String.format(Locale.CHINA, "评价(%d)", gameEntity.getApp().getComment_num()));
|
|
|
CommonUtil.getInstance().reflex(tabLayout, this, true);
|
|
CommonUtil.getInstance().reflex(tabLayout, this, true);
|
|
|
}
|
|
}
|
|
|
//加载游戏背景
|
|
//加载游戏背景
|
|
|
- if(TextUtils.isEmpty(gameEntity.getApp().getMain_publicize())){
|
|
|
|
|
|
|
+ if (TextUtils.isEmpty(gameEntity.getApp().getMain_publicize())) {
|
|
|
ViewUtil.setImage(gc_game_app_detail_iv, gameEntity.getApp().getPictures());
|
|
ViewUtil.setImage(gc_game_app_detail_iv, gameEntity.getApp().getPictures());
|
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv, true);
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv, true);
|
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv2, false);
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv2, false);
|
|
@@ -192,7 +200,7 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
ViewUtil.setImage(gc_game_app_detail_iv2, gameEntity.getApp().getMain_publicize());
|
|
ViewUtil.setImage(gc_game_app_detail_iv2, gameEntity.getApp().getMain_publicize());
|
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv, false);
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv, false);
|
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv2, true);
|
|
ViewUtil.setVisibility(gc_game_app_detail_iv2, true);
|
|
|
- if(gameEntity.getApp().getMain_publicize().endsWith(".mp4")) {
|
|
|
|
|
|
|
+ if (gameEntity.getApp().getMain_publicize().endsWith(".mp4")) {
|
|
|
gc_game_app_detail_play_iv.setVisibility(View.VISIBLE);
|
|
gc_game_app_detail_play_iv.setVisibility(View.VISIBLE);
|
|
|
gc_game_app_detail_play_iv.setOnClickListener(new View.OnClickListener() {
|
|
gc_game_app_detail_play_iv.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
@Override
|
|
@@ -207,26 +215,32 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
//加载游戏名字
|
|
//加载游戏名字
|
|
|
ViewUtil.setText(gc_game_app_detail_name, gameEntity.getApp().getName());
|
|
ViewUtil.setText(gc_game_app_detail_name, gameEntity.getApp().getName());
|
|
|
//加载游戏 福利
|
|
//加载游戏 福利
|
|
|
- if(gameEntity.getRelease_task() != null)
|
|
|
|
|
- ViewUtil.setText(gc_game_app_detail_fl_tv,"+\u0020\u0020"+NumberFormatUtils.retainMost2W(gameEntity.getRelease_task().getBonus())+ "元");
|
|
|
|
|
|
|
+ if (gameEntity.getRelease_task() != null)
|
|
|
|
|
+ ViewUtil.setText(gc_game_app_detail_fl_tv, "+\u0020\u0020" + NumberFormatUtils.retainMost2W(gameEntity.getRelease_task().getBonus()) + "元");
|
|
|
else
|
|
else
|
|
|
ViewUtil.setText(gc_game_app_detail_fl_tv);
|
|
ViewUtil.setText(gc_game_app_detail_fl_tv);
|
|
|
//加载游戏标签
|
|
//加载游戏标签
|
|
|
- if(gameEntity.getApp().getTags() != null) {
|
|
|
|
|
|
|
+ if (gameEntity.getApp().getTags() != null) {
|
|
|
tagList.addAll(gameEntity.getApp().getTags());
|
|
tagList.addAll(gameEntity.getApp().getTags());
|
|
|
ListUtil.removeNull(tagList);
|
|
ListUtil.removeNull(tagList);
|
|
|
- if(recyclerView.getAdapter() != null)
|
|
|
|
|
|
|
+ if (recyclerView.getAdapter() != null)
|
|
|
recyclerView.getAdapter().notifyDataSetChanged();
|
|
recyclerView.getAdapter().notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
//下载按钮
|
|
//下载按钮
|
|
|
CommonUtil.getInstance().palyGameDetailBtnValue(this, gameEntity, gc_game_app_detail_bt2, 0);
|
|
CommonUtil.getInstance().palyGameDetailBtnValue(this, gameEntity, gc_game_app_detail_bt2, 0);
|
|
|
fgtGcPlayGameDetail.loadData(gameEntity);
|
|
fgtGcPlayGameDetail.loadData(gameEntity);
|
|
|
|
|
+ if (gameEntity.getApp().getGame_discount_id() == 0) {
|
|
|
|
|
+ gc_game_app_detail_bt3.setVisibility(View.GONE);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ gc_game_app_detail_bt3.setVisibility(View.VISIBLE);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private FgtGcGameAppWelfare fgtGcGameAppWelfare;
|
|
private FgtGcGameAppWelfare fgtGcGameAppWelfare;
|
|
|
|
|
+
|
|
|
//重新初始化viewPager的数据
|
|
//重新初始化viewPager的数据
|
|
|
private void tryInitWelfare() {
|
|
private void tryInitWelfare() {
|
|
|
- if(fgtGcGameAppWelfare != null || !gameEntity.isGift()){
|
|
|
|
|
|
|
+ if (fgtGcGameAppWelfare != null || !gameEntity.isGift()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
fgtGcGameAppWelfare = FgtGcGameAppWelfare.newInstance(id);
|
|
fgtGcGameAppWelfare = FgtGcGameAppWelfare.newInstance(id);
|
|
@@ -249,7 +263,7 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
if (isNewData) {
|
|
if (isNewData) {
|
|
|
GameEntity gameEntity = baseMessage.getData(GameEntity.class);
|
|
GameEntity gameEntity = baseMessage.getData(GameEntity.class);
|
|
|
checkData(gameEntity);
|
|
checkData(gameEntity);
|
|
|
- } else if(gameEntity != null){
|
|
|
|
|
|
|
+ } else if (gameEntity != null) {
|
|
|
//更新下载按钮
|
|
//更新下载按钮
|
|
|
CommonUtil.getInstance().palyGameDetailBtnValue(ActGcGameAppDetail.this, gameEntity, gc_game_app_detail_bt2, 0);
|
|
CommonUtil.getInstance().palyGameDetailBtnValue(ActGcGameAppDetail.this, gameEntity, gc_game_app_detail_bt2, 0);
|
|
|
}
|
|
}
|
|
@@ -271,12 +285,14 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private int refreshDataCount = 0;
|
|
private int refreshDataCount = 0;
|
|
|
|
|
+
|
|
|
//刷新数据
|
|
//刷新数据
|
|
|
- public void refreshData(){
|
|
|
|
|
|
|
+ public void refreshData() {
|
|
|
refreshData(viewPager.getCurrentItem());
|
|
refreshData(viewPager.getCurrentItem());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//刷新数据
|
|
//刷新数据
|
|
|
- public void refreshData(int position){
|
|
|
|
|
|
|
+ public void refreshData(int position) {
|
|
|
initDetailFromNet();
|
|
initDetailFromNet();
|
|
|
boolean isRefresh = false;
|
|
boolean isRefresh = false;
|
|
|
if (refreshDataCount != 0) {
|
|
if (refreshDataCount != 0) {
|
|
@@ -287,9 +303,10 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
refreshDataCount++;
|
|
refreshDataCount++;
|
|
|
- if(!isRefresh)
|
|
|
|
|
|
|
+ if (!isRefresh)
|
|
|
notifyDataSetChanged();
|
|
notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//加载更多数据
|
|
//加载更多数据
|
|
|
private void loadMoreData() {
|
|
private void loadMoreData() {
|
|
|
Fragment item = mAdapter.getItem(viewPager.getCurrentItem());
|
|
Fragment item = mAdapter.getItem(viewPager.getCurrentItem());
|
|
@@ -315,7 +332,7 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
//点击分享
|
|
//点击分享
|
|
|
public void onClickShareImg(View view) {
|
|
public void onClickShareImg(View view) {
|
|
|
FIND_SHARE.onEvent("application_id", id);
|
|
FIND_SHARE.onEvent("application_id", id);
|
|
|
- if(gameEntity == null || gameEntity.getApp() == null || TextUtils.isEmpty(gameEntity.getApp().getName())){
|
|
|
|
|
|
|
+ if (gameEntity == null || gameEntity.getApp() == null || TextUtils.isEmpty(gameEntity.getApp().getName())) {
|
|
|
Jump2View.getInstance().tryShare(this, "find_share_url", "application_id", id);
|
|
Jump2View.getInstance().tryShare(this, "find_share_url", "application_id", id);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -329,7 +346,7 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
|
|
|
|
|
//点击关注
|
|
//点击关注
|
|
|
public void onClickFollowTv(final View view) {
|
|
public void onClickFollowTv(final View view) {
|
|
|
- if(gameEntity == null){
|
|
|
|
|
|
|
+ if (gameEntity == null) {
|
|
|
G.showToast(R.string.loading_data);
|
|
G.showToast(R.string.loading_data);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -351,6 +368,15 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @OnClick(R.id.gc_game_app_detail_bt3)
|
|
|
|
|
+ public void onGoDirectionalPay(View v) {
|
|
|
|
|
+ CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_DIRECTIONAL_RECHARGE_URL, url -> {
|
|
|
|
|
+ url = url + "/" + gameEntity.getApp().getGame_discount_id() + "?authorization=";
|
|
|
|
|
+ WebParams webParams = new WebParams(url, "抢购优惠").setShowTitle(false);
|
|
|
|
|
+ Jump2View.getInstance().goWeb(this, webParams);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private AbsGetDownloadListener absGetDownloadListener = new AbsGetDownloadListener(true) {
|
|
private AbsGetDownloadListener absGetDownloadListener = new AbsGetDownloadListener(true) {
|
|
|
@Override
|
|
@Override
|
|
|
public String getDownloadUrl(String packageName) {
|
|
public String getDownloadUrl(String packageName) {
|
|
@@ -386,9 +412,9 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
@Override
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
- switch (requestCode){
|
|
|
|
|
|
|
+ switch (requestCode) {
|
|
|
case RequestCodeConstants.REQUEST_CODE_REFRESH:
|
|
case RequestCodeConstants.REQUEST_CODE_REFRESH:
|
|
|
- if(resultCode == RESULT_OK)//发表评论成功
|
|
|
|
|
|
|
+ if (resultCode == RESULT_OK)//发表评论成功
|
|
|
refreshData(1);//需要刷新第二页的评论
|
|
refreshData(1);//需要刷新第二页的评论
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|