Browse Source

added first draft of uploadListActivity

Luke Owncloud 10 years ago
parent
commit
ba7e62e9f3

+ 13 - 1
AndroidManifest.xml

@@ -161,8 +161,20 @@
         <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
         
         <activity android:name=".ui.activity.LogHistoryActivity"/>
+
+        <activity android:name=".ui.errorhandling.ErrorShowActivity" />
+        <activity android:name=".ui.activity.UploadsListActivity" >
+
+            <!-- for testing only: -->
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+            <!-- end: for testing only: -->
+        </activity>
         
-        <receiver android:name=".files.InstantUploadBroadcastReceiver">
+		<receiver android:name=".files.InstantUploadBroadcastReceiver">
             <intent-filter>
                 <!-- unofficially supported by many Android phones but not by HTC devices: -->
                 <action android:name="com.android.camera.NEW_PICTURE" />

+ 11 - 0
res/layout/errorhandling_showerror.xml

@@ -0,0 +1,11 @@
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+
+    <TextView
+        android:id="@+id/errorTextView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+</ScrollView>

+ 1 - 1
res/layout/upload_files_layout.xml

@@ -28,7 +28,7 @@
         android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1"
-        class="com.owncloud.android.ui.fragment.LocalFileListFragment" />
+        class="com.owncloud.android.ui.fragment.UploadsListFragment" />
 
     <LinearLayout
         android:layout_width="match_parent"

+ 129 - 0
res/layout/uploads_list_item.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/ListItemLayout"
+    android:layout_width="fill_parent"
+    android:background="@drawable/list_selector"
+    android:orientation="horizontal"
+    android:layout_height="56dp">
+
+    <FrameLayout
+        android:layout_width="56dp"
+        android:layout_height="56dp"
+        android:focusable="false"
+        android:focusableInTouchMode="false">
+
+        <ImageView
+            android:id="@+id/imageView2"
+            android:layout_width="@dimen/file_icon_size"
+            android:layout_height="@dimen/file_icon_size"
+            android:layout_gravity="center_vertical"
+            android:layout_marginLeft="22dp"
+            android:src="@drawable/local_file_indicator" />
+
+        <ImageView
+            android:id="@+id/imageView1"
+            android:layout_width="@dimen/file_icon_size"
+            android:layout_height="@dimen/file_icon_size"
+            android:layout_gravity="center_vertical"
+            android:layout_marginLeft="9dp"
+            android:src="@drawable/ic_menu_archive" />
+
+        <ImageView
+            android:id="@+id/imageView3"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom|right"
+            android:layout_marginBottom="10dp"
+            android:layout_marginRight="2dp"
+            android:src="@drawable/ic_favorite" />
+    </FrameLayout>
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_vertical"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/Filename"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
+            android:ellipsize="middle"
+            android:singleLine="true"
+            android:text="TextView"
+            android:textColor="#303030"
+            android:textSize="16dip" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
+            android:weightSum="1">
+
+            <TextView
+                android:id="@+id/last_mod"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="TextView"
+                android:layout_weight=".5"
+                android:textColor="@color/list_item_lastmod_and_filesize_text"
+                android:textSize="12dip"/>
+
+            <TextView
+                android:id="@+id/file_size"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="right"
+                android:text="TextView"
+                android:textColor="@color/list_item_lastmod_and_filesize_text"
+                android:layout_weight=".5"
+                android:textSize="12dip"/>
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="25dp"
+        android:layout_height="match_parent"
+        android:gravity="center_vertical"
+        android:orientation="vertical">
+
+    <ImageView
+        android:id="@+id/sharedIcon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginLeft="4dp"
+        android:layout_marginBottom="4dp"
+        android:layout_marginRight="4dp"
+        android:src="@drawable/sharedlink" />
+
+    <ImageView
+        android:id="@+id/sharedWithMeIcon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginLeft="4dp"
+        android:layout_marginRight="4dp"
+        android:layout_marginTop="4dp"
+        android:src="@drawable/shared_with_me" />
+
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/custom_checkbox"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:layout_marginLeft="4dp"
+        android:layout_marginRight="4dp"
+        android:gravity=""
+        android:src="@android:drawable/checkbox_off_background" />
+
+</LinearLayout>

