|
|
@@ -26,6 +26,7 @@ import com.sheep.gamegroup.helper.DownloadHelper;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.GameEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
+import com.sheep.gamegroup.util.ApiUtil;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
@@ -149,12 +150,16 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
|
|
|
private GameEntity gameEntity;
|
|
|
|
|
|
+ //更新关注状态
|
|
|
+ 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);
|
|
|
+ }
|
|
|
//加载游戏数据
|
|
|
private void loadData(GameEntity gameEntity) {
|
|
|
this.gameEntity = gameEntity;
|
|
|
//更新关注状态
|
|
|
- gc_game_app_detail_bt1.setText(gameEntity.isIs_focus_game() ? "已关注" : "关注");
|
|
|
- gc_game_app_detail_bt1.setEnabled(!gameEntity.isIs_focus_game());
|
|
|
+ updateFocusTv();
|
|
|
tryInitWelfare();
|
|
|
//更新评价数量
|
|
|
if(gameEntity.getApp().getComment_num() > 0) {
|
|
|
@@ -265,8 +270,11 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
|
|
|
//点击分享
|
|
|
public void onClickShareImg(View view) {
|
|
|
- //TODO 点击分享游戏
|
|
|
- G.showToast(R.string.coming_soon);
|
|
|
+ if(gameEntity == null || gameEntity.getApp() == null || TextUtils.isEmpty(gameEntity.getApp().getName())){
|
|
|
+ CommonUtil.getInstance().tryShowShareDialog(this);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CommonUtil.getInstance().tryShowShareDialog(this, String.format(Locale.CHINA, "小朋友,快来玩【%s】", gameEntity.getApp().getName()));
|
|
|
}
|
|
|
|
|
|
//点击加,发表评论
|
|
|
@@ -275,32 +283,27 @@ public class ActGcGameAppDetail extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
//点击关注
|
|
|
- public void onClickFollowTv(View view) {
|
|
|
+ public void onClickFollowTv(final View view) {
|
|
|
if(gameEntity == null){
|
|
|
G.showToast(R.string.loading_data);
|
|
|
return;
|
|
|
}
|
|
|
- if(gameEntity.isIs_focus_game()){
|
|
|
- G.showToast("已经关注");
|
|
|
- return;
|
|
|
- }
|
|
|
- //点击关注游戏
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().postGameUserFocusGame(id)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
- @Override
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
- G.showToast("关注游戏成功");
|
|
|
- gc_game_app_detail_bt1.setText("已关注");
|
|
|
- gc_game_app_detail_bt1.setEnabled(false);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
- G.showToast(baseMessage);
|
|
|
- }
|
|
|
- });
|
|
|
+ view.setEnabled(false);
|
|
|
+ ApiUtil.postGameUserFocusGame(id, new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ G.showToast(gameEntity.isIs_focus_game() ? R.string.cancel_focus_success : R.string.focus_success);
|
|
|
+ gameEntity.setIs_focus_game(!gameEntity.isIs_focus_game());
|
|
|
+ updateFocusTv();
|
|
|
+ view.setEnabled(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ G.showToast(gameEntity.isIs_focus_game() ? R.string.cancel_focus_fail : R.string.focus_fail);
|
|
|
+ view.setEnabled(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private AbsGetDownloadListener absGetDownloadListener = new AbsGetDownloadListener(true) {
|