import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.ViewGroup;
import android.view.Window;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.MainApp;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.operations.CreateShareOperation;
import com.owncloud.android.operations.MoveFileOperation;
} else {
updateFragmentsVisibility(!file.isFolder());
- updateNavigationElementsInActionBar(file.isFolder() ? null : file);
+ updateActionBarTitleAndHomeButton(file.isFolder() ? null : file);
}
}
}
if (secondFragment != null) {
setSecondFragment(secondFragment);
updateFragmentsVisibility(true);
- updateNavigationElementsInActionBar(file);
+ updateActionBarTitleAndHomeButton(file);
} else {
cleanSecondFragment();
tr.commit();
}
updateFragmentsVisibility(false);
- updateNavigationElementsInActionBar(null);
+ updateActionBarTitleAndHomeButton(null);
}
protected void refreshListOfFilesFragment() {
case android.R.id.home: {
FileFragment second = getSecondFragment();
OCFile currentDir = getCurrentDir();
- if((currentDir != null && currentDir.getParentId() != 0) ||
+ if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
+ mDrawerLayout.closeDrawer(GravityCompat.START);
+ } else if((currentDir != null && currentDir.getParentId() != 0) ||
(second != null && second.getFile() != null)) {
onBackPressed();
} else {
- if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
- mDrawerLayout.closeDrawer(GravityCompat.START);
- } else {
- mDrawerLayout.openDrawer(GravityCompat.START);
- }
+ mDrawerLayout.openDrawer(GravityCompat.START);
}
break;
}
public void onBackPressed() {
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (mDualPane || getSecondFragment() == null) {
+ if (getFile() != null && getFile().getParentId() == 0) {
+ finish();
+ return;
+ }
if (listOfFiles != null) { // should never be null, indeed
listOfFiles.onBrowseUp();
}
if (listOfFiles != null) { // should never be null, indeed
setFile(listOfFiles.getCurrentFile());
}
- updateActionBarTitle();
cleanSecondFragment();
}
// refresh Navigation Drawer account list
mNavigationDrawerAdapter.updateAccountList();
+
// refresh list of files
refreshListOfFilesFragment();
// listOfFiles.listDirectory(root, MainApp.getOnlyOnDevice());
setFile(listOfFiles.getCurrentFile());
startSyncFolderOperation(root, false);
- updateActionBarTitle();
}
cleanSecondFragment();
*/
@Override
public void onBrowsedDownTo(OCFile directory) {
+ setFile(directory);
cleanSecondFragment();
- updateActionBarTitle();
// Sync Folder
startSyncFolderOperation(directory, false);
Fragment detailFragment = new FileDetailFragment(file, getAccount());
setSecondFragment(detailFragment);
updateFragmentsVisibility(true);
- updateNavigationElementsInActionBar(file);
+ updateActionBarTitleAndHomeButton(file);
setFile(file);
}
/**
* TODO
*/
- private void updateNavigationElementsInActionBar(OCFile chosenFile) {
+ private void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
ActionBar actionBar = getSupportActionBar();
// For adding content description tag to a title field in the action bar
// only list of files - set for browsing through folders
OCFile currentDir = getCurrentDir();
boolean noRoot = (currentDir != null && currentDir.getParentId() != 0);
-// actionBar.setDisplayHomeAsUpEnabled(noRoot);
-// actionBar.setDisplayShowTitleEnabled(!noRoot);
+ //actionBar.setDisplayHomeAsUpEnabled(noRoot);
+ //actionBar.setDisplayShowTitleEnabled(!noRoot);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
+ mDrawerToggle.setDrawerIndicatorEnabled(!noRoot);
if (!noRoot) {
actionBar.setTitle(getString(R.string.default_display_name_for_root_folder));
View actionBarTitleView = getWindow().getDecorView().findViewById(actionBarTitleId);
} else {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
+ mDrawerToggle.setDrawerIndicatorEnabled(false);
actionBar.setTitle(chosenFile.getFileName());
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
View actionBarTitleView = getWindow().getDecorView().findViewById(actionBarTitleId);
autoplay);
setSecondFragment(mediaFragment);
updateFragmentsVisibility(true);
- updateNavigationElementsInActionBar(file);
+ updateActionBarTitleAndHomeButton(file);
setFile(file);
}
mWaitingToPreview = file;
requestForDownload();
updateFragmentsVisibility(true);
- updateNavigationElementsInActionBar(file);
+ updateActionBarTitleAndHomeButton(file);
setFile(file);
}