浏览代码

Merge branch 'master' of gitorious.org:owncloud/android-devel

Bartek Przybylski 13 年之前
父节点
当前提交
ef45634ffe

+ 1 - 1
res/drawable/icon_list_selector.xml

@@ -17,7 +17,7 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
 
-    <item android:drawable="@color/filelist_backgorund" android:state_window_focused="false"/>
+    <item android:drawable="@color/owncloud_white" android:state_window_focused="false"/>
 
     <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
     <item android:drawable="@android:color/holo_blue_bright" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>

+ 1 - 1
res/drawable/list_selector.xml

@@ -17,7 +17,7 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
 
-    <item android:drawable="@color/filelist_backgorund" android:state_window_focused="false"/>
+    <item android:drawable="@color/owncloud_white" android:state_window_focused="false"/>
 
     <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
     <item android:drawable="@android:color/holo_blue_bright" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>

+ 4 - 10
res/layout-large-land/files.xml

@@ -19,12 +19,13 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
+    android:background="@color/owncloud_white"
     android:orientation="horizontal" >
 
     <LinearLayout
         android:id="@+id/file_list_container"
         android:layout_width="0dp"
-        android:layout_height="wrap_content"
+        android:layout_height="fill_parent"
         android:layout_weight="1" >
 
         <fragment
@@ -39,17 +40,10 @@
 
     <LinearLayout android:id="@+id/file_details_container"
         android:layout_width="0dp"
-        android:layout_height="wrap_content"
+        android:layout_height="fill_parent"
         android:layout_weight="2" >
 
-        <fragment
-            android:id="@+id/fileDetail"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            class="eu.alefzero.owncloud.ui.fragment.FileDetailFragment" >
-
-            <!-- Preview: layout=@layout/file_details_empty -->
-        </fragment>
+        <!-- Preview: layout=@layout/file_details_empty -->
     </LinearLayout>
 
 </LinearLayout>

+ 9 - 8
res/layout/file_activity_details.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- 
+<!--
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
@@ -14,17 +14,18 @@
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- -->
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.

+-->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >
 
-<fragment
-    android:id="@+id/fileDetail"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    class="eu.alefzero.owncloud.ui.fragment.FileDetailFragment" />
+    <LinearLayout
+        android:id="@+id/fragment"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent" >
+            <!-- Preview: layout=@layout/file_details_fragment -->
+    </LinearLayout>
 
 </LinearLayout>

+ 140 - 86
res/layout/file_details_fragment.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- 
+<!--
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
@@ -15,97 +15,151 @@
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
-    android:background="#F7F7F7"
-    android:orientation="vertical" >
+    android:background="@color/owncloud_white" >
 
-    <LinearLayout
-        android:id="@+id/linearLayout1"
+    <ScrollView
+        android:id="@+id/fdScrollView"
         android:layout_width="fill_parent"
-        android:layout_height="wrap_content" >
-
-        <LinearLayout
-            android:id="@+id/linearLayout2"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent" >
-
-            <ImageView
-                android:id="@+id/imageView1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/icon" >
-            </ImageView>
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/linearLayout3"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent"
-            android:orientation="vertical" >
-
-            <TextView
-                android:id="@+id/textView1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="TextView" >
-            </TextView>
+        android:layout_height="fill_parent" >
 
-            <TextView
-                android:id="@+id/textView2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="TextView" >
-            </TextView>
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" >
 
