Skip to content

Commit

Permalink
On branded clients always use branding info
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky authored and backportbot-nextcloud[bot] committed Jan 15, 2024
1 parent 8bcdfce commit 10c52f8
Showing 1 changed file with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 10c52f8

Please sign in to comment.