Display of app name and version in the download title
This commit is contained in:
parent
6f8b49c974
commit
13e54ced07
@ -884,7 +884,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startDownload(Apk apk, String repoAddress) {
|
private void startDownload(Apk apk, String repoAddress) {
|
||||||
downloadHandler = new ApkDownloader(getBaseContext(), apk, repoAddress);
|
downloadHandler = new ApkDownloader(getBaseContext(), app, apk, repoAddress);
|
||||||
localBroadcastManager.registerReceiver(downloaderProgressReceiver,
|
localBroadcastManager.registerReceiver(downloaderProgressReceiver,
|
||||||
new IntentFilter(Downloader.LOCAL_ACTION_PROGRESS));
|
new IntentFilter(Downloader.LOCAL_ACTION_PROGRESS));
|
||||||
downloadHandler.setProgressListener(this);
|
downloadHandler.setProgressListener(this);
|
||||||
|
@ -34,6 +34,7 @@ import org.fdroid.fdroid.ProgressListener;
|
|||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.compat.FileCompat;
|
import org.fdroid.fdroid.compat.FileCompat;
|
||||||
import org.fdroid.fdroid.data.Apk;
|
import org.fdroid.fdroid.data.Apk;
|
||||||
|
import org.fdroid.fdroid.data.App;
|
||||||
import org.fdroid.fdroid.data.SanitizedFile;
|
import org.fdroid.fdroid.data.SanitizedFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -69,6 +70,7 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
*/
|
*/
|
||||||
public static final String EVENT_DATA_ERROR_TYPE = "apkDownloadErrorType";
|
public static final String EVENT_DATA_ERROR_TYPE = "apkDownloadErrorType";
|
||||||
|
|
||||||
|
@NonNull private final App app;
|
||||||
@NonNull private final Apk curApk;
|
@NonNull private final Apk curApk;
|
||||||
@NonNull private final Context context;
|
@NonNull private final Context context;
|
||||||
@NonNull private final String repoAddress;
|
@NonNull private final String repoAddress;
|
||||||
@ -89,8 +91,9 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
setProgressListener(null);
|
setProgressListener(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApkDownloader(@NonNull final Context context, @NonNull final Apk apk, @NonNull final String repoAddress) {
|
public ApkDownloader(@NonNull final Context context, @NonNull final App app, @NonNull final Apk apk, @NonNull final String repoAddress) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
this.app = app;
|
||||||
curApk = apk;
|
curApk = apk;
|
||||||
this.repoAddress = repoAddress;
|
this.repoAddress = repoAddress;
|
||||||
localFile = new SanitizedFile(Utils.getApkDownloadDir(context), apk.apkName);
|
localFile = new SanitizedFile(Utils.getApkDownloadDir(context), apk.apkName);
|
||||||
@ -197,7 +200,9 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
if (canUseDownloadManager(new URL(remoteAddress))) {
|
if (canUseDownloadManager(new URL(remoteAddress))) {
|
||||||
// If we can use Android's DownloadManager, let's use it, because
|
// If we can use Android's DownloadManager, let's use it, because
|
||||||
// of better OS integration, reliability, and async ability
|
// of better OS integration, reliability, and async ability
|
||||||
dlWrapper = new AsyncDownloader(context, this, curApk.apkName, curApk.id, remoteAddress, localFile);
|
dlWrapper = new AsyncDownloader(context, this,
|
||||||
|
app.name + " " + curApk.version, curApk.id,
|
||||||
|
remoteAddress, localFile);
|
||||||
} else {
|
} else {
|
||||||
Downloader downloader = DownloaderFactory.create(context, remoteAddress, localFile);
|
Downloader downloader = DownloaderFactory.create(context, remoteAddress, localFile);
|
||||||
dlWrapper = new AsyncDownloadWrapper(downloader, this);
|
dlWrapper = new AsyncDownloadWrapper(downloader, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user