-            <TextView
-                android:id="@+id/textView3"
-                android:layout_width="wrap_content"
+            <RelativeLayout
+                android:id="@+id/fdFileHeaderContainer"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="TextView" >
-            </TextView>
-
-            <TextView
-                android:id="@+id/textView4"
-                android:layout_width="wrap_content"
+                android:layout_marginLeft="16dp"
+                android:layout_marginTop="4dp" >
+
+                <ImageView
+                    android:id="@+id/fdIcon"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:src="@drawable/file" />
+
+                <TextView
+                    android:id="@+id/fdFilename"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_toRightOf="@+id/fdIcon"
+                    android:text="file.name"
+                    android:textAppearance="?android:attr/textAppearanceLarge" />
+            </RelativeLayout>
+
+            <RelativeLayout
+                android:id="@+id/fdDetailsContainer"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="TextView" >
-            </TextView>
-
-            <TextView
-                android:id="@+id/textView5"
-                android:layout_width="wrap_content"
+                android:layout_below="@+id/fdFileHeaderContainer" >
+
+                <RelativeLayout
+                    android:id="@+id/fdLabelContainer"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="16dp" >
+
+                    <TextView
+                        android:id="@+id/fdTypeLabel"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="24dp"
+                        android:text="@string/filedetails_type"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                    <TextView
+                        android:id="@+id/fdSizeLabel"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@+id/fdTypeLabel"
+                        android:layout_marginTop="12dp"
+                        android:text="@string/filedetails_size"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                    <TextView
+                        android:id="@+id/fdCreatedLabel"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@+id/fdSizeLabel"
+                        android:layout_marginTop="12dp"
+                        android:text="@string/filedetails_created"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+                </RelativeLayout>
+
+                <RelativeLayout
+                    android:id="@+id/fdValueContainer"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerHorizontal="true"
+                    android:layout_marginLeft="4dp" >
+
+                    <TextView
+                        android:id="@+id/fdType"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="24dp"
+                        android:text="JPG Image"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                    <TextView
+                        android:id="@+id/fdSize"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@+id/fdType"
+                        android:layout_marginTop="12dp"
+                        android:text="389 KB"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                    <TextView
+                        android:id="@+id/fdCreated"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@+id/fdSize"
+                        android:layout_marginTop="12dp"
+                        android:text="2012/05/18 12:23 PM"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                    <TextView
+                        android:id="@+id/fdModified"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@+id/fdCreated"
+                        android:layout_marginTop="12dp"
+                        android:text="2012/05/19 02:56 PM"
+                        android:textAppearance="?android:attr/textAppearanceMedium" />
+                </RelativeLayout>
+            </RelativeLayout>
+
+            <RelativeLayout
+                android:id="@+id/fdPreviewAndDL"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="TextView" >
-            </TextView>
-        </LinearLayout>
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/linearLayout4"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent" >
-
-        <ImageView
-            android:id="@+id/imageView2"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:src="@drawable/action_item_btn" />
-
-        <VideoView
-            android:id="@+id/videoView1"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent" />
-
-        <ListView
-            android:id="@android:id/list"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:divider="@drawable/uploader_list_separator"
-            android:dividerHeight="1dip" >
-        </ListView>
-    </LinearLayout>
-
-</LinearLayout>
+                android:layout_below="@+id/fdDetailsContainer" >
+
+                <ImageView
+                    android:id="@+id/fdPreview"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerHorizontal="true"
+                    android:layout_marginTop="16dp"
+                    android:src="@drawable/owncloud_logo" />
+
+                <Button
+                    android:id="@+id/fdDownloadBtn"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerHorizontal="true"
+                    android:layout_below="@+id/fdPreview"
+                    android:layout_marginTop="12dp"
+                    android:text="@string/filedetails_download" />
+            </RelativeLayout>
+        </RelativeLayout>
+    </ScrollView>
+
+</RelativeLayout>

+ 1 - 0
res/layout/files.xml

@@ -19,6 +19,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
+    android:background="@color/owncloud_white"
     android:orientation="vertical" >
 
     <fragment

+ 1 - 1
res/values/colors.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <color name="filelist_icon_backgorund">#DDDDDD</color>
-    <color name="filelist_backgorund">#F7F7F7</color>
+    <color name="owncloud_white">#F7F7F7</color>
     
 </resources>

+ 5 - 0
res/values/strings.xml

@@ -49,6 +49,11 @@
     <string name="uploader_info_uploading">Uploading</string>
     <string name="uploader_btn_create_dir_text">Create dir for upload</string>
     <string name="filedetails_select_file">Tap on a file to display additional information.</string>
+    <string name="filedetails_size">Size:</string>
+    <string name="filedetails_type">Type:</string>
+    <string name="filedetails_created">Created:</string>
+    <string name="filedetails_modified">Modified:</string>
+    <string name="filedetails_download">Download</string>
     <string name="common_yes">Yes</string>
     <string name="common_no">No</string>
     <string name="common_ok">OK</string>

+ 1 - 1
src/eu/alefzero/owncloud/DisplayUtils.java

@@ -35,7 +35,7 @@ public class DisplayUtils {
             attachedsuff++;
         }
         result = ((int) (result * 100)) / 100.;
