Merge branch 'master' of gitorious.org:owncloud/android-devel
authorBartek Przybylski <bart.p.pl@gmail.com>
Sat, 19 May 2012 17:08:39 +0000 (19:08 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sat, 19 May 2012 17:08:39 +0000 (19:08 +0200)
12 files changed:
res/drawable/icon_list_selector.xml
res/drawable/list_selector.xml
res/layout-large-land/files.xml
res/layout/file_activity_details.xml
res/layout/file_details_fragment.xml
res/layout/files.xml
res/values/colors.xml
res/values/strings.xml
src/eu/alefzero/owncloud/DisplayUtils.java
src/eu/alefzero/owncloud/ui/activity/FileDetailActivity.java
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
src/eu/alefzero/owncloud/ui/fragment/FileListFragment.java

index d9f8d68..f7c8392 100644 (file)
@@ -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"/>
index d9f8d68..f7c8392 100644 (file)
@@ -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"/>
index 68f8c86..32d86b0 100644 (file)
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
     android:layout_width="fill_parent"\r
     android:layout_height="fill_parent"\r
+    android:background="@color/owncloud_white"\r
     android:orientation="horizontal" >\r
 \r
     <LinearLayout\r
         android:id="@+id/file_list_container"\r
         android:layout_width="0dp"\r
-        android:layout_height="wrap_content"\r
+        android:layout_height="fill_parent"\r
         android:layout_weight="1" >\r
 \r
         <fragment\r
 \r
     <LinearLayout android:id="@+id/file_details_container"\r
         android:layout_width="0dp"\r
-        android:layout_height="wrap_content"\r
+        android:layout_height="fill_parent"\r
         android:layout_weight="2" >\r
 \r
-        <fragment\r
-            android:id="@+id/fileDetail"\r
-            android:layout_width="fill_parent"\r
-            android:layout_height="fill_parent"\r
-            class="eu.alefzero.owncloud.ui.fragment.FileDetailFragment" >\r
-\r
-            <!-- Preview: layout=@layout/file_details_empty -->\r
-        </fragment>\r
+        <!-- Preview: layout=@layout/file_details_empty -->\r
     </LinearLayout>\r
 \r
 </LinearLayout>
\ No newline at end of file
index 664d756..f37270b 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>\r
-<!-- \r
+<!--\r
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
   GNU General Public License for more details.\r
 \r
   You should have received a copy of the GNU General Public License\r
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
- -->\r
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r\r
+-->\r
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
     android:layout_width="fill_parent"\r
     android:layout_height="fill_parent"\r
     android:orientation="vertical" >\r
 \r
-<fragment\r
-    android:id="@+id/fileDetail"\r
-    android:layout_width="fill_parent"\r
-    android:layout_height="fill_parent"\r
-    class="eu.alefzero.owncloud.ui.fragment.FileDetailFragment" />\r
+    <LinearLayout\r
+        android:id="@+id/fragment"\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="fill_parent" >\r
+            <!-- Preview: layout=@layout/file_details_fragment -->\r
+    </LinearLayout>\r
 \r
 </LinearLayout>
\ No newline at end of file
index f4cd33f..c011e67 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- 
+<!--
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
 
   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>
\ No newline at end of file
+                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>
\ No newline at end of file
index e1be03b..3ff6012 100644 (file)
@@ -19,6 +19,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
     android:layout_width="fill_parent"\r
     android:layout_height="fill_parent"\r
+    android:background="@color/owncloud_white"\r
     android:orientation="vertical" >\r
 \r
     <fragment\r
index 521105b..26a029b 100644 (file)
@@ -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>
\ No newline at end of file
index a75f227..afec754 100644 (file)
     <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>
index 40bcb5e..08afd65 100644 (file)
@@ -35,7 +35,7 @@ public class DisplayUtils {
             attachedsuff++;\r
         }\r
         result = ((int) (result * 100)) / 100.;\r
-        return result + suffixes[attachedsuff];\r
+        return result + " " + suffixes[attachedsuff];\r
     }\r
 \r
     public static String HtmlDecode(String s) {\r
index 80898cf..cb899f6 100644 (file)
@@ -43,11 +43,19 @@ public class FileDetailActivity extends SherlockFragmentActivity {
         getWindow().requestFeature(Window.FEATURE_NO_TITLE);\r
         setContentView(R.layout.file_activity_details);\r
 \r
-        mFileDetail = new FileDetailFragment(getIntent());\r
         FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\r
-        ft.add(R.id.fileDetail, mFileDetail);\r
+        mFileDetail = new FileDetailFragment();\r
+        ft.add(R.id.fragment, mFileDetail, "FileDetails");\r
         ft.commit();\r
 \r
     }\r
 \r
+    @Override\r
+    protected void onResume() {\r
+        super.onResume();\r
+        mFileDetail.updateFileDetails(getIntent());\r
+    }\r
+    \r
+    \r
+\r
 }\r
