hearts everywhere
closes sk22#846
This commit is contained in:
@@ -24,6 +24,7 @@ import org.joinmastodon.android.api.requests.statuses.CreateStatus;
|
|||||||
import org.joinmastodon.android.api.requests.statuses.SetStatusBookmarked;
|
import org.joinmastodon.android.api.requests.statuses.SetStatusBookmarked;
|
||||||
import org.joinmastodon.android.api.requests.statuses.SetStatusFavorited;
|
import org.joinmastodon.android.api.requests.statuses.SetStatusFavorited;
|
||||||
import org.joinmastodon.android.api.requests.statuses.SetStatusReblogged;
|
import org.joinmastodon.android.api.requests.statuses.SetStatusReblogged;
|
||||||
|
import org.joinmastodon.android.api.session.AccountLocalPreferences;
|
||||||
import org.joinmastodon.android.api.session.AccountSession;
|
import org.joinmastodon.android.api.session.AccountSession;
|
||||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||||
import org.joinmastodon.android.model.Account;
|
import org.joinmastodon.android.model.Account;
|
||||||
@@ -158,6 +159,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||||||
private void notify(Context context, PushNotification pn, String accountID, org.joinmastodon.android.model.Notification notification){
|
private void notify(Context context, PushNotification pn, String accountID, org.joinmastodon.android.model.Notification notification){
|
||||||
NotificationManager nm=context.getSystemService(NotificationManager.class);
|
NotificationManager nm=context.getSystemService(NotificationManager.class);
|
||||||
AccountSession session=AccountSessionManager.get(accountID);
|
AccountSession session=AccountSessionManager.get(accountID);
|
||||||
|
AccountLocalPreferences lp=session.getLocalPreferences();
|
||||||
Account self=session.self;
|
Account self=session.self;
|
||||||
String accountName="@"+self.username+"@"+AccountSessionManager.getInstance().getAccount(accountID).domain;
|
String accountName="@"+self.username+"@"+AccountSessionManager.getInstance().getAccount(accountID).domain;
|
||||||
Notification.Builder builder;
|
Notification.Builder builder;
|
||||||
@@ -212,7 +214,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||||||
|
|
||||||
if (!GlobalUserPreferences.uniformNotificationIcon) {
|
if (!GlobalUserPreferences.uniformNotificationIcon) {
|
||||||
builder.setSmallIcon(switch (pn.notificationType) {
|
builder.setSmallIcon(switch (pn.notificationType) {
|
||||||
case FAVORITE -> R.drawable.ic_fluent_star_24_filled;
|
case FAVORITE -> lp.likeIcon ? R.drawable.ic_fluent_heart_24_filled : R.drawable.ic_fluent_star_24_filled;
|
||||||
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
||||||
case FOLLOW -> R.drawable.ic_fluent_person_add_24_filled;
|
case FOLLOW -> R.drawable.ic_fluent_person_add_24_filled;
|
||||||
case MENTION -> R.drawable.ic_fluent_mention_24_filled;
|
case MENTION -> R.drawable.ic_fluent_mention_24_filled;
|
||||||
|
|||||||
@@ -321,7 +321,8 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
R.string.sk_favorite_as,
|
R.string.sk_favorite_as,
|
||||||
R.string.sk_favorited_as,
|
R.string.sk_favorited_as,
|
||||||
R.string.sk_already_favorited,
|
R.string.sk_already_favorited,
|
||||||
R.drawable.ic_fluent_star_28_regular
|
AccountSessionManager.get(item.accountID).getLocalPreferences().likeIcon ?
|
||||||
|
R.drawable.ic_fluent_heart_28_regular : R.drawable.ic_fluent_star_28_regular
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import org.joinmastodon.android.GlobalUserPreferences;
|
import org.joinmastodon.android.GlobalUserPreferences;
|
||||||
import org.joinmastodon.android.R;
|
import org.joinmastodon.android.R;
|
||||||
|
import org.joinmastodon.android.api.session.AccountLocalPreferences;
|
||||||
import org.joinmastodon.android.api.session.AccountSession;
|
import org.joinmastodon.android.api.session.AccountSession;
|
||||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||||
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
||||||
@@ -47,12 +48,14 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
private final CustomEmojiHelper emojiHelper=new CustomEmojiHelper();
|
private final CustomEmojiHelper emojiHelper=new CustomEmojiHelper();
|
||||||
private final CharSequence text;
|
private final CharSequence text;
|
||||||
private final CharSequence timestamp;
|
private final CharSequence timestamp;
|
||||||
|
private final AccountLocalPreferences lp;
|
||||||
|
|
||||||
public NotificationHeaderStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Notification notification, String accountID){
|
public NotificationHeaderStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Notification notification, String accountID){
|
||||||
super(parentID, parentFragment);
|
super(parentID, parentFragment);
|
||||||
this.notification=notification;
|
this.notification=notification;
|
||||||
this.accountID=accountID;
|
this.accountID=accountID;
|
||||||
this.timestamp=notification.createdAt==null ? null : UiUtils.formatRelativeTimestamp(context, notification.createdAt);
|
this.timestamp=notification.createdAt==null ? null : UiUtils.formatRelativeTimestamp(context, notification.createdAt);
|
||||||
|
this.lp=AccountSessionManager.get(accountID).getLocalPreferences();
|
||||||
|
|
||||||
if(notification.type==Notification.Type.POLL){
|
if(notification.type==Notification.Type.POLL){
|
||||||
text=parentFragment.getString(R.string.poll_ended);
|
text=parentFragment.getString(R.string.poll_ended);
|
||||||
@@ -158,7 +161,7 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
timestamp.setText(item.timestamp);
|
timestamp.setText(item.timestamp);
|
||||||
avatar.setVisibility(item.notification.type==Notification.Type.POLL ? View.GONE : View.VISIBLE);
|
avatar.setVisibility(item.notification.type==Notification.Type.POLL ? View.GONE : View.VISIBLE);
|
||||||
icon.setImageResource(switch(item.notification.type){
|
icon.setImageResource(switch(item.notification.type){
|
||||||
case FAVORITE -> R.drawable.ic_fluent_star_24_filled;
|
case FAVORITE -> item.lp.likeIcon ? R.drawable.ic_fluent_heart_24_filled : R.drawable.ic_fluent_star_24_filled;
|
||||||
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
||||||
case FOLLOW, FOLLOW_REQUEST -> R.drawable.ic_fluent_person_add_24_filled;
|
case FOLLOW, FOLLOW_REQUEST -> R.drawable.ic_fluent_person_add_24_filled;
|
||||||
case POLL -> R.drawable.ic_fluent_poll_24_filled;
|
case POLL -> R.drawable.ic_fluent_poll_24_filled;
|
||||||
@@ -169,7 +172,7 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
default -> throw new IllegalStateException("Unexpected value: "+item.notification.type);
|
default -> throw new IllegalStateException("Unexpected value: "+item.notification.type);
|
||||||
});
|
});
|
||||||
icon.setImageTintList(ColorStateList.valueOf(UiUtils.getThemeColor(item.parentFragment.getActivity(), switch(item.notification.type){
|
icon.setImageTintList(ColorStateList.valueOf(UiUtils.getThemeColor(item.parentFragment.getActivity(), switch(item.notification.type){
|
||||||
case FAVORITE -> R.attr.colorFavorite;
|
case FAVORITE -> item.lp.likeIcon ? R.attr.colorLike : R.attr.colorFavorite;
|
||||||
case REBLOG -> R.attr.colorBoost;
|
case REBLOG -> R.attr.colorBoost;
|
||||||
case POLL -> R.attr.colorPoll;
|
case POLL -> R.attr.colorPoll;
|
||||||
default -> android.R.attr.colorAccent;
|
default -> android.R.attr.colorAccent;
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
|
||||||
|
<path android:pathData="M14.604 6.193c2.601-2.932 7.184-2.922 9.772 0.02 2.263 2.574 2.148 6.459-0.263 8.893l-9.58 9.672C14.392 24.92 14.2 25 14 25s-0.392-0.08-0.533-0.222l-9.58-9.672c-2.41-2.434-2.526-6.32-0.263-8.892 2.588-2.943 7.17-2.953 9.772-0.021L14 6.873l0.604-0.68zm8.646 1.011c-1.993-2.266-5.521-2.274-7.524-0.016L14.56 8.501C14.419 8.66 14.214 8.753 14 8.753c-0.215 0-0.419-0.092-0.561-0.252l-1.165-1.313c-2.003-2.257-5.53-2.25-7.524 0.016-1.742 1.981-1.653 4.973 0.203 6.847L14 23.184l9.047-9.133c1.856-1.874 1.945-4.866 0.203-6.847z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||||
|
</vector>
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
<attr name="colorSensitiveOverlay" format="color"/>
|
<attr name="colorSensitiveOverlay" format="color"/>
|
||||||
<attr name="colorWhite" format="color"/>
|
<attr name="colorWhite" format="color"/>
|
||||||
<attr name="colorFavorite" format="color" />
|
<attr name="colorFavorite" format="color" />
|
||||||
|
<attr name="colorLike" format="color" />
|
||||||
<attr name="colorBoost" format="color" />
|
<attr name="colorBoost" format="color" />
|
||||||
<attr name="colorPoll" format="color" />
|
<attr name="colorPoll" format="color" />
|
||||||
<attr name="colorProfileHeaderBackground" format="color"/>
|
<attr name="colorProfileHeaderBackground" format="color"/>
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
<item name="colorM3PrimaryInverse">?colorPrimary200</item>
|
<item name="colorM3PrimaryInverse">?colorPrimary200</item>
|
||||||
|
|
||||||
<item name="colorFavorite">@color/favorite_selected</item>
|
<item name="colorFavorite">@color/favorite_selected</item>
|
||||||
|
<item name="colorLike">@color/like_selected</item>
|
||||||
<item name="colorBoost">?colorM3Primary</item>
|
<item name="colorBoost">?colorM3Primary</item>
|
||||||
<item name="colorPoll">@color/bookmark_selected</item>
|
<item name="colorPoll">@color/bookmark_selected</item>
|
||||||
<item name="colorTabBarAlpha">#14000000</item>
|
<item name="colorTabBarAlpha">#14000000</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user