瀏覽代碼

Refactor

Signed-off-by: Joris Bodin <joris.bodin@infomaniak.com>
Joris Bodin 5 年之前
父節點
當前提交
6d34e6c1f8

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

@@ -778,9 +778,9 @@ public abstract class DrawerActivity extends ToolbarActivity
                 mDrawerToggle.setDrawerIndicatorEnabled(true);
             } else {
                 mDrawerToggle.setDrawerIndicatorEnabled(false);
-                Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
-                upArrow.setColorFilter(ThemeUtils.fontAppbarColor(this), PorterDuff.Mode.SRC_ATOP);
-                mDrawerToggle.setHomeAsUpIndicator(upArrow);
+                Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
+                mDrawerToggle.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow,
+                                                                              ThemeUtils.fontAppbarColor(this)));
             }
         } else if (mDrawerToggle != null) {
             mDrawerToggle.setDrawerIndicatorEnabled(false);

+ 1 - 3
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -402,9 +402,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
             actionBar.setDisplayHomeAsUpEnabled(!atRoot);
             actionBar.setHomeButtonEnabled(!atRoot);
 
-            Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
-
-            actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontAppbarColor(this)));
+            ThemeUtils.tintBackButton(actionBar, this);
 
             ThemeUtils.setColoredTitle(getSupportActionBar(), atRoot ? caption : currentDir.getFileName(), this);
         }

+ 1 - 5
src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -782,11 +782,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
             ThemeUtils.colorStatusBar(this);
 
-            Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
-
-            if (actionBar != null) {
-                actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontAppbarColor(this)));
-            }
+            ThemeUtils.tintBackButton(actionBar, this);
 
             Button btnNewFolder = findViewById(R.id.uploader_cancel);
             btnNewFolder.setTextColor(ThemeUtils.primaryColor(this, true));

+ 4 - 4
src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

@@ -746,12 +746,12 @@ public class SettingsActivity extends ThemedPreferenceActivity
         ActionBar actionBar = getDelegate().getSupportActionBar();
 
         if (actionBar != null) {
-            actionBar.setDisplayHomeAsUpEnabled(true);
             ThemeUtils.setColoredTitle(actionBar, getString(R.string.actionbar_settings), this);
-            actionBar.setBackgroundDrawable(new ColorDrawable(ThemeUtils.primaryColor(this)));
+            ThemeUtils.colorStatusBar(this);
+            actionBar.setBackgroundDrawable(new ColorDrawable(ThemeUtils.primaryAppbarColor(this)));
 
-            Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
-            actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontAppbarColor(this)));
+            actionBar.setDisplayHomeAsUpEnabled(true);
+            ThemeUtils.tintBackButton(actionBar, this);
         }
 
         Window window = getWindow();

+ 1 - 2
src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -212,8 +212,7 @@ public class UploadFilesActivity extends FileActivity implements
             actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
             actionBar.setListNavigationCallbacks(mDirectories, this);
 
-            Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
-            actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontAppbarColor(this)));
+            ThemeUtils.tintBackButton(actionBar, this);
         }
 
         // wait dialog

+ 2 - 3
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java

@@ -133,10 +133,9 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
 
         if (actionBar != null) {
             ThemeUtils.setColoredTitle(actionBar, getString(R.string.actionbar_contacts), getContext());
-            actionBar.setDisplayHomeAsUpEnabled(true);
 
-            Drawable backArrow = getResources().getDrawable(R.drawable.ic_arrow_back);
-            actionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.fontAppbarColor(getContext())));
+            actionBar.setDisplayHomeAsUpEnabled(true);
+            ThemeUtils.tintBackButton(actionBar, getContext());
         }
 
         arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver());

+ 2 - 2
src/main/java/com/owncloud/android/utils/ThemeUtils.java

@@ -437,7 +437,7 @@ public final class ThemeUtils {
      * @param fragmentActivity fragment activity
      * @param color            the color
      */
-    public static void colorStatusBar(FragmentActivity fragmentActivity, @ColorInt int color) {
+    public static void colorStatusBar(Activity fragmentActivity, @ColorInt int color) {
         Window window = fragmentActivity.getWindow();
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && window != null) {
             window.setStatusBarColor(color);
@@ -452,7 +452,7 @@ public final class ThemeUtils {
         }
     }
 
-    public static void colorStatusBar(FragmentActivity fragmentActivity) {
+    public static void colorStatusBar(Activity fragmentActivity) {
         colorStatusBar(fragmentActivity, primaryAppbarColor(fragmentActivity));
     }