Bläddra i källkod

Replaced the logo and header drawer background/color

Signed-off-by: Kilian Périsset <kilian.perisset@infomaniak.com>
Kilian Périsset 5 år sedan
förälder
incheckning
bd94196ede

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

@@ -40,6 +40,7 @@ import android.os.SystemClock;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
@@ -196,6 +197,11 @@ public abstract class DrawerActivity extends ToolbarActivity
         mNavigationView = findViewById(R.id.nav_view);
         if (mNavigationView != null) {
 
+            // Setting up drawer header
+            View navigationHeader = mNavigationView.getHeaderView(0);
+            FrameLayout drawerHeader = navigationHeader.findViewById(R.id.drawer_header_view);
+            setupDrawerHeader(drawerHeader);
+
             setupDrawerMenu(mNavigationView);
             getAndDisplayUserQuota();
             setupQuotaElement();
@@ -259,9 +265,8 @@ public abstract class DrawerActivity extends ToolbarActivity
     /**
      * setup drawer header, basically the logo color
      */
-    private void setupDrawerHeader() {
-        ImageView drawerLogo = findViewById(R.id.drawer_header_logo);
-        drawerLogo.setColorFilter(ThemeUtils.primaryColor(getAccount(), true, this));
+    private void setupDrawerHeader(FrameLayout drawerHeader) {
+        drawerHeader.setBackgroundColor(ThemeUtils.primaryColor(getAccount(), true, this));
     }
 
     /**
@@ -523,7 +528,6 @@ public abstract class DrawerActivity extends ToolbarActivity
      */
     public void openDrawer() {
         if (mDrawerLayout != null) {
-            setupDrawerHeader();
             mDrawerLayout.openDrawer(GravityCompat.START);
             updateExternalLinksInDrawer();
             updateQuotaLink();
@@ -923,22 +927,6 @@ public abstract class DrawerActivity extends ToolbarActivity
         }
     }
 
-    /**
-     * Finds a view that was identified by the id attribute from the drawer header.
-     *
-     * @param id the view's id
-     * @return The view if found or <code>null</code> otherwise.
-     */
-    private View findNavigationViewChildById(int id) {
-        NavigationView view = findViewById(R.id.nav_view);
-
-        if (view != null) {
-            return view.getHeaderView(0).findViewById(id);
-        } else {
-            return null;
-        }
-    }
-
     /**
      * Quota view can be either at navigation bottom or header
      *

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 8 - 9
src/main/res/drawable/nextcloud_logo.xml


+ 9 - 8
src/main/res/layout/drawer_header.xml

@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
   Nextcloud Android client application
 
   Copyright (C) 2016 Andy Scherzinger
   Copyright (C) 2016 Nextcloud.
+  Copyright (C) 2020 Infomaniak Network SA
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -19,18 +19,19 @@
   License along with this program. If not, see <http://www.gnu.org/licenses/>.
   -->
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/drawer_header_view"
-              android:layout_width="match_parent"
-              android:layout_height="@dimen/drawer_header_height"
-              android:fitsSystemWindows="true">
+    android:id="@+id/drawer_header_view"
+    android:layout_width="match_parent"
+    android:layout_height="@dimen/drawer_header_height"
+    android:fitsSystemWindows="true">
 
     <ImageView
         android:id="@+id/drawer_header_logo"
         android:layout_width="@dimen/drawer_header_logo_width"
         android:layout_height="match_parent"
         android:layout_margin="@dimen/standard_margin"
-        android:src="@drawable/nextcloud_logo"
+        android:contentDescription="@string/empty"
         android:scaleType="fitCenter"
-        android:contentDescription="@string/empty" />
+        android:src="@drawable/nextcloud_logo"
+        android:tint="@color/drawer_logo_color" />
 
 </FrameLayout>

+ 1 - 0
src/main/res/values/colors.xml

@@ -77,6 +77,7 @@
     <color name="switch_thumb_color_unchecked">#FFFFFF</color>
     <color name="switch_track_color_unchecked">#4D000000</color>
     <color name="drawer_active_item_background">#80000000</color>
+    <color name="drawer_logo_color">#FFFFFF</color>
 
     <!-- Excluded from future app dark theme -->
     <color name="themed_fg">#FFFFFF</color>

Vissa filer visades inte eftersom för många filer har ändrats