On branded clients always use branding info

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2023-12-19 08:37:58 +01:00 committed by Tobias Kaminsky (Rebase PR Action)
parent ead050d0f3
commit 56f9584dc2

View file

@ -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);
}
}