- int i = itemPosition;
- while (i-- != 0) {
- onBackPressed();
- }
- // the next operation triggers a new call to this method, but it's necessary to
- // ensure that the name exposed in the action bar is the current directory when the
- // user selected it in the navigation list
- if (itemPosition != 0)
+ if (itemPosition != 0) {
+ String targetPath = "";
+ for (int i=itemPosition; i < mDirectories.getCount() - 1; i++) {
+ targetPath = mDirectories.getItem(i) + OCFile.PATH_SEPARATOR + targetPath;
+ }
+ targetPath = OCFile.PATH_SEPARATOR + targetPath;
+ OCFile targetFolder = mStorageManager.getFileByPath(targetPath);
+ if (targetFolder != null) {
+ browseTo(targetFolder);
+ }
+
+ // the next operation triggers a new call to this method, but it's necessary to
+ // ensure that the name exposed in the action bar is the current directory when the
+ // user selected it in the navigation list