X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/7c2174d09e376ecc5ebd9a510a66dc7582b173f9..15a2d8b8e6bcdac3791cc772af85a2806b87a3b6:/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java diff --git a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java index 2c4ae382..14637599 100644 --- a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java @@ -111,7 +111,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setSupportProgressBarIndeterminateVisibility(false); - Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(getApplicationContext())); +// Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(getApplicationContext())); if(savedInstanceState != null) { mDirs = savedInstanceState.getStringArray(KEY_DIR_ARRAY); @@ -160,6 +160,8 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements break; } case R.id.startSync: { + // This could be interesting + //ContentResolver.cancelSync(null, "org.owncloud"); // cancel the current synchronizations of any other ownCloud account Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); ContentResolver.requestSync( @@ -610,32 +612,30 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements FileSyncService.IN_PROGRESS, false); String account_name = intent .getStringExtra(FileSyncService.ACCOUNT_NAME); + Log.d("FileDisplay", "sync of account " + account_name + " is in_progress: " + inProgress); - setSupportProgressBarIndeterminateVisibility(inProgress); + + if (account_name.equals(AccountUtils.getCurrentOwnCloudAccount(context).name)) { - long OCDirId = intent.getLongExtra(FileSyncService.SYNC_FOLDER, -1); - if (OCDirId >= 0) { - OCFile syncDir = mStorageManager.getFileById(OCDirId); - if (syncDir != null && ( - (mCurrentDir == null && syncDir.getFileName().equals("/")) || - syncDir.equals(mCurrentDir)) - ) { - FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList); - if (fileListFragment != null) { - fileListFragment.listDirectory(); + String synchFolderRemotePath = intent.getStringExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH); + + if (mCurrentDir == null) + mCurrentDir = mStorageManager.getFileByPath("/"); + + if (synchFolderRemotePath != null && mCurrentDir != null && mCurrentDir.getRemotePath().equals(synchFolderRemotePath) ) { + FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager() + .findFragmentById(R.id.fileList); + mCurrentDir = getStorageManager().getFileByPath(synchFolderRemotePath); + if (fileListFragment != null) { + fileListFragment.listDirectory(mCurrentDir); } } - } - - if (!inProgress) { - FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager() - .findFragmentById(R.id.fileList); - if (fileListFragment != null) - fileListFragment.listDirectory(); + + setSupportProgressBarIndeterminateVisibility(inProgress); + } } - } @@ -717,17 +717,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements // If we are on a large device -> update fragment if (mDualPane) { - FileDetailFragment fileDetails = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG); - if (fileDetails == null) { - // first selected file since the current directory was listed - FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); - transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG); - transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); - transaction.commit(); - } else { - // another select file - fileDetails.updateFileDetails(file, AccountUtils.getCurrentOwnCloudAccount(this)); - } + // buttons in the details view are problematic when trying to reuse an existing fragment; create always a new one solves some of them, BUT no all; downloads are 'dangerous' + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG); + transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); + transaction.commit(); } else { // small or medium screen device -> new Activity Intent showDetailsIntent = new Intent(this, FileDetailActivity.class);