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;
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) {
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(mDirectories, this);
-
// wait dialog
if (mCurrentDialog != null) {
mCurrentDialog.dismiss();
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;
}
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) {
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
}
- toggleOffSelectAll();
}
* {@inheritDoc}
*/
@Override
- public void onDirectoryClick(File directory) {
+ public void onDirectoryClick(File directory) {
pushDirname(directory);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
- toggleOffSelectAll();
}
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()) {
<?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>