Browse Source

first download & preview scratch, removing unused code, changing noncompatible code

Bartek Przybylski 13 years ago
parent
commit
007edfe102

BIN
res/drawable-hdpi/download.png


BIN
res/drawable-ldpi/download.png


BIN
res/drawable-mdpi/download.png


+ 12 - 0
res/layout/file_details.xml

@@ -27,6 +27,18 @@
 	</LinearLayout>
 	<LinearLayout android:layout_width="fill_parent"
 		android:id="@+id/linearLayout4" 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:layout_width="fill_parent" android:id="@android:id/list"
 			android:layout_height="fill_parent" android:divider="@drawable/uploader_list_separator"
 			android:dividerHeight="1dip"></ListView>

+ 10 - 3
src/eu/alefzero/owncloud/FileDownloader.java

@@ -8,6 +8,7 @@ import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
+import android.content.ContentValues;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Binder;
@@ -20,6 +21,8 @@ import android.os.Message;
 import android.os.Process;
 import android.util.Log;
 import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
+import eu.alefzero.owncloud.db.DbHandler;
+import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
 import eu.alefzero.owncloud.ui.activity.FileDisplayActivity;
 import eu.alefzero.webdav.WebdavClient;
 
@@ -71,8 +74,7 @@ public class FileDownloader extends Service {
     Message msg = mServiceHandler.obtainMessage();
     msg.arg1 = startId;
     mServiceHandler.sendMessage(msg);
-    
-    
+
     return START_NOT_STICKY;
   }
   
@@ -87,7 +89,6 @@ public class FileDownloader extends Service {
     try {
       password = am.blockingGetAuthToken(mAccount, AccountAuthenticator.AUTH_TOKEN_TYPE, true);
     } catch (Exception e) {
-      // TODO Auto-generated catch block
       e.printStackTrace();
     }
     
@@ -105,6 +106,12 @@ public class FileDownloader extends Service {
     File file = new File(dir, mFilePath.replace('/', '.'));
     
     wdc.downloadFile(mFilePath, file);
+    ContentValues cv = new ContentValues();
+    cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getAbsolutePath());
+    getContentResolver().update(ProviderTableMeta.CONTENT_URI,
+        cv,
+        ProviderTableMeta.FILE_NAME +"=? AND "+ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
+        new String[]{mFilePath.substring(mFilePath.lastIndexOf('/')+1), mAccount.name});
     nm.cancel(1);
   }
   

+ 10 - 0
src/eu/alefzero/owncloud/Uploader.java

@@ -438,6 +438,16 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
                 Uploader.this.onUploadComplete(false, "Error while uploading file: " + c.getString(c.getColumnIndex(Media.DISPLAY_NAME)));
               }
             });
