Loading app/src/main/java/app/fedilab/android/activities/ProfileActivity.java +5 −7 Original line number Diff line number Diff line Loading @@ -942,13 +942,11 @@ public class ProfileActivity extends BaseActivity { builderInner.setTitle(stringArrayConf[0]); builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); builderInner.setNegativeButton(R.string.keep_notifications, (dialog, which) -> { accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, false, 0) builderInner.setNegativeButton(R.string.keep_notifications, (dialog, which) -> accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, false, 0) .observe(ProfileActivity.this, relationShip -> { this.relationship = relationShip; updateAccount(); }); }); })); builderInner.setPositiveButton(R.string.action_mute, (dialog, which) -> { accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, true, 0) .observe(ProfileActivity.this, relationShip -> { Loading app/src/main/java/app/fedilab/android/ui/drawer/ConversationAdapter.java +42 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Handler; import android.os.Looper; import android.view.LayoutInflater; Loading Loading @@ -83,12 +84,51 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH return new ConversationHolder(itemBinding); } public static void applyColorConversation(Context context, ConversationHolder holder) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); int theme_icons_color = -1; int theme_statuses_color = -1; int theme_text_color = -1; if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME if (customLight) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_TEXT), -1); } } else { if (customDark) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_TEXT), -1); } } if (theme_icons_color != -1) { Helper.changeDrawableColor(context, R.drawable.ic_star_outline, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_person, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_bot, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_baseline_reply_16, theme_icons_color); } if (theme_statuses_color != -1) { holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color); } if (theme_text_color != -1) { holder.binding.statusContent.setTextColor(theme_text_color); holder.binding.spoiler.setTextColor(theme_text_color); Helper.changeDrawableColor(context, R.drawable.ic_baseline_lock_24, theme_text_color); } } @SuppressLint("ClickableViewAccessibility") @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { Conversation conversation = conversationList.get(position); ConversationHolder holder = (ConversationHolder) viewHolder; final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); if (sharedpreferences.getBoolean(context.getString(R.string.SET_CARDVIEW), false)) { holder.binding.cardviewContainer.setCardElevation(Helper.convertDpToPixel(5, context)); Loading Loading @@ -201,6 +241,8 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } }, 100, 100); } applyColorConversation(context, holder); } private void displayAttachments(ConversationAdapter.ConversationHolder holder, int position) { Loading app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java +65 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; Loading Loading @@ -144,6 +145,50 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } } public static void applyColorAccount(Context context, ViewHolderFollow holder) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); int theme_icons_color = -1; int theme_statuses_color = -1; int theme_text_color = -1; int theme_text_header_1_line = -1; int theme_text_header_2_line = -1; if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME if (customLight) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_TEXT), -1); theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_DISPLAY_NAME), -1); theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_USERNAME), -1); } } else { if (customDark) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_TEXT), -1); theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_DISPLAY_NAME), -1); theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_USERNAME), -1); } } if (theme_text_color != -1) { holder.binding.title.setTextColor(theme_text_color); } if (theme_icons_color != -1) { Helper.changeDrawableColor(context, holder.binding.icon, theme_icons_color); } if (theme_statuses_color != -1) { holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color); } if (theme_text_header_1_line != -1) { holder.binding.displayName.setTextColor(theme_text_header_1_line); } if (theme_text_header_2_line != -1) { holder.binding.username.setTextColor(theme_text_header_2_line); } } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { Notification notification = notificationList.get(position); Loading Loading @@ -230,6 +275,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } else { holderFollow.binding.layoutFetchMore.fetchMoreContainer.setVisibility(View.GONE); } applyColorAccount(context, holderFollow); } else if (getItemViewType(position) == TYPE_FILERED) { StatusAdapter.StatusViewHolder holder = (StatusAdapter.StatusViewHolder) viewHolder; SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); Loading @@ -242,6 +288,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH notification.filteredByApp = null; notifyItemChanged(position); }); StatusAdapter.applyColor(context, holder); } else { StatusAdapter.StatusViewHolder holderStatus = (StatusAdapter.StatusViewHolder) viewHolder; SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); Loading @@ -266,6 +313,23 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } else if (getItemViewType(position) == TYPE_POLL) { holderStatus.bindingNotification.status.typeOfNotification.setImageResource(R.drawable.ic_baseline_poll_24); } int theme_icons_color = -1; int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME if (customLight) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1); } } else { if (customDark) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1); } } if (theme_icons_color != -1) { Helper.changeDrawableColor(context, holderStatus.bindingNotification.status.typeOfNotification, theme_icons_color); } holderStatus.bindingNotification.status.mainContainer.setAlpha(1.0f); StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class); SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class); Loading Loading @@ -384,6 +448,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct)); holderStatus.bindingNotification.status.actionButtons.setVisibility(View.GONE); } StatusAdapter.applyColor(context, holderStatus); } } Loading app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -530,7 +530,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> holder.binding.actionButtonFavorite.setActiveImageTint(R.color.marked_icon); holder.binding.actionButtonBoost.setActiveImageTint(R.color.boost_icon); holder.binding.actionButtonBookmark.setActiveImageTint(R.color.marked_icon); applyColor(context, holder); if (status.pinned) { holder.binding.statusPinned.setVisibility(View.VISIBLE); Loading Loading @@ -2156,7 +2156,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> return position; } private static void applyColor(Context context, StatusViewHolder holder) { public static void applyColor(Context context, StatusViewHolder holder) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); Loading app/src/main/res/layout/drawer_follow.xml +1 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ tools:text="User asked to follow you" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/icon" android:layout_width="20dp" android:layout_height="20dp" android:layout_gravity="center" Loading Loading
app/src/main/java/app/fedilab/android/activities/ProfileActivity.java +5 −7 Original line number Diff line number Diff line Loading @@ -942,13 +942,11 @@ public class ProfileActivity extends BaseActivity { builderInner.setTitle(stringArrayConf[0]); builderInner.setNeutralButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); builderInner.setNegativeButton(R.string.keep_notifications, (dialog, which) -> { accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, false, 0) builderInner.setNegativeButton(R.string.keep_notifications, (dialog, which) -> accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, false, 0) .observe(ProfileActivity.this, relationShip -> { this.relationship = relationShip; updateAccount(); }); }); })); builderInner.setPositiveButton(R.string.action_mute, (dialog, which) -> { accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, true, 0) .observe(ProfileActivity.this, relationShip -> { Loading
app/src/main/java/app/fedilab/android/ui/drawer/ConversationAdapter.java +42 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Handler; import android.os.Looper; import android.view.LayoutInflater; Loading Loading @@ -83,12 +84,51 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH return new ConversationHolder(itemBinding); } public static void applyColorConversation(Context context, ConversationHolder holder) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); int theme_icons_color = -1; int theme_statuses_color = -1; int theme_text_color = -1; if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME if (customLight) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_TEXT), -1); } } else { if (customDark) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_TEXT), -1); } } if (theme_icons_color != -1) { Helper.changeDrawableColor(context, R.drawable.ic_star_outline, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_person, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_bot, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_baseline_reply_16, theme_icons_color); } if (theme_statuses_color != -1) { holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color); } if (theme_text_color != -1) { holder.binding.statusContent.setTextColor(theme_text_color); holder.binding.spoiler.setTextColor(theme_text_color); Helper.changeDrawableColor(context, R.drawable.ic_baseline_lock_24, theme_text_color); } } @SuppressLint("ClickableViewAccessibility") @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { Conversation conversation = conversationList.get(position); ConversationHolder holder = (ConversationHolder) viewHolder; final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); if (sharedpreferences.getBoolean(context.getString(R.string.SET_CARDVIEW), false)) { holder.binding.cardviewContainer.setCardElevation(Helper.convertDpToPixel(5, context)); Loading Loading @@ -201,6 +241,8 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } }, 100, 100); } applyColorConversation(context, holder); } private void displayAttachments(ConversationAdapter.ConversationHolder holder, int position) { Loading
app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java +65 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; Loading Loading @@ -144,6 +145,50 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } } public static void applyColorAccount(Context context, ViewHolderFollow holder) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); int theme_icons_color = -1; int theme_statuses_color = -1; int theme_text_color = -1; int theme_text_header_1_line = -1; int theme_text_header_2_line = -1; if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME if (customLight) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_TEXT), -1); theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_DISPLAY_NAME), -1); theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_USERNAME), -1); } } else { if (customDark) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1); theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_BACKGROUND), -1); theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_TEXT), -1); theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_DISPLAY_NAME), -1); theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_USERNAME), -1); } } if (theme_text_color != -1) { holder.binding.title.setTextColor(theme_text_color); } if (theme_icons_color != -1) { Helper.changeDrawableColor(context, holder.binding.icon, theme_icons_color); } if (theme_statuses_color != -1) { holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color); } if (theme_text_header_1_line != -1) { holder.binding.displayName.setTextColor(theme_text_header_1_line); } if (theme_text_header_2_line != -1) { holder.binding.username.setTextColor(theme_text_header_2_line); } } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { Notification notification = notificationList.get(position); Loading Loading @@ -230,6 +275,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } else { holderFollow.binding.layoutFetchMore.fetchMoreContainer.setVisibility(View.GONE); } applyColorAccount(context, holderFollow); } else if (getItemViewType(position) == TYPE_FILERED) { StatusAdapter.StatusViewHolder holder = (StatusAdapter.StatusViewHolder) viewHolder; SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); Loading @@ -242,6 +288,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH notification.filteredByApp = null; notifyItemChanged(position); }); StatusAdapter.applyColor(context, holder); } else { StatusAdapter.StatusViewHolder holderStatus = (StatusAdapter.StatusViewHolder) viewHolder; SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); Loading @@ -266,6 +313,23 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH } else if (getItemViewType(position) == TYPE_POLL) { holderStatus.bindingNotification.status.typeOfNotification.setImageResource(R.drawable.ic_baseline_poll_24); } int theme_icons_color = -1; int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME if (customLight) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1); } } else { if (customDark) { theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1); } } if (theme_icons_color != -1) { Helper.changeDrawableColor(context, holderStatus.bindingNotification.status.typeOfNotification, theme_icons_color); } holderStatus.bindingNotification.status.mainContainer.setAlpha(1.0f); StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class); SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class); Loading Loading @@ -384,6 +448,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH holderStatus.bindingNotification.status.username.setText(String.format("@%s", notification.account.acct)); holderStatus.bindingNotification.status.actionButtons.setVisibility(View.GONE); } StatusAdapter.applyColor(context, holderStatus); } } Loading
app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -530,7 +530,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> holder.binding.actionButtonFavorite.setActiveImageTint(R.color.marked_icon); holder.binding.actionButtonBoost.setActiveImageTint(R.color.boost_icon); holder.binding.actionButtonBookmark.setActiveImageTint(R.color.marked_icon); applyColor(context, holder); if (status.pinned) { holder.binding.statusPinned.setVisibility(View.VISIBLE); Loading Loading @@ -2156,7 +2156,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> return position; } private static void applyColor(Context context, StatusViewHolder holder) { public static void applyColor(Context context, StatusViewHolder holder) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); Loading
app/src/main/res/layout/drawer_follow.xml +1 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ tools:text="User asked to follow you" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/icon" android:layout_width="20dp" android:layout_height="20dp" android:layout_gravity="center" Loading