浏览代码

Merge remote-tracking branch 'origin/navigationDrawer_basic' into navigationDrawer_basic

David A. Velasco 10 年之前
父节点
当前提交
4d7b5a1e50

+ 13 - 5
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -206,7 +206,16 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     protected void onCreate(Bundle savedInstanceState) {
         //Log_OC.wtf(TAG,  "onCreate init");
         super.onCreate(savedInstanceState);
-        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+
+        // Workaround, for fixing a problem with Android Library Suppor v7 19
+        //getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+        if (getSupportActionBar() != null) {
+            getSupportActionBar().hide();
+
+            getSupportActionBar().setDisplayHomeAsUpEnabled(false);
+            getSupportActionBar().setDisplayShowHomeEnabled(false);
+            getSupportActionBar().setDisplayShowTitleEnabled(false);
+        }
 
         mIsFirstAuthAttempt = true;
 
@@ -787,7 +796,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             Intent getServerInfoIntent = new Intent();
             getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);
             getServerInfoIntent.putExtra(
-                OperationsService.EXTRA_SERVER_URL, 
+                OperationsService.EXTRA_SERVER_URL,
                 normalizeUrlSuffix(uri)
             );
             if (mOperationsServiceBinder != null) {
@@ -1106,7 +1115,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                     url = "http://" + url;
                 }
             }
-        
+
             url = normalizeUrlSuffix(url);
         }
         return (url != null ? url : "");
@@ -1425,7 +1434,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);
 
         if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).
-                equals(mAuthTokenType)) { 
+                equals(mAuthTokenType)) {
             response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);
             // the next line is necessary, notifications are calling directly to the 
             // AuthenticatorActivity to update, without AccountManager intervention
@@ -1898,5 +1907,4 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mIsFirstAuthAttempt = true;
     }
 
-
 }

+ 7 - 2
src/com/owncloud/android/ui/activity/FileActivity.java

@@ -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);
         }
     }
     /**

+ 8 - 8
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -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);
 

+ 3 - 1
src/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -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()) {