index 3e3082c..5fd4003 100644 (file)
@@ -17,7 +17,6 @@
  */\r
 package eu.alefzero.owncloud.ui.fragment;\r
 \r
-import android.app.FragmentTransaction;\r
 import android.content.BroadcastReceiver;\r
 import android.content.Context;\r
 import android.content.Intent;\r
@@ -29,10 +28,10 @@ import android.view.LayoutInflater;
 import android.view.View;\r
 import android.view.View.OnClickListener;\r
 import android.view.ViewGroup;\r
+import android.widget.Button;\r
 import android.widget.ImageView;\r
 import android.widget.TextView;\r
 import android.widget.Toast;\r
-import android.widget.VideoView;\r
 \r
 import com.actionbarsherlock.app.SherlockFragment;\r
 \r
@@ -52,33 +51,43 @@ public class FileDetailFragment extends SherlockFragment implements
 \r
     public static final String FILE = "FILE";\r
 \r
+    private DownloadFinishReceiver mDownloadFinishReceiver;\r
     private Intent mIntent;\r
+    private int mLayout;\r
     private View mView;\r
-    private DownloadFinishReceiver mDownloadFinishReceiver;\r
     private OCFile mFile;\r
 \r
-    private int mLayout;\r
-    private boolean mEmptyLayout;\r
-\r
     /**\r
-     * Default constructor. When inflated by android -> display empty layout\r
+     * Default constructor - contains real layout\r
      */\r
