diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e790b06a..8f4a9b4f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -18,7 +18,8 @@
android:maxSdkVersion="22" />
-
@@ -33,7 +34,9 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:label">
-
+ items;
+
+ public RedditGalleryPayload(String subredditName, String submitType, String kind, String title,
+ boolean isSpoiler, boolean isNSFW, boolean sendReplies, List- items) {
+ this.subredditName = subredditName;
+ this.submitType = submitType;
+ this.title = title;
+ this.isSpoiler = isSpoiler;
+ this.isNSFW = isNSFW;
+ this.kind = kind;
+ this.sendReplies = sendReplies;
+ this.items = items;
+ }
+
+ public class Item {
+ public String caption;
+ @SerializedName("outbound_url")
+ public String outboundUrl;
+ @SerializedName("media_id")
+ public String mediaId;
+
+ public Item(String caption, String outboundUrl, String mediaId) {
+ this.caption = caption;
+ this.outboundUrl = outboundUrl;
+ this.mediaId = mediaId;
+ }
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
new file mode 100644
index 00000000..c70957f6
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
@@ -0,0 +1,163 @@
+package ml.docilealligator.infinityforreddit.activities;
+
+import android.content.SharedPreferences;
+import android.content.res.Resources;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.appcompat.widget.Toolbar;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.RequestManager;
+import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.button.MaterialButton;
+import com.google.android.material.snackbar.Snackbar;
+import com.google.android.material.switchmaterial.SwitchMaterial;
+import com.libRG.CustomTextView;
+
+import java.util.concurrent.Executor;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import butterknife.BindView;
+import ml.docilealligator.infinityforreddit.Flair;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.bottomsheetfragments.FlairBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import pl.droidsonroids.gif.GifImageView;
+import retrofit2.Retrofit;
+
+public class PostGalleryActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
+
+ static final String EXTRA_SUBREDDIT_NAME = "ESN";
+
+ private static final String SUBREDDIT_NAME_STATE = "SNS";
+ private static final String SUBREDDIT_ICON_STATE = "SIS";
+ private static final String SUBREDDIT_SELECTED_STATE = "SSS";
+ private static final String SUBREDDIT_IS_USER_STATE = "SIUS";
+ private static final String LOAD_SUBREDDIT_ICON_STATE = "LSIS";
+ private static final String IS_POSTING_STATE = "IPS";
+ private static final String FLAIR_STATE = "FS";
+ private static final String IS_SPOILER_STATE = "ISS";
+ private static final String IS_NSFW_STATE = "INS";
+
+ private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
+ private static final int PICK_IMAGE_REQUEST_CODE = 1;
+ private static final int CAPTURE_IMAGE_REQUEST_CODE = 2;
+
+ @BindView(R.id.coordinator_layout_post_gallery_activity)
+ CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.appbar_layout_post_gallery_activity)
+ AppBarLayout appBarLayout;
+ @BindView(R.id.toolbar_post_gallery_activity)
+ Toolbar toolbar;
+ @BindView(R.id.subreddit_icon_gif_image_view_post_gallery_activity)
+ GifImageView iconGifImageView;
+ @BindView(R.id.subreddit_name_text_view_post_gallery_activity)
+ TextView subredditNameTextView;
+ @BindView(R.id.rules_button_post_gallery_activity)
+ MaterialButton rulesButton;
+ @BindView(R.id.divider_1_post_gallery_activity)
+ View divider1;
+ @BindView(R.id.flair_custom_text_view_post_gallery_activity)
+ CustomTextView flairTextView;
+ @BindView(R.id.spoiler_custom_text_view_post_gallery_activity)
+ CustomTextView spoilerTextView;
+ @BindView(R.id.nsfw_custom_text_view_post_gallery_activity)
+ CustomTextView nsfwTextView;
+ @BindView(R.id.divider_2_post_gallery_activity)
+ View divider2;
+ @BindView(R.id.receive_post_reply_notifications_linear_layout_post_gallery_activity)
+ LinearLayout receivePostReplyNotificationsLinearLayout;
+ @BindView(R.id.receive_post_reply_notifications_text_view_post_gallery_activity)
+ TextView receivePostReplyNotificationsTextView;
+ @BindView(R.id.receive_post_reply_notifications_switch_material_post_gallery_activity)
+ SwitchMaterial receivePostReplyNotificationsSwitchMaterial;
+ @BindView(R.id.divider_3_post_gallery_activity)
+ View divider3;
+ @BindView(R.id.post_title_edit_text_post_gallery_activity)
+ EditText titleEditText;
+ @BindView(R.id.divider_4_post_gallery_activity)
+ View divider4;
+ @BindView(R.id.images_recycler_view_post_gallery_activity)
+ RecyclerView imagesRecyclerView;
+ @Inject
+ @Named("no_oauth")
+ Retrofit mRetrofit;
+ @Inject
+ @Named("oauth")
+ Retrofit mOauthRetrofit;
+ @Inject
+ @Named("upload_media")
+ Retrofit mUploadMediaRetrofit;
+ @Inject
+ RedditDataRoomDatabase mRedditDataRoomDatabase;
+ @Inject
+ @Named("default")
+ SharedPreferences mSharedPreferences;
+ @Inject
+ @Named("current_account")
+ SharedPreferences mCurrentAccountSharedPreferences;
+ @Inject
+ CustomThemeWrapper mCustomThemeWrapper;
+ @Inject
+ Executor mExecutor;
+ private String mAccessToken;
+ private String mAccountName;
+ private String iconUrl;
+ private String subredditName;
+ private boolean subredditSelected = false;
+ private boolean subredditIsUser;
+ private boolean loadSubredditIconSuccessful = true;
+ private boolean isPosting;
+ private Uri imageUri;
+ private int primaryTextColor;
+ private int flairBackgroundColor;
+ private int flairTextColor;
+ private int spoilerBackgroundColor;
+ private int spoilerTextColor;
+ private int nsfwBackgroundColor;
+ private int nsfwTextColor;
+ private Flair flair;
+ private boolean isSpoiler = false;
+ private boolean isNSFW = false;
+ private Resources resources;
+ private Menu mMemu;
+ private RequestManager mGlide;
+ private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
+ private Snackbar mPostingSnackbar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_post_gallery);
+ }
+
+ @Override
+ protected SharedPreferences getDefaultSharedPreferences() {
+ return null;
+ }
+
+ @Override
+ protected CustomThemeWrapper getCustomThemeWrapper() {
+ return null;
+ }
+
+ @Override
+ protected void applyCustomTheme() {
+
+ }
+
+ @Override
+ public void flairSelected(Flair flair) {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
index 5269da5f..36fa1d39 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
@@ -5,6 +5,7 @@ import java.util.Map;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
+import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
@@ -356,4 +357,7 @@ public interface RedditAPI {
@GET("/api/subreddit_autocomplete_v2?typeahead_active=true&include_profiles=false&raw_json=1")
Call subredditAutocomplete(@HeaderMap Map headers, @Query("query") String query,
@Query("include_over_18") boolean nsfw);
+
+ @POST("/api/submit_gallery_post.json?resubmit=true&raw_json=1")
+ Call submitGalleryPost(@HeaderMap Map headers, @Body String body);
}
diff --git a/app/src/main/res/layout/activity_post_gallery.xml b/app/src/main/res/layout/activity_post_gallery.xml
new file mode 100644
index 00000000..e573b945
--- /dev/null
+++ b/app/src/main/res/layout/activity_post_gallery.xml
@@ -0,0 +1,199 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file