Skip to content

Commit

Permalink
feat(Discover/TrendingLinkTimelineFragment): support prefilled compos…
Browse files Browse the repository at this point in the history
…e text
  • Loading branch information
FineFindus committed Jun 15, 2024
1 parent 4392ce2 commit aa3c8b5
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit aa3c8b5

Please sign in to comment.