-        return result + suffixes[attachedsuff];
+        return result + " " + suffixes[attachedsuff];
     }
 
     public static String HtmlDecode(String s) {

+ 10 - 2
src/eu/alefzero/owncloud/ui/activity/FileDetailActivity.java

@@ -43,11 +43,19 @@ public class FileDetailActivity extends SherlockFragmentActivity {
         getWindow().requestFeature(Window.FEATURE_NO_TITLE);
         setContentView(R.layout.file_activity_details);
 
-        mFileDetail = new FileDetailFragment(getIntent());
         FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-        ft.add(R.id.fileDetail, mFileDetail);
+        mFileDetail = new FileDetailFragment();
+        ft.add(R.id.fragment, mFileDetail, "FileDetails");
         ft.commit();
 
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        mFileDetail.updateFileDetails(getIntent());
+    }
+    
+    
+
 }

+ 64 - 78
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java

@@ -17,7 +17,6 @@
  */
 package eu.alefzero.owncloud.ui.fragment;
 
-import android.app.FragmentTransaction;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -29,10 +28,10 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
+import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
-import android.widget.VideoView;
 
 import com.actionbarsherlock.app.SherlockFragment;
 
@@ -52,33 +51,43 @@ public class FileDetailFragment extends SherlockFragment implements
 
     public static final String FILE = "FILE";
 
+    private DownloadFinishReceiver mDownloadFinishReceiver;
     private Intent mIntent;
+    private int mLayout;
     private View mView;
-    private DownloadFinishReceiver mDownloadFinishReceiver;
     private OCFile mFile;
 
-    private int mLayout;
-    private boolean mEmptyLayout;
-
     /**
-     * Default constructor. When inflated by android -> display empty layout
+     * Default constructor - contains real layout
      */
-    public FileDetailFragment() {
-        mLayout = R.layout.file_details_empty;
-        mEmptyLayout = true;
+    public FileDetailFragment(){
+        mLayout = R.layout.file_details_fragment;
     }
-
+    
     /**
-     * Custom construtor. Use with a {@link FragmentTransaction}. The intent has
-     * to contain {@link FileDetailFragment#FILE} with an OCFile and also
-     * {@link FileDownloader#EXTRA_ACCOUNT} with the account.
+     * Creates a dummy layout. For use if the user never has
+     * tapped on a file before
      * 
-     * @param nonEmptyFragment True, to enable file detail rendering
+     * @param useEmptyView If true, use empty layout
      */
-    public FileDetailFragment(Intent intent) {
+    public FileDetailFragment(boolean useEmptyView){
+        if(useEmptyView){
+            mLayout = R.layout.file_details_empty;
+        } else {
+            mLayout = R.layout.file_details_fragment;
+        }
+    }
+    
+    /**
+     * Use this when creating the fragment and display
+     * a file at the same time
+     * 
+     * @param showDetailsIntent The Intent with the required parameters
+     * @see FileDetailFragment#updateFileDetails(Intent)
+     */
+    public FileDetailFragment(Intent showDetailsIntent) {
+        mIntent = showDetailsIntent;
         mLayout = R.layout.file_details_fragment;
-        mIntent = intent;
-        mEmptyLayout = false;
     }
 
     @Override
@@ -122,85 +131,63 @@ public class FileDetailFragment extends SherlockFragment implements
             setFiletype(DisplayUtils.convertMIMEtoPrettyPrint(mFile
                     .getMimetype()));
             setFilesize(mFile.getFileLength());
-
-            // set file preview if available and possible
-            VideoView videoView = (VideoView) mView
-                    .findViewById(R.id.videoView1);
-            videoView.setVisibility(View.INVISIBLE);
-            if (mFile.getStoragePath() == null) {
-                ImageView imageView = (ImageView) getView().findViewById(
-                        R.id.imageView2);
-                imageView.setImageResource(R.drawable.download);
-                imageView.setOnClickListener(this);
-            } else {
+            
+            // Update preview
+            if (mFile.getStoragePath() != null) {
                 if (mFile.getMimetype().startsWith("image/")) {
-                    ImageView imageView = (ImageView) mView
-                            .findViewById(R.id.imageView2);
+                    ImageView preview = (ImageView) getView().findViewById(
+                            R.id.fdPreview);
                     Bitmap bmp = BitmapFactory.decodeFile(mFile.getStoragePath());
-                    imageView.setImageBitmap(bmp);
-                } else if (mFile.getMimetype().startsWith("video/")) {
-                    videoView.setVisibility(View.VISIBLE);
-                    videoView.setVideoPath(mFile.getStoragePath());
-                    videoView.start();
+                    preview.setImageBitmap(bmp);
                 }
             }
+            
+            // Make download button effective
+            Button downloadButton = (Button) getView().findViewById(R.id.fdDownloadBtn);
+            downloadButton.setOnClickListener(this);
         }
     }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        View view = null;
-
-        view = inflater.inflate(mLayout, container, false);
-        mIntent = getActivity().getIntent();
-        mView = view;
-
-        // make sure we are not using the empty layout
-        if (mEmptyLayout == false) {
-            updateFileDetails();
-        }
-
-        return view;
-    }
-
-    @Override
-    public View getView() {
-        return mView == null ? super.getView() : mView;
-    };
-
+    
     private void setFilename(String filename) {
-        TextView tv = (TextView) getView().findViewById(R.id.textView1);
+        TextView tv = (TextView) getView().findViewById(R.id.fdFilename);
         if (tv != null)
             tv.setText(filename);
     }
 
     private void setFiletype(String mimetype) {
-        TextView tv = (TextView) getView().findViewById(R.id.textView2);
+        TextView tv = (TextView) getView().findViewById(R.id.fdType);
         if (tv != null)
             tv.setText(mimetype);
     }
 
     private void setFilesize(long filesize) {
-        TextView tv = (TextView) getView().findViewById(R.id.textView3);
+        TextView tv = (TextView) getView().findViewById(R.id.fdSize);
         if (tv != null)
             tv.setText(DisplayUtils.bitsToHumanReadable(filesize));
     }
 
