Merge branch 'master' into oauth_login
[pub/Android/ownCloud.git] / src / com / owncloud / android / Uploader.java
index 0db4871..6ec8c4f 100644 (file)
@@ -30,7 +30,6 @@ import com.owncloud.android.datamodel.DataStorageManager;
 import com.owncloud.android.datamodel.FileDataStorageManager;\r
 import com.owncloud.android.datamodel.OCFile;\r
 import com.owncloud.android.files.services.FileUploader;\r
-import com.owncloud.android.network.OwnCloudClientUtils;\r
 \r
 import android.accounts.Account;\r
 import android.accounts.AccountManager;\r
@@ -60,7 +59,6 @@ import android.widget.SimpleAdapter;
 import android.widget.Toast;\r
 \r
 import com.owncloud.android.R;\r
-import eu.alefzero.webdav.WebdavClient;\r
 \r
 /**\r
  * This can be used to upload things to an ownCloud instance.\r
@@ -325,58 +323,24 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
         mFile = mStorageManager.getFileByPath(full_path);\r
         if (mFile != null) {\r
             Vector<OCFile> files = mStorageManager.getDirectoryContent(mFile);\r
-            if (files.size() > 0) {\r
-                List<HashMap<String, Object>> data = new LinkedList<HashMap<String,Object>>();\r
-                for (OCFile f : files) {\r
-                    HashMap<String, Object> h = new HashMap<String, Object>();\r
-                    if (f.isDirectory()) {\r
-                        h.put("dirname", f.getFileName());\r
-                        data.add(h);\r
-                    }\r
+            List<HashMap<String, Object>> data = new LinkedList<HashMap<String,Object>>();\r
+            for (OCFile f : files) {\r
+                HashMap<String, Object> h = new HashMap<String, Object>();\r
+                if (f.isDirectory()) {\r
+                    h.put("dirname", f.getFileName());\r
+                    data.add(h);\r
                 }\r
-                SimpleAdapter sa = new SimpleAdapter(this,\r
-                                                     data,\r
-                                                     R.layout.uploader_list_item_layout,\r
-                                                     new String[] {"dirname"},\r
-                                                     new int[] {R.id.textView1});\r
-                setListAdapter(sa);\r
-                Button btn = (Button) findViewById(R.id.uploader_choose_folder);\r
-                btn.setOnClickListener(this);\r
-                getListView().setOnItemClickListener(this);\r
             }\r
-        }\r
-        /*\r
-        mCursor = managedQuery(ProviderMeta.ProviderTableMeta.CONTENT_URI, null, ProviderTableMeta.FILE_NAME\r
-                + "=? AND " + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?", new String[] { "/", mAccount.name }, null);\r
-\r
-        if (mCursor.moveToFirst()) {\r
-            mCursor = managedQuery(\r
-                    ProviderMeta.ProviderTableMeta.CONTENT_URI,\r
-                    null,\r
-                    ProviderTableMeta.FILE_CONTENT_TYPE + "=? AND " + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND "\r
-                            + ProviderTableMeta.FILE_PARENT + "=?",\r
-                    new String[] { "DIR", mAccount.name,\r
-                            mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta._ID)) }, null);\r
-\r
-            ListView lv = getListView();\r
-            lv.setOnItemClickListener(this);\r
-            SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.uploader_list_item_layout, mCursor,\r
-                    new String[] { ProviderTableMeta.FILE_NAME }, new int[] { R.id.textView1 });\r
-            setListAdapter(sca);\r
+            SimpleAdapter sa = new SimpleAdapter(this,\r
+                                                data,\r
+                                                R.layout.uploader_list_item_layout,\r
+                                                new String[] {"dirname"},\r
+                                                new int[] {R.id.textView1});\r
+            setListAdapter(sa);\r
             Button btn = (Button) findViewById(R.id.uploader_choose_folder);\r
             btn.setOnClickListener(this);\r
-            /*\r
-             * disable this until new server interaction service wont be created\r
-             * // insert create new directory for multiple items uploading if\r
-             * (getIntent().getAction().equals(Intent.ACTION_SEND_MULTIPLE)) {\r
-             * Button createDirBtn = new Button(this);\r
-             * createDirBtn.setId(android.R.id.button1);\r
-             * createDirBtn.setText(R.string.uploader_btn_create_dir_text);\r
-             * createDirBtn.setOnClickListener(this); ((LinearLayout)\r
-             * findViewById(R.id.linearLayout1)).addView( createDirBtn,\r
-             * LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); }\r
-             *\r
-        }*/\r
+            getListView().setOnItemClickListener(this);\r
+        }\r
     }\r
 \r
     private boolean prepareStreamsToUpload() {\r