From e5b35e11e907a10bed08ff9f98c4a116253e34cb Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:28:40 -0400 Subject: Show GiphyGifInfoBottomSheetFragment before the Giphy gif selector. --- .../activities/CommentActivity.java | 4 +- .../GiphyGifInfoBottomSheetFragment.java | 42 +++++++++++++++++++++ .../drawable-night-xxxhdpi/powered_by_giphy.gif | Bin 0 -> 75929 bytes .../main/res/drawable-xxxhdpi/powered_by_giphy.gif | Bin 0 -> 75929 bytes .../fragment_giphy_gif_info_bottom_sheet.xml | 42 +++++++++++++++++++++ app/src/main/res/values/strings.xml | 19 ++++++++-- 6 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/GiphyGifInfoBottomSheetFragment.java create mode 100644 app/src/main/res/drawable-night-xxxhdpi/powered_by_giphy.gif create mode 100644 app/src/main/res/drawable-xxxhdpi/powered_by_giphy.gif create mode 100644 app/src/main/res/layout/fragment_giphy_gif_info_bottom_sheet.xml (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java index 67d5cf3a..260ff43c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -57,6 +57,7 @@ import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.adapters.MarkdownBottomBarRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.bottomsheetfragments.AccountChooserBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.CopyTextBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.GiphyGifInfoBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.UploadedImagesBottomSheetFragment; import ml.docilealligator.infinityforreddit.comment.Comment; import ml.docilealligator.infinityforreddit.comment.SendComment; @@ -313,7 +314,8 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA @Override public void onSelectGiphyGif() { - GiphyDialogFragment.Companion.newInstance().show(getSupportFragmentManager(), "giphy_dialog"); + GiphyGifInfoBottomSheetFragment fragment = new GiphyGifInfoBottomSheetFragment(); + fragment.show(getSupportFragmentManager(), fragment.getTag()); } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/GiphyGifInfoBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/GiphyGifInfoBottomSheetFragment.java new file mode 100644 index 00000000..60d5c330 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/GiphyGifInfoBottomSheetFragment.java @@ -0,0 +1,42 @@ +package ml.docilealligator.infinityforreddit.bottomsheetfragments; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; + +import com.giphy.sdk.ui.views.GiphyDialogFragment; + +import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; +import ml.docilealligator.infinityforreddit.databinding.FragmentGiphyGifInfoBottomSheetBinding; + +public class GiphyGifInfoBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { + + private BaseActivity activity; + + public GiphyGifInfoBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + FragmentGiphyGifInfoBottomSheetBinding binding = FragmentGiphyGifInfoBottomSheetBinding.inflate(inflater, container, false); + + binding.selectGiphyGifButtonUploadedImagesBottomSheetFragment.setOnClickListener(view -> { + GiphyDialogFragment.Companion.newInstance().show(activity.getSupportFragmentManager(), "giphy_dialog"); + dismiss(); + }); + + return binding.getRoot(); + } + + public void onAttach(@NonNull Context context) { + super.onAttach(context); + this.activity = (BaseActivity) context; + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-night-xxxhdpi/powered_by_giphy.gif b/app/src/main/res/drawable-night-xxxhdpi/powered_by_giphy.gif new file mode 100644 index 00000000..81fabfcf Binary files /dev/null and b/app/src/main/res/drawable-night-xxxhdpi/powered_by_giphy.gif differ diff --git a/app/src/main/res/drawable-xxxhdpi/powered_by_giphy.gif b/app/src/main/res/drawable-xxxhdpi/powered_by_giphy.gif new file mode 100644 index 00000000..81fabfcf Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/powered_by_giphy.gif differ diff --git a/app/src/main/res/layout/fragment_giphy_gif_info_bottom_sheet.xml b/app/src/main/res/layout/fragment_giphy_gif_info_bottom_sheet.xml new file mode 100644 index 00000000..f62ad532 --- /dev/null +++ b/app/src/main/res/layout/fragment_giphy_gif_info_bottom_sheet.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3650e686..ac325395 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1255,11 +1255,11 @@ Uploaded Images This is an experimental feature, and here are some things you need to know:\n 1. Uploaded images will not be shown in the text editor, and instead, a piece of text will be inserted as a block, - with a format similar to ![](XXXXX). XXXXX is the image id, and it should not be modified. To add a caption for - your image, simply type between the brackets. Example: ![This is a caption](XXXXX). Note that the caption will be treated - as plain text.\n + with a format similar to ![](XXXXX). XXXXX is the image id, and it should not be modified. To add a caption for + your image, simply type between the brackets. Example: ![This is a caption](XXXXX). Note that the caption will be treated + as plain text.\n 2. To write a superscript, please use ^(), and put the texts inside the parentheses, instead of only - using a single ^. For simplicity, click the superscript option in the formatting tools to insert a superscript.\n + using a single ^. For simplicity, click the superscript option in the formatting tools to insert a superscript.\n 3. This feature converts your markdown to rich text format and some formatting may be lost in the process.\n 4. Uploaded images may not be shown on the preview screen.\n 5. You cannot edit a submitted post with embedded images in it.\n @@ -1271,6 +1271,17 @@ Upload image successfully. Click the image button again to see the uploaded images. Unable to get the bitmap of the image Unable to upload the image + Select a Giphy GIF + This is an experimental feature, and here are some things you need to know:\n + 1. Giphy gifs will not be shown in the text editor, and instead, a piece of text will be inserted as a block, + with a format similar to ![gif](XXXXX). XXXXX is the Giphy gif id, and it should not be modified.\n + 2. You can only insert one Giphy gif per comment.\n + 3. To write a superscript, please use ^(), and put the texts inside the parentheses, instead of only + using a single ^. For simplicity, click the superscript option in the formatting tools to insert a superscript.\n + 4. This feature converts your markdown to rich text format and some formatting may be lost in the process.\n + 5. Giphy gifs may not be shown on the preview screen.\n + 6. Please do not change your account using the account chooser on the editing screen. You should switch + your account in the navigation drawer on the main screen. Search Comments -- cgit v1.2.3