Better posting activities

You can now add content to Image and Link type posts!
This commit is contained in:
Balazs Toldi 2023-07-31 22:18:37 +02:00
parent 92292be472
commit 426c3e6979
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
8 changed files with 617 additions and 378 deletions

View File

@ -17,6 +17,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -25,6 +26,8 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
@ -43,6 +46,7 @@ import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.Executor;
import javax.inject.Inject;
@ -55,11 +59,16 @@ import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.UploadImageEnabledActivity;
import eu.toldi.infinityforlemmy.UploadedImage;
import eu.toldi.infinityforlemmy.account.Account;
import eu.toldi.infinityforlemmy.adapters.MarkdownBottomBarRecyclerViewAdapter;
import eu.toldi.infinityforlemmy.asynctasks.LoadSubredditIcon;
import eu.toldi.infinityforlemmy.bottomsheetfragments.AccountChooserBottomSheetFragment;
import eu.toldi.infinityforlemmy.bottomsheetfragments.FlairBottomSheetFragment;
import eu.toldi.infinityforlemmy.bottomsheetfragments.UploadedImagesBottomSheetFragment;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
import eu.toldi.infinityforlemmy.events.SubmitImagePostEvent;
import eu.toldi.infinityforlemmy.events.SubmitVideoOrGifPostEvent;
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
@ -68,12 +77,13 @@ import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
public class PostImageActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback,
AccountChooserBottomSheetFragment.AccountChooserListener {
UploadImageEnabledActivity, AccountChooserBottomSheetFragment.AccountChooserListener {
static final String EXTRA_SUBREDDIT_NAME = "ESN";
@ -92,6 +102,9 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
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;
private static final int PICK_IMAGE_REQUEST_CODE_2 = 100;
private static final int CAPTURE_IMAGE_REQUEST_CODE_2 = 200;
private static final String COMMUNITY_DATA_STATE = "CDS";
@BindView(R.id.coordinator_layout_post_image_activity)
@ -153,6 +166,11 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
@Inject
@Named("current_account")
SharedPreferences mCurrentAccountSharedPreferences;
@BindView(R.id.post_text_content_edit_text_post_text_activity)
EditText contentEditText;
@BindView(R.id.markdown_bottom_bar_recycler_view_post_text_activity)
RecyclerView markdownBottomBarRecyclerView;
@Inject
CustomThemeWrapper mCustomThemeWrapper;
@Inject
@ -184,6 +202,9 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
private Snackbar mPostingSnackbar;
private Uri capturedImageUri;
private ArrayList<UploadedImage> uploadedImages = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
@ -376,6 +397,30 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
imageView.setVisibility(View.GONE);
constraintLayout.setVisibility(View.VISIBLE);
});
MarkdownBottomBarRecyclerViewAdapter adapter = new MarkdownBottomBarRecyclerViewAdapter(
mCustomThemeWrapper, new MarkdownBottomBarRecyclerViewAdapter.ItemClickListener() {
@Override
public void onClick(int item) {
MarkdownBottomBarRecyclerViewAdapter.bindEditTextWithItemClickListener(
PostImageActivity.this, contentEditText, item);
}
@Override
public void onUploadImage() {
Utils.hideKeyboard(PostImageActivity.this);
UploadedImagesBottomSheetFragment fragment = new UploadedImagesBottomSheetFragment();
Bundle arguments = new Bundle();
arguments.putParcelableArrayList(UploadedImagesBottomSheetFragment.EXTRA_UPLOADED_IMAGES,
uploadedImages);
fragment.setArguments(arguments);
fragment.show(getSupportFragmentManager(), fragment.getTag());
}
});
markdownBottomBarRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this,
LinearLayoutManager.HORIZONTAL, false));
markdownBottomBarRecyclerView.setAdapter(adapter);
}
private void loadCurrentAccount() {
@ -544,6 +589,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_BODY, contentEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
@ -626,6 +672,16 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
if (resultCode == RESULT_OK) {
loadImage();
}
} else if (requestCode == PICK_IMAGE_REQUEST_CODE_2) {
if (data == null) {
Toast.makeText(PostImageActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
return;
}
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE_2) {
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, capturedImageUri, uploadedImages);
}
}
@ -705,4 +761,37 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
}
}
}
@Override
public void uploadImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
getResources().getString(R.string.select_from_gallery)), PICK_IMAGE_REQUEST_CODE_2);
}
@Override
public void captureImage() {
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
try {
capturedImageUri = FileProvider.getUriForFile(this, "eu.toldi.infinityforlemmy.provider",
File.createTempFile("captured_image", ".jpg", getExternalFilesDir(Environment.DIRECTORY_PICTURES)));
pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
startActivityForResult(pictureIntent, CAPTURE_IMAGE_REQUEST_CODE_2);
} catch (IOException ex) {
Toast.makeText(this, R.string.error_creating_temp_file, Toast.LENGTH_SHORT).show();
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.no_camera_available, Toast.LENGTH_SHORT).show();
}
}
@Override
public void insertImageUrl(UploadedImage uploadedImage) {
int start = Math.max(contentEditText.getSelectionStart(), 0);
int end = Math.max(contentEditText.getSelectionEnd(), 0);
contentEditText.getText().replace(Math.min(start, end), Math.max(start, end),
"[" + uploadedImage.imageName + "](" + uploadedImage.imageUrl + ")",
0, "[]()".length() + uploadedImage.imageName.length() + uploadedImage.imageUrl.length());
}
}