-    /**
-     * Use this to check if the correct layout is loaded. When android
-     * instanciates this class using the default constructor, the layout will be
-     * empty.
-     * 
-     * Once a user touches a file for the first time, you must instanciate a new
-     * Fragment with the new FileDetailFragment(true) to inflate the actual
-     * details
-     * 
-     * @return If the layout is empty, this method will return true, otherwise
-     *         false
-     */
-    public boolean isEmptyLayout() {
-        return mEmptyLayout;
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        View view = null;
+        view = inflater.inflate(mLayout, container, false);
+        mView = view;
+        if(mLayout == R.layout.file_details_fragment){
+            // Phones will launch an activity with this intent
+            if(mIntent == null){
+                mIntent = getActivity().getIntent();
+            }
+            updateFileDetails();
+        }
+        
+        return view;
+    }
+    
+    
+
+    @Override
+    public View getView() {
+        return super.getView() == null ? mView : super.getView();
     }
 
     @Override
@@ -209,8 +196,7 @@ public class FileDetailFragment extends SherlockFragment implements
         Intent i = new Intent(getActivity(), FileDownloader.class);
         i.putExtra(FileDownloader.EXTRA_ACCOUNT,
                 mIntent.getParcelableExtra(FileDownloader.EXTRA_ACCOUNT));
-        i.putExtra(FileDownloader.EXTRA_FILE_PATH,
-                mIntent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));
+        i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getPath());
         getActivity().startService(i);
     }
 

+ 48 - 38
src/eu/alefzero/owncloud/ui/fragment/FileListFragment.java

