Skip to content

Commit

Permalink
fix: make app compile again
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGGamerM committed Sep 30, 2023
1 parent b9bf1e6 commit 5220a98
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState){

Optional<String> text = Optional.ofNullable(getIntent().getStringExtra(Intent.EXTRA_TEXT));
Optional<Pair<String, Optional<String>>> fediHandle = text.flatMap(UiUtils::parseFediverseHandle);
boolean isFediUrl = text.map(UiUtils::looksLikeMastodonUrl).orElse(false);
boolean isFediUrl = text.map(UiUtils::looksLikeFediverseUrl).orElse(false);
boolean isOpenable = isFediUrl || fediHandle.isPresent();

List<AccountSession> sessions=AccountSessionManager.getInstance().getLoggedInAccounts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import org.joinmastodon.android.model.Poll;
import org.joinmastodon.android.model.Relationship;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.model.Translation;
import org.joinmastodon.android.ui.BetterItemAnimator;
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
import org.joinmastodon.android.ui.displayitems.AccountStatusDisplayItem;
import org.joinmastodon.android.ui.displayitems.EmojiReactionsStatusDisplayItem;
import org.joinmastodon.android.ui.displayitems.ExtendedFooterStatusDisplayItem;
Expand Down Expand Up @@ -63,6 +65,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonErrorResponse;
import org.joinmastodon.android.api.requests.filters.CreateFilter;
import org.joinmastodon.android.api.requests.filters.DeleteFilter;
import org.joinmastodon.android.api.requests.tags.GetTag;
import org.joinmastodon.android.api.requests.tags.SetTagFollowed;
import org.joinmastodon.android.api.requests.timelines.GetHashtagTimeline;
import org.joinmastodon.android.model.Filter;
import org.joinmastodon.android.model.FilterAction;
import org.joinmastodon.android.model.FilterContext;
import org.joinmastodon.android.model.FilterKeyword;
import org.joinmastodon.android.model.Hashtag;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.model.TimelineDefinition;
Expand Down Expand Up @@ -62,6 +70,8 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
private Menu optionsMenu;
private MenuInflater optionsMenuInflater;

private Optional<Filter> filter = Optional.empty();

@Override
protected boolean wantsComposeButton() {
return true;
Expand Down Expand Up @@ -191,14 +201,14 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy){

@Override
public boolean onFabLongClick(View v) {
return UiUtils.pickAccountForCompose(getActivity(), accountID, '#'+hashtag+' ');
return UiUtils.pickAccountForCompose(getActivity(), accountID, '#'+hashtagName+' ');
}

@Override
public void onFabClick(View v){
Bundle args=new Bundle();
args.putString("account", accountID);
args.putString("prefilledText", '#'+hashtag+' ');
args.putString("prefilledText", '#'+hashtagName+' ');
Nav.go(getActivity(), ComposeFragment.class, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void onBind(Hashtag item){

@Override
public void onClick(){
UiUtils.openHashtagTimeline(getActivity(), accountID, item.name, item.following);
UiUtils.openHashtagTimeline(getActivity(), accountID, item.name);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import org.joinmastodon.android.fragments.BaseStatusListFragment;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.model.Translation;
import org.joinmastodon.android.model.StatusPrivacy;
import org.joinmastodon.android.model.TranslatedStatus;
import org.joinmastodon.android.ui.text.HtmlParser;
import org.joinmastodon.android.ui.utils.CustomEmojiHelper;
import org.joinmastodon.android.ui.utils.UiUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,20 @@ public static String formatPeriodBetween(Context context, Instant since, Instant
if(diff<1000L){
return context.getString(R.string.time_now);
}else if(diff<60_000L){
return context.getString(ago ? R.string.time_seconds_ago_short : R.string.sk_time_seconds, diff/1000L);
long time = diff/1000L;
return ago ?
context.getString(R.string.time_seconds_ago_short, time) :
context.getResources().getQuantityString(R.plurals.sk_time_seconds, (int) time, time);
}else if(diff<3600_000L){
return context.getString(ago ? R.string.time_minutes_ago_short : R.string.sk_time_minutes, diff/60_000L);
long time = diff/60_000L;
return ago ?
context.getString(R.string.time_minutes_ago_short, time) :
context.getResources().getQuantityString(R.plurals.sk_time_minutes, (int) time, time);
}else if(diff<3600_000L*24L){
return context.getString(ago ? R.string.time_hours_ago_short : R.string.sk_time_hours, diff/3600_000L);
long time = diff/3600_000L;
return ago ?
context.getString(R.string.time_hours_ago_short, time) :
context.getResources().getQuantityString(R.plurals.sk_time_hours, (int) time, time);
} else {
int days = (int) (diff / (3600_000L * 24L));
if (ago && days > 30) {
Expand All @@ -235,7 +244,7 @@ public static String formatPeriodBetween(Context context, Instant since, Instant
return DATE_FORMATTER_SHORT_WITH_YEAR.format(dt);
}
}
return context.getString(ago ? R.string.time_days_ago_short : R.string.sk_time_days, days);
return ago ? context.getString(R.string.time_days_ago_short, days) : context.getResources().getQuantityString(R.plurals.sk_time_days, days, days);
}
}

Expand Down Expand Up @@ -1094,7 +1103,7 @@ public static Optional<Pair<String, Optional<String>>> parseFediverseHandle(Stri
// https://foo.microblog.pub/o/5b64045effd24f48a27d7059f6cb38f5
//
// COPIED FROM https://github.com/tuskyapp/Tusky/blob/develop/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.kt
public static boolean looksLikeMastodonUrl(String urlString) {
public static boolean looksLikeFediverseUrl(String urlString) {
if(urlString == null)
return false;
URI uri;
Expand Down

0 comments on commit 5220a98

Please sign in to comment.