View File

@ -1,11 +1,15 @@
package eu.toldi.infinityforlemmy.activities;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.MediaStore;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.URLUtil;
@ -19,6 +23,9 @@ import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
@ -34,6 +41,9 @@ import com.libRG.CustomTextView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.Executor;
import javax.inject.Inject;
@ -46,12 +56,17 @@ import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RedditDataRoomDatabase;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.UploadImageEnabledActivity;
import eu.toldi.infinityforlemmy.UploadedImage;
import eu.toldi.infinityforlemmy.account.Account;
import eu.toldi.infinityforlemmy.adapters.MarkdownBottomBarRecyclerViewAdapter;
import eu.toldi.infinityforlemmy.apis.TitleSuggestion;
import eu.toldi.infinityforlemmy.asynctasks.LoadSubredditIcon;
import eu.toldi.infinityforlemmy.bottomsheetfragments.AccountChooserBottomSheetFragment;
import eu.toldi.infinityforlemmy.bottomsheetfragments.FlairBottomSheetFragment;
import eu.toldi.infinityforlemmy.bottomsheetfragments.UploadedImagesBottomSheetFragment;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
import eu.toldi.infinityforlemmy.events.SubmitTextOrLinkPostEvent;
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
import eu.toldi.infinityforlemmy.services.SubmitPostService;
@ -60,6 +75,7 @@ import eu.toldi.infinityforlemmy.subreddit.SubredditData;
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Call;
@ -69,7 +85,7 @@ import retrofit2.Retrofit;
import retrofit2.converter.scalars.ScalarsConverterFactory;
public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback,
AccountChooserBottomSheetFragment.AccountChooserListener {
UploadImageEnabledActivity, AccountChooserBottomSheetFragment.AccountChooserListener {
static final String EXTRA_SUBREDDIT_NAME = "ESN";
static final String EXTRA_LINK = "EL";
@ -87,6 +103,9 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
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 = 100;
private static final int CAPTURE_IMAGE_REQUEST_CODE = 200;
private static final int MARKDOWN_PREVIEW_REQUEST_CODE = 300;
@BindView(R.id.coordinator_layout_post_link_activity)
CoordinatorLayout coordinatorLayout;
@ -124,6 +143,11 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
MaterialButton suggestTitleButton;
@BindView(R.id.post_link_edit_text_post_link_activity)
EditText linkEditText;
@BindView(R.id.post_text_content_edit_text_post_text_activity)
EditText contentEditText;
@BindView(R.id.markdown_bottom_bar_recycler_view_post_text_activity)
RecyclerView markdownBottomBarRecyclerView;
@Inject
@Named("no_oauth")
RetrofitHolder mRetrofit;
@ -167,6 +191,9 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
private Snackbar mPostingSnackbar;
private Uri capturedImageUri;
private ArrayList<UploadedImage> uploadedImages = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
@ -335,21 +362,46 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
.baseUrl("http://localhost/")
.addConverterFactory(ScalarsConverterFactory.create())
.build().create(TitleSuggestion.class).getHtml(url).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
titleEditText.setText(response.body().substring(response.body().indexOf("<title>") + 7, response.body().indexOf("</title>")));
} else {
Toast.makeText(PostLinkActivity.this, R.string.suggest_title_failed, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
titleEditText.setText(response.body().substring(response.body().indexOf("<title>") + 7, response.body().indexOf("</title>")));
} else {
Toast.makeText(PostLinkActivity.this, R.string.suggest_title_failed, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Toast.makeText(PostLinkActivity.this, R.string.suggest_title_failed, Toast.LENGTH_SHORT).show();
}
});
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Toast.makeText(PostLinkActivity.this, R.string.suggest_title_failed, Toast.LENGTH_SHORT).show();
}
});
});
MarkdownBottomBarRecyclerViewAdapter adapter = new MarkdownBottomBarRecyclerViewAdapter(
mCustomThemeWrapper, new MarkdownBottomBarRecyclerViewAdapter.ItemClickListener() {
@Override
public void onClick(int item) {
MarkdownBottomBarRecyclerViewAdapter.bindEditTextWithItemClickListener(
PostLinkActivity.this, contentEditText, item);
}
@Override
public void onUploadImage() {
Utils.hideKeyboard(PostLinkActivity.this);
UploadedImagesBottomSheetFragment fragment = new UploadedImagesBottomSheetFragment();
Bundle arguments = new Bundle();
arguments.putParcelableArrayList(UploadedImagesBottomSheetFragment.EXTRA_UPLOADED_IMAGES,
uploadedImages);
fragment.setArguments(arguments);
fragment.show(getSupportFragmentManager(), fragment.getTag());
}
});
markdownBottomBarRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this,
LinearLayoutManager.HORIZONTAL, false));
markdownBottomBarRecyclerView.setAdapter(adapter);
}
private void loadCurrentAccount() {
@ -438,10 +490,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
private void loadSubredditIcon() {
LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName,
mAccessToken, mOauthRetrofit, mRetrofit.getRetrofit(), iconImageUrl -> {
iconUrl = iconImageUrl;
displaySubredditIcon();
loadSubredditIconSuccessful = true;
});
iconUrl = iconImageUrl;
displaySubredditIcon();
loadSubredditIconSuccessful = true;
});
}
private void promptAlertDialog(int titleResId, int messageResId) {
@ -514,7 +566,8 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_CONTENT, linkEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_BODY, contentEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_URL, linkEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_KIND, APIUtils.KIND_LINK);
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
@ -561,8 +614,8 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
if (resultCode == RESULT_OK) {
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
communityData = data.getExtras().getParcelable(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
subredditName = communityData.getName();
iconUrl = communityData.getIconUrl();
@ -574,6 +627,16 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
displaySubredditIcon();
flair = null;
} else if (requestCode == PICK_IMAGE_REQUEST_CODE) {
if (data == null) {
Toast.makeText(PostLinkActivity.this, R.string.error_getting_image, Toast.LENGTH_LONG).show();
return;
}
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mRetrofit,
mAccessToken, contentEditText, coordinatorLayout, capturedImageUri, uploadedImages);
}
}
}
@ -629,4 +692,37 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
}
}
}
@Override
public void uploadImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
getResources().getString(R.string.select_from_gallery)), PICK_IMAGE_REQUEST_CODE);
}
@Override
public void captureImage() {
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
try {
capturedImageUri = FileProvider.getUriForFile(this, "eu.toldi.infinityforlemmy.provider",
File.createTempFile("captured_image", ".jpg", getExternalFilesDir(Environment.DIRECTORY_PICTURES)));
pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
startActivityForResult(pictureIntent, CAPTURE_IMAGE_REQUEST_CODE);
} catch (IOException ex) {
Toast.makeText(this, R.string.error_creating_temp_file, Toast.LENGTH_SHORT).show();
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.no_camera_available, Toast.LENGTH_SHORT).show();
}
}
@Override
public void insertImageUrl(UploadedImage uploadedImage) {
int start = Math.max(contentEditText.getSelectionStart(), 0);
int end = Math.max(contentEditText.getSelectionEnd(), 0);
contentEditText.getText().replace(Math.min(start, end), Math.max(start, end),
"[" + uploadedImage.imageName + "](" + uploadedImage.imageUrl + ")",
0, "[]()".length() + uploadedImage.imageName.length() + uploadedImage.imageUrl.length());
}
}

