aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-25 21:28:40 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-25 21:28:40 +0000
commite5b35e11e907a10bed08ff9f98c4a116253e34cb (patch)
tree52ea6850439413f0103552ff5ceaf5e7369b48bb /app
parentcfe178117d107113dd938dfedff3b91d1547ab34 (diff)
downloadinfinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.tar
infinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.tar.gz
infinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.tar.bz2
infinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.tar.lz
infinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.tar.xz
infinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.tar.zst
infinity-for-reddit-e5b35e11e907a10bed08ff9f98c4a116253e34cb.zip
Show GiphyGifInfoBottomSheetFragment before the Giphy gif selector.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/GiphyGifInfoBottomSheetFragment.java42
-rw-r--r--app/src/main/res/drawable-night-xxxhdpi/powered_by_giphy.gifbin0 -> 75929 bytes
-rw-r--r--app/src/main/res/drawable-xxxhdpi/powered_by_giphy.gifbin0 -> 75929 bytes
-rw-r--r--app/src/main/res/layout/fragment_giphy_gif_info_bottom_sheet.xml42
-rw-r--r--app/src/main/res/values/strings.xml19
6 files changed, 102 insertions, 5 deletions
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
--- /dev/null
+++ b/app/src/main/res/drawable-night-xxxhdpi/powered_by_giphy.gif
Binary files 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
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/powered_by_giphy.gif
Binary files 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".bottomsheetfragments.GiphyGifInfoBottomSheetFragment">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <pl.droidsonroids.gif.GifImageView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:padding="16dp"
+ android:src="@drawable/powered_by_giphy" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:text="@string/select_giphy_gif_explanation"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default"
+ android:textColor="?attr/secondaryTextColor" />
+
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/select_giphy_gif_button_uploaded_images_bottom_sheet_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="16dp"
+ android:backgroundTint="@color/colorPrimary"
+ android:textColor="#FFFFFF"
+ android:text="@string/select_giphy_gif" />
+
+ </LinearLayout>
+
+</ScrollView> \ 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 @@
<string name="uploaded_images">Uploaded Images</string>
<string name="uploaded_images_explanation">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 @@
<string name="upload_image_success">Upload image successfully. Click the image button again to see the uploaded images.</string>
<string name="get_image_bitmap_failed">Unable to get the bitmap of the image</string>
<string name="upload_image_failed">Unable to upload the image</string>
+ <string name="select_giphy_gif">Select a Giphy GIF</string>
+ <string name="select_giphy_gif_explanation">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.</string>
<string name="search_comments">Search Comments</string>