From: David A. Velasco Date: Thu, 10 Jan 2013 15:12:59 +0000 (+0100) Subject: Fixed bug preventing the enter in empty folders when uploading files from external... X-Git-Tag: oc-android-1.4.3~70 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/4905f9a3961effe0c974fc862969632b0a5df371?hp=--cc Fixed bug preventing the enter in empty folders when uploading files from external apps through 'share to' or 'send' --- 4905f9a3961effe0c974fc862969632b0a5df371 diff --git a/src/com/owncloud/android/Uploader.java b/src/com/owncloud/android/Uploader.java index 138f68e7..e19a9724 100644 --- a/src/com/owncloud/android/Uploader.java +++ b/src/com/owncloud/android/Uploader.java @@ -325,58 +325,24 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro mFile = mStorageManager.getFileByPath(full_path); if (mFile != null) { Vector files = mStorageManager.getDirectoryContent(mFile); - if (files.size() > 0) { - List> data = new LinkedList>(); - for (OCFile f : files) { - HashMap h = new HashMap(); - if (f.isDirectory()) { - h.put("dirname", f.getFileName()); - data.add(h); - } + List> data = new LinkedList>(); + for (OCFile f : files) { + HashMap h = new HashMap(); + if (f.isDirectory()) { + h.put("dirname", f.getFileName()); + data.add(h); } - SimpleAdapter sa = new SimpleAdapter(this, - data, - R.layout.uploader_list_item_layout, - new String[] {"dirname"}, - new int[] {R.id.textView1}); - setListAdapter(sa); - Button btn = (Button) findViewById(R.id.uploader_choose_folder); - btn.setOnClickListener(this); - getListView().setOnItemClickListener(this); } - } - /* - mCursor = managedQuery(ProviderMeta.ProviderTableMeta.CONTENT_URI, null, ProviderTableMeta.FILE_NAME - + "=? AND " + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?", new String[] { "/", mAccount.name }, null); - - if (mCursor.moveToFirst()) { - mCursor = managedQuery( - ProviderMeta.ProviderTableMeta.CONTENT_URI, - null, - ProviderTableMeta.FILE_CONTENT_TYPE + "=? AND " + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " - + ProviderTableMeta.FILE_PARENT + "=?", - new String[] { "DIR", mAccount.name, - mCursor.getString(mCursor.getColumnIndex(ProviderTableMeta._ID)) }, null); - - ListView lv = getListView(); - lv.setOnItemClickListener(this); - SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.uploader_list_item_layout, mCursor, - new String[] { ProviderTableMeta.FILE_NAME }, new int[] { R.id.textView1 }); - setListAdapter(sca); + SimpleAdapter sa = new SimpleAdapter(this, + data, + R.layout.uploader_list_item_layout, + new String[] {"dirname"}, + new int[] {R.id.textView1}); + setListAdapter(sa); Button btn = (Button) findViewById(R.id.uploader_choose_folder); btn.setOnClickListener(this); - /* - * disable this until new server interaction service wont be created - * // insert create new directory for multiple items uploading if - * (getIntent().getAction().equals(Intent.ACTION_SEND_MULTIPLE)) { - * Button createDirBtn = new Button(this); - * createDirBtn.setId(android.R.id.button1); - * createDirBtn.setText(R.string.uploader_btn_create_dir_text); - * createDirBtn.setOnClickListener(this); ((LinearLayout) - * findViewById(R.id.linearLayout1)).addView( createDirBtn, - * LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); } - * - }*/ + getListView().setOnItemClickListener(this); + } } private boolean prepareStreamsToUpload() { diff --git a/src/com/owncloud/android/ui/activity/UploadFilesActivity.java b/src/com/owncloud/android/ui/activity/UploadFilesActivity.java index d6e9bffe..f2c36afb 100644 --- a/src/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/src/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -140,7 +140,7 @@ public class UploadFilesActivity extends SherlockFragmentActivity implements break; } default: - retval = onOptionsItemSelected(item); + retval = super.onOptionsItemSelected(item); } return retval; }