-    public FileDetailFragment() {\r
-        mLayout = R.layout.file_details_empty;\r
-        mEmptyLayout = true;\r
+    public FileDetailFragment(){\r
+        mLayout = R.layout.file_details_fragment;\r
     }\r
-\r
+    \r
     /**\r
-     * Custom construtor. Use with a {@link FragmentTransaction}. The intent has\r
-     * to contain {@link FileDetailFragment#FILE} with an OCFile and also\r
-     * {@link FileDownloader#EXTRA_ACCOUNT} with the account.\r
+     * Creates a dummy layout. For use if the user never has\r
+     * tapped on a file before\r
      * \r
-     * @param nonEmptyFragment True, to enable file detail rendering\r
+     * @param useEmptyView If true, use empty layout\r
      */\r
-    public FileDetailFragment(Intent intent) {\r
+    public FileDetailFragment(boolean useEmptyView){\r
+        if(useEmptyView){\r
+            mLayout = R.layout.file_details_empty;\r
+        } else {\r
+            mLayout = R.layout.file_details_fragment;\r
+        }\r
+    }\r
+    \r
+    /**\r
+     * Use this when creating the fragment and display\r
+     * a file at the same time\r
+     * \r
+     * @param showDetailsIntent The Intent with the required parameters\r
+     * @see FileDetailFragment#updateFileDetails(Intent)\r
+     */\r
+    public FileDetailFragment(Intent showDetailsIntent) {\r
+        mIntent = showDetailsIntent;\r
         mLayout = R.layout.file_details_fragment;\r
-        mIntent = intent;\r
-        mEmptyLayout = false;\r
     }\r
 \r
     @Override\r
@@ -122,85 +131,63 @@ public class FileDetailFragment extends SherlockFragment implements
             setFiletype(DisplayUtils.convertMIMEtoPrettyPrint(mFile\r
                     .getMimetype()));\r
             setFilesize(mFile.getFileLength());\r
-\r
-            // set file preview if available and possible\r
-            VideoView videoView = (VideoView) mView\r
-                    .findViewById(R.id.videoView1);\r
-            videoView.setVisibility(View.INVISIBLE);\r
-            if (mFile.getStoragePath() == null) {\r
-                ImageView imageView = (ImageView) getView().findViewById(\r
-                        R.id.imageView2);\r
-                imageView.setImageResource(R.drawable.download);\r
-                imageView.setOnClickListener(this);\r
-            } else {\r
+            \r
+            // Update preview\r
+            if (mFile.getStoragePath() != null) {\r
                 if (mFile.getMimetype().startsWith("image/")) {\r
-                    ImageView imageView = (ImageView) mView\r
-                            .findViewById(R.id.imageView2);\r
+                    ImageView preview = (ImageView) getView().findViewById(\r
+                            R.id.fdPreview);\r
                     Bitmap bmp = BitmapFactory.decodeFile(mFile.getStoragePath());\r
-                    imageView.setImageBitmap(bmp);\r
-                } else if (mFile.getMimetype().startsWith("video/")) {\r
-                    videoView.setVisibility(View.VISIBLE);\r
-                    videoView.setVideoPath(mFile.getStoragePath());\r
-                    videoView.start();\r
+                    preview.setImageBitmap(bmp);\r
                 }\r
             }\r
+            \r
+            // Make download button effective\r
+            Button downloadButton = (Button) getView().findViewById(R.id.fdDownloadBtn);\r
+            downloadButton.setOnClickListener(this);\r
         }\r
     }\r
-\r
-    @Override\r
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r
-            Bundle savedInstanceState) {\r
-        View view = null;\r
-\r
-        view = inflater.inflate(mLayout, container, false);\r
-        mIntent = getActivity().getIntent();\r
-        mView = view;\r
-\r
-        // make sure we are not using the empty layout\r
-        if (mEmptyLayout == false) {\r
-            updateFileDetails();\r
-        }\r
-\r
-        return view;\r
-    }\r
-\r
-    @Override\r
-    public View getView() {\r
-        return mView == null ? super.getView() : mView;\r
-    };\r
-\r
+    \r
     private void setFilename(String filename) {\r
-        TextView tv = (TextView) getView().findViewById(R.id.textView1);\r
+        TextView tv = (TextView) getView().findViewById(R.id.fdFilename);\r
         if (tv != null)\r
             tv.setText(filename);\r
     }\r
 \r
     private void setFiletype(String mimetype) {\r
-        TextView tv = (TextView) getView().findViewById(R.id.textView2);\r
+        TextView tv = (TextView) getView().findViewById(R.id.fdType);\r
         if (tv != null)\r
             tv.setText(mimetype);\r
     }\r
 \r
     private void setFilesize(long filesize) {\r
-        TextView tv = (TextView) getView().findViewById(R.id.textView3);\r
+        TextView tv = (TextView) getView().findViewById(R.id.fdSize);\r
         if (tv != null)\r
             tv.setText(DisplayUtils.bitsToHumanReadable(filesize));\r
     }\r
 \r
