From d789d304e3c2a0024ba940e9e0d7c938c0e73c11 Mon Sep 17 00:00:00 2001 From: masensio Date: Thu, 28 May 2015 14:43:30 +0200 Subject: [PATCH] Click on OC icon shows the navigation drawer if the current folder isn't the root folder --- .../android/ui/activity/FileActivity.java | 4 ++-- .../ui/activity/FileDisplayActivity.java | 20 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/com/owncloud/android/ui/activity/FileActivity.java b/src/com/owncloud/android/ui/activity/FileActivity.java index 135eeea04d..bfac912aaa 100644 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@ -609,8 +609,8 @@ public class FileActivity extends ActionBarActivity */ @Override public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { - Log_OC.d(TAG, "Received result of operation in FileActivity - common behaviour for all the " + - "FileActivities "); + Log_OC.d(TAG, "Received result of operation in FileActivity - common behaviour for all the " + + "FileActivities "); mFileOperationsHelper.setOpIdWaitingFor(Long.MAX_VALUE); diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 193d5d6825..cc6944cf2d 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -520,10 +520,18 @@ public class FileDisplayActivity extends HookActivity implements break; } case android.R.id.home: { - if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { - mDrawerLayout.closeDrawer(GravityCompat.START); + FileFragment second = getSecondFragment(); + OCFile currentDir = getCurrentDir(); + if((currentDir != null && currentDir.getParentId() != 0) || + (second != null && second.getFile() != null)) { + onBackPressed(); + } else { - mDrawerLayout.openDrawer(GravityCompat.START); + if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { + mDrawerLayout.closeDrawer(GravityCompat.START); + } else { + mDrawerLayout.openDrawer(GravityCompat.START); + } } break; } @@ -843,7 +851,8 @@ public class FileDisplayActivity extends HookActivity implements registerReceiver(mUploadFinishReceiver, uploadIntentFilter); // Listen for download messages - IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage()); + IntentFilter downloadIntentFilter = new IntentFilter( + FileDownloader.getDownloadAddedMessage()); downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage()); mDownloadFinishReceiver = new DownloadFinishReceiver(); registerReceiver(mDownloadFinishReceiver, downloadIntentFilter); @@ -965,7 +974,8 @@ public class FileDisplayActivity extends HookActivity implements // current folder was removed from the server Toast.makeText( FileDisplayActivity.this, String.format( - getString(R.string.sync_current_folder_was_removed), + getString(R.string. + sync_current_folder_was_removed), mDirectories.getItem(0)), Toast.LENGTH_LONG) .show();