|
@@ -2,16 +2,12 @@ package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
-import android.os.Bundle;
|
|
|
|
|
-import android.os.Handler;
|
|
|
|
|
-import android.os.Message;
|
|
|
|
|
import android.support.design.widget.AppBarLayout;
|
|
import android.support.design.widget.AppBarLayout;
|
|
|
import android.support.design.widget.TabLayout;
|
|
import android.support.design.widget.TabLayout;
|
|
|
import android.support.v4.view.ViewPager;
|
|
import android.support.v4.view.ViewPager;
|
|
|
import android.support.v7.widget.AppCompatRatingBar;
|
|
import android.support.v7.widget.AppCompatRatingBar;
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
-import android.view.ViewGroup;
|
|
|
|
|
import android.widget.ImageButton;
|
|
import android.widget.ImageButton;
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
@@ -24,7 +20,7 @@ import com.arialyy.aria.core.download.DownloadTask;
|
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
|
import com.kfzs.duanduan.mine.GiftpackListAdapter;
|
|
import com.kfzs.duanduan.mine.GiftpackListAdapter;
|
|
|
import com.kfzs.duanduan.services.DownloadTaskService;
|
|
import com.kfzs.duanduan.services.DownloadTaskService;
|
|
|
-import com.kfzs.duanduan.utils.dlg.HelperUtils;
|
|
|
|
|
|
|
+import com.kfzs.duanduan.view.ViewPagerAutoHeigh;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
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;
|
|
@@ -33,11 +29,12 @@ import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
|
|
+import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.TimeUtil;
|
|
import com.sheep.gamegroup.util.TimeUtil;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtPlaGameGift;
|
|
import com.sheep.gamegroup.view.fragment.FgtPlaGameGift;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtPlayGameDetail;
|
|
import com.sheep.gamegroup.view.fragment.FgtPlayGameDetail;
|
|
|
-import com.sheep.gamegroup.view.fragment.FgtPlayGameSon;
|
|
|
|
|
|
|
+import com.sheep.gamegroup.view.fragment.FgtTryMakeMoney;
|
|
|
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;
|
|
@@ -48,13 +45,12 @@ import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
|
|
import java.util.Locale;
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
|
-import butterknife.ButterKnife;
|
|
|
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
|
import rx.functions.Action1;
|
|
import rx.functions.Action1;
|
|
|
import rx.schedulers.Schedulers;
|
|
import rx.schedulers.Schedulers;
|
|
@@ -69,10 +65,6 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
|
|
public class ActPlayGameDetail extends BaseActivity implements Action1<Integer> {
|
|
public class ActPlayGameDetail extends BaseActivity implements Action1<Integer> {
|
|
|
@BindView(R.id.appbar_act_game_details)
|
|
@BindView(R.id.appbar_act_game_details)
|
|
|
AppBarLayout appbarActGameDetails;
|
|
AppBarLayout appbarActGameDetails;
|
|
|
- @BindView(R.id.bottom_line_text)
|
|
|
|
|
- TextView bottomLineText;
|
|
|
|
|
- @BindView(R.id.bottom_line)
|
|
|
|
|
- LinearLayout bottomLine;
|
|
|
|
|
@BindView(R.id.status_height_view)
|
|
@BindView(R.id.status_height_view)
|
|
|
View statusHeightView;
|
|
View statusHeightView;
|
|
|
@BindView(R.id.find_game_bar)
|
|
@BindView(R.id.find_game_bar)
|
|
@@ -96,7 +88,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
@BindView(R.id.find_game_down_tv)
|
|
@BindView(R.id.find_game_down_tv)
|
|
|
TextView find_game_down_tv;
|
|
TextView find_game_down_tv;
|
|
|
@BindView(R.id.viewpager_act_game_details)
|
|
@BindView(R.id.viewpager_act_game_details)
|
|
|
- ViewPager mViewPager;
|
|
|
|
|
|
|
+ ViewPagerAutoHeigh mViewPager;
|
|
|
@BindView(R.id.tabLayout)
|
|
@BindView(R.id.tabLayout)
|
|
|
TabLayout tabLayout;
|
|
TabLayout tabLayout;
|
|
|
@BindView(R.id.welfare_gift_layout)
|
|
@BindView(R.id.welfare_gift_layout)
|
|
@@ -105,6 +97,8 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
TextView welfare_tv;
|
|
TextView welfare_tv;
|
|
|
@BindView(R.id.gift_tv)
|
|
@BindView(R.id.gift_tv)
|
|
|
TextView gift_tv;
|
|
TextView gift_tv;
|
|
|
|
|
+ @BindView(R.id.ll_game_tag)
|
|
|
|
|
+ LinearLayout ll_game_tag;
|
|
|
|
|
|
|
|
private Activity activity;
|
|
private Activity activity;
|
|
|
private int id;
|
|
private int id;
|
|
@@ -133,6 +127,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
EventBus.getDefault().register(this);
|
|
EventBus.getDefault().register(this);
|
|
|
Aria.download(this).register();
|
|
Aria.download(this).register();
|
|
|
|
|
|
|
|
|
|
+ mAdapter = new GiftpackListAdapter(getSupportFragmentManager(), SheepApp.getInstance());
|
|
|
txt_baseactivity_title.setVisibility(View.INVISIBLE);//不显示标题栏
|
|
txt_baseactivity_title.setVisibility(View.INVISIBLE);//不显示标题栏
|
|
|
|
|
|
|
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 0);
|
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 0);
|
|
@@ -174,12 +169,16 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
layoutParams2.leftMargin = Math.max(titleWidth + row + 2 * leftRow, (G.WIDTH - nameWidth) / 2 + verticalOffset);
|
|
layoutParams2.leftMargin = Math.max(titleWidth + row + 2 * leftRow, (G.WIDTH - nameWidth) / 2 + verticalOffset);
|
|
|
layoutParams2.topMargin = Math.max(topRow2, getResources().getDimensionPixelSize(R.dimen.find_game_top2) + verticalOffset);
|
|
layoutParams2.topMargin = Math.max(topRow2, getResources().getDimensionPixelSize(R.dimen.find_game_top2) + verticalOffset);
|
|
|
find_game_name_tv.setLayoutParams(layoutParams2);
|
|
find_game_name_tv.setLayoutParams(layoutParams2);
|
|
|
|
|
+ //tag
|
|
|
|
|
+ RelativeLayout.LayoutParams layoutParams6 = (RelativeLayout.LayoutParams) ll_game_tag.getLayoutParams();
|
|
|
|
|
+ layoutParams6.topMargin = getResources().getDimensionPixelSize(R.dimen.find_game_top158) + verticalOffset;
|
|
|
|
|
+ ll_game_tag.setLayoutParams(layoutParams6);
|
|
|
//信息位置变化
|
|
//信息位置变化
|
|
|
RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) find_game_info_tv.getLayoutParams();
|
|
RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) find_game_info_tv.getLayoutParams();
|
|
|
int left1 = (G.WIDTH - infoWidth) / 2;
|
|
int left1 = (G.WIDTH - infoWidth) / 2;
|
|
|
int left2 = titleWidth + row + 2 * leftRow;
|
|
int left2 = titleWidth + row + 2 * leftRow;
|
|
|
layoutParams3.leftMargin = left1;//left2 > left1 ? Math.min(left2, left1 - verticalOffset) : Math.max(left2, left1 + verticalOffset);
|
|
layoutParams3.leftMargin = left1;//left2 > left1 ? Math.min(left2, left1 - verticalOffset) : Math.max(left2, left1 + verticalOffset);
|
|
|
- layoutParams3.topMargin = /*Math.max(find_game_name_tv.getHeight() + 4 * topRow, */getResources().getDimensionPixelSize(R.dimen.find_game_top3) + verticalOffset/*)*/;
|
|
|
|
|
|
|
+ layoutParams3.topMargin = /*Math.max(find_game_name_tv.getHeight() + 4 * topRow, */getResources().getDimensionPixelSize(R.dimen.find_game_top190) + verticalOffset/*)*/;
|
|
|
find_game_info_tv.setLayoutParams(layoutParams3);
|
|
find_game_info_tv.setLayoutParams(layoutParams3);
|
|
|
//下载按钮位置变化
|
|
//下载按钮位置变化
|
|
|
RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) welfare_gift_layout.getLayoutParams();
|
|
RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) welfare_gift_layout.getLayoutParams();
|
|
@@ -189,7 +188,6 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
//星级位置变化
|
|
//星级位置变化
|
|
|
RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) find_game_xin.getLayoutParams();
|
|
RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) find_game_xin.getLayoutParams();
|
|
|
layoutParams5.topMargin = getResources().getDimensionPixelSize(R.dimen.find_game_top210) + verticalOffset;
|
|
layoutParams5.topMargin = getResources().getDimensionPixelSize(R.dimen.find_game_top210) + verticalOffset;
|
|
|
- find_game_xin.setLayoutParams(layoutParams5);
|
|
|
|
|
if (willTop == topRow/2) {
|
|
if (willTop == topRow/2) {
|
|
|
if (mIsExpanded) {
|
|
if (mIsExpanded) {
|
|
|
// txt_baseactivity_title.setVisibility(View.INVISIBLE);
|
|
// txt_baseactivity_title.setVisibility(View.INVISIBLE);
|
|
@@ -210,22 +208,11 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- //viewpaper
|
|
|
|
|
- initViewPaper();
|
|
|
|
|
resetData();
|
|
resetData();
|
|
|
|
|
|
|
|
initData();
|
|
initData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void initViewPaper() {
|
|
|
|
|
- mAdapter = new GiftpackListAdapter(getSupportFragmentManager(), SheepApp.getInstance());
|
|
|
|
|
- mAdapter.add(FgtPlayGameDetail.newInstance(gameEntity), "详情");
|
|
|
|
|
- mAdapter.add(FgtPlaGameGift.newInstance(gameEntity), "礼包");
|
|
|
|
|
- mViewPager.setAdapter(mAdapter);
|
|
|
|
|
- tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
|
|
|
|
- tabLayout.setupWithViewPager(mViewPager);
|
|
|
|
|
- CommonUtil.getInstance().reflex(tabLayout, activity);
|
|
|
|
|
- }
|
|
|
|
|
private void resetData() {
|
|
private void resetData() {
|
|
|
//游戏简介与下载
|
|
//游戏简介与下载
|
|
|
ViewUtil.setText(find_game_name_tv);
|
|
ViewUtil.setText(find_game_name_tv);
|
|
@@ -274,6 +261,36 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
|
|
|
|
|
updateView(this, gameEntity.getApp(), find_game_down_tv);
|
|
updateView(this, gameEntity.getApp(), find_game_down_tv);
|
|
|
|
|
|
|
|
|
|
+ mAdapter.clearData();
|
|
|
|
|
+ mAdapter.add(FgtPlayGameDetail.newInstance(gameEntity), "详情");
|
|
|
|
|
+ //ViewPager
|
|
|
|
|
+ //welfare_gift_layout
|
|
|
|
|
+ if(gameEntity.isGiftAndBonus()){
|
|
|
|
|
+ welfare_gift_layout.setVisibility(View.GONE);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ welfare_gift_layout.setVisibility(View.VISIBLE);
|
|
|
|
|
+ if(gameEntity.isGift()){
|
|
|
|
|
+ gift_tv.setVisibility(View.VISIBLE);
|
|
|
|
|
+ mAdapter.add(FgtPlaGameGift.newInstance(gameEntity), "礼包");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ gift_tv.setVisibility(View.GONE);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.getBonusText())){
|
|
|
|
|
+ welfare_tv.setVisibility(View.GONE);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ welfare_tv.setVisibility(View.VISIBLE);
|
|
|
|
|
+ ViewUtil.setText(welfare_tv, String.format(Locale.CHINA, "+%s元", gameEntity.getBonusText()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ mViewPager.setAdapter(mAdapter);
|
|
|
|
|
+ tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
|
|
|
|
+ tabLayout.setupWithViewPager(mViewPager);
|
|
|
|
|
+ CommonUtil.getInstance().reflex(tabLayout, activity);
|
|
|
|
|
+
|
|
|
|
|
+ //tag 标签绘制
|
|
|
|
|
+ CommonUtil.getInstance().paintLineaLayout(activity, gameEntity, ll_game_tag, 4,R.color.txt_bule, R.drawable.shape_blue_stroke_rectangle_no_lb);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//更新按钮状态与添加点击事件
|
|
//更新按钮状态与添加点击事件
|
|
@@ -325,7 +342,6 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
@Override
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
super.onDestroy();
|
|
|
- Aria.download(this).unRegister();
|
|
|
|
|
EventBus.getDefault().unregister(this);
|
|
EventBus.getDefault().unregister(this);
|
|
|
}
|
|
}
|
|
|
//获取任务对应的TextView来更新进度
|
|
//获取任务对应的TextView来更新进度
|