-    /**\r
-     * Use this to check if the correct layout is loaded. When android\r
-     * instanciates this class using the default constructor, the layout will be\r
-     * empty.\r
-     * \r
-     * Once a user touches a file for the first time, you must instanciate a new\r
-     * Fragment with the new FileDetailFragment(true) to inflate the actual\r
-     * details\r
-     * \r
-     * @return If the layout is empty, this method will return true, otherwise\r
-     *         false\r
-     */\r
-    public boolean isEmptyLayout() {\r
-        return mEmptyLayout;\r
+    @Override\r
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r
+            Bundle savedInstanceState) {\r
+        View view = null;\r
+        view = inflater.inflate(mLayout, container, false);\r
+        mView = view;\r
+        if(mLayout == R.layout.file_details_fragment){\r
+            // Phones will launch an activity with this intent\r
+            if(mIntent == null){\r
+                mIntent = getActivity().getIntent();\r
+            }\r
+            updateFileDetails();\r
+        }\r
+        \r
+        return view;\r
+    }\r
+    \r
+    \r
+\r
+    @Override\r
+    public View getView() {\r
+        return super.getView() == null ? mView : super.getView();\r
     }\r
 \r
     @Override\r
@@ -209,8 +196,7 @@ public class FileDetailFragment extends SherlockFragment implements
         Intent i = new Intent(getActivity(), FileDownloader.class);\r
         i.putExtra(FileDownloader.EXTRA_ACCOUNT,\r
                 mIntent.getParcelableExtra(FileDownloader.EXTRA_ACCOUNT));\r
-        i.putExtra(FileDownloader.EXTRA_FILE_PATH,\r
-                mIntent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));\r
+        i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getPath());\r
         getActivity().startService(i);\r
     }\r
 \r
index 5647bf5..1dc6576 100644 (file)
@@ -52,6 +52,7 @@ public class FileListFragment extends FragmentListView {
     private Stack<String> mDirNames;\r
     private Vector<OCFile> mFiles;\r
     private DataStorageManager mStorageManager;\r
+    private boolean mIsLargeDevice = false;\r
 \r
     public FileListFragment() {\r
         mDirNames = new Stack<String>();\r
@@ -62,14 +63,27 @@ public class FileListFragment extends FragmentListView {
         super.onCreate(savedInstanceState);\r
 \r
         mAccount = AccountUtils.getCurrentOwnCloudAccount(getActivity());\r
-        getListView().setDivider(\r
-                getResources().getDrawable(R.drawable.uploader_list_separator));\r
+        getListView().setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));\r
         getListView().setDividerHeight(1);\r
 \r
         populateFileList();\r
     }\r
 \r
     @Override\r
