|
@@ -42,7 +42,9 @@ import android.os.AsyncTask;
|
|
import android.provider.MediaStore;
|
|
import android.provider.MediaStore;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
import android.view.Display;
|
|
import android.view.Display;
|
|
|
|
+import android.view.View;
|
|
import android.view.WindowManager;
|
|
import android.view.WindowManager;
|
|
|
|
+import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
|
|
import com.nextcloud.client.network.ConnectivityService;
|
|
import com.nextcloud.client.network.ConnectivityService;
|
|
@@ -253,18 +255,21 @@ public final class ThumbnailsCacheManager {
|
|
private FileDataStorageManager storageManager;
|
|
private FileDataStorageManager storageManager;
|
|
private Account account;
|
|
private Account account;
|
|
private WeakReference<ImageView> imageViewReference;
|
|
private WeakReference<ImageView> imageViewReference;
|
|
|
|
+ private WeakReference<FrameLayout> frameLayoutReference;
|
|
private OCFile file;
|
|
private OCFile file;
|
|
private ConnectivityService connectivityService;
|
|
private ConnectivityService connectivityService;
|
|
|
|
|
|
|
|
|
|
public ResizedImageGenerationTask(FileFragment fileFragment,
|
|
public ResizedImageGenerationTask(FileFragment fileFragment,
|
|
ImageView imageView,
|
|
ImageView imageView,
|
|
|
|
+ FrameLayout emptyListProgress,
|
|
FileDataStorageManager storageManager,
|
|
FileDataStorageManager storageManager,
|
|
ConnectivityService connectivityService,
|
|
ConnectivityService connectivityService,
|
|
Account account)
|
|
Account account)
|
|
throws IllegalArgumentException {
|
|
throws IllegalArgumentException {
|
|
this.fileFragment = fileFragment;
|
|
this.fileFragment = fileFragment;
|
|
imageViewReference = new WeakReference<>(imageView);
|
|
imageViewReference = new WeakReference<>(imageView);
|
|
|
|
+ frameLayoutReference = new WeakReference<>(emptyListProgress);
|
|
this.storageManager = storageManager;
|
|
this.storageManager = storageManager;
|
|
this.connectivityService = connectivityService;
|
|
this.connectivityService = connectivityService;
|
|
this.account = account;
|
|
this.account = account;
|
|
@@ -276,11 +281,17 @@ public final class ThumbnailsCacheManager {
|
|
|
|
|
|
file = (OCFile) params[0];
|
|
file = (OCFile) params[0];
|
|
|
|
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(8000);
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
try {
|
|
try {
|
|
if (account != null) {
|
|
if (account != null) {
|
|
OwnCloudAccount ocAccount = new OwnCloudAccount(account, MainApp.getAppContext());
|
|
OwnCloudAccount ocAccount = new OwnCloudAccount(account, MainApp.getAppContext());
|
|
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount,
|
|
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount,
|
|
- MainApp.getAppContext());
|
|
|
|
|
|
+ MainApp.getAppContext());
|
|
}
|
|
}
|
|
|
|
|
|
thumbnail = doResizedImageInBackground();
|
|
thumbnail = doResizedImageInBackground();
|
|
@@ -375,6 +386,7 @@ public final class ThumbnailsCacheManager {
|
|
protected void onPostExecute(Bitmap bitmap) {
|
|
protected void onPostExecute(Bitmap bitmap) {
|
|
if (imageViewReference != null) {
|
|
if (imageViewReference != null) {
|
|
final ImageView imageView = imageViewReference.get();
|
|
final ImageView imageView = imageViewReference.get();
|
|
|
|
+ final FrameLayout frameLayout = frameLayoutReference.get();
|
|
|
|
|
|
if (bitmap != null) {
|
|
if (bitmap != null) {
|
|
final ResizedImageGenerationTask bitmapWorkerTask = getResizedImageGenerationWorkerTask(imageView);
|
|
final ResizedImageGenerationTask bitmapWorkerTask = getResizedImageGenerationWorkerTask(imageView);
|
|
@@ -383,7 +395,12 @@ public final class ThumbnailsCacheManager {
|
|
String tagId = String.valueOf(file.getFileId());
|
|
String tagId = String.valueOf(file.getFileId());
|
|
|
|
|
|
if (String.valueOf(imageView.getTag()).equals(tagId)) {
|
|
if (String.valueOf(imageView.getTag()).equals(tagId)) {
|
|
|
|
+ imageView.setVisibility(View.VISIBLE);
|
|
imageView.setImageBitmap(bitmap);
|
|
imageView.setImageBitmap(bitmap);
|
|
|
|
+
|
|
|
|
+ if (frameLayout != null) {
|
|
|
|
+ frameLayout.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|