@@ -52,6 +52,7 @@ public class FileListFragment extends FragmentListView {
     private Stack<String> mDirNames;
     private Vector<OCFile> mFiles;
     private DataStorageManager mStorageManager;
+    private boolean mIsLargeDevice = false;
 
     public FileListFragment() {
         mDirNames = new Stack<String>();
@@ -62,13 +63,26 @@ public class FileListFragment extends FragmentListView {
         super.onCreate(savedInstanceState);
 
         mAccount = AccountUtils.getCurrentOwnCloudAccount(getActivity());
-        getListView().setDivider(
-                getResources().getDrawable(R.drawable.uploader_list_separator));
+        getListView().setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
         getListView().setDividerHeight(1);
 
         populateFileList();
     }
 
+    @Override
+    public void onStart() {
+                
+        // Create a placeholder upon launch
+        View fragmentContainer = getActivity().findViewById(R.id.file_details_container);
+        if (fragmentContainer != null) {
+            mIsLargeDevice = true;
+            FragmentTransaction transaction = getFragmentManager().beginTransaction();
+            transaction.replace(R.id.file_details_container, new FileDetailFragment(true));
+            transaction.commit();
+        }
+        super.onStart();
+    }
+
     @Override
     public void onItemClick(AdapterView<?> l, View v, int position, long id) {
         if (mFiles.size() <= position) {
@@ -84,53 +98,51 @@ public class FileListFragment extends FragmentListView {
             ((FileDisplayActivity) getActivity()).pushPath(dirname);
 
             populateFileList();
+            resetFileFragment();
+
             return;
         }
 
-        Intent showDetailsIntent = new Intent(getActivity(),
-                FileDetailActivity.class);
+        Intent showDetailsIntent = new Intent(getActivity(), FileDetailActivity.class);
         showDetailsIntent.putExtra(FileDetailFragment.FILE, file);
         showDetailsIntent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
 
-        // Try to find by tag first
-        FileDetailFragment fd = (FileDetailFragment) getFragmentManager()
-                .findFragmentByTag("FileDetails");
-
-        // Could be the first time the user has touched a file. find by id
-        if (fd == null) {
-            fd = (FileDetailFragment) getFragmentManager().findFragmentById(
-                    R.id.fileDetail);
-        }
-
-        // Tablets will have this fragment, phones not. Could still be null
-        if (fd != null) {
-
-            if (fd.isEmptyLayout()) {
-                // True, if this is the first time a user taps on a file
-                fd = new FileDetailFragment(showDetailsIntent);
-                FragmentTransaction transaction = getFragmentManager()
-                        .beginTransaction();
-                transaction.replace(R.id.file_details_container, fd,
-                        "FileDetails");
+        // If we are on a large device -> update fragment
+        if (mIsLargeDevice) {
+            FileDetailFragment fileDetails = (FileDetailFragment) getFragmentManager().findFragmentByTag("FileDetails");
+            if (fileDetails == null) {
+                FragmentTransaction transaction = getFragmentManager().beginTransaction();
+                transaction.replace(R.id.file_details_container, new FileDetailFragment(showDetailsIntent), "FileDetails");
+                transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                 transaction.commit();
             } else {
-                fd.updateFileDetails(showDetailsIntent);
+                fileDetails.updateFileDetails(showDetailsIntent);
             }
-
         } else {
             startActivity(showDetailsIntent);
         }
     }
 
+    /**
+     * Resets the FileDetailsFragment on Tablets so that it always displays
+     * "Tab on a file to display it's details"
+     */
+    private void resetFileFragment() {
+        FileDetailFragment fileDetails = (FileDetailFragment) getFragmentManager().findFragmentByTag("FileDetails");
+        if (fileDetails != null) {
+            FragmentTransaction transaction = getFragmentManager().beginTransaction();
+            transaction.remove(fileDetails);
+            transaction.add(R.id.file_details_container, new FileDetailFragment(true));
+            transaction.commit();
+        }
+    }
+
     @Override
-    public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2,
-            long arg3) {
+    public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
         ClipData.Item item = new ClipData.Item("ASD");
-        ClipDescription cd = new ClipDescription("ASD",
-                new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN });
+        ClipDescription cd = new ClipDescription("ASD", new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN });
         ClipData dragData = new ClipData(cd, item);
-        arg1.startDrag(dragData,
-                new View.DragShadowBuilder(arg0.getChildAt(arg2)), null, 0);
+        arg1.startDrag(dragData, new View.DragShadowBuilder(arg0.getChildAt(arg2)), null, 0);
         return true;
     }
 
@@ -140,6 +152,7 @@ public class FileListFragment extends FragmentListView {
     public void onNavigateUp() {
         mDirNames.pop();
         populateFileList();
+        resetFileFragment();
     }
 
     /**
@@ -151,16 +164,13 @@ public class FileListFragment extends FragmentListView {
             s += a + "/";
         Log.e("ASD", s);
 
-        mStorageManager = new FileDataStorageManager(mAccount, getActivity()
-                .getContentResolver());
+        mStorageManager = new FileDataStorageManager(mAccount, getActivity().getContentResolver());
         OCFile file = mStorageManager.getFileByPath(s);
         mFiles = mStorageManager.getDirectoryContent(file);
         if (mFiles == null || mFiles.size() == 0) {
-            Toast.makeText(getActivity(), "There are no files here",
-                    Toast.LENGTH_LONG).show();
+            Toast.makeText(getActivity(), "There are no files here", Toast.LENGTH_LONG).show();
         }
-        setListAdapter(new FileListListAdapter(file, mStorageManager,
-                getActivity()));
+        setListAdapter(new FileListListAdapter(file, mStorageManager, getActivity()));
     }
 
     // TODO: Delete this testing stuff.