Merge branch 'download-request-constructor' into 'master'
Remove usages of deprecated DownloadRequest constructor See merge request fdroid/fdroidclient!1197
This commit is contained in:
commit
37286ac7d4
|
@ -548,7 +548,7 @@ public class NotificationHelper {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
App.loadBitmapWithGlide(context, entry.app.repoId, entry.app.getIconPath())
|
App.loadBitmapWithGlide(context, entry.app.repoId, entry.app.iconFile)
|
||||||
.into(new CustomTarget<Bitmap>() {
|
.into(new CustomTarget<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||||
|
|
|
@ -529,15 +529,6 @@ public final class Utils {
|
||||||
return new DownloadRequest(file, mirrors, proxy, repo.getUsername(), repo.getPassword());
|
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}.
|
* 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
|
* {@code file} must exist on the filesystem and {@code hashAlgo} must be supported
|
||||||
|
|
|
@ -374,7 +374,7 @@ public class App implements Comparable<App>, Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RequestBuilder<Bitmap> loadBitmapWithGlide(Context context, long repoId,
|
public static RequestBuilder<Bitmap> loadBitmapWithGlide(Context context, long repoId,
|
||||||
String path) {
|
IndexFile file) {
|
||||||
Repository repo = FDroidApp.getRepo(repoId);
|
Repository repo = FDroidApp.getRepo(repoId);
|
||||||
if (repo == null) {
|
if (repo == null) {
|
||||||
Log.e(TAG, "Repo not found: " + repoId);
|
Log.e(TAG, "Repo not found: " + repoId);
|
||||||
|
@ -382,13 +382,13 @@ public class App implements Comparable<App>, Parcelable {
|
||||||
}
|
}
|
||||||
String address = Utils.getRepoAddress(repo);
|
String address = Utils.getRepoAddress(repo);
|
||||||
if (address.startsWith("content://")) {
|
if (address.startsWith("content://")) {
|
||||||
String sb = path == null ?
|
String sb = file == null ?
|
||||||
null : Utils.getUri(address, path.split("/")).toString();
|
null : Utils.getUri(address, file.getName().split("/")).toString();
|
||||||
return Glide.with(context).asBitmap().load(sb);
|
return Glide.with(context).asBitmap().load(sb);
|
||||||
} else if (address.startsWith("file://")) {
|
} else if (address.startsWith("file://")) {
|
||||||
return Glide.with(context).asBitmap().load(path);
|
return Glide.with(context).asBitmap().load(file.getName());
|
||||||
} else {
|
} else {
|
||||||
return Glide.with(context).asBitmap().load(Utils.getDownloadRequest(repo, path));
|
return Glide.with(context).asBitmap().load(Utils.getDownloadRequest(repo, file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue