Browse Source

Merge pull request #5623 from nextcloud/backButton

tint back button correctly
Tobias Kaminsky 5 years ago
parent
commit
7ab1377744

+ 10 - 11
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -112,7 +112,6 @@ import javax.inject.Inject;
 import androidx.annotation.NonNull;
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.ActionBarDrawerToggle;
 import androidx.appcompat.app.ActionBarDrawerToggle;
 import androidx.appcompat.app.AppCompatDelegate;
 import androidx.appcompat.app.AppCompatDelegate;
-import androidx.appcompat.graphics.drawable.DrawerArrowDrawable;
 import androidx.core.content.ContextCompat;
 import androidx.core.content.ContextCompat;
 import androidx.core.view.GravityCompat;
 import androidx.core.view.GravityCompat;
 import androidx.drawerlayout.widget.DrawerLayout;
 import androidx.drawerlayout.widget.DrawerLayout;
@@ -292,7 +291,7 @@ public abstract class DrawerActivity extends ToolbarActivity
         // Set the drawer toggle as the DrawerListener
         // Set the drawer toggle as the DrawerListener
         mDrawerLayout.addDrawerListener(mDrawerToggle);
         mDrawerLayout.addDrawerListener(mDrawerToggle);
         mDrawerToggle.setDrawerIndicatorEnabled(true);
         mDrawerToggle.setDrawerIndicatorEnabled(true);
-        mDrawerToggle.getDrawerArrowDrawable().setColor(ThemeUtils.fontColor(this, true));
+        mDrawerToggle.setDrawerSlideAnimationEnabled(true);
     }
     }
 
 
     /**
     /**
@@ -768,7 +767,6 @@ public abstract class DrawerActivity extends ToolbarActivity
 
 
     /**
     /**
      * Updates title bar and home buttons (state and icon).
      * Updates title bar and home buttons (state and icon).
-     * <p/>
      * Assumes that navigation drawer is NOT visible.
      * Assumes that navigation drawer is NOT visible.
      */
      */
     protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
     protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
@@ -776,16 +774,17 @@ public abstract class DrawerActivity extends ToolbarActivity
 
 
         // set home button properties
         // set home button properties
         if (mDrawerToggle != null && chosenFile != null) {
         if (mDrawerToggle != null && chosenFile != null) {
-            mDrawerToggle.setDrawerIndicatorEnabled(isRoot(chosenFile));
-        } else if (mDrawerToggle != null){
+            if (isRoot(chosenFile)) {
+                mDrawerToggle.setDrawerIndicatorEnabled(true);
+            } else {
+                mDrawerToggle.setDrawerIndicatorEnabled(false);
+                Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
+                upArrow.setColorFilter(ThemeUtils.fontColor(this), PorterDuff.Mode.SRC_ATOP);
+                mDrawerToggle.setHomeAsUpIndicator(upArrow);
+            }
+        } else if (mDrawerToggle != null) {
             mDrawerToggle.setDrawerIndicatorEnabled(false);
             mDrawerToggle.setDrawerIndicatorEnabled(false);
         }
         }
-
-        if (mDrawerToggle != null) {
-            DrawerArrowDrawable icon = mDrawerToggle.getDrawerArrowDrawable();
-            icon.setColorFilter(ThemeUtils.fontColor(this), PorterDuff.Mode.SRC_ATOP);
-            mDrawerToggle.setDrawerArrowDrawable(icon);
-        }
     }
     }
 
 
     /**
     /**

+ 0 - 6
src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java

@@ -132,14 +132,8 @@ public abstract class ToolbarActivity extends BaseActivity {
 
 
         // set home button properties
         // set home button properties
         if (actionBar != null) {
         if (actionBar != null) {
-            actionBar.setDisplayHomeAsUpEnabled(true);
             actionBar.setDisplayShowTitleEnabled(true);
             actionBar.setDisplayShowTitleEnabled(true);
         }
         }
-
-        Toolbar toolbar = findViewById(R.id.toolbar);
-        if (toolbar != null && toolbar.getNavigationIcon() != null) {
-            ThemeUtils.tintDrawable(toolbar.getNavigationIcon(), ThemeUtils.fontColor(this));
-        }
     }
     }
 
 
     /**
     /**