+ 11 - 0
res/layout/uploads_list_layout.xml

@@ -0,0 +1,11 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+
+    <fragment
+        android:id="@+id/UploadsListFragment"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        class="com.owncloud.android.ui.fragment.UploadsListFragment" />
+
+</FrameLayout>

+ 6 - 1
res/menu/main_menu.xml

@@ -55,7 +55,12 @@
         android:orderInCategory="2"
         android:showAsAction="never"
         android:title="@string/actionbar_sort"/>
-
+	<item
+        android:id="@+id/action_uploads_list"
+        android:icon="@drawable/ic_action_settings"
+        android:orderInCategory="2"
+        android:showAsAction="never"
+        android:title="Open upload list"/>
     <!-- <item android:id="@+id/search" android:title="@string/actionbar_search" android:icon="@drawable/ic_action_search"></item> -->
 
 </menu>

+ 6 - 1
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -105,7 +105,7 @@ import com.owncloud.android.utils.ErrorMessageAdapter;
 
 
 /**
- * Displays, what files the user has available in his ownCloud.
+ * Displays, what files the user has available in his ownCloud. This is the main view.
  * 
  * @author Bartek Przybylski
  * @author David A. Velasco
@@ -495,6 +495,11 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
             startActivity(loggerIntent);
             break;
         }
+        case R.id.action_uploads_list: {
+            Intent uploadListIntent = new Intent(getApplicationContext(),UploadsListActivity.class);
+            startActivity(uploadListIntent);
+            break;
+        }
         case android.R.id.home: {
             FileFragment second = getSecondFragment();
             OCFile currentDir = getCurrentDir();

+ 1 - 1
src/com/owncloud/android/ui/activity/Uploader.java

@@ -68,7 +68,7 @@ import com.owncloud.android.utils.DisplayUtils;
 /**
  * This class is registered for Intents android.intent.action.SEND and android.intent.action.SEND_MULTIPLE
  * and causes indicated to be uploaded to an ownCloud instance. User can choose which account to use as well
- * as the upload destination.
+ * as the upload destination. Better name: UploadHandlerActivity
  * 
  * @author Bartek Przybylski
  * 

+ 43 - 0
src/com/owncloud/android/ui/activity/UploadsListActivity.java

@@ -0,0 +1,43 @@
+package com.owncloud.android.ui.activity;
+
+import java.io.File;
+
+import android.os.Bundle;
+
+import com.owncloud.android.R;
+import com.owncloud.android.db.UploadDbHandler;
+import com.owncloud.android.ui.errorhandling.ExceptionHandler;
+import com.owncloud.android.ui.fragment.UploadsListFragment;
+
+/**
+ * Activity listing pending, active, and completed uploads. User can delete
+ * completed uploads from view. Content of this list of coming from
+ * {@link UploadDbHandler}.
+ */
+public class UploadsListActivity extends FileActivity implements UploadsListFragment.ContainerActivity {
+
+    private static final String TAG = "UploadsListActivity";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
+        setContentView(R.layout.uploads_list_layout);
+    }
+
+    // ////////////////////////////////////////
+    // UploadsListFragment.ContainerActivity
+    // ////////////////////////////////////////
+    @Override
+    public void onUploadItemClick(File file) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public File getInitialFilter() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

+ 171 - 0
src/com/owncloud/android/ui/adapter/UploadsListAdapter.java