View File

@ -533,7 +533,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_CONTENT, contentEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_BODY, contentEditText.getText().toString());
intent.putExtra(SubmitPostService.EXTRA_KIND, APIUtils.KIND_SELF);
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);

View File

@ -573,9 +573,9 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
if (post.isCrosspost()) {
intent.putExtra(SubmitPostService.EXTRA_CONTENT, "t3_" + post.getCrosspostParentId());
intent.putExtra(SubmitPostService.EXTRA_BODY, "t3_" + post.getCrosspostParentId());
} else {
intent.putExtra(SubmitPostService.EXTRA_CONTENT, post.getFullName());
intent.putExtra(SubmitPostService.EXTRA_BODY, post.getFullName());
}
intent.putExtra(SubmitPostService.EXTRA_KIND, APIUtils.KIND_CROSSPOST);
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);

View File

@ -23,23 +23,23 @@ import retrofit2.Retrofit;
public class SubmitPost {
public static void submitTextOrLinkPost(Executor executor, Handler handler, Retrofit oauthRetrofit, String accessToken,
int communityId, String title, String content,
int communityId, String title, String body, String url,
Flair flair, boolean isSpoiler, boolean isNSFW,
boolean receivePostReplyNotifications, String kind,
SubmitPostListener submitPostListener) {
submitPost(executor, handler, oauthRetrofit, accessToken, communityId, title, content,
flair, isSpoiler, isNSFW, receivePostReplyNotifications, kind, null, submitPostListener);
submitPost(executor, handler, oauthRetrofit, accessToken, communityId, title, body,
isNSFW, receivePostReplyNotifications, kind, url, submitPostListener);
}
public static void submitImagePost(Executor executor, Handler handler, RetrofitHolder mRetrofit,
String accessToken, int communityId, String title, Bitmap image,
String accessToken, int communityId, String title, String body, Bitmap image,
Flair flair, boolean isSpoiler, boolean isNSFW,
boolean receivePostReplyNotifications, SubmitPostListener submitPostListener) {
try {
String imageUrlOrError = UploadImageUtils.uploadImage(mRetrofit, accessToken, image);
if (imageUrlOrError != null && !imageUrlOrError.startsWith("Error: ")) {
submitPost(executor, handler, mRetrofit.getRetrofit(), accessToken,
communityId, title, null, flair, isSpoiler, isNSFW,
communityId, title, body, isNSFW,
receivePostReplyNotifications, APIUtils.KIND_IMAGE, imageUrlOrError, submitPostListener);
} else {
submitPostListener.submitFailed(imageUrlOrError);
@ -56,12 +56,12 @@ public class SubmitPost {
boolean receivePostReplyNotifications, String kind,
SubmitPostListener submitPostListener) {
submitPost(executor, handler, oauthRetrofit, accessToken, communityId, title, crosspostFullname,
flair, isSpoiler, isNSFW, receivePostReplyNotifications, kind, null, submitPostListener);
isNSFW, receivePostReplyNotifications, kind, null, submitPostListener);
}
private static void submitPost(Executor executor, Handler handler, Retrofit oauthRetrofit, String accessToken,
int communityId, String title, String content,
Flair flair, boolean isSpoiler, boolean isNSFW,
boolean isNSFW,
boolean receivePostReplyNotifications, String kind,
@Nullable String posterUrl, SubmitPostListener submitPostListener) {
LemmyAPI api = oauthRetrofit.create(LemmyAPI.class);

View File

@ -64,7 +64,9 @@ public class SubmitPostService extends Service {
public static final String EXTRA_ACCOUNT = "EA";
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
public static final String EXTRA_TITLE = "ET";
public static final String EXTRA_CONTENT = "EC";
public static final String EXTRA_BODY = "EC";
public static final String EXTRA_URL = "EU";
public static final String EXTRA_REDDIT_GALLERY_PAYLOAD = "ERGP";
public static final String EXTRA_POLL_PAYLOAD = "EPP";
public static final String EXTRA_KIND = "EK";
@ -129,20 +131,20 @@ public class SubmitPostService extends Service {
boolean isNSFW = bundle.getBoolean(EXTRA_IS_NSFW, false);
boolean receivePostReplyNotifications = bundle.getBoolean(EXTRA_RECEIVE_POST_REPLY_NOTIFICATIONS, true);
int postType = bundle.getInt(EXTRA_POST_TYPE, EXTRA_POST_TEXT_OR_LINK);
String body = bundle.getString(EXTRA_BODY);
String url = bundle.getString(EXTRA_URL);
if (postType == EXTRA_POST_TEXT_OR_LINK) {
String content = bundle.getString(EXTRA_CONTENT);
String kind = bundle.getString(EXTRA_KIND);
submitTextOrLinkPost(mRetrofit.getRetrofit(), account, subredditName, title, content, flair, isSpoiler, isNSFW,
submitTextOrLinkPost(mRetrofit.getRetrofit(), account, subredditName, title, body, url, flair, isSpoiler, isNSFW,
receivePostReplyNotifications, kind);
} else if (postType == EXTRA_POST_TYPE_CROSSPOST) {
String content = bundle.getString(EXTRA_CONTENT);
submitCrosspost(mExecutor, handler, mRetrofit.getRetrofit(), account, subredditName, title, content,
submitCrosspost(mExecutor, handler, mRetrofit.getRetrofit(), account, subredditName, title, body,
flair, isSpoiler, isNSFW, receivePostReplyNotifications);
} else if (postType == EXTRA_POST_TYPE_IMAGE) {
Uri mediaUri = Uri.parse(bundle.getString(EXTRA_MEDIA_URI));
submitImagePost(mRetrofit, account, mediaUri, subredditName, title, flair, isSpoiler, isNSFW,
submitImagePost(mRetrofit, account, mediaUri, subredditName, title, body, flair, isSpoiler, isNSFW,
receivePostReplyNotifications);
} else if (postType == EXTRA_POST_TYPE_GALLERY) {
submitGalleryPost(mRetrofit.getRetrofit(), account, bundle.getString(EXTRA_REDDIT_GALLERY_PAYLOAD));
@ -214,11 +216,11 @@ public class SubmitPostService extends Service {
.build();
}
private void submitTextOrLinkPost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, int communityId, String title, String content,
private void submitTextOrLinkPost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, int communityId, String title, String body, String url,
Flair flair, boolean isSpoiler, boolean isNSFW, boolean receivePostReplyNotifications,
String kind) {
SubmitPost.submitTextOrLinkPost(mExecutor, handler, newAuthenticatorOauthRetrofit, selectedAccount.getAccessToken(),
communityId, title, content, flair, isSpoiler,
communityId, title, body, url, flair, isSpoiler,
isNSFW, receivePostReplyNotifications, kind, new SubmitPost.SubmitPostListener() {
@Override
public void submitSuccessful(Post post) {
@ -259,12 +261,12 @@ public class SubmitPostService extends Service {
});
}
private void submitImagePost(RetrofitHolder newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, int communityId, String title,
private void submitImagePost(RetrofitHolder newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, int communityId, String title, String body,
Flair flair, boolean isSpoiler, boolean isNSFW, boolean receivePostReplyNotifications) {
try {
Bitmap resource = Glide.with(this).asBitmap().load(mediaUri).submit().get();
SubmitPost.submitImagePost(mExecutor, handler, newAuthenticatorOauthRetrofit,
selectedAccount.getAccessToken(), communityId, title, resource, flair, isSpoiler, isNSFW, receivePostReplyNotifications,
selectedAccount.getAccessToken(), communityId, title, body, resource, flair, isSpoiler, isNSFW, receivePostReplyNotifications,
new SubmitPost.SubmitPostListener() {
@Override
public void submitSuccessful(Post post) {

View File

@ -23,211 +23,237 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/account_linear_layout_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/account_icon_gif_image_view_post_image_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/account_name_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="32dp"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/subreddit_icon_gif_image_view_post_image_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_toStartOf="@id/rules_button_post_image_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_image_activity"
android:text="@string/choose_a_communities"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
</RelativeLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_1_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:orientation="vertical">
<com.libRG.CustomTextView
android:id="@+id/nsfw_custom_text_view_post_image_activity"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/account_linear_layout_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:padding="4dp"
android:text="@string/nsfw"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/account_icon_gif_image_view_post_image_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/account_name_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="32dp"
android:fontFamily="?attr/font_family"
android:textSize="?attr/font_default" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/subreddit_icon_gif_image_view_post_image_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_toStartOf="@id/rules_button_post_image_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_image_activity"
android:fontFamily="?attr/font_family"
android:text="@string/choose_a_communities"
android:textSize="?attr/font_default" />
<com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="?attr/font_family"
android:text="@string/rules"
android:textSize="?attr/font_default" />
</RelativeLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_1_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.libRG.CustomTextView
android:id="@+id/nsfw_custom_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:fontFamily="?attr/font_family"
android:padding="4dp"
android:text="@string/nsfw"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
app:lib_setRadius="6dp"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
</LinearLayout>
<LinearLayout
android:id="@+id/receive_post_reply_notifications_linear_layout_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<TextView
android:id="@+id/receive_post_reply_notifications_text_view_post_image_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:fontFamily="?attr/font_family"
android:text="@string/receive_post_reply_notifications"
android:textSize="?attr/font_default" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/receive_post_reply_notifications_switch_material_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:checked="true" />
</LinearLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_2_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/post_title_edit_text_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:fontFamily="?attr/title_font_family"
android:gravity="top"
android:hint="@string/post_title_hint"
android:inputType="textCapSentences|textMultiLine"
android:padding="16dp"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:lib_setRadius="6dp"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
android:textSize="?attr/title_font_18" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/select_image_constraint_layout_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="32dp">
<LinearLayout
android:id="@+id/receive_post_reply_notifications_linear_layout_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/capture_fab_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_outline_add_a_photo_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_image_activity"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@android:color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/select_from_library_fab_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_outline_select_photo_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity"
app:layout_constraintTop_toTopOf="parent"
app:tint="@android:color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/receive_post_reply_notifications_text_view_post_image_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:text="@string/receive_post_reply_notifications"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/receive_post_reply_notifications_switch_material_post_image_activity"
android:id="@+id/select_again_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:checked="true" />
android:fontFamily="?attr/font_family"
android:padding="16dp"
android:text="@string/select_again"
android:textColor="?attr/colorAccent"
android:textSize="?attr/font_default"
android:visibility="gone" />
<ImageView
android:id="@+id/image_view_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:visibility="gone" />
<EditText
android:id="@+id/post_text_content_edit_text_post_text_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:fontFamily="?attr/content_font_family"
android:gravity="top"
android:hint="@string/post_text_content_hint"
android:inputType="textCapSentences|textMultiLine"
android:padding="16dp"
android:textSize="?attr/content_font_18" />
</LinearLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_2_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/post_title_edit_text_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:gravity="top"
android:hint="@string/post_title_hint"
android:inputType="textCapSentences|textMultiLine"
android:padding="16dp"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/title_font_18"
android:fontFamily="?attr/title_font_family" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/select_image_constraint_layout_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="32dp">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/capture_fab_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_outline_add_a_photo_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_image_activity"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@android:color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/select_from_library_fab_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_outline_select_photo_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity"
app:layout_constraintTop_toTopOf="parent"
app:tint="@android:color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/select_again_text_view_post_image_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/select_again"
android:textColor="?attr/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:visibility="gone" />
<ImageView
android:id="@+id/image_view_post_image_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:visibility="gone" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/markdown_bottom_bar_recycler_view_post_text_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:scrollbars="horizontal" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -23,190 +23,216 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/account_linear_layout_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
android:orientation="vertical">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/account_icon_gif_image_view_post_link_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/account_name_text_view_post_link_activity"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/account_linear_layout_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="32dp"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingTop="16dp"
android:paddingBottom="16dp">
</LinearLayout>
<pl.droidsonroids.gif.GifImageView
android:id="@+id/account_icon_gif_image_view_post_link_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:id="@+id/account_name_text_view_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="32dp"
android:fontFamily="?attr/font_family"
android:textSize="?attr/font_default" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/subreddit_icon_gif_image_view_post_link_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
</LinearLayout>
<TextView
android:id="@+id/subreddit_name_text_view_post_link_activity"
android:layout_width="wrap_content"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_toStartOf="@id/rules_button_post_link_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_link_activity"
android:text="@string/choose_a_communities"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
android:paddingTop="8dp"
android:paddingBottom="8dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_link_activity"
android:layout_width="wrap_content"
<pl.droidsonroids.gif.GifImageView
android:id="@+id/subreddit_icon_gif_image_view_post_link_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_toStartOf="@id/rules_button_post_link_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_link_activity"
android:fontFamily="?attr/font_family"
android:text="@string/choose_a_communities"
android:textSize="?attr/font_default" />
<com.google.android.material.button.MaterialButton
android:id="@+id/rules_button_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="?attr/font_family"
android:text="@string/rules"
android:textSize="?attr/font_default" />
</RelativeLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_1_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.libRG.CustomTextView
android:id="@+id/nsfw_custom_text_view_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:fontFamily="?attr/font_family"
android:padding="4dp"
android:text="@string/nsfw"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
app:lib_setRadius="6dp"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
</LinearLayout>
<LinearLayout
android:id="@+id/receive_post_reply_notifications_linear_layout_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="16dp"
android:paddingEnd="16dp">
</RelativeLayout>
<TextView
android:id="@+id/receive_post_reply_notifications_text_view_post_link_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:fontFamily="?attr/font_family"
android:text="@string/receive_post_reply_notifications"
android:textSize="?attr/font_default" />
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_1_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/receive_post_reply_notifications_switch_material_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:checked="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>
<com.libRG.CustomTextView
android:id="@+id/nsfw_custom_text_view_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:padding="4dp"
android:text="@string/nsfw"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:lib_setRadius="6dp"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_2_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/receive_post_reply_notifications_linear_layout_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
<EditText
android:id="@+id/post_title_edit_text_post_link_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#00000000"
android:fontFamily="?attr/title_font_family"
android:gravity="top"
android:hint="@string/post_title_hint"
android:inputType="textCapSentences|textMultiLine"
android:padding="16dp"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/title_font_18" />
<TextView
android:id="@+id/receive_post_reply_notifications_text_view_post_link_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:text="@string/receive_post_reply_notifications"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<com.google.android.material.button.MaterialButton
android:id="@+id/suggest_title_button_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="?attr/font_family"
android:text="@string/suggest_title"
android:textSize="?attr/font_default" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/receive_post_reply_notifications_switch_material_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:checked="true" />
</LinearLayout>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_2_post_link_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>
<EditText
android:id="@+id/post_title_edit_text_post_link_activity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:id="@+id/post_link_edit_text_post_link_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:fontFamily="?attr/content_font_family"
android:gravity="top"
android:hint="@string/post_title_hint"
android:inputType="textCapSentences|textMultiLine"
android:hint="@string/post_link_hint"
android:inputType="textMultiLine"
android:padding="16dp"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/title_font_18"
android:fontFamily="?attr/title_font_family" />
android:textSize="?attr/content_font_18" />
<com.google.android.material.button.MaterialButton
android:id="@+id/suggest_title_button_post_link_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/suggest_title"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<EditText
android:id="@+id/post_text_content_edit_text_post_text_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:fontFamily="?attr/content_font_family"
android:gravity="top"
android:hint="@string/post_text_content_hint"
android:inputType="textCapSentences|textMultiLine"
android:padding="16dp"
android:textSize="?attr/content_font_18" />
</LinearLayout>
<EditText
android:id="@+id/post_link_edit_text_post_link_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:gravity="top"
android:hint="@string/post_link_hint"
android:inputType="textMultiLine"
android:padding="16dp"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/content_font_18"
android:fontFamily="?attr/content_font_family" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/markdown_bottom_bar_recycler_view_post_text_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:scrollbars="horizontal" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>