Fix colors for notifications

This commit is contained in:
Thomas 2022-10-19 11:35:00 +02:00
parent f403d38c81
commit 9ad5177486
2 changed files with 19 additions and 1 deletions

View file

@ -20,6 +20,7 @@ import static app.fedilab.android.ui.drawer.StatusAdapter.statusManagement;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -31,6 +32,7 @@ import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.ref.WeakReference;
@ -125,6 +127,22 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
new WeakReference<>(holderFollow.binding.displayName)),
TextView.BufferType.SPANNABLE);
holderFollow.binding.username.setText(String.format("@%s", notification.account.acct));
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
int theme_icons_color = -1;
int theme_text_color = -1;
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
//Getting custom colors
theme_icons_color = sharedpreferences.getInt("theme_icons_color", -1);
theme_text_color = sharedpreferences.getInt("theme_text_color", -1);
}
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, holderFollow.binding.cacheIndicator, theme_icons_color);
}
if (theme_text_color != -1) {
holderFollow.binding.displayName.setTextColor(theme_text_color);
holderFollow.binding.username.setTextColor(theme_text_color);
holderFollow.binding.title.setTextColor(theme_text_color);
}
if (getItemViewType(position) == TYPE_FOLLOW_REQUEST) {
holderFollow.binding.rejectButton.setVisibility(View.VISIBLE);
holderFollow.binding.acceptButton.setVisibility(View.VISIBLE);

View file

@ -483,6 +483,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, holder.binding.actionButtonReply, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.cacheIndicator, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.statusAddCustomEmoji, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.statusEmoji, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.actionButtonMore, theme_icons_color);
@ -496,7 +497,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.actionButtonFavorite.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonBookmark.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonBoost.setInActiveImageTintColor(theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_baseline_cached_24, theme_icons_color);
holder.binding.replyCount.setTextColor(theme_icons_color);
} else {
holder.binding.actionButtonFavorite.setInActiveImageTintColor(ThemeHelper.getAttColor(context, R.attr.colorControlNormal));