Revert "Add "select all" option to photo (or other) upload screen"

This commit is contained in:
grecep 2014-10-29 22:37:45 +01:00
parent fd7a940dee
commit 31ffae0093
4 changed files with 7 additions and 74 deletions

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/actionbar_select_all"
android:icon="@android:drawable/checkbox_off_background"
android:orderInCategory="1"
android:showAsAction="always"
android:title="actionbar_select_all"/>
</menu>

View file

@ -34,9 +34,6 @@ import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
import com.actionbarsherlock.internal.view.menu.ActionMenuItemView;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
@ -76,8 +73,6 @@ public class UploadFilesActivity extends FileActivity implements
private static final String WAIT_DIALOG_TAG = "WAIT";
private static final String QUERY_TO_MOVE_DIALOG_TAG = "QUERY_TO_MOVE";
private boolean selectAllToggled = false;
private Menu menu;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -124,7 +119,6 @@ public class UploadFilesActivity extends FileActivity implements
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(mDirectories, this);
// wait dialog
if (mCurrentDialog != null) {
mCurrentDialog.dismiss();
@ -133,15 +127,8 @@ public class UploadFilesActivity extends FileActivity implements
Log_OC.d(TAG, "onCreate() end");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getSherlock().getMenuInflater();
inflater.inflate(R.menu.file_select_all, menu);
this.menu = menu;
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
@ -152,33 +139,12 @@ public class UploadFilesActivity extends FileActivity implements
}
break;
}
case R.id.actionbar_select_all:{
if(selectAllToggled){
toggleOffSelectAll();
}else{
toggleOnSelectAll(item);
}
break;
}
default:
retval = super.onOptionsItemSelected(item);
}
return retval;
}
public void toggleOffSelectAll(MenuItem item){
selectAllToggled = false;
item.setIcon(android.R.drawable.checkbox_off_background);
mFileListFragment.deselectAll();
}
public void toggleOffSelectAll(){
MenuItem item = menu.findItem(R.id.actionbar_select_all);
toggleOffSelectAll(item);
}
public void toggleOnSelectAll(MenuItem item){
selectAllToggled = true;
item.setIcon(android.R.drawable.checkbox_on_background);
mFileListFragment.selectAll();
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
@ -209,7 +175,6 @@ public class UploadFilesActivity extends FileActivity implements
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
}
toggleOffSelectAll();
}
@ -277,11 +242,10 @@ public class UploadFilesActivity extends FileActivity implements
* {@inheritDoc}
*/
@Override
public void onDirectoryClick(File directory) {
public void onDirectoryClick(File directory) {
pushDirname(directory);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
toggleOffSelectAll();
}

View file

@ -98,33 +98,13 @@ public class LocalFileListFragment extends ExtendedListFragment {
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.onFileClick(file);
}
}
}
}
public void deselectAll(){
mAdapter = new LocalFileListAdapter(mContainerActivity.getInitialDirectory(), 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);
File file = (File) mAdapter.getItem(position);
if (file != null) {
/// Click on a directory
if (file.isDirectory()) {

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry combineaccessrules="false" kind="src" path="/owncloud-android"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>