Additional changes to apply the new code to the other FileFragments: PreviewMediaFragment, DetailsFragment, PreviewImageFragment

This commit is contained in:
masensio 2014-05-05 14:10:15 +02:00
parent 9820893fd9
commit 6cdd830a7b
2 changed files with 24 additions and 22 deletions

View file

@ -1,6 +1,6 @@
/* ownCloud Android client application /* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski * Copyright (C) 2011 Bartek Przybylski
* Copyright (C) 2012-2013 ownCloud Inc. * Copyright (C) 2012-2014 ownCloud Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, * it under the terms of the GNU General Public License version 2,
@ -182,13 +182,14 @@ public class FileDetailFragment extends FileFragment implements
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
if (mAccount != null) { // TODO: Remove this code. (Updated no needed)
OCFile file = ((FileActivity)getActivity()).getStorageManager(). // if (mAccount != null) {
getFileByPath(getFile().getRemotePath()); // OCFile file = ((FileActivity)getActivity()).getStorageManager().
if (file != null) { // getFileByPath(getFile().getRemotePath());
setFile(file); // if (file != null) {
} // setFile(file);
} // }
// }
} }

View file

@ -1,5 +1,5 @@
/* ownCloud Android client application /* ownCloud Android client application
* Copyright (C) 2012-2013 ownCloud Inc. * Copyright (C) 2012-2014 ownCloud Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, * it under the terms of the GNU General Public License version 2,
@ -173,20 +173,21 @@ public class PreviewImageFragment extends FileFragment implements OnRemoteOper
if (savedInstanceState != null) { if (savedInstanceState != null) {
if (!mIgnoreFirstSavedState) { if (!mIgnoreFirstSavedState) {
OCFile file = (OCFile)savedInstanceState.getParcelable(PreviewImageFragment.EXTRA_FILE); OCFile file = (OCFile)savedInstanceState.getParcelable(PreviewImageFragment.EXTRA_FILE);
setFile(file);
mAccount = savedInstanceState.getParcelable(PreviewImageFragment.EXTRA_ACCOUNT); mAccount = savedInstanceState.getParcelable(PreviewImageFragment.EXTRA_ACCOUNT);
// TODO remove this code: update file no needed
// Update the file // // Update the file
if (mAccount!= null) { //// if (mAccount!= null) {
OCFile updatedFile = ((FileActivity)getSherlockActivity()). // OCFile updatedFile = ((FileActivity)getSherlockActivity()).
getStorageManager().getFileByPath(file.getRemotePath()); // getStorageManager().getFileByPath(file.getRemotePath());
if (updatedFile != null) { // if (updatedFile != null) {
setFile(updatedFile); // setFile(updatedFile);
} else { // } else {
setFile(file); // setFile(file);
} // }
} else { // } else {
setFile(file); // setFile(file);
} // }
} else { } else {
mIgnoreFirstSavedState = false; mIgnoreFirstSavedState = false;