+          } else {
+            mHandler.post(new Runnable() {
+              public void run() {
+                Uploader.this.PartialupdateUpload(c.getString(c.getColumnIndex(Media.DATA)),
+                    c.getString(c.getColumnIndex(Media.DISPLAY_NAME)),
+                    mUploadPath+"/"+c.getString(c.getColumnIndex(Media.DISPLAY_NAME)),
+                    c.getString(c.getColumnIndex(Media.MIME_TYPE)),
+                    c.getString(c.getColumnIndex(Media.SIZE)));
+              }
+            });
           }
         } else if (uri.getScheme().equals("file")) {
          final File file = new File(Uri.decode(uri.toString()).replace(uri.getScheme()+"://", ""));

+ 4 - 234
src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java

@@ -18,59 +18,26 @@
 
 package eu.alefzero.owncloud.ui.activity;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.Stack;
-
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.app.AlertDialog;
 import android.app.Dialog;
-import android.app.ListActivity;
 import android.app.ActionBar.OnNavigationListener;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.DialogInterface.OnCancelListener;
 import android.content.res.Configuration;
-import android.database.Cursor;
-import android.database.DataSetObserver;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Matrix;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
 import android.os.Bundle;
-import android.os.Environment;
-import android.support.v4.app.FragmentActivity;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v4.view.Menu;
 import android.support.v4.view.MenuItem;
-import android.text.TextUtils;
-import android.util.Log;
 import android.view.MenuInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
 import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.Spinner;
-import android.widget.SpinnerAdapter;
-import android.widget.TextView;
 import eu.alefzero.owncloud.R;
 import eu.alefzero.owncloud.R.id;
-import eu.alefzero.owncloud.R.layout;
-import eu.alefzero.owncloud.R.menu;
-import eu.alefzero.owncloud.R.string;
 import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
-import eu.alefzero.owncloud.db.DbHandler;
-import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
 import eu.alefzero.owncloud.ui.fragment.FileDetail;
 import eu.alefzero.owncloud.ui.fragment.FileList;
-import eu.alefzero.owncloud.ui.fragment.ActionBar;
 
 /**
  * Displays, what files the user has available in his ownCloud.
@@ -79,12 +46,6 @@ import eu.alefzero.owncloud.ui.fragment.ActionBar;
  */
 
 public class FileDisplayActivity extends android.support.v4.app.FragmentActivity implements OnNavigationListener {
-  private DbHandler mDBHandler;
-  private Stack<String> mParents;
-  private LinkedList<String> mPath;
-  private Account mAccount;
-  private Cursor mCursor;
-  private boolean mIsDisplayingFile;
   private ArrayAdapter<String> mDirectories;
  
   private static final int DIALOG_CHOOSE_ACCOUNT = 0;
@@ -95,7 +56,6 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
   
   public boolean popPath() {
     mDirectories.remove(mDirectories.getItem(0));
-    Log.d("TAG", ""+getActionBar().getCustomView());
     return !mDirectories.isEmpty();
   }
   
@@ -108,51 +68,13 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
     getActionBar().setNavigationMode(android.support.v4.app.ActionBar.NAVIGATION_MODE_LIST);
     getActionBar().setDisplayShowTitleEnabled(false);
     getActionBar().setListNavigationCallbacks(mDirectories, this);
-    
+
     FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
     ft.add(R.id.file_list_container, new FileList());
     if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
       ft.add(R.id.fileDetail, new FileDetail());
     }
     ft.commit();
-
-    /*getSupportFragmentManager().beginTransaction().add(arg0, arg1);
-    FileList fl = new FileList();
-    ft.add(R.id.fileList, fl);
-    ft.commit();
-    /*
-
-    
-    if (savedInstanceState != null) {
-      mParents = (Stack<String>)savedInstanceState.getSerializable("parentsStack");
-      mIsDisplayingFile = savedInstanceState.getBoolean("isDisplayingFile");
-      mPath = (LinkedList<String>)savedInstanceState.getSerializable("path");
-    } else {
-      mParents = new Stack<String>();
-      mPath = new LinkedList<String>();
-      mIsDisplayingFile = false;
-    }
-
-    mDBHandler = new DbHandler(getBaseContext());
-    requestWindowFeature(Window.FEATURE_NO_TITLE);
-    setContentView(R.layout.main);
-
-    AccountManager accMan = AccountManager.get(this);
-    Account[] accounts = accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);
-
-    if (accounts.length == 0) {
-      // using string value since in API7 this constatn is not defined
-      // in API7 < this constatant is defined in Settings.ADD_ACCOUNT_SETTINGS
-      // and Settings.EXTRA_AUTHORITIES
-      Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
-      intent.putExtra("authorities", new String[] {AccountAuthenticator.AUTH_TOKEN_TYPE});
-      startActivity(intent);
-    } else if (accounts.length > 1) {
-      showDialog(DIALOG_CHOOSE_ACCOUNT);
-    } else {
-      mAccount = accounts[0];
-      populateFileList();
-    }*/
   }
 
   @Override
@@ -182,7 +104,7 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
     inflater.inflate(R.menu.menu, menu);
     return true;
   }
-    
+
   private Dialog createChooseAccountDialog() {
     final AccountManager accMan = AccountManager.get(this);
     CharSequence[] items = new CharSequence[accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE).length];
@@ -196,7 +118,7 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
     builder.setCancelable(true);
     builder.setItems(items, new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int item) {
-            mAccount = accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE)[item];
+            //mAccount = accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE)[item];
             dialog.dismiss();
         }
     });
