修复例子bug
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -37,7 +37,7 @@
|
|||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -11,6 +11,7 @@ import com.arialyy.downloadutil.core.DownloadManager;
|
|||||||
import com.arialyy.downloadutil.core.command.CommandFactory;
|
import com.arialyy.downloadutil.core.command.CommandFactory;
|
||||||
import com.arialyy.downloadutil.core.command.IDownloadCommand;
|
import com.arialyy.downloadutil.core.command.IDownloadCommand;
|
||||||
import com.arialyy.downloadutil.entity.DownloadEntity;
|
import com.arialyy.downloadutil.entity.DownloadEntity;
|
||||||
|
import com.arialyy.frame.util.show.L;
|
||||||
import com.arialyy.simple.R;
|
import com.arialyy.simple.R;
|
||||||
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
|
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
|
||||||
|
|
||||||
@ -85,11 +86,7 @@ public class DownloadAdapter extends AbsRVAdapter<DownloadEntity, DownloadAdapte
|
|||||||
}
|
}
|
||||||
current = (int) (mProgress.get(item.getDownloadUrl()) * 100 / item.getFileSize());
|
current = (int) (mProgress.get(item.getDownloadUrl()) * 100 / item.getFileSize());
|
||||||
holder.progress.setProgress(current);
|
holder.progress.setProgress(current);
|
||||||
BtClickListener listener = (BtClickListener) holder.bt.getTag(holder.bt.getId());
|
BtClickListener listener = new BtClickListener(position, item);
|
||||||
if (listener == null) {
|
|
||||||
listener = new BtClickListener(item);
|
|
||||||
holder.bt.setTag(holder.bt.getId(), listener);
|
|
||||||
}
|
|
||||||
holder.bt.setOnClickListener(listener);
|
holder.bt.setOnClickListener(listener);
|
||||||
String str = "";
|
String str = "";
|
||||||
int color = android.R.color.holo_green_light;
|
int color = android.R.color.holo_green_light;
|
||||||
@ -122,12 +119,15 @@ public class DownloadAdapter extends AbsRVAdapter<DownloadEntity, DownloadAdapte
|
|||||||
|
|
||||||
private class BtClickListener implements View.OnClickListener {
|
private class BtClickListener implements View.OnClickListener {
|
||||||
private DownloadEntity entity;
|
private DownloadEntity entity;
|
||||||
|
private int position;
|
||||||
|
|
||||||
BtClickListener(DownloadEntity entity) {
|
BtClickListener(int position, DownloadEntity entity) {
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onClick(View v) {
|
@Override public void onClick(View v) {
|
||||||
|
L.d(TAG, "position ==> " + position);
|
||||||
switch (entity.getState()) {
|
switch (entity.getState()) {
|
||||||
case DownloadEntity.STATE_WAIT:
|
case DownloadEntity.STATE_WAIT:
|
||||||
case DownloadEntity.STATE_OTHER:
|
case DownloadEntity.STATE_OTHER:
|
||||||
|
Reference in New Issue
Block a user