X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/b59784af890d90ccca1674ea176f9171bd60198b..a99f74bd9e09ed9acc74b0fe276ed030b91fc85d:/src/com/owncloud/android/Uploader.java diff --git a/src/com/owncloud/android/Uploader.java b/src/com/owncloud/android/Uploader.java index 3f67dc2a..6f9dc6dd 100644 --- a/src/com/owncloud/android/Uploader.java +++ b/src/com/owncloud/android/Uploader.java @@ -1,9 +1,10 @@ /* ownCloud Android client application * Copyright (C) 2012 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 as published by - * the Free Software Foundation, either version 3 of the License, or + * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -129,7 +130,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro case DIALOG_NO_ACCOUNT: builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setTitle(R.string.uploader_wrn_no_account_title); - builder.setMessage(R.string.uploader_wrn_no_account_text); + builder.setMessage(String.format(getString(R.string.uploader_wrn_no_account_text), getString(R.string.app_name))); builder.setCancelable(false); builder.setPositiveButton(R.string.uploader_wrn_no_account_setup_btn_text, new OnClickListener() { @Override @@ -325,58 +326,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() { @@ -432,7 +399,8 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro finish(); } catch (SecurityException e) { - Toast.makeText(this, getString(R.string.uploader_error_forbidden_content), Toast.LENGTH_LONG).show(); + String message = String.format(getString(R.string.uploader_error_forbidden_content), getString(R.string.app_name)); + Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } }