Merge branch 'download-request-constructor' into 'master'

Remove usages of deprecated DownloadRequest constructor

See merge request fdroid/fdroidclient!1197
This commit is contained in:
Hans-Christoph Steiner 2023-03-14 16:33:36 +00:00
commit 37286ac7d4
3 changed files with 6 additions and 15 deletions

View File

@ -548,7 +548,7 @@ public class NotificationHelper {
}
});
} else {
App.loadBitmapWithGlide(context, entry.app.repoId, entry.app.getIconPath())
App.loadBitmapWithGlide(context, entry.app.repoId, entry.app.iconFile)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {

View File

@ -529,15 +529,6 @@ public final class Utils {
return new DownloadRequest(file, mirrors, proxy, repo.getUsername(), repo.getPassword());
}
@Nullable
@Deprecated
public static DownloadRequest getDownloadRequest(@NonNull Repository repo, @Nullable String path) {
if (path == null) return null;
List<Mirror> mirrors = repo.getMirrors();
Proxy proxy = NetCipher.getProxy();
return new DownloadRequest(path, mirrors, proxy, repo.getUsername(), repo.getPassword());
}
/**
* Get the checksum hash of the file {@code file} using the algorithm in {@code hashAlgo}.
* {@code file} must exist on the filesystem and {@code hashAlgo} must be supported

View File

@ -374,7 +374,7 @@ public class App implements Comparable<App>, Parcelable {
}
public static RequestBuilder<Bitmap> loadBitmapWithGlide(Context context, long repoId,
String path) {
IndexFile file) {
Repository repo = FDroidApp.getRepo(repoId);
if (repo == null) {
Log.e(TAG, "Repo not found: " + repoId);
@ -382,13 +382,13 @@ public class App implements Comparable<App>, Parcelable {
}
String address = Utils.getRepoAddress(repo);
if (address.startsWith("content://")) {
String sb = path == null ?
null : Utils.getUri(address, path.split("/")).toString();
String sb = file == null ?
null : Utils.getUri(address, file.getName().split("/")).toString();
return Glide.with(context).asBitmap().load(sb);
} else if (address.startsWith("file://")) {
return Glide.with(context).asBitmap().load(path);
return Glide.with(context).asBitmap().load(file.getName());
} else {
return Glide.with(context).asBitmap().load(Utils.getDownloadRequest(repo, path));
return Glide.with(context).asBitmap().load(Utils.getDownloadRequest(repo, file));
}
}