Merge pull request #686 from tobiasKaminsky/bugfixMultipleSelect

Bugfix multiple select
This commit is contained in:
jabarros 2014-10-29 18:09:16 +01:00
commit 945c584f34

View file

@ -18,6 +18,7 @@
package com.owncloud.android.ui.fragment; package com.owncloud.android.ui.fragment;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
@ -209,16 +210,18 @@ public class LocalFileListFragment extends ExtendedListFragment {
* @return File paths to the files checked by the user. * @return File paths to the files checked by the user.
*/ */
public String[] getCheckedFilePaths() { public String[] getCheckedFilePaths() {
String [] result = null; ArrayList<String> result = new ArrayList<String>();
SparseBooleanArray positions = mList.getCheckedItemPositions(); SparseBooleanArray positions = mList.getCheckedItemPositions();
if (positions.size() > 0) { if (positions.size() > 0) {
Log_OC.d(TAG, "Returning " + positions.size() + " selected files");
result = new String[positions.size()];
for (int i = 0; i < positions.size(); i++) { for (int i = 0; i < positions.size(); i++) {
result[i] = ((File) mList.getItemAtPosition(positions.keyAt(i))).getAbsolutePath(); if (positions.get(positions.keyAt(i)) == true) {
result.add(((File) mList.getItemAtPosition(positions.keyAt(i))).getAbsolutePath());
} }
} }
return result;
Log_OC.d(TAG, "Returning " + result.size() + " selected files");
}
return result.toArray(new String[result.size()]);
} }