minor change in android model

This commit is contained in:
Thibault Deckers 2020-03-17 15:25:55 +09:00
parent 39ec0f8d09
commit 1474d4fcb9
2 changed files with 3 additions and 8 deletions

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.ContentUris;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
@ -103,7 +104,7 @@ public class ImageDecodeTask extends AsyncTask<ImageDecodeTask.Params, Void, Ima
private Bitmap getThumbnailBytesByMediaStore(Params params) { private Bitmap getThumbnailBytesByMediaStore(Params params) {
ImageEntry entry = params.entry; ImageEntry entry = params.entry;
long contentId = entry.getContentId(); long contentId = ContentUris.parseId(entry.getUri());
ContentResolver resolver = activity.getContentResolver(); ContentResolver resolver = activity.getContentResolver();
try { try {

View file

@ -12,8 +12,7 @@ import deckers.thibault.aves.utils.Constants;
public class ImageEntry { public class ImageEntry {
// from source // from source
private String path; // best effort to get local path from content providers private String path; // best effort to get local path from content providers
private long contentId; // should be defined for mediastore, use full URI otherwise private Uri uri; // content URI
private Uri uri; // should be defined for external content, use ID for mediastore
private String mimeType; private String mimeType;
private int width, height, orientationDegrees; private int width, height, orientationDegrees;
private long sizeBytes; private long sizeBytes;
@ -27,7 +26,6 @@ public class ImageEntry {
public ImageEntry(Map map) { public ImageEntry(Map map) {
this.uri = Uri.parse((String) map.get("uri")); this.uri = Uri.parse((String) map.get("uri"));
this.path = (String) map.get("path"); this.path = (String) map.get("path");
this.contentId = toLong(map.get("contentId"));
this.mimeType = (String) map.get("mimeType"); this.mimeType = (String) map.get("mimeType");
this.width = (int) map.get("width"); this.width = (int) map.get("width");
this.height = (int) map.get("height"); this.height = (int) map.get("height");
@ -44,10 +42,6 @@ public class ImageEntry {
return uri; return uri;
} }
public long getContentId() {
return contentId;
}
@Nullable @Nullable
public String getPath() { public String getPath() {
return path; return path;