@@ -209,150 +131,11 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
     return alert;
   }
 
-  //@Override
-  //public void onBackPressed() {
-    /*PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
-    if (mIsDisplayingFile) {
-      mIsDisplayingFile = false;
-      setContentView(R.layout.main);
-      pl = (PathLayout) findViewById(R.id.pathLayout1);
-      Uri uri;
-      if (mParents.empty()) {
-        uri = ProviderTableMeta.CONTENT_URI;
-      } else {
-        uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, mParents.peek());
-      }
-      mCursor = managedQuery(uri,
-                             null,
-                             ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
-                             new String[]{mAccount.name}, null);
-  
-      if (mCursor.moveToFirst()) {
-        String s = mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_PATH));
-        for (String str : s.split("/")) {
-          if (!TextUtils.isEmpty(str))
-            pl.push(DisplayUtils.HtmlDecode(str));
-        }
-      }
-      getListView().setAdapter(new FileListListAdapter(mCursor, this));      
-      getListView().invalidate();
-      return;
-    }
-    if (mParents.size()==0) {
-      super.onBackPressed();
-      return;
-    } else if (mParents.size() == 1) {
-      mParents.pop();
-      mPath.removeLast();
-      pl.pop();
-      mCursor = managedQuery(ProviderTableMeta.CONTENT_URI,
-          null,
-          ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
-          new String[]{mAccount.name},
-          null);
-    } else {
-      mParents.pop();
-      mPath.removeLast();
-      pl.pop();
-      mCursor = managedQuery(Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, mParents.peek()),
-          null,
-          ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
-          new String[]{mAccount.name},
-          null);
-    }
-    
-    setListAdapter(new FileListListAdapter(mCursor, this));
-    getListView().invalidate();*/
-  //}
-
-  //@Override
-/*  protected void onListItemClick(ListView l, View v, int position, long id) {
-    super.onListItemClick(l, v, position, id);
-    /*PathLayout pl = (PathLayout) findViewById(R.id.pathLayout1);
-    if (!mCursor.moveToPosition(position)) {
-      throw new IndexOutOfBoundsException("Incorrect item selected");
-    }
-    if (!mIsDisplayingFile) {
-      if (mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)).equals("DIR")) {
-        String id_ = mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta._ID));
-        String dirname = mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_NAME));
-        pl.push(DisplayUtils.HtmlDecode(dirname));
-        mPath.addLast(DisplayUtils.HtmlDecode(dirname));
-        mParents.push(id_);
-        mCursor = managedQuery(Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, id_),
-                               null,
-                               ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
-                               new String[]{mAccount.name}, null);
-        setListAdapter(new FileListListAdapter(mCursor, this));
-      } else {
-        mIsDisplayingFile = true;
-        setContentView(R.layout.file_display);
-        String id_ = mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta._ID));
-        mCursor = managedQuery(Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, id_),
-                               null,
-                               null,
-                               null,
-                               null);
-        mCursor.moveToFirst();
-        // filename
-        TextView tv = (TextView) findViewById(R.id.textView1);
-        tv.setText(mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_NAME)));
-        // filetype
-        tv = (TextView) findViewById(R.id.textView2);
-        tv.setText(DisplayUtils.convertMIMEtoPrettyPrint(mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE))));
-        // size
-        tv = (TextView) findViewById(R.id.textView3);
-        tv.setText(DisplayUtils.bitsToHumanReadable(mCursor.getLong(mCursor.getColumnIndex(ProviderTableMeta.FILE_CONTENT_LENGTH))));
-        // modified
-        tv = (TextView) findViewById(R.id.textView4);
-        tv.setText(mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_MODIFIED)));
-        if (!TextUtils.isEmpty(mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH))) &&
-            mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)).matches("image/*")) {
-          ImageView iv = (ImageView) findViewById(R.id.imageView1);
-          Bitmap bmp = BitmapFactory.decodeFile(mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH)));
-          Matrix m = new Matrix();
-          float scale;
-          if (bmp.getWidth() > bmp.getHeight()) {
-            scale = (float) (200./bmp.getWidth());
-          } else {
-            scale = (float) (200./bmp.getHeight());
-          }
-          m.postScale(scale, scale);
-          Bitmap newBmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), m, true);
-          iv.setImageBitmap(newBmp);
-        }
-        setListAdapter(new FileListActionListAdapter(mCursor, this, mAccount));
-      }    
-      getListView().invalidate();
-    } else {
-        Intent i = (Intent) getListAdapter().getItem(position);
-        if (i.hasExtra("toDownload")) {
-          
-          Intent intent = new Intent(this, FileDownloader.class);
-          intent.putExtra(FileDownloader.EXTRA_FILE_PATH, "/"+((TextView)findViewById(R.id.textView1)).getText().toString());
-          intent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
-          startService(intent);
-          /*
-          if (i.getBooleanExtra("toDownload", false)) {
-            startActivityForResult(i, 200);
-          } else {
-            startActivity(i);            
-          }*/
-       // }
-
-    //}
-//  }
-  
- 
-//    setListAdapter(new FileListListAdapter(mCursor, this));
-//    getListView().invalidate();
-
   @Override
   public boolean onNavigationItemSelected(int itemPosition, long itemId) {
     int i = itemPosition;
     while (i-- != 0) {
-      popPath();
-      //mFileList.onBackPressed();
+      onBackPressed();
     }
     return true;
   }
