Add a share option in PostOptionsBottomSheetFragment.

This commit is contained in:
Docile-Alligator 2025-06-08 09:42:54 -04:00
parent 447139459c
commit 289ff0465d
2 changed files with 44 additions and 0 deletions

View File

@ -184,6 +184,30 @@ public class PostOptionsBottomSheetFragment extends LandscapeExpandedRoundedBott
dismiss();
});
binding.shareTextViewPostOptionsBottomSheetFragment.setOnClickListener(view -> {
Bundle bundle = new Bundle();
bundle.putString(ShareLinkBottomSheetFragment.EXTRA_POST_LINK, mPost.getPermalink());
if (mPost.getPostType() != Post.TEXT_TYPE) {
bundle.putInt(ShareLinkBottomSheetFragment.EXTRA_MEDIA_TYPE, mPost.getPostType());
switch (mPost.getPostType()) {
case Post.IMAGE_TYPE:
case Post.GIF_TYPE:
case Post.LINK_TYPE:
case Post.NO_PREVIEW_LINK_TYPE:
bundle.putString(ShareLinkBottomSheetFragment.EXTRA_MEDIA_LINK, mPost.getUrl());
break;
case Post.VIDEO_TYPE:
bundle.putString(ShareLinkBottomSheetFragment.EXTRA_MEDIA_LINK, mPost.getVideoDownloadUrl());
break;
}
}
ShareLinkBottomSheetFragment shareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
shareLinkBottomSheetFragment.setArguments(bundle);
shareLinkBottomSheetFragment.show(mBaseActivity.getSupportFragmentManager(), shareLinkBottomSheetFragment.getTag());
dismiss();
});
if (mPost.isHidden()) {
binding.hidePostTextViewPostOptionsBottomSheetFragment.setText(R.string.action_unhide_post);
} else {

View File

@ -31,6 +31,26 @@
android:textSize="?attr/font_default"
app:drawableTint="?attr/primaryTextColor" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_text_view_post_options_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:drawableStart="@drawable/ic_share_day_night_24dp"
android:drawablePadding="48dp"
android:focusable="true"
android:fontFamily="?attr/font_family"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/share"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
app:drawableTint="?attr/primaryTextColor" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/add_to_post_filter_text_view_post_options_bottom_sheet_fragment"
android:layout_width="match_parent"