mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-29 11:59:07 +03:00
Apply branding to sync status
This commit is contained in:
parent
4a3f132b95
commit
778ee79194
5 changed files with 12 additions and 4 deletions
|
@ -41,7 +41,7 @@ public class NoteViewGridHolder extends NoteViewHolder {
|
||||||
super.bind(note, showCategory, mainColor, textColor, searchQuery);
|
super.bind(note, showCategory, mainColor, textColor, searchQuery);
|
||||||
@NonNull final Context context = itemView.getContext();
|
@NonNull final Context context = itemView.getContext();
|
||||||
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);
|
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);
|
||||||
binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? INVISIBLE : VISIBLE);
|
bindStatus(binding.noteStatus, note.getStatus(), mainColor);
|
||||||
bindFavorite(binding.noteFavorite, note.isFavorite());
|
bindFavorite(binding.noteFavorite, note.isFavorite());
|
||||||
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
||||||
bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt().replace(EXCERPT_LINE_SEPARATOR, "\n"), mainColor);
|
bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt().replace(EXCERPT_LINE_SEPARATOR, "\n"), mainColor);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class NoteViewGridHolderOnlyTitle extends NoteViewHolder {
|
||||||
public void bind(@NonNull DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) {
|
public void bind(@NonNull DBNote note, boolean showCategory, int mainColor, int textColor, @Nullable CharSequence searchQuery) {
|
||||||
super.bind(note, showCategory, mainColor, textColor, searchQuery);
|
super.bind(note, showCategory, mainColor, textColor, searchQuery);
|
||||||
@NonNull final Context context = itemView.getContext();
|
@NonNull final Context context = itemView.getContext();
|
||||||
binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? INVISIBLE : VISIBLE);
|
bindStatus(binding.noteStatus, note.getStatus(), mainColor);
|
||||||
bindFavorite(binding.noteFavorite, note.isFavorite());
|
bindFavorite(binding.noteFavorite, note.isFavorite());
|
||||||
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import androidx.annotation.CallSuper;
|
||||||
import androidx.annotation.ColorInt;
|
import androidx.annotation.ColorInt;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
@ -29,6 +30,8 @@ import it.niedermann.owncloud.notes.R;
|
||||||
import it.niedermann.owncloud.notes.branding.BrandingUtil;
|
import it.niedermann.owncloud.notes.branding.BrandingUtil;
|
||||||
import it.niedermann.owncloud.notes.util.Notes;
|
import it.niedermann.owncloud.notes.util.Notes;
|
||||||
|
|
||||||
|
import static android.view.View.INVISIBLE;
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
import static it.niedermann.owncloud.notes.util.ColorUtil.contrastRatioIsSufficient;
|
import static it.niedermann.owncloud.notes.util.ColorUtil.contrastRatioIsSufficient;
|
||||||
import static it.niedermann.owncloud.notes.util.ColorUtil.isColorDark;
|
import static it.niedermann.owncloud.notes.util.ColorUtil.isColorDark;
|
||||||
|
|
||||||
|
@ -47,6 +50,11 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder {
|
||||||
itemView.setOnLongClickListener((view) -> noteClickListener.onNoteLongClick(getAdapterPosition(), view));
|
itemView.setOnLongClickListener((view) -> noteClickListener.onNoteLongClick(getAdapterPosition(), view));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void bindStatus(AppCompatImageView noteStatus, DBStatus status, int mainColor) {
|
||||||
|
noteStatus.setVisibility(DBStatus.VOID.equals(status) ? INVISIBLE : VISIBLE);
|
||||||
|
DrawableCompat.setTint(noteStatus.getDrawable(), BrandingUtil.getSecondaryForegroundColorDependingOnTheme(noteStatus.getContext(), mainColor));
|
||||||
|
}
|
||||||
|
|
||||||
protected void bindCategory(@NonNull Context context, @NonNull TextView noteCategory, boolean showCategory, @NonNull String category, int mainColor) {
|
protected void bindCategory(@NonNull Context context, @NonNull TextView noteCategory, boolean showCategory, @NonNull String category, int mainColor) {
|
||||||
final boolean isDarkThemeActive = Notes.isDarkThemeActive(context);
|
final boolean isDarkThemeActive = Notes.isDarkThemeActive(context);
|
||||||
noteCategory.setVisibility(showCategory && !category.isEmpty() ? View.VISIBLE : View.GONE);
|
noteCategory.setVisibility(showCategory && !category.isEmpty() ? View.VISIBLE : View.GONE);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class NoteViewHolderWithExcerpt extends NoteViewHolder {
|
||||||
@NonNull final Context context = itemView.getContext();
|
@NonNull final Context context = itemView.getContext();
|
||||||
binding.noteSwipeable.setAlpha(DBStatus.LOCAL_DELETED.equals(note.getStatus()) ? 0.5f : 1.0f);
|
binding.noteSwipeable.setAlpha(DBStatus.LOCAL_DELETED.equals(note.getStatus()) ? 0.5f : 1.0f);
|
||||||
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);
|
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);
|
||||||
binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? View.INVISIBLE : View.VISIBLE);
|
bindStatus(binding.noteStatus, note.getStatus(), mainColor);
|
||||||
bindFavorite(binding.noteFavorite, note.isFavorite());
|
bindFavorite(binding.noteFavorite, note.isFavorite());
|
||||||
|
|
||||||
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class NoteViewHolderWithoutExcerpt extends NoteViewHolder {
|
||||||
@NonNull final Context context = itemView.getContext();
|
@NonNull final Context context = itemView.getContext();
|
||||||
binding.noteSwipeable.setAlpha(DBStatus.LOCAL_DELETED.equals(note.getStatus()) ? 0.5f : 1.0f);
|
binding.noteSwipeable.setAlpha(DBStatus.LOCAL_DELETED.equals(note.getStatus()) ? 0.5f : 1.0f);
|
||||||
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);
|
bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), mainColor);
|
||||||
binding.noteStatus.setVisibility(DBStatus.VOID.equals(note.getStatus()) ? View.INVISIBLE : View.VISIBLE);
|
bindStatus(binding.noteStatus, note.getStatus(), mainColor);
|
||||||
bindFavorite(binding.noteFavorite, note.isFavorite());
|
bindFavorite(binding.noteFavorite, note.isFavorite());
|
||||||
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), mainColor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue