Skip to content

Commit ccc7957

Browse files
committed
Colour ecosystem app icons
Signed-off-by: ZetaTom <[email protected]>
1 parent 7086021 commit ccc7957

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import android.content.res.ColorStateList;
3838
import android.content.res.Configuration;
3939
import android.graphics.Bitmap;
40+
import android.graphics.Color;
4041
import android.graphics.drawable.BitmapDrawable;
4142
import android.graphics.drawable.ColorDrawable;
4243
import android.graphics.drawable.Drawable;
@@ -133,6 +134,7 @@
133134
import androidx.core.view.GravityCompat;
134135
import androidx.drawerlayout.widget.DrawerLayout;
135136
import androidx.fragment.app.Fragment;
137+
import hct.Hct;
136138

137139
/**
138140
* Base class to handle setup of the drawer implementation including user switching and avatar fetching and fallback
@@ -362,14 +364,19 @@ public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
362364
views[1].setOnClickListener(v -> openAppOrStore("com.nextcloud.talk2"));
363365
views[2].setOnClickListener(v -> openAppStore("Nextcloud", true));
364366

365-
int color = themeColorUtils.unchangedIconColor(this, primaryColor);
367+
int iconColor;
368+
if (Hct.fromInt(primaryColor).getTone() < 80.0) {
369+
iconColor = Color.WHITE;
370+
} else {
371+
iconColor = getColor(R.color.grey_800_transparent);
372+
}
366373
for (LinearLayout view : views) {
367374
ImageView imageView = (ImageView) view.getChildAt(0);
368-
imageView.setImageTintList(ColorStateList.valueOf(color));
375+
imageView.setImageTintList(ColorStateList.valueOf(iconColor));
369376
GradientDrawable background = (GradientDrawable) imageView.getBackground();
370-
background.setStroke(DisplayUtils.convertDpToPixel(1, this), color);
377+
background.setStroke(DisplayUtils.convertDpToPixel(1, this), iconColor);
371378
TextView textView = (TextView) view.getChildAt(1);
372-
textView.setTextColor(color);
379+
textView.setTextColor(iconColor);
373380
}
374381

375382
ecosystemApps.setVisibility(View.VISIBLE);

app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import com.nextcloud.android.common.ui.util.PlatformThemeUtil;
3030
import com.owncloud.android.R;
3131

32-
import hct.Hct;
33-
3432
import static com.owncloud.android.utils.theme.CapabilityUtils.getCapability;
3533

3634
/**
@@ -59,13 +57,4 @@ public int unchangedFontColor(Context context) {
5957
}
6058
}
6159
}
62-
63-
public int unchangedIconColor(Context context, int primaryColor) {
64-
double hct = Hct.fromInt(primaryColor).getTone();
65-
if (hct < 80.0) {
66-
return Color.WHITE;
67-
} else {
68-
return context.getColor(R.color.grey_700_transparent);
69-
}
70-
}
7160
}

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<color name="grey_200">#EEEEEE</color>
4141
<color name="grey_400">#BDBDBD</color>
4242
<color name="grey_600">#666666</color>
43-
<color name="grey_700_transparent">#B3000000</color>
43+
<color name="grey_800_transparent">#CC000000</color>
4444

4545
<!-- level colors for info notifications/visualisations -->
4646
<color name="infolevel_warning">#e9322d</color>

0 commit comments

Comments
 (0)