From aa3c8b5812d8f7d27ea9a3fb2c365211bf0fc6c0 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Sat, 15 Jun 2024 19:02:34 +0200 Subject: [PATCH] feat(Discover/TrendingLinkTimelineFragment): support prefilled compose text --- .../DiscoverTrendingLinkTimelineFragment.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverTrendingLinkTimelineFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverTrendingLinkTimelineFragment.java index bc53b052d4..53212feea5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverTrendingLinkTimelineFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverTrendingLinkTimelineFragment.java @@ -18,6 +18,7 @@ import org.joinmastodon.android.R; import org.joinmastodon.android.api.requests.timelines.GetTrendingLinksTimeline; import org.joinmastodon.android.api.session.AccountSessionManager; +import org.joinmastodon.android.fragments.ComposeFragment; import org.joinmastodon.android.fragments.HomeTabFragment; import org.joinmastodon.android.fragments.StatusListFragment; import org.joinmastodon.android.model.Card; @@ -28,6 +29,7 @@ import java.util.List; +import me.grishka.appkit.Nav; import me.grishka.appkit.api.SimpleCallback; import me.grishka.appkit.utils.MergeRecyclerAdapter; import me.grishka.appkit.utils.SingleViewRecyclerAdapter; @@ -82,6 +84,8 @@ protected void onShown(){ @Override public void onViewCreated(View view, Bundle savedInstanceState){ super.onViewCreated(view, savedInstanceState); + fab=view.findViewById(R.id.fab); + fab.setOnClickListener(this::onFabClick); if(getParentFragment() instanceof HomeTabFragment) return; @@ -101,6 +105,20 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy){ }); } + + @Override + public boolean onFabLongClick(View v) { + return UiUtils.pickAccountForCompose(getActivity(), accountID, trendingLink.url); + } + + @Override + public void onFabClick(View v){ + Bundle args=new Bundle(); + args.putString("account", accountID); + args.putString("prefilledText", trendingLink.url); + Nav.go(getActivity(), ComposeFragment.class, args); + } + @Override protected void onSetFabBottomInset(int inset){ ((ViewGroup.MarginLayoutParams) fab.getLayoutParams()).bottomMargin=V.dp(16)+inset;