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

View File

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

View File

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