|
|
@@ -1,677 +0,0 @@
|
|
|
-//package com.sheep.gamegroup.view.activity;
|
|
|
-//
|
|
|
-//import android.app.Activity;
|
|
|
-//import android.content.Intent;
|
|
|
-//import android.os.Bundle;
|
|
|
-//import android.support.annotation.Nullable;
|
|
|
-//import android.support.design.widget.AppBarLayout;
|
|
|
-//import android.support.v7.widget.AppCompatRatingBar;
|
|
|
-//import android.support.v7.widget.RecyclerView;
|
|
|
-//import android.text.TextUtils;
|
|
|
-//import android.view.View;
|
|
|
-//import android.widget.ImageView;
|
|
|
-//import android.widget.ProgressBar;
|
|
|
-//import android.widget.RatingBar;
|
|
|
-//import android.widget.RelativeLayout;
|
|
|
-//import android.widget.TextView;
|
|
|
-//
|
|
|
-//import com.alibaba.fastjson.JSONObject;
|
|
|
-//import com.kfzs.duanduan.utils.StatusBarUtils;
|
|
|
-//import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
-//import com.sheep.gamegroup.event.BigEvent;
|
|
|
-//import com.sheep.gamegroup.greendao.download.DownLoadInfo;
|
|
|
-//import com.sheep.gamegroup.helper.ImageListHelper;
|
|
|
-//import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
-//import com.sheep.gamegroup.model.entity.GameApp;
|
|
|
-//import com.sheep.gamegroup.model.entity.GameAppScore;
|
|
|
-//import com.sheep.gamegroup.model.entity.MyFindAppCore;
|
|
|
-//import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
-//import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
-//import com.sheep.gamegroup.util.CommonUtil;
|
|
|
-//import com.sheep.gamegroup.util.DataUtil;
|
|
|
-//import com.sheep.gamegroup.util.DownloadUtil;
|
|
|
-//import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
-//import com.sheep.gamegroup.util.Jump2View;
|
|
|
-//import com.sheep.gamegroup.util.ListUtil;
|
|
|
-//import com.sheep.gamegroup.util.TimeUtil;
|
|
|
-//import com.sheep.gamegroup.util.ViewUtil;
|
|
|
-//import com.sheep.jiuyan.samllsheep.R;
|
|
|
-//import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
-//import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
-//import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
|
|
|
-//import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
-//import com.tencent.smtt.sdk.WebView;
|
|
|
-//
|
|
|
-//import org.afinal.simplecache.ApiKey;
|
|
|
-//import org.greenrobot.eventbus.EventBus;
|
|
|
-//import org.greenrobot.eventbus.Subscribe;
|
|
|
-//
|
|
|
-//import java.util.ArrayList;
|
|
|
-//import java.util.HashMap;
|
|
|
-//import java.util.List;
|
|
|
-//import java.util.Locale;
|
|
|
-//import java.util.Map;
|
|
|
-//
|
|
|
-//import butterknife.BindView;
|
|
|
-//import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
-//import rx.functions.Action1;
|
|
|
-//import io.reactivex.schedulers.Schedulers;
|
|
|
-//
|
|
|
-//import static android.content.Intent.ACTION_PACKAGE_ADDED;
|
|
|
-//import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
|
|
-//import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SCORE;
|
|
|
-//import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * Created by realicing on 2018/5/10.
|
|
|
-// * realicing@sina.com
|
|
|
-// */
|
|
|
-//public class ActFindGame extends BaseActivity {
|
|
|
-// @Override
|
|
|
-// protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
-// StatusBarUtils.setTranslucent(this);
|
|
|
-// super.onCreate(savedInstanceState);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// protected int getLayoutId() {
|
|
|
-// return R.layout.act_find_game;
|
|
|
-// }
|
|
|
-//
|
|
|
-// private int id;
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void initView() {
|
|
|
-// id = getIntent().getIntExtra("id", 0);
|
|
|
-// TitleBarUtils.getInstance()
|
|
|
-// .setTitle(this, "详情")
|
|
|
-// .setTitleFinish(this)
|
|
|
-// .setRightImgBotton(this, R.mipmap.share, new View.OnClickListener() {
|
|
|
-// @Override
|
|
|
-// public void onClick(View view) {
|
|
|
-// FIND_SHARE.onEvent("application_id", id);
|
|
|
-// Jump2View.getInstance().tryShare(ActFindGame.this, "find_share_url", "application_id", id);
|
|
|
-// }
|
|
|
-// });
|
|
|
-//
|
|
|
-// EventBus.getDefault().register(this);
|
|
|
-//
|
|
|
-// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, G.BAR_HEIGHT);
|
|
|
-// status_height_view.setLayoutParams(params);
|
|
|
-// /*
|
|
|
-// 标题显示和隐藏的监听
|
|
|
-// */
|
|
|
-// ((AppBarLayout) findViewById(R.id.appbar_act_game_details)).addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
|
|
-// @Override
|
|
|
-// public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
|
-// int nameWidth = find_game_name_tv.getWidth();
|
|
|
-// if (nameWidth == 0) {
|
|
|
-// find_game_name_tv.measure(0, 0);
|
|
|
-// nameWidth = find_game_name_tv.getMeasuredWidth();
|
|
|
-// }
|
|
|
-// int infoWidth = find_game_info_tv.getWidth();
|
|
|
-// if (infoWidth == 0) {
|
|
|
-// find_game_info_tv.measure(0, 0);
|
|
|
-// infoWidth = find_game_info_tv.getMeasuredWidth();
|
|
|
-// }
|
|
|
-// //图标位置变化
|
|
|
-// int find_game_top = getResources().getDimensionPixelSize(R.dimen.find_game_top);
|
|
|
-// int find_icon_with = getResources().getDimensionPixelSize(R.dimen.find_icon_with);
|
|
|
-//// int leftMargin = getResources().getDimensionPixelSize(R.dimen.content_padding_5);
|
|
|
-// int titleHeight = img_baseactivity_title.getHeight();
|
|
|
-// int titleWidth = img_baseactivity_title.getWidth();
|
|
|
-// int topRow = (titleHeight - find_game_name_tv.getHeight() - find_game_info_tv.getHeight()) / 5;
|
|
|
-// int topRow2 = (titleHeight - find_game_name_tv.getHeight()) / 2;
|
|
|
-// int leftRow = topRow2 / 4;//isNeedReservation ? topRow : 5 * topRow;
|
|
|
-//
|
|
|
-// int willTop = Math.max(topRow / 2, find_game_top + verticalOffset);
|
|
|
-// int row = (find_icon_with * willTop + titleHeight * (find_game_top - willTop)) / find_game_top - topRow;
|
|
|
-// 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);
|
|
|
-// //名字位置变化
|
|
|
-// RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) find_game_name_tv.getLayoutParams();
|
|
|
-// 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);
|
|
|
-// find_game_name_tv.setLayoutParams(layoutParams2);
|
|
|
-// //信息位置变化
|
|
|
-// RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) find_game_info_tv.getLayoutParams();
|
|
|
-// int left1 = (G.WIDTH - infoWidth) / 2;
|
|
|
-// int left2 = titleWidth + row + 2 * leftRow;
|
|
|
-// 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/*)*/;
|
|
|
-// 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);// Math.max(topRow, getResources().getDimensionPixelSize(R.dimen.find_game_top4) + verticalOffset);
|
|
|
-// find_game_down_tv.setLayoutParams(layoutParams4);
|
|
|
-// //星级位置变化
|
|
|
-// RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) find_game_xin.getLayoutParams();
|
|
|
-// layoutParams5.topMargin = getResources().getDimensionPixelSize(R.dimen.find_game_top5) + verticalOffset;
|
|
|
-// find_game_xin.setLayoutParams(layoutParams5);
|
|
|
-// if (willTop == topRow / 2) {
|
|
|
-// if (mIsExpanded) {
|
|
|
-//// txt_baseactivity_title.setVisibility(View.INVISIBLE);
|
|
|
-// find_game_bar.setVisibility(View.VISIBLE);
|
|
|
-// title_bottom_line.setVisibility(View.VISIBLE);
|
|
|
-// img_baseactivity_title.setImageLevel(1);
|
|
|
-// 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);//不显示标题栏
|
|
|
-// bindBanner();
|
|
|
-// resetData();
|
|
|
-// resetAppScoreNum();
|
|
|
-// resetMyAppScore();
|
|
|
-// resetUserInfo();
|
|
|
-// if (isShowAppScore) {
|
|
|
-// find_game_score_no.setVisibility(View.VISIBLE);
|
|
|
-// find_game_score_my.setVisibility(View.VISIBLE);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// private boolean mIsExpanded = false;//是否是折叠状态
|
|
|
-// private boolean isShowAppScore = false;//是否显示评分模块
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void initListener() {
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void initData() {
|
|
|
-// GameApp findApp = DataUtil.getInstance().getCacheResult(ApiKey.applications(id), GameApp.class);
|
|
|
-// if (findApp != null) {
|
|
|
-// loadApp(findApp);
|
|
|
-// }
|
|
|
-// initFindAppFromNet();
|
|
|
-// if (isShowAppScore) {
|
|
|
-// initAppScoreNum();
|
|
|
-// initMyAppScore();
|
|
|
-// }
|
|
|
-// UserEntity userEntity = DataUtil.getInstance().getUserEntity();
|
|
|
-// if (userEntity == null) {
|
|
|
-// CommonUtil.getInstance().updateUserInfo(new Action1<UserEntity>() {
|
|
|
-// @Override
|
|
|
-// public void call(UserEntity userEntity) {
|
|
|
-// if (userEntity != null) {
|
|
|
-// loadUserInfo(userEntity);
|
|
|
-// } else {
|
|
|
-// resetUserInfo();
|
|
|
-// }
|
|
|
-// }
|
|
|
-// });
|
|
|
-// } else {
|
|
|
-// loadUserInfo(userEntity);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void initFindAppFromNet() {
|
|
|
-// showProgress();
|
|
|
-// SheepApp.getInstance().getNetComponent().getApiService().getAppDetail(id)
|
|
|
-// .subscribeOn(Schedulers.io())
|
|
|
-// .observeOn(AndroidSchedulers.mainThread())
|
|
|
-// .subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
|
-// @Override
|
|
|
-// public void onNext(BaseMessage baseMessage) {
|
|
|
-// boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.applications(id));
|
|
|
-// if (isNewData) {
|
|
|
-// GameApp findApp = baseMessage.getData(GameApp.class);
|
|
|
-// loadApp(findApp);
|
|
|
-// }
|
|
|
-// hideProgress();
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onError(BaseMessage baseMessage) {
|
|
|
-// G.showToast(baseMessage);
|
|
|
-// resetData();
|
|
|
-// hideProgress();
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void loadApp(GameApp findApp) {
|
|
|
-// if (findApp != null) {
|
|
|
-// loadData(findApp);
|
|
|
-// } else {
|
|
|
-// resetData();
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void initAppScoreNum() {
|
|
|
-// List<GameAppScore> findAppScoreList = DataUtil.getInstance().getCacheList(ApiKey.score_num(id), GameAppScore.class);
|
|
|
-// if (!findAppScoreList.isEmpty()) {
|
|
|
-// loadAppScoreNum(findAppScoreList);
|
|
|
-// }
|
|
|
-// SheepApp.getInstance().getNetComponent().getApiService().getAppScoreNum(id)
|
|
|
-// .subscribeOn(Schedulers.io())
|
|
|
-// .observeOn(AndroidSchedulers.mainThread())
|
|
|
-// .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
-// @Override
|
|
|
-// public void onNext(BaseMessage baseMessage) {
|
|
|
-// List<GameAppScore> findAppScoreList = baseMessage.getDataList(GameAppScore.class);
|
|
|
-// if (ListUtil.isEmpty(findAppScoreList))
|
|
|
-// resetAppScoreNum();
|
|
|
-// else
|
|
|
-// loadAppScoreNum(findAppScoreList);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onError(BaseMessage baseMessage) {
|
|
|
-// G.showToast(baseMessage);
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void initMyAppScore() {
|
|
|
-// MyFindAppCore myFindAppCore = DataUtil.getInstance().getCacheResult(ApiKey.my_score(id), MyFindAppCore.class);
|
|
|
-// if (myFindAppCore == null) {
|
|
|
-// SheepApp.getInstance().getNetComponent().getApiService().getMyAppScore(id)
|
|
|
-// .subscribeOn(Schedulers.io())
|
|
|
-// .observeOn(AndroidSchedulers.mainThread())
|
|
|
-// .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
-// @Override
|
|
|
-// public void onNext(BaseMessage baseMessage) {
|
|
|
-// MyFindAppCore myFindAppCore = baseMessage.getData(MyFindAppCore.class);
|
|
|
-// if (myFindAppCore == null)
|
|
|
-// resetMyAppScore();
|
|
|
-// else
|
|
|
-// loadMyAppScore(myFindAppCore);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onError(BaseMessage baseMessage) {
|
|
|
-// resetMyAppScore();
|
|
|
-// }
|
|
|
-// });
|
|
|
-// } else {
|
|
|
-// loadMyAppScore(myFindAppCore);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @BindView(R.id.find_game_iv)
|
|
|
-// ImageView find_game_iv;
|
|
|
-// @BindView(R.id.find_game_bar)
|
|
|
-// View find_game_bar;
|
|
|
-// @BindView(R.id.title_bottom_line)
|
|
|
-// View title_bottom_line;
|
|
|
-// @BindView(R.id.img_baseactivity_title)
|
|
|
-// ImageView img_baseactivity_title;
|
|
|
-// @BindView(R.id.txt_baseactivity_title)
|
|
|
-// View txt_baseactivity_title;
|
|
|
-// @BindView(R.id.ibtn_baseactivity_right)
|
|
|
-// ImageView ibtn_baseactivity_right;
|
|
|
-// @BindView(R.id.status_height_view)
|
|
|
-// View status_height_view;
|
|
|
-//
|
|
|
-// //游戏banner图片
|
|
|
-// @BindView(R.id.find_game_list)
|
|
|
-// RecyclerView find_game_list;
|
|
|
-// private ArrayList<String> pictureList = ListUtil.emptyList();
|
|
|
-//
|
|
|
-// private void bindBanner() {
|
|
|
-// ImageListHelper.initList(this, find_game_list, pictureList);
|
|
|
-// }
|
|
|
-//
|
|
|
-// //游戏简介与下载
|
|
|
-// @BindView(R.id.find_game_name_tv)
|
|
|
-// TextView find_game_name_tv;
|
|
|
-// @BindView(R.id.find_game_info_tv)
|
|
|
-// TextView find_game_info_tv;
|
|
|
-// @BindView(R.id.find_game_xin)
|
|
|
-// RatingBar find_game_xin;
|
|
|
-// @BindView(R.id.find_game_down_tv)
|
|
|
-// TextView find_game_down_tv;
|
|
|
-//
|
|
|
-// private GameApp findApp;
|
|
|
-// private boolean isNeedReservation = false;
|
|
|
-//
|
|
|
-// private void loadData(final GameApp findApp) {
|
|
|
-// this.findApp = findApp;
|
|
|
-// //游戏简介与下载
|
|
|
-// GlideImageLoader.setGameImage(find_game_iv, findApp.getIcon());
|
|
|
-// ViewUtil.setText(find_game_name_tv, findApp.getName());
|
|
|
-// isNeedReservation = !findApp.isCanDownload();//这里认为只有两种状态:可下载与预约下载
|
|
|
-// if (isNeedReservation)
|
|
|
-// ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "开放时间:%s", TimeUtil.TimeStamp2Date(findApp.getDownload_at(), "yyyy-MM-dd\u0020HH:mm")));
|
|
|
-// else {
|
|
|
-// String format = !TextUtils.isEmpty(findApp.getManufacturer()) && findApp.getManufacturer().length() > 5 ? "厂商:%s\n版本号:%s | 包体大小:%sM" : "厂商:%s | 版本号:%s\n包体大小:%sM";
|
|
|
-// ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, format, findApp.getManufacturer(), findApp.getVersions(), findApp.getPackage_size()));
|
|
|
-// }
|
|
|
-//
|
|
|
-// find_game_xin.setRating(findApp.getScore() / 2);
|
|
|
-//
|
|
|
-// updateView(this, findApp, find_game_down_tv);
|
|
|
-//
|
|
|
-// //游戏图片banner
|
|
|
-// String pictures = findApp.getPictures();
|
|
|
-// if (!TextUtils.isEmpty(pictures) && pictures.contains(";")) {
|
|
|
-// pictureList.clear();
|
|
|
-// ListUtil.addAll(pictureList, pictures.split(";"));
|
|
|
-// find_game_list.setVisibility(View.VISIBLE);
|
|
|
-// find_game_list.getAdapter().notifyDataSetChanged();
|
|
|
-// } else {
|
|
|
-// find_game_list.setVisibility(View.GONE);
|
|
|
-// }
|
|
|
-// //应用评分情况
|
|
|
-// find_game_xin2.setRating(findApp.getScore() / 2);
|
|
|
-// ViewUtil.setText(find_game_score, String.format(Locale.CHINA, "%.1f分", findApp.getScore()));
|
|
|
-// int max = Math.max(1, findApp.getScore_count());
|
|
|
-// find_game_progress_1.setMax(max);
|
|
|
-// find_game_progress_2.setMax(max);
|
|
|
-// find_game_progress_3.setMax(max);
|
|
|
-// find_game_progress_4.setMax(max);
|
|
|
-// find_game_progress_5.setMax(max);
|
|
|
-// //游戏介绍
|
|
|
-// loadAppInfo(findApp);
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void resetData() {
|
|
|
-// //游戏简介与下载
|
|
|
-// ViewUtil.setText(find_game_name_tv);
|
|
|
-// ViewUtil.setText(find_game_info_tv);
|
|
|
-// ViewUtil.setText(find_game_down_tv);
|
|
|
-// find_game_xin.setRating(0.0f);
|
|
|
-// //应用评分情况
|
|
|
-// find_game_xin2.setRating(0);
|
|
|
-// ViewUtil.setText(find_game_score, "0.0分");
|
|
|
-// //游戏介绍
|
|
|
-// }
|
|
|
-//
|
|
|
-// //应用评分情况
|
|
|
-// @BindView(R.id.find_game_score_no)
|
|
|
-// View find_game_score_no;
|
|
|
-// @BindView(R.id.find_game_score_my)
|
|
|
-// View find_game_score_my;
|
|
|
-// @BindView(R.id.find_game_xin2)
|
|
|
-// AppCompatRatingBar find_game_xin2;
|
|
|
-// @BindView(R.id.find_game_progress_5)
|
|
|
-// ProgressBar find_game_progress_5;
|
|
|
-// @BindView(R.id.find_game_progress_4)
|
|
|
-// ProgressBar find_game_progress_4;
|
|
|
-// @BindView(R.id.find_game_progress_3)
|
|
|
-// ProgressBar find_game_progress_3;
|
|
|
-// @BindView(R.id.find_game_progress_2)
|
|
|
-// ProgressBar find_game_progress_2;
|
|
|
-// @BindView(R.id.find_game_progress_1)
|
|
|
-// ProgressBar find_game_progress_1;
|
|
|
-// @BindView(R.id.find_game_score)
|
|
|
-// TextView find_game_score;
|
|
|
-//
|
|
|
-// private void loadAppScoreNum(List<GameAppScore> findAppScoreList) {
|
|
|
-// for (GameAppScore findAppScore : findAppScoreList) {
|
|
|
-// switch (findAppScore.getStar()) {
|
|
|
-// case 1:
|
|
|
-// find_game_progress_1.setProgress(findAppScore.getNum());
|
|
|
-// break;
|
|
|
-// case 2:
|
|
|
-// find_game_progress_2.setProgress(findAppScore.getNum());
|
|
|
-// break;
|
|
|
-// case 3:
|
|
|
-// find_game_progress_3.setProgress(findAppScore.getNum());
|
|
|
-// break;
|
|
|
-// case 4:
|
|
|
-// find_game_progress_4.setProgress(findAppScore.getNum());
|
|
|
-// break;
|
|
|
-// case 5:
|
|
|
-// find_game_progress_5.setProgress(findAppScore.getNum());
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void resetAppScoreNum() {
|
|
|
-// }
|
|
|
-//
|
|
|
-// //用户信息与提交评分
|
|
|
-// @BindView(R.id.find_game_user_iv)
|
|
|
-// ImageView find_game_user_iv;
|
|
|
-// @BindView(R.id.find_game_user_name_tv)
|
|
|
-// TextView find_game_user_name_tv;
|
|
|
-// @BindView(R.id.find_game_user_xin)
|
|
|
-// AppCompatRatingBar find_game_user_xin;
|
|
|
-// @BindView(R.id.find_game_user_commit_tv)
|
|
|
-// TextView find_game_user_commit_tv;
|
|
|
-//
|
|
|
-// private void loadUserInfo(final UserEntity userEntity) {
|
|
|
-// GlideImageLoader.setAvatar(find_game_user_iv, userEntity.getAvatar());
|
|
|
-// ViewUtil.setText(find_game_user_name_tv, userEntity.getNickname());
|
|
|
-// find_game_user_commit_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
-// @Override
|
|
|
-// public void onClick(View view) {
|
|
|
-// commitMyAppScore((int) (find_game_user_xin.getRating() * 2));
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void loadMyAppScore(MyFindAppCore myFindAppCore) {
|
|
|
-// find_game_user_xin.setRating(myFindAppCore.getScore() / 2);
|
|
|
-// find_game_user_commit_tv.setText("重新评分");
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * "application_id": 0,
|
|
|
-// * "score": 0,
|
|
|
-// *
|
|
|
-// * @param score 要提交的分数
|
|
|
-// */
|
|
|
-// private void commitMyAppScore(int score) {
|
|
|
-// FIND_SCORE.onEvent("application_id", id);
|
|
|
-// JSONObject jsonObject = new JSONObject();
|
|
|
-// jsonObject.put("application_id", id);
|
|
|
-// jsonObject.put("score", score);
|
|
|
-// SheepApp.getInstance().getNetComponent().getApiService().commitAppScore(jsonObject)
|
|
|
-// .subscribeOn(Schedulers.io())
|
|
|
-// .observeOn(AndroidSchedulers.mainThread())
|
|
|
-// .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
-// @Override
|
|
|
-// public void onNext(BaseMessage baseMessage) {
|
|
|
-// find_game_user_commit_tv.setText("重新评分");
|
|
|
-// G.showToast(baseMessage);
|
|
|
-// //更新评分与我的评分
|
|
|
-// initAppScoreNum();
|
|
|
-// initMyAppScore();
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onError(BaseMessage baseMessage) {
|
|
|
-// G.showToast(baseMessage);
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void resetUserInfo() {
|
|
|
-// ViewUtil.setText(find_game_user_name_tv);
|
|
|
-// }
|
|
|
-//
|
|
|
-// private void resetMyAppScore() {
|
|
|
-// find_game_user_xin.setRating(0.0f);
|
|
|
-// }
|
|
|
-//
|
|
|
-// //游戏介绍
|
|
|
-// @BindView(R.id.find_game_info_wv)
|
|
|
-// WebView find_game_info_wv;
|
|
|
-//
|
|
|
-// private void loadAppInfo(final GameApp findApp) {
|
|
|
-// ViewUtil.loadDataWithBaseURL(find_game_info_wv, findApp.getIntro());
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// private Map<String, TextView> downLoadTextViewMap = new HashMap<>();
|
|
|
-//
|
|
|
-// //获取任务对应的TextView来更新进度
|
|
|
-// private TextView getTextViewByTask(DownLoadInfo task) {
|
|
|
-// return getTextViewByKey(task.getMDownloadUrl());
|
|
|
-// }
|
|
|
-//
|
|
|
-// private TextView getTextViewByKey(String key) {
|
|
|
-// if (downLoadTextViewMap.containsKey(key))
|
|
|
-// return downLoadTextViewMap.get(key);
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// //更新按钮状态与添加点击事件
|
|
|
-// private void updateView(Activity activity, GameApp findApp, TextView textView) {
|
|
|
-// if (findApp.getAvailable_receive() == 0 && findApp.getReceive_account() == 0) {//未领取账号
|
|
|
-//
|
|
|
-// CommonUtil.getInstance()
|
|
|
-// .xiaomiRevieceAcctoun(find_game_down_tv, findApp, activity);
|
|
|
-// } else if (findApp.isCanDownload()) {//可下载
|
|
|
-// downLoadTextViewMap.put(findApp.getDownload_link(), textView);
|
|
|
-// downLoadTextViewMap.put(findApp.getPackage_name(), textView);
|
|
|
-// findApp.getFindAppHelper().updateDownloadTaskView(activity, findApp, textView);
|
|
|
-// } else {//预约下载
|
|
|
-// findApp.getFindAppHelper().updateReservationView(activity, findApp, textView);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// //下载状态监听
|
|
|
-// void onPre(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText("准备下载中");
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// void taskStart(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText("开始下载中");
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// void taskResume(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText("恢复下载中");
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// //在这里处理任务执行中的状态,如进度进度条的刷新
|
|
|
-// protected void running(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText(String.format(Locale.CHINA, "%d%%(%s)", Math.abs(task.getMPercent()), task.getAverageSpeed()));//添加下载速度
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// void taskStop(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText(CommonUtil.CONTINUE_DOWNLOAD);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// void taskCancel(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText("已经取消");
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// void taskFail(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText(CommonUtil.FAIL_DOWNLOAD);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// void taskComplete(DownLoadInfo task) {
|
|
|
-// TextView textView = getTextViewByTask(task);
|
|
|
-// if (textView != null) {
|
|
|
-// textView.setText(CommonUtil.START_INSTALL);
|
|
|
-// }
|
|
|
-// if (findApp != null && TextUtils.equals(task.getMDownloadUrl(), findApp.getDownload_link()))
|
|
|
-// findApp.updateState(DownloadUtil.STATUS_FINISH);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Subscribe
|
|
|
-// public void onEventMainThread(Intent intent) {
|
|
|
-// if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
|
|
|
-// String packageName = intent.getDataString().replace("package:", "");
|
|
|
-//
|
|
|
-// TextView textView = getTextViewByKey(packageName);
|
|
|
-// if (textView != null && findApp != null) {
|
|
|
-// switch (intent.getAction()) {
|
|
|
-// case ACTION_PACKAGE_ADDED:
|
|
|
-// textView.setText(CommonUtil.GAME_OPEN);
|
|
|
-// break;
|
|
|
-// case ACTION_PACKAGE_REMOVED:
|
|
|
-// String path = PackageUtil.isExistsFile(packageName, findApp.getDownload_url());
|
|
|
-// if (TextUtils.isEmpty(path)) {
|
|
|
-// textView.setText(CommonUtil.START_DOWNLOAD);
|
|
|
-// } else {
|
|
|
-// textView.setText(CommonUtil.START_INSTALL);
|
|
|
-// }
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (findApp != null && TextUtils.equals(packageName, findApp.getPackage_names())) {
|
|
|
-// switch (intent.getAction()) {
|
|
|
-// case ACTION_PACKAGE_ADDED:
|
|
|
-// findApp.updateState(DownloadUtil.STATUS_INSTALLED);
|
|
|
-// break;
|
|
|
-// case ACTION_PACKAGE_REMOVED:
|
|
|
-// String path = PackageUtil.isExistsFile(packageName, findApp.getDownload_url());
|
|
|
-// if (TextUtils.isEmpty(path)) {
|
|
|
-// findApp.updateState(DownloadUtil.STATUS_INIT);
|
|
|
-// } else {
|
|
|
-// findApp.updateState(DownloadUtil.STATUS_FINISH);
|
|
|
-// }
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Subscribe
|
|
|
-// public void onEventMainThread(BigEvent event) {
|
|
|
-// switch (event.getEventTypes()) {
|
|
|
-// case REFRESH_XIAOMI_GAME_LIST:
|
|
|
-// initData();
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// if (event.getData() instanceof DownLoadInfo) {
|
|
|
-// DownLoadInfo task = (DownLoadInfo) event.getData();
|
|
|
-// switch (event.getEventTypes()) {
|
|
|
-// case DOWNLOAD_RUNNING:
|
|
|
-// running(task);
|
|
|
-// break;
|
|
|
-// case DOWNLOAD_STOP:
|
|
|
-// taskStop(task);
|
|
|
-// break;
|
|
|
-// case DOWNLOAD_COMPLETE:
|
|
|
-// taskComplete(task);
|
|
|
-// break;
|
|
|
-// case DOWNLOAD_CANCEL:
|
|
|
-// taskCancel(task);
|
|
|
-// break;
|
|
|
-// case DOWNLOAD_FAIL:
|
|
|
-// taskFail(task);
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// protected void onDestroy() {
|
|
|
-// super.onDestroy();
|
|
|
-// EventBus.getDefault().unregister(this);
|
|
|
-// }
|
|
|
-//}
|