diff --git a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index 2484b4d22a8e..0dd4e2aa3b70 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -299,12 +299,14 @@ private void setupQuotaElement() { } 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 void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) { .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); } }