@@ -367,17 +150,4 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
     }
     ((FileList)getSupportFragmentManager().findFragmentById(id.file_list_container)).onBackPressed();
   }
-  
-  //@Override
-  /*protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-    super.onActivityResult(requestCode, resultCode, data);
-  }
-  
-  @Override
-  protected void onSaveInstanceState(Bundle outState) {
-    super.onSaveInstanceState(outState);
-    outState.putSerializable("parentsStack", mParents);
-    outState.putSerializable("path", mPath);
-    outState.putBoolean("isDisplayingFile", mIsDisplayingFile);
-  }*/
 }

+ 66 - 22
src/eu/alefzero/owncloud/ui/fragment/FileDetail.java

@@ -17,32 +17,36 @@
  */
 package eu.alefzero.owncloud.ui.fragment;
 
-import eu.alefzero.owncloud.DisplayUtils;
-import eu.alefzero.owncloud.R;
-import eu.alefzero.owncloud.cp;
-import eu.alefzero.owncloud.R.id;
-import eu.alefzero.owncloud.R.layout;
-import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
+import android.accounts.Account;
 import android.content.Intent;
 import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.View.OnClickListener;
+import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
+import android.widget.VideoView;
+import eu.alefzero.owncloud.DisplayUtils;
+import eu.alefzero.owncloud.FileDownloader;
+import eu.alefzero.owncloud.R;
+import eu.alefzero.owncloud.db.ProviderMeta.ProviderTableMeta;
 
 /**
  * This Fragment is used to display the details about a file.
  * @author Bartek Przybylski
  *
  */
-public class FileDetail extends Fragment {
+public class FileDetail extends Fragment implements OnClickListener {
   
-  public Intent mIntent;
+  private Intent mIntent;
+  private View mView;
   
   public void setStuff(Intent intent) {
     mIntent = intent;
@@ -50,8 +54,10 @@ public class FileDetail extends Fragment {
   }
   
   private void setStuff(View view) {
+    mView = view;
     String id = mIntent.getStringExtra("FILE_ID");
-    String account_name = mIntent.getStringExtra("ACCOUNT_NAME");
+    Account account = mIntent.getParcelableExtra("ACCOUNT");
+    String account_name = account.name;
     Cursor c = getActivity().managedQuery(
         Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, id),
         null,
@@ -59,11 +65,37 @@ public class FileDetail extends Fragment {
         new String[]{account_name},
         null);
     c.moveToFirst();
-    
+
+    // retrive details from DB
     String filename = c.getString(c.getColumnIndex(ProviderTableMeta.FILE_NAME));
-    setFilename(filename, view);
     String mimetype = c.getString(c.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE));
-    setFiletype(DisplayUtils.convertMIMEtoPrettyPrint(mimetype), view);
+    String path = c.getString(c.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH));
+    long filesize = c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_CONTENT_LENGTH));
+
+    // set file details
+    setFilename(filename);
+    setFiletype(DisplayUtils.convertMIMEtoPrettyPrint(mimetype));
+    setFilesize(filesize);
+    
+    // set file preview if available and possible
+    View w = view.findViewById(R.id.videoView1);
+    w.setVisibility(View.INVISIBLE);
+    if (path == null) {
+      ImageView v = (ImageView) getView().findViewById(R.id.imageView2);
+      v.setImageResource(R.drawable.download);
+      v.setOnClickListener(this);
+    } else {
+      if (mimetype.startsWith("image/")) {
+        ImageView v = (ImageView) view.findViewById(R.id.imageView2);
+        Bitmap bmp = BitmapFactory.decodeFile(path);
+        v.setImageBitmap(bmp);
+      } else if (mimetype.startsWith("video/")) {
+        VideoView v = (VideoView) view.findViewById(R.id.videoView1);
+        v.setVisibility(View.VISIBLE);
+        v.setVideoPath(path);
+        v.start();
+      }
+    }
   }
 
   @Override
