Merge branch 'master' into 831-room

This commit is contained in:
Stefan Niedermann 2021-03-16 13:54:20 +01:00
commit 1a0e99fd4d
5 changed files with 18 additions and 7 deletions

View file

@ -3,8 +3,6 @@ package it.niedermann.owncloud.notes.main.items;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.BackgroundColorSpan;
@ -66,8 +64,8 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder {
noteCategory.setVisibility(showCategory && !category.isEmpty() ? View.VISIBLE : View.GONE);
noteCategory.setText(category);
@ColorInt int categoryForeground;
@ColorInt int categoryBackground;
@ColorInt final int categoryForeground;
@ColorInt final int categoryBackground;
if (isDarkThemeActive) {
if (ColorUtil.INSTANCE.isColorDark(mainColor)) {
@ -93,8 +91,13 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder {
noteCategory.setTextColor(categoryForeground);
if (noteCategory instanceof Chip) {
((Chip) noteCategory).setChipStrokeColor(ColorStateList.valueOf(categoryBackground));
((Chip) noteCategory).setChipBackgroundColor(ColorStateList.valueOf(isDarkThemeActive ? categoryBackground : Color.TRANSPARENT));
final Chip chip = (Chip) noteCategory;
chip.setChipStrokeColor(ColorStateList.valueOf(categoryBackground));
if(isDarkThemeActive) {
chip.setChipBackgroundColor(ColorStateList.valueOf(categoryBackground));
} else {
chip.setChipBackgroundColorResource(R.color.grid_item_background_selector);
}
} else {
DrawableCompat.setTint(noteCategory.getBackground(), categoryBackground);
}

View file

@ -38,7 +38,8 @@ public class GridItemDecoration extends SectionItemDecoration {
final int spanIndex = lp.getSpanIndex();
// First row gets some spacing at the top
if (position < spanCount && position < adapter.getFirstPositionOfViewType(ItemAdapter.TYPE_SECTION)) {
final int firstSectionPosition = adapter.getFirstPositionOfViewType(ItemAdapter.TYPE_SECTION);
if (position < spanCount && (firstSectionPosition < 0 || position < firstSectionPosition)) {
outRect.top = gutter;
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- Same as grid_item_background_selector in res/drawable, but can be applied as BackgroundColorResource -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/bg_highlighted" android:state_selected="true" />
<item android:color="@android:color/transparent" />
</selector>

View file

@ -0,0 +1 @@
- 🐞 Grid view: no padding top on first line in some cases (#890)

View file

@ -0,0 +1 @@
- 🏷 Category label in grid view doesn't take highlight background colour upon selection (#945)