import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
private OCFile mWaitingToPreview;
private Handler mHandler;
+
+ private boolean mSyncInProgress = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@Override
public void onBackPressed() {
- OCFileListFragment listOfFiles = getListOfFilesFragment();
- if (mDualPane || getSecondFragment() == null) {
- if (listOfFiles != null) { // should never be null, indeed
- if (mDirectories.getCount() <= 1) {
- finish();
- return;
+ if (!mSyncInProgress) {
+ OCFileListFragment listOfFiles = getListOfFilesFragment();
+ if (mDualPane || getSecondFragment() == null) {
+ if (listOfFiles != null) { // should never be null, indeed
+ if (mDirectories.getCount() <= 1) {
+ finish();
+ return;
+ }
+ popDirname();
+ listOfFiles.onBrowseUp();
}
- popDirname();
- listOfFiles.onBrowseUp();
}
+ if (listOfFiles != null) { // should never be null, indeed
+ setFile(listOfFiles.getCurrentFile());
+ }
+ cleanSecondFragment();
}
- if (listOfFiles != null) { // should never be null, indeed
- setFile(listOfFiles.getCurrentFile());
- }
- cleanSecondFragment();
}
@Override
// Sync Folder
startSyncFolderOperation(directory.getRemotePath(), directory.getFileId());
-// // Update folder size on DB
-// getStorageManager().calculateFolderSize(directory.getParentId());
}
if (chosenFile == null || mDualPane) {
// only list of files - set for browsing through folders
OCFile currentDir = getCurrentDir();
- actionBar.setDisplayHomeAsUpEnabled(currentDir != null && currentDir.getParentId() != 0);
+ actionBar.setDisplayHomeAsUpEnabled(currentDir != null && currentDir.getParentId() != 0 && !mSyncInProgress);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(mDirectories, this); // assuming mDirectories is updated
}
+ private void updateDisplayHomeAtSync(){
+ ActionBar actionBar = getSupportActionBar();
+ OCFile currentDir = getCurrentDir();
+ if (currentDir.getParentId() != DataStorageManager.ROOT_PARENT_ID) {
+ actionBar.setHomeButtonEnabled(!mSyncInProgress);
+ actionBar.setDisplayHomeAsUpEnabled(!mSyncInProgress);
+ }
+ else {
+ actionBar.setHomeButtonEnabled(true);
+ actionBar.setDisplayHomeAsUpEnabled(false);
+ }
+ }
+
/**
* {@inheritDoc}
*/
OCFileListFragment list = getListOfFilesFragment();
enableDisableViewGroup(list.getListView(), true);
+ mSyncInProgress = false;
+ updateDisplayHomeAtSync();
setSupportProgressBarIndeterminateVisibility(false);
if (result.isSuccess()) {
OCFileListFragment list = getListOfFilesFragment();
enableDisableViewGroup(list.getListView(), false);
+ mSyncInProgress = true;
+ updateDisplayHomeAtSync();
// perform folder synchronization
RemoteOperation synchFolderOp = new SynchronizeFolderOperation( remotePath,
currentSyncTime,
parentId,
+ false,
getStorageManager(),
getAccount(),
getApplicationContext()