Эх сурвалжийг харах

Merge pull request #4958 from Infomaniak/fix/see-detail-from-preview-nc

Fixed issue relative to Properties from ImagePreview
Tobias Kaminsky 5 жил өмнө
parent
commit
1145c3813e

+ 4 - 0
src/main/java/com/owncloud/android/datamodel/OCFile.java

@@ -155,6 +155,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         favorite = source.readInt() == 1;
         encrypted = source.readInt() == 1;
         encryptedFileName = source.readString();
+        ownerId = source.readString();
+        ownerDisplayName = source.readString();
         mountType = (WebdavEntry.MountType) source.readSerializable();
     }
 
@@ -185,6 +187,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         dest.writeInt(favorite ? 1 : 0);
         dest.writeInt(encrypted ? 1 : 0);
         dest.writeString(encryptedFileName);
+        dest.writeString(ownerId);
+        dest.writeString(ownerDisplayName);
         dest.writeSerializable(mountType);
     }
 

+ 4 - 7
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -502,9 +502,13 @@ public class FileDisplayActivity extends FileActivity
     protected void onNewIntent(Intent intent) {
         super.onNewIntent(intent);
 
+
         if (ACTION_DETAILS.equalsIgnoreCase(intent.getAction())) {
+            OCFile file = intent.getParcelableExtra(EXTRA_FILE);
+            setFile(file);
             setIntent(intent);
             setFile(intent.getParcelableExtra(EXTRA_FILE));
+            showDetails(file);
         } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
             handleOpenFileViaIntent(intent);
         } else if (RESTART.equals(intent.getAction())) {
@@ -1158,13 +1162,6 @@ public class FileDisplayActivity extends FileActivity
         } else {
             // all closed
 
-            //if PreviewImageActivity called this activity and mDualPane==false  then calls PreviewImageActivity again
-            if (ACTION_DETAILS.equalsIgnoreCase(getIntent().getAction()) && !mDualPane) {
-                getIntent().setAction(null);
-                getIntent().putExtra(EXTRA_FILE, (OCFile) null);
-                startImagePreview(getFile(), false);
-            }
-
             OCFileListFragment listOfFiles = getListOfFilesFragment();
             if (mDualPane || getSecondFragment() == null) {
                 OCFile currentDir = getCurrentDir();

+ 1 - 3
src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -386,12 +386,10 @@ public class PreviewImageActivity extends FileActivity implements
     @SuppressFBWarnings("DLS")
     @Override
     public void showDetails(OCFile file) {
-        final User currentUser = getUserAccountManager().getUser();
         final Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
         showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
         showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, file);
-        showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, currentUser.toPlatformAccount());
-        showDetailsIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+        showDetailsIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         startActivity(showDetailsIntent);
         finish();
     }