@@ -0,0 +1,171 @@
+package com.owncloud.android.ui.adapter;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.db.UploadDbHandler;
+import com.owncloud.android.db.UploadDbObject;
+import com.owncloud.android.utils.DisplayUtils;
+
+/**
+ * This Adapter populates a ListView with following types of uploads: pending, active, completed.
+ * Filtering possible.
+ * 
+ */
+public class UploadsListAdapter extends BaseAdapter implements ListAdapter {
+    
+    private Context mContext;
+    private UploadDbObject[] mUploads = null;
+
+    public UploadsListAdapter(Context context) {
+        mContext = context;
+        loadUploadItemsFromDb();
+    }
+
+    @Override
+    public boolean areAllItemsEnabled() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled(int position) {
+        return true;
+    }
+
+    @Override
+    public int getCount() {
+        return mUploads != null ? mUploads.length : 0;
+    }
+
+    @Override
+    public Object getItem(int position) {
+        if (mUploads == null || mUploads.length <= position)
+            return null;
+        return mUploads[position];
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return mUploads != null && mUploads.length <= position ? position : -1;
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        return 0;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        View view = convertView;
+        if (view == null) {
+            LayoutInflater inflator = (LayoutInflater) mContext
+                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            view = inflator.inflate(R.layout.uploads_list_item, null);
+        }
+        if (mUploads != null && mUploads.length > position) {
+            UploadDbObject file = mUploads[position];
+            
+            TextView fileName = (TextView) view.findViewById(R.id.Filename);
+            String name = file.getLocalPath();
+            fileName.setText(name);
+            
+//            ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
+//            if (!file.isDirectory()) {
+//                fileIcon.setImageResource(R.drawable.file);
+//            } else {
+//                fileIcon.setImageResource(R.drawable.ic_menu_archive);
+//            }
+
+            TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);
+            TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
+            ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
+//            if (!file.isDirectory()) {
+//                fileSizeV.setVisibility(View.VISIBLE);
+//                fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.length()));
+//                lastModV.setVisibility(View.VISIBLE);
+//                lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.lastModified()));
+//                ListView parentList = (ListView)parent;
+//                if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { 
+//                    checkBoxV.setVisibility(View.GONE);
+//                } else {
+//                    if (parentList.isItemChecked(position)) {
+//                        checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
+//                    } else {
+//                        checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
+//                    }
+//                    checkBoxV.setVisibility(View.VISIBLE);
+//                }
+//
+//            } else {
+                fileSizeV.setVisibility(View.GONE);
+                lastModV.setVisibility(View.GONE);
+                checkBoxV.setVisibility(View.GONE);
+//            }
+            
+            view.findViewById(R.id.imageView2).setVisibility(View.INVISIBLE);   // not GONE; the alignment changes; ugly way to keep it
+            view.findViewById(R.id.imageView3).setVisibility(View.GONE);
+            
+            view.findViewById(R.id.sharedIcon).setVisibility(View.GONE);
+            view.findViewById(R.id.sharedWithMeIcon).setVisibility(View.GONE);
+        }
+
+        return view;
+    }
+
+    @Override
+    public int getViewTypeCount() {
+        return 1;
+    }
+
+    @Override
+    public boolean hasStableIds() {
+        return false;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return (mUploads == null || mUploads.length == 0);
+    }
+
+    /**
+     * Load upload items from {@link UploadDbHandler}.
+     */
+    public void loadUploadItemsFromDb() {
+        UploadDbHandler mDb = new UploadDbHandler(mContext);
+        List<UploadDbObject> list = mDb.getAllStoredUploads();
+        mUploads = list.toArray(new UploadDbObject[list.size()]);
+        if (mUploads != null) {
+            Arrays.sort(mUploads, new Comparator<UploadDbObject>() {
+                @Override
+                public int compare(UploadDbObject lhs, UploadDbObject rhs) {
+//                    if (lhs.isDirectory() && !rhs.isDirectory()) {
+//                        return -1;
+//                    } else if (!lhs.isDirectory() && rhs.isDirectory()) {
+//                        return 1;
+//                    }
+                    return compareNames(lhs, rhs);
+                }
+            
+                private int compareNames(UploadDbObject lhs, UploadDbObject rhs) {
+                    return lhs.getLocalPath().toLowerCase().compareTo(rhs.getLocalPath().toLowerCase());                
+                }
+            
+            });
+        }
+        notifyDataSetChanged();
+    }
+}

