删除无用代码,临时修复下载插件化判断错误问题

This commit is contained in:
kehaoyuan@ghzhushou.com
2020-04-21 10:25:42 +08:00
parent 29430b9967
commit 0ba598ee67
2 changed files with 28 additions and 54 deletions

View File

@ -24,9 +24,7 @@ import androidx.core.content.ContextCompat;
public class DownloadProgressBar extends ProgressBar {
public static final int MAX_LENGTH = 1000;
public static final int DOWNLOAD_NORMAL_STYLE = 0;
public static final int DOWNLOAD_RECT_STYLE = 1;
public static final int DOWNLOAD_IMAGE_STYLE = 2;
public static final int DOWNLOAD_SLIDE_STYLE = 3;
public enum DownloadType {
NORMAL,
@ -115,8 +113,6 @@ public class DownloadProgressBar extends ProgressBar {
int color = Color.WHITE;
if (DOWNLOAD_IMAGE_STYLE == mDownloadStyle) {
color = Color.BLACK;
} else if (DOWNLOAD_SLIDE_STYLE == mDownloadStyle) {
color = getResources().getColor(R.color.theme_font);
}
mPaint.setColor(color); // 反向颜色
}
@ -167,72 +163,47 @@ public class DownloadProgressBar extends ProgressBar {
case NONE_WITH_HINT:
case INSTALL_NORMAL:
case H5_GAME:
switch (mDownloadStyle) {
case DOWNLOAD_RECT_STYLE:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_rect_style));
mDefaultColor = Color.WHITE;
break;
case DOWNLOAD_IMAGE_STYLE:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_image_style));
mDefaultColor = Color.BLACK;
break;
default:
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = Color.WHITE;
break;
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_image_style));
mDefaultColor = Color.BLACK;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = Color.WHITE;
}
setProgress(0);
break;
case PLUGIN:
case INSTALL_PLUGIN:
setProgressDrawable(getResources().getDrawable(mDownloadStyle == DOWNLOAD_RECT_STYLE
? R.drawable.detail_download_plugin_install_rect_style : R.drawable.download_button_pluggable_style));
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_pluggable_style));
mDefaultColor = Color.WHITE;
setProgress(0);
break;
case NONE:
setProgressDrawable(getResources().getDrawable(mDownloadStyle == DOWNLOAD_RECT_STYLE
? R.drawable.detail_download_none_rect_style : R.drawable.news_detail_comment));
setProgressDrawable(getResources().getDrawable(R.drawable.news_detail_comment));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.hint);
setProgress(0);
break;
case LAUNCH_OR_OPEN:
switch (mDownloadStyle) {
case DOWNLOAD_RECT_STYLE:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_rect_style));
mDefaultColor = Color.WHITE;
break;
case DOWNLOAD_IMAGE_STYLE:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_open_image_style));
mDefaultColor = Color.WHITE;
break;
default:
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = Color.WHITE;
break;
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_open_image_style));
mDefaultColor = Color.WHITE;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = Color.WHITE;
}
setProgress(0);
break;
case DOWNLOADING_NORMAL:
switch (mDownloadStyle) {
case DOWNLOAD_RECT_STYLE:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_rect_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme_font);
break;
case DOWNLOAD_IMAGE_STYLE:
case DOWNLOAD_SLIDE_STYLE:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_image_style));
mDefaultColor = Color.WHITE;
break;
default:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme_font);
break;
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_image_style));
mDefaultColor = Color.WHITE;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme_font);
}
break;
case DOWNLOADING_PLUGIN:
setProgressDrawable(getResources().getDrawable(mDownloadStyle == DOWNLOAD_RECT_STYLE
? R.drawable.detail_downloading_plugin_rect_style : R.drawable.detail_downloading_plugin_style));
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_plugin_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_00D7B0);
break;
case RESERVABLE: