fix deprecated
This commit is contained in:
@ -3,6 +3,7 @@ package com.gh.common.util;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Message;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
@ -239,7 +240,7 @@ public class DownloadItemUtils {
|
||||
if (isNormal) {
|
||||
holder.gameDownloadBtn.setText("下载中");
|
||||
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
holder.gameDownloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
|
||||
}
|
||||
} else if (status.equals(DownloadStatus.waiting)) {
|
||||
holder.gameProgressbar.setProgress((int) (downloadEntity.getPercent() * 10));
|
||||
@ -253,7 +254,7 @@ public class DownloadItemUtils {
|
||||
if (isNormal) {
|
||||
holder.gameDownloadBtn.setText("下载中");
|
||||
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
holder.gameDownloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
|
||||
}
|
||||
} else if (status.equals(DownloadStatus.pause)
|
||||
|| status.equals(DownloadStatus.timeout)
|
||||
@ -269,7 +270,7 @@ public class DownloadItemUtils {
|
||||
if (isNormal) {
|
||||
holder.gameDownloadBtn.setText("下载中");
|
||||
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
holder.gameDownloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
|
||||
}
|
||||
} else if (status.equals(DownloadStatus.done)) {
|
||||
holder.gameProgressbar.setProgress(1000);
|
||||
@ -388,7 +389,7 @@ public class DownloadItemUtils {
|
||||
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
downloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
|
||||
|
||||
DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
|
||||
} else {
|
||||
@ -397,10 +398,7 @@ public class DownloadItemUtils {
|
||||
}
|
||||
|
||||
//插件化
|
||||
private static void plugin(Context context,
|
||||
GameEntity gameEntity,
|
||||
TextView downloadBtn,
|
||||
String entrance,
|
||||
private static void plugin(Context context, GameEntity gameEntity, TextView downloadBtn, String entrance,
|
||||
String location) {
|
||||
String msg = FileUtils.isCanDownload(context, gameEntity.getApk().get(0).getSize());
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
@ -411,7 +409,7 @@ public class DownloadItemUtils {
|
||||
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
downloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
|
||||
|
||||
DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
|
||||
} else {
|
||||
@ -420,9 +418,7 @@ public class DownloadItemUtils {
|
||||
}
|
||||
|
||||
//安装
|
||||
private static void install(final Context context,
|
||||
GameEntity gameEntity,
|
||||
int position,
|
||||
private static void install(final Context context, GameEntity gameEntity, int position,
|
||||
RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter) {
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance(context).get(gameEntity.getApk().get(0).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
@ -441,10 +437,7 @@ public class DownloadItemUtils {
|
||||
}
|
||||
|
||||
//更新
|
||||
private static void update(Context context,
|
||||
GameEntity gameEntity,
|
||||
String entrance,
|
||||
String location) {
|
||||
private static void update(Context context, GameEntity gameEntity, String entrance, String location) {
|
||||
DataUtils.onGameUpdateEvent(context, gameEntity.getName(), gameEntity.getApk().get(0).getPlatform(), "下载开始");
|
||||
DownloadManager.createDownload(context, gameEntity, "更新", entrance, location);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user