@@ -78,21 +110,33 @@ public class FileDetail extends Fragment {
     return v;
   }
 
-  private void setFilename(String filename, View target_view) {
-    TextView tv = (TextView) target_view.findViewById(R.id.textView1);
+  @Override
+  public View getView() {
+    return mView == null ? super.getView() : mView;
+  };
+  
+  public void setFilename(String filename) {
+    TextView tv = (TextView) getView().findViewById(R.id.textView1);
     if (tv != null) tv.setText(filename);
   }
   
-  private void setFiletype(String mimetype, View target_view) {
-    TextView tv = (TextView) target_view.findViewById(R.id.textView2);
+  public void setFiletype(String mimetype) {
+    TextView tv = (TextView) getView().findViewById(R.id.textView2);
     if (tv != null) tv.setText(mimetype);
   }
   
-  public void setFilename(String filename) {
-    setFilename(filename, getView());
+  public void setFilesize(long filesize) {
+    TextView tv = (TextView) getView().findViewById(R.id.textView3);
+    if (tv != null) tv.setText(DisplayUtils.bitsToHumanReadable(filesize));
   }
-  
-  public void setFiletype(String filename) {
-    setFiletype(filename, getView());
+
+  @Override
+  public void onClick(View v) {
+    Toast.makeText(getActivity(), "Downloading", Toast.LENGTH_LONG).show();
+    Intent i = new Intent(getActivity(), FileDownloader.class);
+    i.putExtra(FileDownloader.EXTRA_ACCOUNT, mIntent.getParcelableExtra("ACCOUNT"));
+    i.putExtra(FileDownloader.EXTRA_FILE_PATH, mIntent.getStringExtra("FULL_PATH"));
+    getActivity().startService(i);
   }
+  
 }

+ 5 - 8
src/eu/alefzero/owncloud/ui/fragment/FileList.java

@@ -21,17 +21,12 @@ import java.util.Stack;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
-import android.app.FragmentManager;
 import android.app.Service;
 import android.content.Intent;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.Bundle;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.LayoutInflater;
 import android.view.View;
-import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.TextView;
 import eu.alefzero.owncloud.R;
@@ -85,10 +80,12 @@ public class FileList extends FragmentListView {
         return;
     }
     Intent i = new Intent(getActivity(), FileDetailActivity.class);
-    i.putExtra("FILE_NAME", ((TextView)v.findViewById(R.id.Filename)).getText());
+    String filename = ((TextView)v.findViewById(R.id.Filename)).getText().toString();
+    i.putExtra("FILE_NAME", filename);
+    i.putExtra("FULL_PATH", "/" + filename);
     i.putExtra("FILE_ID", id_);
-    i.putExtra("ACCOUNT_NAME", mAccount.name);
-    FileDetail fd = (FileDetail) getFragmentManager().findFragmentById(R.id.fileDetail);
+    i.putExtra("ACCOUNT", mAccount);
+    FileDetail fd = (FileDetail) getSupportFragmentManager().findFragmentById(R.id.fileDetail);
     if (fd != null) {
       fd.setStuff(i);
     } else {