+ 26 - 0
src/com/owncloud/android/ui/errorhandling/ErrorShowActivity.java

@@ -0,0 +1,26 @@
+package com.owncloud.android.ui.errorhandling;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+
+public class ErrorShowActivity extends Activity {
+
+	private static final String TAG = ErrorShowActivity.class.getName();
+
+	TextView error;
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		Log.e(TAG, "ErrorShowActivity was called. See above for StackTrace.");
+		Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
+		setContentView(R.layout.errorhandling_showerror);
+		error = (TextView) findViewById(R.id.errorTextView);
+		error.setText(getIntent().getStringExtra("error"));
+
+	}
+}

+ 66 - 0
src/com/owncloud/android/ui/errorhandling/ExceptionHandler.java

@@ -0,0 +1,66 @@
+package com.owncloud.android.ui.errorhandling;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Build;
+import android.util.Log;
+
+public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler {
+	private final Activity myContext;
+	private final String LINE_SEPARATOR = "\n";
+
+	private static final String TAG = ExceptionHandler.class.getName();
+
+	public ExceptionHandler(Activity context) {
+		myContext = context;
+	}
+
+	public void uncaughtException(Thread thread, Throwable exception) {
+	    Log.e(TAG, "ExceptionHandler caught UncaughtException", exception);
+		StringWriter stackTrace = new StringWriter();
+		exception.printStackTrace(new PrintWriter(stackTrace));
+		StringBuilder errorReport = new StringBuilder();
+		errorReport.append("************ CAUSE OF ERROR ************\n\n");
+		errorReport.append(stackTrace.toString());
+
+		errorReport.append("\n************ DEVICE INFORMATION ***********\n");
+		errorReport.append("Brand: ");
+		errorReport.append(Build.BRAND);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("Device: ");
+		errorReport.append(Build.DEVICE);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("Model: ");
+		errorReport.append(Build.MODEL);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("Id: ");
+		errorReport.append(Build.ID);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("Product: ");
+		errorReport.append(Build.PRODUCT);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("\n************ FIRMWARE ************\n");
+		errorReport.append("SDK: ");
+		errorReport.append(Build.VERSION.SDK_INT);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("Release: ");
+		errorReport.append(Build.VERSION.RELEASE);
+		errorReport.append(LINE_SEPARATOR);
+		errorReport.append("Incremental: ");
+		errorReport.append(Build.VERSION.INCREMENTAL);
+		errorReport.append(LINE_SEPARATOR);
+
+		Log.e(TAG, "An exception was thrown and handled by ExceptionHandler:", exception);
+
+		Intent intent = new Intent(myContext, ErrorShowActivity.class);
+		intent.putExtra("error", errorReport.toString());
+		myContext.startActivity(intent);
+
+		android.os.Process.killProcess(android.os.Process.myPid());
+		System.exit(1000);
+	}
+
+}

+ 192 - 0
src/com/owncloud/android/ui/fragment/UploadsListFragment.java

