Browse Source

Merge pull request #12304 from nextcloud/forceBranding

On branded clients always use branding info
Tobias Kaminsky 1 năm trước cách đây
mục cha
commit
5def5a6809

+ 34 - 32
app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -299,12 +299,14 @@ public abstract class DrawerActivity extends ToolbarActivity
     }
 
     public void updateHeader() {
+        int primaryColor = themeColorUtils.unchangedPrimaryColor(getAccount(), this);
+
         if (getAccount() != null &&
-            getCapabilities().getServerBackground() != null) {
+            getCapabilities().getServerBackground() != null &&
+            !getResources().getBoolean(R.bool.is_branded_client)) {
 
             OCCapability capability = getCapabilities();
             String logo = capability.getServerLogo();
-            int primaryColor = themeColorUtils.unchangedPrimaryColor(getAccount(), this);
 
             // set background to primary color
             LinearLayout drawerHeader = mNavigationViewHeader.findViewById(R.id.drawer_header_view);
@@ -348,39 +350,39 @@ public abstract class DrawerActivity extends ToolbarActivity
                     .load(Uri.parse(logo))
                     .into(target);
             }
+        }
 
-            // hide ecosystem apps according to user preference or in branded client
-            LinearLayout ecosystemApps = mNavigationViewHeader.findViewById(R.id.drawer_ecosystem_apps);
-            if (getResources().getBoolean(R.bool.is_branded_client) || !preferences.isShowEcosystemApps()) {
-                ecosystemApps.setVisibility(View.GONE);
+        // hide ecosystem apps according to user preference or in branded client
+        LinearLayout ecosystemApps = mNavigationViewHeader.findViewById(R.id.drawer_ecosystem_apps);
+        if (getResources().getBoolean(R.bool.is_branded_client) || !preferences.isShowEcosystemApps()) {
+            ecosystemApps.setVisibility(View.GONE);
+        } else {
+            LinearLayout[] views = {
+                ecosystemApps.findViewById(R.id.drawer_ecosystem_notes),
+                ecosystemApps.findViewById(R.id.drawer_ecosystem_talk),
+                ecosystemApps.findViewById(R.id.drawer_ecosystem_more)
+            };
+
+            views[0].setOnClickListener(v -> openAppOrStore("it.niedermann.owncloud.notes"));
+            views[1].setOnClickListener(v -> openAppOrStore("com.nextcloud.talk2"));
+            views[2].setOnClickListener(v -> openAppStore("Nextcloud", true));
+
+            int iconColor;
+            if (Hct.fromInt(primaryColor).getTone() < 80.0) {
+                iconColor = Color.WHITE;
             } else {
-                LinearLayout[] views = {
-                    ecosystemApps.findViewById(R.id.drawer_ecosystem_notes),
-                    ecosystemApps.findViewById(R.id.drawer_ecosystem_talk),
-                    ecosystemApps.findViewById(R.id.drawer_ecosystem_more)
-                };
-
-                views[0].setOnClickListener(v -> openAppOrStore("it.niedermann.owncloud.notes"));
-                views[1].setOnClickListener(v -> openAppOrStore("com.nextcloud.talk2"));
-                views[2].setOnClickListener(v -> openAppStore("Nextcloud", true));
-
-                int iconColor;
-                if (Hct.fromInt(primaryColor).getTone() < 80.0) {
-                    iconColor = Color.WHITE;
-                } else {
-                    iconColor = getColor(R.color.grey_800_transparent);
-                }
-                for (LinearLayout view : views) {
-                    ImageView imageView = (ImageView) view.getChildAt(0);
-                    imageView.setImageTintList(ColorStateList.valueOf(iconColor));
-                    GradientDrawable background = (GradientDrawable) imageView.getBackground();
-                    background.setStroke(DisplayUtils.convertDpToPixel(1, this), iconColor);
-                    TextView textView = (TextView) view.getChildAt(1);
-                    textView.setTextColor(iconColor);
-                }
-
-                ecosystemApps.setVisibility(View.VISIBLE);
+                iconColor = getColor(R.color.grey_800_transparent);
+            }
+            for (LinearLayout view : views) {
+                ImageView imageView = (ImageView) view.getChildAt(0);
+                imageView.setImageTintList(ColorStateList.valueOf(iconColor));
+                GradientDrawable background = (GradientDrawable) imageView.getBackground();
+                background.setStroke(DisplayUtils.convertDpToPixel(1, this), iconColor);
+                TextView textView = (TextView) view.getChildAt(1);
+                textView.setTextColor(iconColor);
             }
+
+            ecosystemApps.setVisibility(View.VISIBLE);
         }
     }