|
@@ -90,8 +90,8 @@ public class DownListAdapter extends BaseAdapter {
|
|
|
|
|
|
|
|
private ImageView ImageView;
|
|
private ImageView ImageView;
|
|
|
private TextView tv_game_name;
|
|
private TextView tv_game_name;
|
|
|
- private TextView tv_state;
|
|
|
|
|
- private TextView tv_remove;
|
|
|
|
|
|
|
+ private ImageView iv_state;
|
|
|
|
|
+ private ImageView iv_remove;
|
|
|
private ProgressBar pb_download;
|
|
private ProgressBar pb_download;
|
|
|
private TextView tv_prorgess;
|
|
private TextView tv_prorgess;
|
|
|
|
|
|
|
@@ -99,9 +99,9 @@ public class DownListAdapter extends BaseAdapter {
|
|
|
super(view, downloadInfo);
|
|
super(view, downloadInfo);
|
|
|
ImageView=(ImageView) view.findViewById(R.id.img_icon);
|
|
ImageView=(ImageView) view.findViewById(R.id.img_icon);
|
|
|
tv_game_name=(TextView) view.findViewById(R.id.tv_game_name);
|
|
tv_game_name=(TextView) view.findViewById(R.id.tv_game_name);
|
|
|
- tv_state=(TextView) view.findViewById(R.id.tv_state);
|
|
|
|
|
|
|
+ iv_state=(ImageView) view.findViewById(R.id.iv_state);
|
|
|
pb_download=(ProgressBar) view.findViewById(R.id.pb_download);
|
|
pb_download=(ProgressBar) view.findViewById(R.id.pb_download);
|
|
|
- tv_remove=(TextView)view.findViewById(R.id.tv_remove);
|
|
|
|
|
|
|
+ iv_remove=(ImageView)view.findViewById(R.id.iv_remove);
|
|
|
tv_prorgess=(TextView) view.findViewById(R.id.tv_prorgess);
|
|
tv_prorgess=(TextView) view.findViewById(R.id.tv_prorgess);
|
|
|
refresh();
|
|
refresh();
|
|
|
Glide.with(mContext)
|
|
Glide.with(mContext)
|
|
@@ -109,8 +109,8 @@ public class DownListAdapter extends BaseAdapter {
|
|
|
.placeholder(R.drawable.icon)
|
|
.placeholder(R.drawable.icon)
|
|
|
.dontAnimate()
|
|
.dontAnimate()
|
|
|
.into(ImageView);
|
|
.into(ImageView);
|
|
|
- tv_state.setOnClickListener(this);
|
|
|
|
|
- tv_remove.setOnClickListener(this);
|
|
|
|
|
|
|
+ iv_state.setOnClickListener(this);
|
|
|
|
|
+ iv_remove.setOnClickListener(this);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -157,18 +157,19 @@ public class DownListAdapter extends BaseAdapter {
|
|
|
switch (state) {
|
|
switch (state) {
|
|
|
case WAITING:
|
|
case WAITING:
|
|
|
case STARTED:
|
|
case STARTED:
|
|
|
- tv_state.setText("暂停");
|
|
|
|
|
|
|
+ iv_state.setImageResource(R.drawable.icon_stop);
|
|
|
break;
|
|
break;
|
|
|
case ERROR:
|
|
case ERROR:
|
|
|
case STOPPED:
|
|
case STOPPED:
|
|
|
- tv_state.setText("开始");
|
|
|
|
|
|
|
+ iv_state.setImageResource(R.drawable.icon_begin);
|
|
|
break;
|
|
break;
|
|
|
case FINISHED:
|
|
case FINISHED:
|
|
|
PackageUtil.installApk(mContext, getDownloadInfo().getFileSavePath());
|
|
PackageUtil.installApk(mContext, getDownloadInfo().getFileSavePath());
|
|
|
- tv_state.setText("完成");
|
|
|
|
|
|
|
+ iv_state.setVisibility(View.GONE);
|
|
|
|
|
+ tv_prorgess.setText("完成");
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
- tv_state.setText("开始");
|
|
|
|
|
|
|
+ iv_state.setImageResource(R.drawable.icon_begin);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -178,7 +179,7 @@ public class DownListAdapter extends BaseAdapter {
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
public void onClick(View view) {
|
|
|
switch (view.getId()){
|
|
switch (view.getId()){
|
|
|
- case R.id.tv_state:
|
|
|
|
|
|
|
+ case R.id.iv_state:
|
|
|
DownloadState state = downloadInfo.getState();
|
|
DownloadState state = downloadInfo.getState();
|
|
|
switch (state) {
|
|
switch (state) {
|
|
|
case WAITING:
|
|
case WAITING:
|
|
@@ -208,7 +209,7 @@ public class DownListAdapter extends BaseAdapter {
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
- case R.id.tv_remove:
|
|
|
|
|
|
|
+ case R.id.iv_remove:
|
|
|
try {
|
|
try {
|
|
|
downloadManager.removeDownload(downloadInfo);
|
|
downloadManager.removeDownload(downloadInfo);
|
|
|
notifyDataSetChanged();
|
|
notifyDataSetChanged();
|