@@ -0,0 +1,192 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2011  Bartek Przybylski
+ *   Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   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/>.
+ *
+ */
+package com.owncloud.android.ui.fragment;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.SparseBooleanArray;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ImageView;
+import android.widget.ListView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.ui.adapter.UploadsListAdapter;
+
+/**
+ * A Fragment that lists all files and folders in a given LOCAL path.
+ * 
+ * @author LukeOwncloud
+ * 
+ */
+public class UploadsListFragment extends ExtendedListFragment {
+    private static final String TAG = "LocalFileListFragment";
+
+    /**
+     * Reference to the Activity which this fragment is attached to. For
+     * callbacks
+     */
+    private UploadsListFragment.ContainerActivity mContainerActivity;
+
+    /** Adapter to connect the data from the directory with the View object */
+    private UploadsListAdapter mAdapter = null;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+        try {
+            mContainerActivity = (ContainerActivity) activity;
+        } catch (ClassCastException e) {
+            throw new ClassCastException(activity.toString() + " must implement "
+                    + UploadsListFragment.ContainerActivity.class.getSimpleName());
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        Log_OC.i(TAG, "onCreateView() start");
+        View v = super.onCreateView(inflater, container, savedInstanceState);
+        getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
+        disableSwipe(); // Disable pull refresh
+//        setMessageForEmptyList(getString(R.string.local_file_list_empty));
+        setMessageForEmptyList("No uploads available.");
+        Log_OC.i(TAG, "onCreateView() end");
+        return v;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        Log_OC.i(TAG, "onActivityCreated() start");
+
+        super.onActivityCreated(savedInstanceState);
+        mAdapter = new UploadsListAdapter(getActivity());
+        setListAdapter(mAdapter);
+
+        Log_OC.i(TAG, "onActivityCreated() stop");
+    }
+
+    public void selectAll() {
+        int numberOfFiles = mAdapter.getCount();
+        for (int i = 0; i < numberOfFiles; i++) {
+            File file = (File) mAdapter.getItem(i);
+            if (file != null) {
+                if (!file.isDirectory()) {
+                    // / Click on a file
+                    getListView().setItemChecked(i, true);
+                    // notify the change to the container Activity
+                    mContainerActivity.onUploadItemClick(file);
+                }
+            }
+        }
+    }
+
+    public void deselectAll() {
+        mAdapter = new UploadsListAdapter(getActivity());
+        setListAdapter(mAdapter);
+    }
+
+    /**
+     * Checks the file clicked over. Browses inside if it is a directory.
+     * Notifies the container activity in any case.
+     */
+    @Override
+    public void onItemClick(AdapterView<?> l, View v, int position, long id) {
+        File file = (File) mAdapter.getItem(position);
+
+        if (file != null) {
+
+            // notify the click to container Activity
+            mContainerActivity.onUploadItemClick(file);
+
+            ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
+            if (checkBoxV != null) {
+                if (getListView().isItemChecked(position)) {
+                    checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
+                } else {
+                    checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
+                }
+            }
+
+        } else {
+            Log_OC.w(TAG, "Null object in ListAdapter!!");
+        }
+    }
+
+    /**
+     * Returns the fule paths to the files checked by the user
+     * 
+     * @return File paths to the files checked by the user.
+     */
+    public String[] getCheckedFilePaths() {
+        ArrayList<String> result = new ArrayList<String>();
+        SparseBooleanArray positions = mList.getCheckedItemPositions();
+        if (positions.size() > 0) {
+            for (int i = 0; i < positions.size(); i++) {
+                if (positions.get(positions.keyAt(i)) == true) {
+                    result.add(((File) mList.getItemAtPosition(positions.keyAt(i))).getAbsolutePath());
+                }
+            }
+
+            Log_OC.d(TAG, "Returning " + result.size() + " selected files");
+        }
+        return result.toArray(new String[result.size()]);
+    }
+
+    /**
+     * Interface to implement by any Activity that includes some instance of
+     * UploadsListFragment
+     * 
+     * @author LukeOwncloud
+     */
+    public interface ContainerActivity {
+
+        /**
+         * Callback method invoked when an upload item is clicked by the user on
+         * the upload list
+         * 
+         * @param file
+         */
+        public void onUploadItemClick(File file);
+
+        /**
+         * Callback method invoked when the parent activity is fully created to
+         * get the filter which is to be applied to the upload list.
+         * 
+         * @return Filter to be applied. Can be null, then all uploads are
+         *         shown.
+         */
+        public File getInitialFilter();
+
+    }
+
+}