remove unused AsyncDownloadWrapper.MSG_DATA

This is all wired up, but the data is never ultimately used.
This commit is contained in:
Hans-Christoph Steiner 2016-03-29 17:41:27 +02:00
parent 91edad0c31
commit 260b5bb9fb
3 changed files with 6 additions and 14 deletions

View File

@ -23,7 +23,6 @@ package org.fdroid.fdroid.net;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
@ -193,7 +192,8 @@ public class ApkDownloader implements AsyncDownloader.Listener {
dlWrapper.download();
return true;
} catch (IOException e) {
onErrorDownloading(e.getLocalizedMessage());
e.printStackTrace();
onErrorDownloading();
}
return false;
@ -219,8 +219,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
}
@Override
public void onErrorDownloading(String localisedExceptionDetails) {
Log.e(TAG, "Download failed: " + localisedExceptionDetails);
public void onErrorDownloading() {
delete(localFile);
}

View File

@ -1,6 +1,5 @@
package org.fdroid.fdroid.net;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
@ -13,7 +12,6 @@ class AsyncDownloadWrapper extends Handler implements AsyncDownloader {
private static final int MSG_DOWNLOAD_COMPLETE = 2;
private static final int MSG_ERROR = 4;
private static final String MSG_DATA = "data";
private final Downloader downloader;
private DownloadThread downloadThread;
@ -61,7 +59,7 @@ class AsyncDownloadWrapper extends Handler implements AsyncDownloader {
listener.onDownloadComplete();
break;
case MSG_ERROR:
listener.onErrorDownloading(message.getData().getString(MSG_DATA));
listener.onErrorDownloading();
break;
}
}
@ -76,12 +74,7 @@ class AsyncDownloadWrapper extends Handler implements AsyncDownloader {
// ignored
} catch (IOException e) {
Log.e(TAG, "I/O exception in download thread", e);
Bundle data = new Bundle(1);
data.putString(MSG_DATA, e.getLocalizedMessage());
Message message = new Message();
message.arg1 = MSG_ERROR;
message.setData(data);
AsyncDownloadWrapper.this.sendMessage(message);
sendMessage(MSG_ERROR);
}
}

View File

@ -5,7 +5,7 @@ import org.fdroid.fdroid.ProgressListener;
public interface AsyncDownloader {
interface Listener extends ProgressListener {
void onErrorDownloading(String localisedExceptionDetails);
void onErrorDownloading();
void onDownloadComplete();
}