Skip to content

Commit

Permalink
chore: make app compile again
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGGamerM committed Oct 12, 2023
1 parent ce3ca42 commit d829c65
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public enum ColorPreference{
BLUE,
BROWN,
RED,
YELLOW;
YELLOW,
NORD,
WHITE;

public @StringRes int getName() {
return switch(this){
Expand All @@ -154,6 +156,8 @@ public enum ColorPreference{
case BROWN -> R.string.sk_color_palette_brown;
case RED -> R.string.sk_color_palette_red;
case YELLOW -> R.string.sk_color_palette_yellow;
case NORD -> R.string.mo_color_palette_nord;
case WHITE -> R.string.mo_color_palette_black_and_white;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
private ImageView avatar;
private CoverImageView cover;
private View avatarBorder;
private View usernameWrap;
private TextView name, username, bio, followersCount, followersLabel, followingCount, followingLabel;
private ImageView lockIcon, botIcon;
private ProgressBarButton actionButton, notifyButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.joinmastodon.android.model.viewmodel.ListItem;
import org.joinmastodon.android.ui.utils.UiUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -79,7 +80,7 @@ private void onClearMediaCacheClick(){
}

private void onClearRecentEmojisClick(){
getLocalPrefs().recentEmojis=new HashMap<>();
getLocalPrefs().recentCustomEmoji=new ArrayList<>();
getLocalPrefs().save();
Toast.makeText(getContext(), R.string.mo_recent_emoji_cleared, Toast.LENGTH_SHORT).show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ protected void onHidden(){
boolean restartPlease=
GlobalUserPreferences.disableM3PillActiveIndicator!=disablePillItem.checked ||
GlobalUserPreferences.showNavigationLabels!=showNavigationLabelsItem.checked ||
lp.likeIcon!=likeIconItem.checked;
GlobalUserPreferences.showNavigationLabels!=showNavigationLabelsItem.checked ||
GlobalUserPreferences.showMediaPreview !=showMediaPreviewItem.checked ||
GlobalUserPreferences.showDividers!=showPostDividersItem.checked;
GlobalUserPreferences.showDividers!=showPostDividersItem.checked ||
lp.likeIcon!=likeIconItem.checked;

lp.revealCWs=revealCWsItem.checked;
lp.hideSensitiveMedia=hideSensitiveMediaItem.checked;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void onBind(EmojiReactionsStatusDisplayItem item) {
(Activity) item.parentFragment.getContext(),
item.accountID,
AccountSessionManager.getInstance().getCustomEmojis(session.domain),
session.domain, true, item.accountID);
session.domain, true);
emojiKeyboard.setListener(this);
space.setVisibility(View.GONE);
root.addView(emojiKeyboard.getView());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public static class Holder extends StatusDisplayItem.Holder<FooterStatusDisplayI
private final TextView replies, boosts, favorites;
private final View reply, boost, favorite, share, bookmark;
private final ImageView favIcon;
private static final Animation opacityOut, opacityIn;
private static AnimationSet animSet;


Expand Down Expand Up @@ -124,6 +123,27 @@ public Holder(Activity activity, ViewGroup parent){
share.setAccessibilityDelegate(buttonAccessibilityDelegate);
}

private static final float ALPHA_PRESSED=0.55f;

static {
AlphaAnimation opacityOut = new AlphaAnimation(1, ALPHA_PRESSED);
opacityOut.setDuration(300);
opacityOut.setInterpolator(CubicBezierInterpolator.DEFAULT);
opacityOut.setFillAfter(true);
AlphaAnimation opacityIn = new AlphaAnimation(ALPHA_PRESSED, 1);
opacityIn.setDuration(400);
opacityIn.setInterpolator(CubicBezierInterpolator.DEFAULT);
Animation spin = new RotateAnimation(0, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);

animSet = new AnimationSet(true);
animSet.setInterpolator(CubicBezierInterpolator.DEFAULT);
animSet.addAnimation(spin);
animSet.addAnimation(opacityIn);
animSet.setDuration(400);
}

@Override
public void onBind(FooterStatusDisplayItem item){
bindText(replies, item.status.repliesCount);
Expand Down Expand Up @@ -200,7 +220,7 @@ private void onReplyClick(View v){
UiUtils.lookupStatus(v.getContext(),
item.status, item.accountID, null,
status -> {
v.startAnimation(opacityIn);
UiUtils.opacityIn(v);
Bundle args=new Bundle();
args.putString("account", item.accountID);
args.putParcelable("replyTo", Parcels.wrap(status));
Expand Down Expand Up @@ -365,10 +385,10 @@ private void onFavoriteClick(View v){
favorite.setSelected(!status.favourited);
vibrateForAction(favorite, !status.favourited);
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(status, !status.favourited, r->{
if (status.favourited) {
v.startAnimation(GlobalUserPreferences.reduceMotion ? opacityIn : animSet);
if (status.favourited && !GlobalUserPreferences.reduceMotion) {
v.startAnimation(animSet);
} else {
v.startAnimation(opacityIn);
UiUtils.opacityIn(v);
}
bindText(favorites, r.favouritesCount);
});
Expand All @@ -379,10 +399,10 @@ private void onFavoriteClick(View v){
favorite.setSelected(!item.status.favourited);
vibrateForAction(favorite, !item.status.favourited);
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{
if (item.status.favourited) {
v.startAnimation(GlobalUserPreferences.reduceMotion ? opacityIn : animSet);
if (item.status.favourited && !GlobalUserPreferences.reduceMotion) {
v.startAnimation(animSet);
} else {
v.startAnimation(opacityIn);
UiUtils.opacityIn(v);
}
bindText(favorites, r.favouritesCount);
});
Expand Down Expand Up @@ -413,7 +433,7 @@ private void onBookmarkClick(View v){
bookmark.setSelected(!status.bookmarked);
vibrateForAction(bookmark, !status.bookmarked);
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setBookmarked(status, !status.bookmarked, r->{
v.startAnimation(opacityIn);
UiUtils.opacityIn(v);
});
}
);
Expand All @@ -430,7 +450,7 @@ private boolean onBookmarkLongClick(View v) {
if (AccountSessionManager.getInstance().getLoggedInAccounts().size() < 2) return false;
UiUtils.pickInteractAs(v.getContext(),
item.accountID, item.status,
s -> s.bookmarked,w
s -> s.bookmarked,
(ic, status, consumer) -> ic.setBookmarked(status, true, consumer),
R.string.sk_bookmark_as,
R.string.sk_bookmarked_as,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public ImageLoaderRequest getImageRequest(int index){
public static class Holder extends StatusDisplayItem.Holder<NotificationHeaderStatusDisplayItem> implements ImageLoaderViewHolder{
private final ImageView icon, avatar, deleteNotification;
private final TextView text, timestamp;
private final int selectableItemBackground;

public Holder(Activity activity, ViewGroup parent){
super(activity, R.layout.display_item_notification_header, parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,14 @@ else if(statusForContent.sensitive && AccountSessionManager.get(accountID).getLo
contentItems.add(new AudioStatusDisplayItem(parentID, fragment, statusForContent, att));
}
if(att.type==Attachment.Type.UNKNOWN){
contentItems.add(new FileStatusDisplayItem(parentID, fragment, att));
contentItems.add(new FileStatusDisplayItem(parentID, fragment, att, statusForContent));
}
}
if(statusForContent.poll!=null){
buildPollItems(parentID, fragment, statusForContent.poll, contentItems);
buildPollItems(parentID, fragment, statusForContent.poll, contentItems, statusForContent);
}
if(statusForContent.card!=null && statusForContent.mediaAttachments.isEmpty()){
contentItems.add(new LinkCardStatusDisplayItem(parentID, fragment, statusForContent));
contentItems.add(new LinkCardStatusDisplayItem(parentID, fragment, statusForContent, (flags & FLAG_NO_MEDIA_PREVIEW)==0));
}
if(contentItems!=items && statusForContent.spoilerRevealed){
items.addAll(contentItems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GREEN, new ColorPalette(R.style.ColorPalette_Green),
BLUE, new ColorPalette(R.style.ColorPalette_Blue),
BROWN, new ColorPalette(R.style.ColorPalette_Brown),
RED, new ColorPalette(R.style.ColorPalette_Red),
YELLOW, new ColorPalette(R.style.ColorPalette_Yellow)
YELLOW, new ColorPalette(R.style.ColorPalette_Yellow),
NORD, new ColorPalette(R.style.ColorPalette_Nord),
WHITE, new ColorPalette(R.style.ColorPalette_White)

Expand Down
2 changes: 1 addition & 1 deletion mastodon/src/main/res/values/palettes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<item name="colorM3DarkOnSurface">?colorGray100</item>
<item name="colorM3PrimaryInverse">?colorPrimary200</item>

<item name="colorFavorite">@color/favorite_selected</item>
<item name="colorFavorite">@color/warning_500</item>
<item name="colorLike">@color/like_selected</item>
<item name="colorBoost">?colorM3Primary</item>
<item name="colorPoll">@color/bookmark_selected</item>
Expand Down

0 comments on commit d829c65

Please sign in to comment.