|
@@ -37,8 +37,10 @@ import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.Conversion2;
|
|
import com.sheep.gamegroup.util.Conversion2;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.ImageGlarryDrawable;
|
|
import com.sheep.gamegroup.util.ImageGlarryDrawable;
|
|
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
|
|
|
+import com.sheep.gamegroup.util.MyDbManager;
|
|
|
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.customview.SheepViewPager;
|
|
import com.sheep.gamegroup.view.customview.SheepViewPager;
|
|
@@ -84,25 +86,17 @@ public class ActFindGame extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private int id;
|
|
private int id;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
id = getIntent().getIntExtra("id", 0);
|
|
id = getIntent().getIntExtra("id", 0);
|
|
|
TitleBarUtils.getInstance()
|
|
TitleBarUtils.getInstance()
|
|
|
- .setTitle(this,"加载中")
|
|
|
|
|
|
|
+ .setTitle(this, "详情")
|
|
|
.setTitleFinish(this)
|
|
.setTitleFinish(this)
|
|
|
.setRightImgBotton(this, R.mipmap.share, new View.OnClickListener() {
|
|
.setRightImgBotton(this, R.mipmap.share, new View.OnClickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
public void onClick(View view) {
|
|
|
- try{
|
|
|
|
|
- Object url_config1 = ACache.get(SheepApp.getInstance()).getAsObject("url_config");
|
|
|
|
|
- if(url_config1 instanceof JSONObject) {
|
|
|
|
|
- String find_share_url = ((JSONObject) url_config1).getString("find_share_url");
|
|
|
|
|
- String url = String.format(Locale.CHINA, "%s?authorization=%s&find_id=%d", find_share_url, SpUtils.getOpenId(ActFindGame.this), id);
|
|
|
|
|
- CommonUtil.getInstance().popShare(ActFindGame.this, url, "all");
|
|
|
|
|
- }
|
|
|
|
|
- }catch (Exception e){
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Jump2View.getInstance().tryShare(ActFindGame.this, "find_share_url", "find_id", id);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -118,28 +112,59 @@ public class ActFindGame extends BaseActivity {
|
|
|
((AppBarLayout) findViewById(R.id.appbar_act_game_details)).addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
|
((AppBarLayout) findViewById(R.id.appbar_act_game_details)).addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
|
- if (Math.abs(verticalOffset) <
|
|
|
|
|
- appBarLayout.getTotalScrollRange() - HelperUtils.getDpiToPix(20)) {
|
|
|
|
|
- if (!mIsExpanded) {
|
|
|
|
|
- mIsExpanded = true;//修改状态标记为展开
|
|
|
|
|
- txt_baseactivity_title.setVisibility(View.INVISIBLE);
|
|
|
|
|
- find_game_bar.setVisibility(View.INVISIBLE);
|
|
|
|
|
- title_bottom_line.setVisibility(View.INVISIBLE);
|
|
|
|
|
- img_baseactivity_title.setImageLevel(0);
|
|
|
|
|
- }
|
|
|
|
|
- } else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) {
|
|
|
|
|
|
|
+ //图标位置变化
|
|
|
|
|
+ int find_game_top = getResources().getDimensionPixelSize(R.dimen.find_game_top);
|
|
|
|
|
+ int find_icon_with = getResources().getDimensionPixelSize(R.dimen.find_icon_with);
|
|
|
|
|
+ int titleHeight = img_baseactivity_title.getHeight();
|
|
|
|
|
+ int titleWidth = img_baseactivity_title.getWidth();
|
|
|
|
|
+
|
|
|
|
|
+ int willTop = Math.max(0, find_game_top + verticalOffset);
|
|
|
|
|
+ int row = (find_icon_with * willTop + titleHeight * (find_game_top - willTop)) / find_game_top;
|
|
|
|
|
+ RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) find_game_iv.getLayoutParams();
|
|
|
|
|
+ layoutParams.leftMargin = Math.max(titleWidth, (G.WIDTH - find_icon_with) / 2 + verticalOffset);
|
|
|
|
|
+ layoutParams.topMargin = willTop;
|
|
|
|
|
+ layoutParams.width = row;
|
|
|
|
|
+ layoutParams.height = row;
|
|
|
|
|
+ find_game_iv.setLayoutParams(layoutParams);
|
|
|
|
|
+ //名字位置变化
|
|
|
|
|
+ int topRow = (titleHeight - find_game_name_tv.getHeight() - find_game_info_tv.getHeight()) / 4;
|
|
|
|
|
+ RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) find_game_name_tv.getLayoutParams();
|
|
|
|
|
+ layoutParams2.leftMargin = Math.max(titleWidth + find_icon_with, (G.WIDTH - find_game_name_tv.getWidth()) / 2 + verticalOffset);
|
|
|
|
|
+ layoutParams2.topMargin = Math.max(topRow, getResources().getDimensionPixelSize(R.dimen.find_game_top2) + verticalOffset);
|
|
|
|
|
+ find_game_name_tv.setLayoutParams(layoutParams2);
|
|
|
|
|
+ //信息位置变化
|
|
|
|
|
+ RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) find_game_info_tv.getLayoutParams();
|
|
|
|
|
+ layoutParams3.leftMargin = Math.max(titleWidth + find_icon_with, (G.WIDTH - find_game_info_tv.getWidth()) / 2 + verticalOffset);
|
|
|
|
|
+ layoutParams3.topMargin = Math.max(find_game_name_tv.getHeight() + 2 * topRow, getResources().getDimensionPixelSize(R.dimen.find_game_top3) + verticalOffset);
|
|
|
|
|
+ find_game_info_tv.setLayoutParams(layoutParams3);
|
|
|
|
|
+ //下载按钮位置变化
|
|
|
|
|
+ RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) find_game_down_tv.getLayoutParams();
|
|
|
|
|
+ layoutParams4.setMarginEnd(Math.max(ibtn_baseactivity_right.getWidth(), (G.WIDTH - find_game_down_tv.getWidth()) / 2 + verticalOffset));
|
|
|
|
|
+ layoutParams4.topMargin = Math.max((titleHeight - find_game_down_tv.getHeight()) / 2, getResources().getDimensionPixelSize(R.dimen.find_game_top4) + verticalOffset);
|
|
|
|
|
+ find_game_down_tv.setLayoutParams(layoutParams4);
|
|
|
|
|
+ if (willTop == 0) {
|
|
|
|
|
+ LogUtil.println("ActFindGame", "onOffsetChanged", 2, verticalOffset);
|
|
|
if (mIsExpanded) {
|
|
if (mIsExpanded) {
|
|
|
- txt_baseactivity_title.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
+// txt_baseactivity_title.setVisibility(View.INVISIBLE);
|
|
|
find_game_bar.setVisibility(View.VISIBLE);
|
|
find_game_bar.setVisibility(View.VISIBLE);
|
|
|
title_bottom_line.setVisibility(View.VISIBLE);
|
|
title_bottom_line.setVisibility(View.VISIBLE);
|
|
|
img_baseactivity_title.setImageLevel(1);
|
|
img_baseactivity_title.setImageLevel(1);
|
|
|
mIsExpanded = false;//修改状态标记为折叠
|
|
mIsExpanded = false;//修改状态标记为折叠
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (!mIsExpanded) {
|
|
|
|
|
+ mIsExpanded = true;//修改状态标记为展开
|
|
|
|
|
+// txt_baseactivity_title.setVisibility(View.VISIBLE);
|
|
|
|
|
+ find_game_bar.setVisibility(View.INVISIBLE);
|
|
|
|
|
+ title_bottom_line.setVisibility(View.INVISIBLE);
|
|
|
|
|
+ img_baseactivity_title.setImageLevel(0);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ txt_baseactivity_title.setVisibility(View.INVISIBLE);//不显示标题栏
|
|
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) homepage_item_banner_layout.getLayoutParams();
|
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) homepage_item_banner_layout.getLayoutParams();
|
|
|
- layoutParams.height = G.WIDTH/2;
|
|
|
|
|
|
|
+ layoutParams.height = G.WIDTH / 2;
|
|
|
homepage_item_banner_layout.setLayoutParams(layoutParams);
|
|
homepage_item_banner_layout.setLayoutParams(layoutParams);
|
|
|
bindBanner();
|
|
bindBanner();
|
|
|
resetData();
|
|
resetData();
|
|
@@ -154,6 +179,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
public void initListener() {
|
|
public void initListener() {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void initData() {
|
|
public void initData() {
|
|
|
showProgress();
|
|
showProgress();
|
|
@@ -164,9 +190,9 @@ public class ActFindGame extends BaseActivity {
|
|
|
.subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
.subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
|
@Override
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
- LogUtil.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
|
|
|
|
|
|
|
+ LogUtil.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
|
|
|
FindApp findApp = baseMessage.getData(FindApp.class);
|
|
FindApp findApp = baseMessage.getData(FindApp.class);
|
|
|
- if(findApp != null){
|
|
|
|
|
|
|
+ if (findApp != null) {
|
|
|
loadData(findApp);
|
|
loadData(findApp);
|
|
|
initAppScoreNum();
|
|
initAppScoreNum();
|
|
|
initMyAppScore();
|
|
initMyAppScore();
|
|
@@ -178,7 +204,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onError(BaseMessage baseMessage) {
|
|
public void onError(BaseMessage baseMessage) {
|
|
|
- LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
|
|
|
|
|
|
|
+ LogUtil.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
|
|
|
G.showToast(baseMessage);
|
|
G.showToast(baseMessage);
|
|
|
resetData();
|
|
resetData();
|
|
|
hideProgress();
|
|
hideProgress();
|
|
@@ -187,7 +213,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
CommonUtil.getInstance().updateUserInfo(new Action1<UserEntity>() {
|
|
CommonUtil.getInstance().updateUserInfo(new Action1<UserEntity>() {
|
|
|
@Override
|
|
@Override
|
|
|
public void call(UserEntity userEntity) {
|
|
public void call(UserEntity userEntity) {
|
|
|
- if(userEntity != null){
|
|
|
|
|
|
|
+ if (userEntity != null) {
|
|
|
loadUserInfo(userEntity);
|
|
loadUserInfo(userEntity);
|
|
|
} else {
|
|
} else {
|
|
|
resetUserInfo();
|
|
resetUserInfo();
|
|
@@ -198,46 +224,47 @@ public class ActFindGame extends BaseActivity {
|
|
|
|
|
|
|
|
private void initAppScoreNum() {
|
|
private void initAppScoreNum() {
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getAppScoreNum(id)
|
|
SheepApp.getInstance().getNetComponent().getApiService().getAppScoreNum(id)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
- LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
|
|
|
|
|
- List<FindAppScore> findAppScoreList = baseMessage.getDataList(FindAppScore.class);
|
|
|
|
|
- if(ListUtil.isEmpty(findAppScoreList))
|
|
|
|
|
- resetAppScoreNum();
|
|
|
|
|
- else
|
|
|
|
|
- loadAppScoreNum(findAppScoreList);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
|
|
- LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
|
|
- G.showToast(baseMessage);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ List<FindAppScore> findAppScoreList = baseMessage.getDataList(FindAppScore.class);
|
|
|
|
|
+ if (ListUtil.isEmpty(findAppScoreList))
|
|
|
|
|
+ resetAppScoreNum();
|
|
|
|
|
+ else
|
|
|
|
|
+ loadAppScoreNum(findAppScoreList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onError " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private void initMyAppScore() {
|
|
private void initMyAppScore() {
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getMyAppScore(id)
|
|
SheepApp.getInstance().getNetComponent().getApiService().getMyAppScore(id)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
- LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
|
|
|
|
|
- MyFindAppCore myFindAppCore = baseMessage.getData(MyFindAppCore.class);
|
|
|
|
|
- if(myFindAppCore == null)
|
|
|
|
|
- resetMyAppScore();
|
|
|
|
|
- else
|
|
|
|
|
- loadMyAppScore(myFindAppCore);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
|
|
- LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ MyFindAppCore myFindAppCore = baseMessage.getData(MyFindAppCore.class);
|
|
|
|
|
+ if (myFindAppCore == null)
|
|
|
|
|
+ resetMyAppScore();
|
|
|
|
|
+ else
|
|
|
|
|
+ loadMyAppScore(myFindAppCore);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onError " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@BindView(R.id.find_game_iv)
|
|
@BindView(R.id.find_game_iv)
|
|
@@ -250,6 +277,8 @@ public class ActFindGame extends BaseActivity {
|
|
|
ImageView img_baseactivity_title;
|
|
ImageView img_baseactivity_title;
|
|
|
@BindView(R.id.txt_baseactivity_title)
|
|
@BindView(R.id.txt_baseactivity_title)
|
|
|
View txt_baseactivity_title;
|
|
View txt_baseactivity_title;
|
|
|
|
|
+ @BindView(R.id.ibtn_baseactivity_right)
|
|
|
|
|
+ ImageView ibtn_baseactivity_right;
|
|
|
@BindView(R.id.status_height_view)
|
|
@BindView(R.id.status_height_view)
|
|
|
View status_height_view;
|
|
View status_height_view;
|
|
|
|
|
|
|
@@ -274,6 +303,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
};
|
|
};
|
|
|
@BindView(R.id.homepage_item_banner_layout)
|
|
@BindView(R.id.homepage_item_banner_layout)
|
|
|
RelativeLayout homepage_item_banner_layout;
|
|
RelativeLayout homepage_item_banner_layout;
|
|
|
|
|
+
|
|
|
private void bindBanner() {
|
|
private void bindBanner() {
|
|
|
homepage_item_banner_layout.setVisibility(View.VISIBLE);
|
|
homepage_item_banner_layout.setVisibility(View.VISIBLE);
|
|
|
if (mImageGlarryStr != null) {
|
|
if (mImageGlarryStr != null) {
|
|
@@ -292,6 +322,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
});
|
|
});
|
|
|
mImageGlarryStr.init(pictureList, ImageView.ScaleType.CENTER_CROP, conversion2);
|
|
mImageGlarryStr.init(pictureList, ImageView.ScaleType.CENTER_CROP, conversion2);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//游戏简介与下载
|
|
//游戏简介与下载
|
|
|
@BindView(R.id.find_game_name_tv)
|
|
@BindView(R.id.find_game_name_tv)
|
|
|
TextView find_game_name_tv;
|
|
TextView find_game_name_tv;
|
|
@@ -303,24 +334,25 @@ public class ActFindGame extends BaseActivity {
|
|
|
TextView find_game_down_tv;
|
|
TextView find_game_down_tv;
|
|
|
|
|
|
|
|
private FindApp findApp;
|
|
private FindApp findApp;
|
|
|
|
|
+
|
|
|
private void loadData(final FindApp findApp) {
|
|
private void loadData(final FindApp findApp) {
|
|
|
this.findApp = findApp;
|
|
this.findApp = findApp;
|
|
|
//游戏简介与下载
|
|
//游戏简介与下载
|
|
|
ViewUtil.setImage(find_game_iv, findApp.getIcon());
|
|
ViewUtil.setImage(find_game_iv, findApp.getIcon());
|
|
|
ViewUtil.setText(find_game_name_tv, findApp.getName());
|
|
ViewUtil.setText(find_game_name_tv, findApp.getName());
|
|
|
- final boolean isNeedReservation = !findApp.isCanDonload();//这里认为只有两种状态:可下载与预约下载
|
|
|
|
|
- if(isNeedReservation)
|
|
|
|
|
- ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "开放时间:%s", TimeUtil.TimeStamp2Date(findApp.getDownload_at(), "yyyy-MM-dd\tHH:mm")));
|
|
|
|
|
- else
|
|
|
|
|
- ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "厂商:%s | 版本号:%s\n包体大小:%sM", findApp.getManufacturer(), findApp.getVersions(), findApp.getPackage_size()));
|
|
|
|
|
|
|
+// final boolean isNeedReservation = !findApp.isCanDonload();//这里认为只有两种状态:可下载与预约下载
|
|
|
|
|
+// if (isNeedReservation)
|
|
|
|
|
+// ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "开放时间:%s", TimeUtil.TimeStamp2Date(findApp.getDownload_at(), "yyyy-MM-dd\tHH:mm")));
|
|
|
|
|
+// else
|
|
|
|
|
+ ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "厂商:%s | 版本号:%s\t包体大小:%sM", findApp.getManufacturer(), findApp.getVersions(), findApp.getPackage_size()));
|
|
|
|
|
|
|
|
- find_game_xin.setRating(findApp.getScore()/2);
|
|
|
|
|
|
|
+ find_game_xin.setRating(findApp.getScore() / 2);
|
|
|
|
|
|
|
|
- updateView(this,findApp, find_game_down_tv);
|
|
|
|
|
|
|
+ updateView(this, findApp, find_game_down_tv);
|
|
|
|
|
|
|
|
//游戏图片banner
|
|
//游戏图片banner
|
|
|
String pictures = findApp.getPictures();
|
|
String pictures = findApp.getPictures();
|
|
|
- if(!TextUtils.isEmpty(pictures) && pictures.contains(";")){
|
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(pictures) && pictures.contains(";")) {
|
|
|
pictureList.clear();
|
|
pictureList.clear();
|
|
|
ListUtil.addAll(pictureList, pictures.split(";"));
|
|
ListUtil.addAll(pictureList, pictures.split(";"));
|
|
|
bindBanner();
|
|
bindBanner();
|
|
@@ -328,7 +360,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
homepage_item_banner_layout.setVisibility(View.GONE);
|
|
homepage_item_banner_layout.setVisibility(View.GONE);
|
|
|
}
|
|
}
|
|
|
//应用评分情况
|
|
//应用评分情况
|
|
|
- find_game_xin2.setRating(findApp.getScore()/2);
|
|
|
|
|
|
|
+ find_game_xin2.setRating(findApp.getScore() / 2);
|
|
|
ViewUtil.setText(find_game_score, String.format(Locale.CHINA, "%.1f分", findApp.getScore()));
|
|
ViewUtil.setText(find_game_score, String.format(Locale.CHINA, "%.1f分", findApp.getScore()));
|
|
|
int max = Math.max(1, findApp.getScore_count());
|
|
int max = Math.max(1, findApp.getScore_count());
|
|
|
find_game_progress_1.setMax(max);
|
|
find_game_progress_1.setMax(max);
|
|
@@ -370,7 +402,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
|
|
|
|
|
private void loadAppScoreNum(List<FindAppScore> findAppScoreList) {
|
|
private void loadAppScoreNum(List<FindAppScore> findAppScoreList) {
|
|
|
for (FindAppScore findAppScore : findAppScoreList) {
|
|
for (FindAppScore findAppScore : findAppScoreList) {
|
|
|
- switch (findAppScore.getStar()){
|
|
|
|
|
|
|
+ switch (findAppScore.getStar()) {
|
|
|
case 1:
|
|
case 1:
|
|
|
find_game_progress_1.setProgress(findAppScore.getNum());
|
|
find_game_progress_1.setProgress(findAppScore.getNum());
|
|
|
break;
|
|
break;
|
|
@@ -389,6 +421,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private void resetAppScoreNum() {
|
|
private void resetAppScoreNum() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -408,44 +441,46 @@ public class ActFindGame extends BaseActivity {
|
|
|
find_game_user_commit_tv.setOnClickListener(new View.OnClickListener() {
|
|
find_game_user_commit_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
public void onClick(View view) {
|
|
|
- commitMyAppScore((int) (find_game_user_xin.getRating()*2));
|
|
|
|
|
|
|
+ commitMyAppScore((int) (find_game_user_xin.getRating() * 2));
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private void loadMyAppScore(MyFindAppCore myFindAppCore) {
|
|
private void loadMyAppScore(MyFindAppCore myFindAppCore) {
|
|
|
- find_game_user_xin.setRating(myFindAppCore.getScore()/2);
|
|
|
|
|
|
|
+ find_game_user_xin.setRating(myFindAppCore.getScore() / 2);
|
|
|
find_game_user_commit_tv.setText("重新评分");
|
|
find_game_user_commit_tv.setText("重新评分");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * "application_id": 0,
|
|
|
|
|
+ * "score": 0,
|
|
|
*
|
|
*
|
|
|
- "application_id": 0,
|
|
|
|
|
- "score": 0,
|
|
|
|
|
* @param score 要提交的分数
|
|
* @param score 要提交的分数
|
|
|
*/
|
|
*/
|
|
|
private void commitMyAppScore(int score) {
|
|
private void commitMyAppScore(int score) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("application_id", id);
|
|
jsonObject.put("application_id", id);
|
|
|
- jsonObject.put("score",score );
|
|
|
|
|
|
|
+ jsonObject.put("score", score);
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().commitAppScore(jsonObject)
|
|
SheepApp.getInstance().getNetComponent().getApiService().commitAppScore(jsonObject)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
- LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
|
|
|
|
|
- find_game_user_commit_tv.setText("重新评分");
|
|
|
|
|
- G.showToast(baseMessage);
|
|
|
|
|
- //更新评分与我的评分
|
|
|
|
|
- initAppScoreNum();
|
|
|
|
|
- initMyAppScore();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
|
|
- LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
|
|
- G.showToast(baseMessage);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ find_game_user_commit_tv.setText("重新评分");
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
|
|
+ //更新评分与我的评分
|
|
|
|
|
+ initAppScoreNum();
|
|
|
|
|
+ initMyAppScore();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onError " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void resetUserInfo() {
|
|
private void resetUserInfo() {
|
|
@@ -455,6 +490,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
private void resetMyAppScore() {
|
|
private void resetMyAppScore() {
|
|
|
find_game_user_xin.setRating(0.0f);
|
|
find_game_user_xin.setRating(0.0f);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//游戏介绍
|
|
//游戏介绍
|
|
|
@BindView(R.id.find_game_info_wv)
|
|
@BindView(R.id.find_game_info_wv)
|
|
|
WebView find_game_info_wv;
|
|
WebView find_game_info_wv;
|
|
@@ -465,19 +501,21 @@ public class ActFindGame extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, TextView> downLoadTextViewMap = new HashMap<>();
|
|
private Map<String, TextView> downLoadTextViewMap = new HashMap<>();
|
|
|
|
|
+
|
|
|
//获取任务对应的TextView来更新进度
|
|
//获取任务对应的TextView来更新进度
|
|
|
private TextView getTextViewByTask(DownloadTask task) {
|
|
private TextView getTextViewByTask(DownloadTask task) {
|
|
|
return getTextViewByKey(task.getKey());
|
|
return getTextViewByKey(task.getKey());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private TextView getTextViewByKey(String key) {
|
|
private TextView getTextViewByKey(String key) {
|
|
|
- if(downLoadTextViewMap.containsKey(key))
|
|
|
|
|
|
|
+ if (downLoadTextViewMap.containsKey(key))
|
|
|
return downLoadTextViewMap.get(key);
|
|
return downLoadTextViewMap.get(key);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//更新按钮状态与添加点击事件
|
|
//更新按钮状态与添加点击事件
|
|
|
private void updateView(Activity activity, FindApp findApp, TextView textView) {
|
|
private void updateView(Activity activity, FindApp findApp, TextView textView) {
|
|
|
- if(findApp.isCanDonload()){//可下载
|
|
|
|
|
|
|
+ if (findApp.isCanDonload()) {//可下载
|
|
|
downLoadTextViewMap.put(findApp.getDownload_link(), textView);
|
|
downLoadTextViewMap.put(findApp.getDownload_link(), textView);
|
|
|
downLoadTextViewMap.put(findApp.getPackage_name(), textView);
|
|
downLoadTextViewMap.put(findApp.getPackage_name(), textView);
|
|
|
findApp.getFindAppHelper().updateDownloadTaskView(activity, findApp, textView);
|
|
findApp.getFindAppHelper().updateDownloadTaskView(activity, findApp, textView);
|
|
@@ -487,80 +525,91 @@ public class ActFindGame extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
//下载状态监听
|
|
//下载状态监听
|
|
|
|
|
|
|
|
- @Download.onPre void onPre(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onPre
|
|
|
|
|
+ void onPre(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText("准备下载中");
|
|
textView.setText("准备下载中");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Download.onTaskStart void taskStart(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onTaskStart
|
|
|
|
|
+ void taskStart(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText("开始下载中");
|
|
textView.setText("开始下载中");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- @Download.onTaskResume void taskResume(DownloadTask task) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Download.onTaskResume
|
|
|
|
|
+ void taskResume(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText("恢复下载中");
|
|
textView.setText("恢复下载中");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
|
|
- @Download.onTaskRunning protected void running(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onTaskRunning
|
|
|
|
|
+ protected void running(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText(String.format(Locale.CHINA, "%d%%", Math.abs(task.getPercent())));
|
|
textView.setText(String.format(Locale.CHINA, "%d%%", Math.abs(task.getPercent())));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Download.onTaskStop void taskStop(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onTaskStop
|
|
|
|
|
+ void taskStop(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText(CommonUtil.CONTINUE_DOWNLOAD);
|
|
textView.setText(CommonUtil.CONTINUE_DOWNLOAD);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Download.onNoSupportBreakPoint void onNoSupportBreakPoint(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onNoSupportBreakPoint
|
|
|
|
|
+ void onNoSupportBreakPoint(DownloadTask task) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Download.onTaskCancel void taskCancel(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onTaskCancel
|
|
|
|
|
+ void taskCancel(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText("已经取消");
|
|
textView.setText("已经取消");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Download.onTaskFail void taskFail(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onTaskFail
|
|
|
|
|
+ void taskFail(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText(CommonUtil.FAIL_DOWNLOAD);
|
|
textView.setText(CommonUtil.FAIL_DOWNLOAD);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Download.onTaskComplete void taskComplete(DownloadTask task) {
|
|
|
|
|
|
|
+ @Download.onTaskComplete
|
|
|
|
|
+ void taskComplete(DownloadTask task) {
|
|
|
TextView textView = getTextViewByTask(task);
|
|
TextView textView = getTextViewByTask(task);
|
|
|
- if(textView != null) {
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
textView.setText(CommonUtil.START_INSTALL);
|
|
textView.setText(CommonUtil.START_INSTALL);
|
|
|
}
|
|
}
|
|
|
- if(findApp != null && TextUtils.equals(task.getKey(), findApp.getDownload_link()))
|
|
|
|
|
|
|
+ if (findApp != null && TextUtils.equals(task.getKey(), findApp.getDownload_link()))
|
|
|
findApp.updateState(DownloadTaskService.STATUS_FINISH);
|
|
findApp.updateState(DownloadTaskService.STATUS_FINISH);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Subscribe
|
|
@Subscribe
|
|
|
public void onEventMainThread(Intent intent) {
|
|
public void onEventMainThread(Intent intent) {
|
|
|
- if(intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")){
|
|
|
|
|
- String packageName = intent.getDataString().replace("package:","");
|
|
|
|
|
|
|
+ if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
|
|
|
|
|
+ String packageName = intent.getDataString().replace("package:", "");
|
|
|
|
|
|
|
|
TextView textView = getTextViewByKey(packageName);
|
|
TextView textView = getTextViewByKey(packageName);
|
|
|
- if(textView != null) {
|
|
|
|
|
- switch (intent.getAction()){
|
|
|
|
|
|
|
+ if (textView != null) {
|
|
|
|
|
+ switch (intent.getAction()) {
|
|
|
case ACTION_PACKAGE_ADDED:
|
|
case ACTION_PACKAGE_ADDED:
|
|
|
textView.setText(CommonUtil.GAME_OPEN);
|
|
textView.setText(CommonUtil.GAME_OPEN);
|
|
|
break;
|
|
break;
|
|
|
case ACTION_PACKAGE_REMOVED:
|
|
case ACTION_PACKAGE_REMOVED:
|
|
|
String path = PackageUtil.isExistsFile(packageName);
|
|
String path = PackageUtil.isExistsFile(packageName);
|
|
|
- if(TextUtils.isEmpty(path)) {
|
|
|
|
|
|
|
+ if (TextUtils.isEmpty(path)) {
|
|
|
textView.setText(CommonUtil.START_DOWNLOAD);
|
|
textView.setText(CommonUtil.START_DOWNLOAD);
|
|
|
} else {
|
|
} else {
|
|
|
textView.setText(CommonUtil.START_INSTALL);
|
|
textView.setText(CommonUtil.START_INSTALL);
|
|
@@ -569,14 +618,14 @@ public class ActFindGame extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(findApp != null && TextUtils.equals(packageName, findApp.getPackage_names())){
|
|
|
|
|
- switch (intent.getAction()){
|
|
|
|
|
|
|
+ if (findApp != null && TextUtils.equals(packageName, findApp.getPackage_names())) {
|
|
|
|
|
+ switch (intent.getAction()) {
|
|
|
case ACTION_PACKAGE_ADDED:
|
|
case ACTION_PACKAGE_ADDED:
|
|
|
findApp.updateState(DownloadTaskService.STATUS_INSTALLED);
|
|
findApp.updateState(DownloadTaskService.STATUS_INSTALLED);
|
|
|
break;
|
|
break;
|
|
|
case ACTION_PACKAGE_REMOVED:
|
|
case ACTION_PACKAGE_REMOVED:
|
|
|
String path = PackageUtil.isExistsFile(packageName);
|
|
String path = PackageUtil.isExistsFile(packageName);
|
|
|
- if(TextUtils.isEmpty(path)) {
|
|
|
|
|
|
|
+ if (TextUtils.isEmpty(path)) {
|
|
|
findApp.updateState(DownloadTaskService.STATUS_INIT);
|
|
findApp.updateState(DownloadTaskService.STATUS_INIT);
|
|
|
} else {
|
|
} else {
|
|
|
findApp.updateState(DownloadTaskService.STATUS_FINISH);
|
|
findApp.updateState(DownloadTaskService.STATUS_FINISH);
|
|
@@ -586,6 +635,7 @@ public class ActFindGame extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
super.onDestroy();
|