+    public void onStart() {\r
+                \r
+        // Create a placeholder upon launch\r
+        View fragmentContainer = getActivity().findViewById(R.id.file_details_container);\r
+        if (fragmentContainer != null) {\r
+            mIsLargeDevice = true;\r
+            FragmentTransaction transaction = getFragmentManager().beginTransaction();\r
+            transaction.replace(R.id.file_details_container, new FileDetailFragment(true));\r
+            transaction.commit();\r
+        }\r
+        super.onStart();\r
+    }\r
+\r
+    @Override\r
     public void onItemClick(AdapterView<?> l, View v, int position, long id) {\r
         if (mFiles.size() <= position) {\r
             throw new IndexOutOfBoundsException("Incorrect item selected");\r
@@ -84,53 +98,51 @@ public class FileListFragment extends FragmentListView {
             ((FileDisplayActivity) getActivity()).pushPath(dirname);\r
 \r
             populateFileList();\r
+            resetFileFragment();\r
+\r
             return;\r
         }\r
 \r
-        Intent showDetailsIntent = new Intent(getActivity(),\r
-                FileDetailActivity.class);\r
+        Intent showDetailsIntent = new Intent(getActivity(), FileDetailActivity.class);\r
         showDetailsIntent.putExtra(FileDetailFragment.FILE, file);\r
         showDetailsIntent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);\r
 \r
-        // Try to find by tag first\r
-        FileDetailFragment fd = (FileDetailFragment) getFragmentManager()\r
-                .findFragmentByTag("FileDetails");\r
-\r
-        // Could be the first time the user has touched a file. find by id\r
-        if (fd == null) {\r
-            fd = (FileDetailFragment) getFragmentManager().findFragmentById(\r
-                    R.id.fileDetail);\r
-        }\r
-\r
-        // Tablets will have this fragment, phones not. Could still be null\r
-        if (fd != null) {\r
-\r
-            if (fd.isEmptyLayout()) {\r
-                // True, if this is the first time a user taps on a file\r
-                fd = new FileDetailFragment(showDetailsIntent);\r
-                FragmentTransaction transaction = getFragmentManager()\r
-                        .beginTransaction();\r
-                transaction.replace(R.id.file_details_container, fd,\r
-                        "FileDetails");\r
+        // If we are on a large device -> update fragment\r
+        if (mIsLargeDevice) {\r
+            FileDetailFragment fileDetails = (FileDetailFragment) getFragmentManager().findFragmentByTag("FileDetails");\r
+            if (fileDetails == null) {\r
+                FragmentTransaction transaction = getFragmentManager().beginTransaction();\r
+                transaction.replace(R.id.file_details_container, new FileDetailFragment(showDetailsIntent), "FileDetails");\r
+                transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);\r
                 transaction.commit();\r
             } else {\r
-                fd.updateFileDetails(showDetailsIntent);\r
+                fileDetails.updateFileDetails(showDetailsIntent);\r
             }\r
-\r
         } else {\r
             startActivity(showDetailsIntent);\r
         }\r
     }\r
 \r
+    /**\r
+     * Resets the FileDetailsFragment on Tablets so that it always displays\r
+     * "Tab on a file to display it's details"\r
+     */\r
+    private void resetFileFragment() {\r
+        FileDetailFragment fileDetails = (FileDetailFragment) getFragmentManager().findFragmentByTag("FileDetails");\r
+        if (fileDetails != null) {\r
+            FragmentTransaction transaction = getFragmentManager().beginTransaction();\r
+            transaction.remove(fileDetails);\r
+            transaction.add(R.id.file_details_container, new FileDetailFragment(true));\r
+            transaction.commit();\r
+        }\r
+    }\r
+\r
     @Override\r
-    public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2,\r
-            long arg3) {\r
+    public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\r
         ClipData.Item item = new ClipData.Item("ASD");\r
-        ClipDescription cd = new ClipDescription("ASD",\r
-                new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN });\r
+        ClipDescription cd = new ClipDescription("ASD", new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN });\r
         ClipData dragData = new ClipData(cd, item);\r
-        arg1.startDrag(dragData,\r
-                new View.DragShadowBuilder(arg0.getChildAt(arg2)), null, 0);\r
+        arg1.startDrag(dragData, new View.DragShadowBuilder(arg0.getChildAt(arg2)), null, 0);\r
         return true;\r
     }\r
 \r
@@ -140,6 +152,7 @@ public class FileListFragment extends FragmentListView {
     public void onNavigateUp() {\r
         mDirNames.pop();\r
         populateFileList();\r
+        resetFileFragment();\r
     }\r
 \r
     /**\r
@@ -151,16 +164,13 @@ public class FileListFragment extends FragmentListView {
             s += a + "/";\r
         Log.e("ASD", s);\r
 \r
-        mStorageManager = new FileDataStorageManager(mAccount, getActivity()\r
-                .getContentResolver());\r
+        mStorageManager = new FileDataStorageManager(mAccount, getActivity().getContentResolver());\r
         OCFile file = mStorageManager.getFileByPath(s);\r
         mFiles = mStorageManager.getDirectoryContent(file);\r
         if (mFiles == null || mFiles.size() == 0) {\r
-            Toast.makeText(getActivity(), "There are no files here",\r
-                    Toast.LENGTH_LONG).show();\r
+            Toast.makeText(getActivity(), "There are no files here", Toast.LENGTH_LONG).show();\r
         }\r
-        setListAdapter(new FileListListAdapter(file, mStorageManager,\r
-                getActivity()));\r
+        setListAdapter(new FileListListAdapter(file, mStorageManager, getActivity()));\r
     }\r
 \r
     // TODO: Delete this testing stuff.\r