parent
c4e23b0fe6
commit
c6d7242043
|
@ -52,6 +52,7 @@ import org.joinmastodon.android.ui.SimpleViewHolder;
|
|||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
import org.joinmastodon.android.updater.GithubSelfUpdater;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -622,6 +623,10 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||
}
|
||||
}
|
||||
|
||||
public Collection<Hashtag> getHashtags() {
|
||||
return hashtagsItems.values();
|
||||
}
|
||||
|
||||
private class HomePagerAdapter extends RecyclerView.Adapter<SimpleViewHolder> {
|
||||
@NonNull
|
||||
@Override
|
||||
|
|
|
@ -10,11 +10,15 @@ import android.view.ViewGroup;
|
|||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
||||
import org.joinmastodon.android.fragments.HashtagTimelineFragment;
|
||||
import org.joinmastodon.android.fragments.HomeTabFragment;
|
||||
import org.joinmastodon.android.fragments.HomeTimelineFragment;
|
||||
import org.joinmastodon.android.fragments.ProfileFragment;
|
||||
import org.joinmastodon.android.fragments.ThreadFragment;
|
||||
import org.joinmastodon.android.model.Account;
|
||||
import org.joinmastodon.android.model.Attachment;
|
||||
import org.joinmastodon.android.model.DisplayItemsParent;
|
||||
import org.joinmastodon.android.model.Hashtag;
|
||||
import org.joinmastodon.android.model.Notification;
|
||||
import org.joinmastodon.android.model.Poll;
|
||||
import org.joinmastodon.android.model.ScheduledStatus;
|
||||
|
@ -27,6 +31,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import me.grishka.appkit.Nav;
|
||||
|
@ -100,6 +105,22 @@ public abstract class StatusDisplayItem{
|
|||
args.putParcelable("profileAccount", Parcels.wrap(account));
|
||||
Nav.go(fragment.getActivity(), ProfileFragment.class, args);
|
||||
}));
|
||||
} else if (!(status.tags.isEmpty() || fragment instanceof HashtagTimelineFragment) &&
|
||||
fragment.getParentFragment() instanceof HomeTabFragment home
|
||||
) {
|
||||
home.getHashtags().stream()
|
||||
.filter(followed -> status.tags.stream()
|
||||
.anyMatch(hashtag -> followed.name.equalsIgnoreCase(hashtag.name)))
|
||||
.findAny()
|
||||
// post contains a hashtag the user is following
|
||||
.ifPresent(hashtag -> items.add(new ReblogOrReplyLineStatusDisplayItem(
|
||||
parentID, fragment, hashtag.name, List.of(),
|
||||
R.drawable.ic_fluent_number_symbol_20_filled, null,
|
||||
i -> {
|
||||
args.putString("hashtag", hashtag.name);
|
||||
Nav.go(fragment.getActivity(), HashtagTimelineFragment.class, args);
|
||||
}
|
||||
)));
|
||||
}
|
||||
HeaderStatusDisplayItem header;
|
||||
items.add(header=new HeaderStatusDisplayItem(parentID, statusForContent.account, statusForContent.createdAt, fragment, accountID, statusForContent, null, notification, scheduledStatus));
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||
<path android:pathData="M8.99 2.877C9.06 2.47 8.784 2.081 8.376 2.011 7.97 1.941 7.581 2.215 7.511 2.623l-0.668 3.88L3.75 6.504C3.335 6.504 3 6.84 3 7.254c0 0.415 0.336 0.75 0.75 0.75l2.835-0.001-0.688 3.996L2.75 12C2.335 12 2 12.336 2 12.75c0 0.415 0.336 0.75 0.75 0.75h2.888l-0.623 3.624c-0.07 0.408 0.203 0.796 0.612 0.866 0.408 0.07 0.796-0.203 0.866-0.612l0.668-3.879 4.477-0.002-0.625 3.627c-0.07 0.408 0.204 0.796 0.612 0.866 0.408 0.07 0.796-0.203 0.867-0.611l0.668-3.883 3.094-0.001c0.414 0 0.75-0.336 0.75-0.75 0-0.415-0.337-0.75-0.75-0.75l-2.835 0.001L14.107 8l3.143-0.001c0.415 0 0.75-0.336 0.75-0.75 0-0.415-0.336-0.75-0.75-0.75L14.365 6.5l0.624-3.621c0.07-0.409-0.204-0.797-0.612-0.867-0.408-0.07-0.796 0.204-0.866 0.612L12.843 6.5 8.365 6.502 8.99 2.877zM8.106 8.002L12.585 8l-0.689 3.996-4.477 0.002 0.688-3.996z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
Loading…
Reference in New Issue