Merge remote-tracking branch 'origin/navigationDrawer_basic' into navigationDrawer_basic
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 3 Jun 2015 09:09:19 +0000 (11:09 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 3 Jun 2015 09:09:19 +0000 (11:09 +0200)
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/ui/activity/FileActivity.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/preview/PreviewImageActivity.java

index 3ab7690..d741929 100644 (file)
@@ -206,7 +206,16 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     protected void onCreate(Bundle savedInstanceState) {\r
         //Log_OC.wtf(TAG,  "onCreate init");\r
         super.onCreate(savedInstanceState);\r
-        getWindow().requestFeature(Window.FEATURE_NO_TITLE);\r
+\r
+        // Workaround, for fixing a problem with Android Library Suppor v7 19\r
+        //getWindow().requestFeature(Window.FEATURE_NO_TITLE);\r
+        if (getSupportActionBar() != null) {\r
+            getSupportActionBar().hide();\r
+\r
+            getSupportActionBar().setDisplayHomeAsUpEnabled(false);\r
+            getSupportActionBar().setDisplayShowHomeEnabled(false);\r
+            getSupportActionBar().setDisplayShowTitleEnabled(false);\r
+        }\r
 \r
         mIsFirstAuthAttempt = true;\r
 \r
@@ -787,7 +796,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             Intent getServerInfoIntent = new Intent();\r
             getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);\r
             getServerInfoIntent.putExtra(\r
-                OperationsService.EXTRA_SERVER_URL, \r
+                OperationsService.EXTRA_SERVER_URL,\r
                 normalizeUrlSuffix(uri)\r
             );\r
             if (mOperationsServiceBinder != null) {\r
@@ -1106,7 +1115,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                     url = "http://" + url;\r
                 }\r
             }\r
-        \r
+\r
             url = normalizeUrlSuffix(url);\r
         }\r
         return (url != null ? url : "");\r
@@ -1425,7 +1434,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);\r
 \r
         if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).\r
-                equals(mAuthTokenType)) { \r
+                equals(mAuthTokenType)) {\r
             response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);\r
             // the next line is necessary, notifications are calling directly to the \r
             // AuthenticatorActivity to update, without AccountManager intervention\r
@@ -1898,5 +1907,4 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mIsFirstAuthAttempt = true;\r
     }\r
 \r
-\r
 }\r
index 382019f..13bad2e 100644 (file)
@@ -393,13 +393,18 @@ public class FileActivity extends ActionBarActivity
     }
 
     protected void updateActionBarTitleAndHomeButton(){
-        if (mFile.getParentId() == 0) {
+        if (mFile.getParentId() == 0 ||
+                (!mFile.isFolder() && mFile.getParentId() == 1)) {
             getSupportActionBar().setTitle(getString(
                     R.string.default_display_name_for_root_folder));
             mDrawerToggle.setDrawerIndicatorEnabled(true);
-        } else {
+        } else if (mFile.isFolder()) {
             getSupportActionBar().setTitle(mFile.getFileName().toString());
             mDrawerToggle.setDrawerIndicatorEnabled(false);
+        } else {
+            getSupportActionBar().setTitle(getStorageManager().getFileById(mFile.getParentId())
+                    .getFileName().toString());
+            mDrawerToggle.setDrawerIndicatorEnabled(false);
         }
     }
     /**
index 8a64bce..ebf20f5 100644 (file)
@@ -1139,7 +1139,6 @@ public class FileDisplayActivity extends HookActivity
         cleanSecondFragment();
         // Sync Folder
         startSyncFolderOperation(directory, false);
-        
     }
 
     /**
@@ -1176,13 +1175,14 @@ public class FileDisplayActivity extends HookActivity
             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);
-                if (actionBarTitleView != null) {    // it's null in Android 2.x
-                    actionBarTitleView.setContentDescription(
-                            getString(R.string.default_display_name_for_root_folder));
-                }
+            String title = getString(R.string.default_display_name_for_root_folder);
+            if (noRoot) {
+                title = currentDir.getFileName();
+            }
+            actionBar.setTitle(title);
+            View actionBarTitleView = getWindow().getDecorView().findViewById(actionBarTitleId);
+            if (actionBarTitleView != null) {    // it's null in Android 2.x
+                actionBarTitleView.setContentDescription(title);
             }
             actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
 
index 6ddaf97..12ba166 100644 (file)
@@ -93,7 +93,7 @@ public class PreviewImageActivity extends FileActivity implements
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
+        //requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
         setContentView(R.layout.preview_image_activity);
 
         // Navigation Drawer
@@ -105,6 +105,8 @@ public class PreviewImageActivity extends FileActivity implements
         actionBar.setDisplayHomeAsUpEnabled(true);
         actionBar.hide();
 
+        updateActionBarTitleAndHomeButton();
+
         // Make sure we're running on Honeycomb or higher to use FullScreen and
         // Immersive Mode
         if (isHoneycombOrHigher()) {