mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Crossposting is available.
This commit is contained in:
parent
567f5c5ce6
commit
fc40fb3b24
@ -24,10 +24,16 @@
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:label">
|
||||
<activity android:name=".Activity.SubmitCrosspostActivity"
|
||||
android:label="@string/submit_crosspost_activity_label"
|
||||
android:parentActivityName=".Activity.MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
|
||||
<service
|
||||
android:name=".Service.DownloadMediaService"
|
||||
android:enabled="true"
|
||||
android:exported="false"></service>
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".Activity.ViewRedditGalleryActivity"
|
||||
|
@ -129,7 +129,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
private boolean isSpoiler = false;
|
||||
private boolean isNSFW = false;
|
||||
private Resources resources;
|
||||
private Menu mMemu;
|
||||
private Menu mMenu;
|
||||
private RequestManager mGlide;
|
||||
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
|
||||
private Snackbar mPostingSnackbar;
|
||||
@ -391,10 +391,10 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.post_text_activity, menu);
|
||||
applyMenuItemTheme(menu);
|
||||
mMemu = menu;
|
||||
mMenu = menu;
|
||||
if (isPosting) {
|
||||
mMemu.findItem(R.id.action_send_post_text_activity).setEnabled(false);
|
||||
mMemu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(130);
|
||||
mMenu.findItem(R.id.action_send_post_text_activity).setEnabled(false);
|
||||
mMenu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(130);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -539,8 +539,8 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
mMemu.findItem(R.id.action_send_post_text_activity).setEnabled(true);
|
||||
mMemu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(255);
|
||||
mMenu.findItem(R.id.action_send_post_text_activity).setEnabled(true);
|
||||
mMenu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(255);
|
||||
if (submitTextOrLinkPostEvent.errorMessage == null || submitTextOrLinkPostEvent.errorMessage.equals("")) {
|
||||
Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
@ -0,0 +1,605 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.davemorrissey.labs.subscaleview.ImageSource;
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.libRG.CustomTextView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.BottomSheetFragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitCrosspostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Service.SubmitPostService;
|
||||
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class SubmitCrosspostActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
|
||||
public static final String EXTRA_POST = "EP";
|
||||
|
||||
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 String NULL_ACCESS_TOKEN_STATE = "NATS";
|
||||
private static final String ACCESS_TOKEN_STATE = "ATS";
|
||||
|
||||
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
|
||||
|
||||
@BindView(R.id.coordinator_layout_submit_crosspost_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_submit_crosspost_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_submit_crosspost_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_submit_crosspost_activity)
|
||||
GifImageView iconGifImageView;
|
||||
@BindView(R.id.subreddit_name_text_view_submit_crosspost_activity)
|
||||
TextView subredditNameTextView;
|
||||
@BindView(R.id.rules_button_submit_crosspost_activity)
|
||||
Button rulesButton;
|
||||
@BindView(R.id.divider_1_submit_crosspost_activity)
|
||||
View divider1;
|
||||
@BindView(R.id.flair_custom_text_view_submit_crosspost_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_submit_crosspost_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_submit_crosspost_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.divider_2_submit_crosspost_activity)
|
||||
View divider2;
|
||||
@BindView(R.id.post_title_edit_text_submit_crosspost_activity)
|
||||
EditText titleEditText;
|
||||
@BindView(R.id.divider_3_submit_crosspost_activity)
|
||||
View divider3;
|
||||
@BindView(R.id.post_content_text_view_submit_crosspost_activity)
|
||||
TextView contentTextView;
|
||||
@BindView(R.id.frame_layout_submit_crosspost_activity)
|
||||
FrameLayout frameLayout;
|
||||
@BindView(R.id.image_view_submit_crosspost_activity)
|
||||
SubsamplingScaleImageView imageView;
|
||||
@BindView(R.id.play_button_image_view_submit_crosspost_activity)
|
||||
ImageView playButton;
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
Retrofit mRetrofit;
|
||||
@Inject
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
@Inject
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
private boolean mNullAccessToken = false;
|
||||
private String mAccessToken;
|
||||
private Post post;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private boolean loadSubredditIconSuccessful = true;
|
||||
private boolean isPosting;
|
||||
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 mMenu;
|
||||
private RequestManager mGlide;
|
||||
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
|
||||
private Snackbar mPostingSnackbar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
setImmersiveModeNotApplicable();
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_submit_crosspost);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
applyCustomTheme();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mGlide = Glide.with(this);
|
||||
|
||||
mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
|
||||
|
||||
resources = getResources();
|
||||
|
||||
post = getIntent().getParcelableExtra(EXTRA_POST);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
|
||||
mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE);
|
||||
|
||||
if (!mNullAccessToken && mAccessToken == null) {
|
||||
getCurrentAccount();
|
||||
}
|
||||
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||
subredditIsUser = savedInstanceState.getBoolean(SUBREDDIT_IS_USER_STATE);
|
||||
loadSubredditIconSuccessful = savedInstanceState.getBoolean(LOAD_SUBREDDIT_ICON_STATE);
|
||||
isPosting = savedInstanceState.getBoolean(IS_POSTING_STATE);
|
||||
flair = savedInstanceState.getParcelable(FLAIR_STATE);
|
||||
isSpoiler = savedInstanceState.getBoolean(IS_SPOILER_STATE);
|
||||
isNSFW = savedInstanceState.getBoolean(IS_NSFW_STATE);
|
||||
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
displaySubredditIcon();
|
||||
|
||||
if (isPosting) {
|
||||
mPostingSnackbar.show();
|
||||
}
|
||||
|
||||
if (flair != null) {
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
if (isSpoiler) {
|
||||
spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
|
||||
spoilerTextView.setBorderColor(spoilerBackgroundColor);
|
||||
spoilerTextView.setTextColor(spoilerTextColor);
|
||||
}
|
||||
if (isNSFW) {
|
||||
nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
|
||||
nsfwTextView.setBorderColor(nsfwBackgroundColor);
|
||||
nsfwTextView.setTextColor(nsfwTextColor);
|
||||
}
|
||||
} else {
|
||||
getCurrentAccount();
|
||||
|
||||
isPosting = false;
|
||||
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.into(iconGifImageView);
|
||||
|
||||
if (post.isSpoiler()) {
|
||||
spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
|
||||
spoilerTextView.setBorderColor(spoilerBackgroundColor);
|
||||
spoilerTextView.setTextColor(spoilerTextColor);
|
||||
}
|
||||
if (post.isNSFW()) {
|
||||
nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
|
||||
nsfwTextView.setBorderColor(nsfwBackgroundColor);
|
||||
nsfwTextView.setTextColor(nsfwTextColor);
|
||||
}
|
||||
|
||||
titleEditText.setText(post.getTitle());
|
||||
}
|
||||
|
||||
if (post.getPostType() == Post.TEXT_TYPE) {
|
||||
contentTextView.setVisibility(View.VISIBLE);
|
||||
contentTextView.setText(post.getSelfTextPlain());
|
||||
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
||||
contentTextView.setVisibility(View.VISIBLE);
|
||||
contentTextView.setText(post.getUrl());
|
||||
} else if (post.getPostType() == Post.GIF_TYPE || post.getPostType() == Post.GALLERY_TYPE || post.getPostType() == Post.IMAGE_TYPE) {
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
mGlide.asBitmap().load(post.getPreviewUrl()).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
imageView.setImage(ImageSource.bitmap(resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
} else if (post.getPostType() == Post.VIDEO_TYPE) {
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
mGlide.asBitmap().load(post.getPreviewUrl()).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
imageView.setImage(ImageSource.bitmap(resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
playButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
iconGifImageView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(this, SubredditSelectionActivity.class);
|
||||
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
|
||||
});
|
||||
|
||||
subredditNameTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(this, SubredditSelectionActivity.class);
|
||||
startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
|
||||
});
|
||||
|
||||
rulesButton.setOnClickListener(view -> {
|
||||
if (subredditName == null) {
|
||||
Snackbar.make(coordinatorLayout, R.string.select_a_subreddit, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Intent intent = new Intent(this, RulesActivity.class);
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
flairTextView.setOnClickListener(view -> {
|
||||
if (flair == null) {
|
||||
flairSelectionBottomSheetFragment = new FlairBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
if (subredditIsUser) {
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
}
|
||||
flairSelectionBottomSheetFragment.setArguments(bundle);
|
||||
flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag());
|
||||
} else {
|
||||
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
flairTextView.setText(getString(R.string.flair));
|
||||
flair = null;
|
||||
}
|
||||
});
|
||||
|
||||
spoilerTextView.setOnClickListener(view -> {
|
||||
if (!isSpoiler) {
|
||||
spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
|
||||
spoilerTextView.setBorderColor(spoilerBackgroundColor);
|
||||
spoilerTextView.setTextColor(spoilerTextColor);
|
||||
isSpoiler = true;
|
||||
} else {
|
||||
spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
isSpoiler = false;
|
||||
}
|
||||
});
|
||||
|
||||
nsfwTextView.setOnClickListener(view -> {
|
||||
if (!isNSFW) {
|
||||
nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
|
||||
nsfwTextView.setBorderColor(nsfwBackgroundColor);
|
||||
nsfwTextView.setTextColor(nsfwTextColor);
|
||||
isNSFW = true;
|
||||
} else {
|
||||
nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
isNSFW = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SharedPreferences getDefaultSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CustomThemeWrapper getCustomThemeWrapper() {
|
||||
return mCustomThemeWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCustomTheme() {
|
||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
|
||||
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
|
||||
subredditNameTextView.setTextColor(secondaryTextColor);
|
||||
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
|
||||
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme()));
|
||||
int dividerColor = mCustomThemeWrapper.getDividerColor();
|
||||
divider1.setBackgroundColor(dividerColor);
|
||||
divider2.setBackgroundColor(dividerColor);
|
||||
divider3.setBackgroundColor(dividerColor);
|
||||
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
|
||||
flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor();
|
||||
flairTextColor = mCustomThemeWrapper.getFlairTextColor();
|
||||
spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor();
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
contentTextView.setTextColor(primaryTextColor);
|
||||
contentTextView.setHintTextColor(secondaryTextColor);
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
mNullAccessToken = true;
|
||||
} else {
|
||||
mAccessToken = account.getAccessToken();
|
||||
}
|
||||
}).execute();
|
||||
}
|
||||
|
||||
private void displaySubredditIcon() {
|
||||
if (iconUrl != null && !iconUrl.equals("")) {
|
||||
mGlide.load(iconUrl)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.error(mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||
.into(iconGifImageView);
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
.into(iconGifImageView);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSubredditIcon() {
|
||||
new LoadSubredditIconAsyncTask(mRedditDataRoomDatabase, subredditName, mRetrofit, iconImageUrl -> {
|
||||
iconUrl = iconImageUrl;
|
||||
displaySubredditIcon();
|
||||
loadSubredditIconSuccessful = true;
|
||||
}).execute();
|
||||
}
|
||||
|
||||
private void promptAlertDialog(int titleResId, int messageResId) {
|
||||
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
||||
.setTitle(titleResId)
|
||||
.setMessage(messageResId)
|
||||
.setPositiveButton(R.string.yes, (dialogInterface, i)
|
||||
-> finish())
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.submit_crosspost_activity, menu);
|
||||
applyMenuItemTheme(menu);
|
||||
mMenu = menu;
|
||||
if (isPosting) {
|
||||
mMenu.findItem(R.id.action_send_submit_crosspost_activity).setEnabled(false);
|
||||
mMenu.findItem(R.id.action_send_submit_crosspost_activity).getIcon().setAlpha(130);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (isPosting) {
|
||||
promptAlertDialog(R.string.exit_when_submit, R.string.exit_when_submit_post_detail);
|
||||
return true;
|
||||
} else {
|
||||
if (!titleEditText.getText().toString().equals("")) {
|
||||
promptAlertDialog(R.string.discard, R.string.discard_detail);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_send_submit_crosspost_activity:
|
||||
if (!subredditSelected) {
|
||||
Snackbar.make(coordinatorLayout, R.string.select_a_subreddit, Snackbar.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (titleEditText.getText() == null || titleEditText.getText().toString().equals("")) {
|
||||
Snackbar.make(coordinatorLayout, R.string.title_required, Snackbar.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
isPosting = true;
|
||||
|
||||
item.setEnabled(false);
|
||||
item.getIcon().setAlpha(130);
|
||||
|
||||
mPostingSnackbar.show();
|
||||
|
||||
String subredditName;
|
||||
if (subredditIsUser) {
|
||||
subredditName = "u_" + subredditNameTextView.getText().toString();
|
||||
} else {
|
||||
subredditName = subredditNameTextView.getText().toString();
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||
if (post.isCrosspost()) {
|
||||
intent.putExtra(SubmitPostService.EXTRA_CONTENT, "t3_" + post.getCrosspostParentId());
|
||||
} else {
|
||||
intent.putExtra(SubmitPostService.EXTRA_CONTENT, post.getFullName());
|
||||
}
|
||||
intent.putExtra(SubmitPostService.EXTRA_KIND, APIUtils.KIND_CROSSPOST);
|
||||
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
|
||||
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_CROSSPOST);
|
||||
startService(intent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (isPosting) {
|
||||
promptAlertDialog(R.string.exit_when_submit, R.string.exit_when_submit_post_detail);
|
||||
} else {
|
||||
if (!titleEditText.getText().toString().equals("")) {
|
||||
promptAlertDialog(R.string.discard, R.string.discard_detail);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
|
||||
outState.putBoolean(SUBREDDIT_IS_USER_STATE, subredditIsUser);
|
||||
outState.putBoolean(LOAD_SUBREDDIT_ICON_STATE, loadSubredditIconSuccessful);
|
||||
outState.putBoolean(IS_POSTING_STATE, isPosting);
|
||||
outState.putParcelable(FLAIR_STATE, flair);
|
||||
outState.putBoolean(IS_SPOILER_STATE, isSpoiler);
|
||||
outState.putBoolean(IS_NSFW_STATE, isNSFW);
|
||||
outState.putBoolean(NULL_ACCESS_TOKEN_STATE, mNullAccessToken);
|
||||
outState.putString(ACCESS_TOKEN_STATE, mAccessToken);
|
||||
}
|
||||
|
||||
@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) {
|
||||
subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
displaySubredditIcon();
|
||||
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
flairTextView.setText(getString(R.string.flair));
|
||||
flair = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAccountSwitchEvent(SwitchAccountEvent event) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onSubmitTextPostEvent(SubmitCrosspostEvent submitCrosspostEvent) {
|
||||
isPosting = false;
|
||||
mPostingSnackbar.dismiss();
|
||||
if (submitCrosspostEvent.postSuccess) {
|
||||
Intent intent = new Intent(this, ViewPostDetailActivity.class);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, submitCrosspostEvent.post);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
mMenu.findItem(R.id.action_send_post_text_activity).setEnabled(true);
|
||||
mMenu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(255);
|
||||
if (submitCrosspostEvent.errorMessage == null || submitCrosspostEvent.errorMessage.equals("")) {
|
||||
Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Snackbar.make(coordinatorLayout, submitCrosspostEvent.errorMessage.substring(0, 1).toUpperCase()
|
||||
+ submitCrosspostEvent.errorMessage.substring(1), Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1466,6 +1466,11 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
case R.id.action_see_removed_view_post_detail_activity:
|
||||
showRemovedPost();
|
||||
return true;
|
||||
case R.id.action_crosspost_view_post_detail_activity:
|
||||
Intent submitCrosspostIntent = new Intent(this, SubmitCrosspostActivity.class);
|
||||
submitCrosspostIntent.putExtra(SubmitCrosspostActivity.EXTRA_POST, mPost);
|
||||
startActivity(submitCrosspostIntent);
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
return true;
|
||||
|
@ -29,6 +29,7 @@ import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActiv
|
||||
import ml.docilealligator.infinityforreddit.Activity.SelectedSubredditsActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SendPrivateMessageActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SettingsActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubmitCrosspostActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubredditMultiselectionActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
|
||||
@ -194,4 +195,6 @@ public interface AppComponent {
|
||||
void inject(DownloadMediaService downloadMediaService);
|
||||
|
||||
void inject(DownloadLocationPreferenceFragment downloadLocationPreferenceFragment);
|
||||
|
||||
void inject(SubmitCrosspostActivity submitCrosspostActivity);
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package ml.docilealligator.infinityforreddit.Event;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
|
||||
public class SubmitCrosspostEvent {
|
||||
public boolean postSuccess;
|
||||
public Post post;
|
||||
public String errorMessage;
|
||||
|
||||
public SubmitCrosspostEvent(boolean postSuccess, Post post, String errorMessage) {
|
||||
this.postSuccess = postSuccess;
|
||||
this.post = post;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
}
|
@ -157,6 +157,14 @@ public class SubmitPost {
|
||||
});
|
||||
}
|
||||
|
||||
public static void submitCrosspost(Retrofit oauthRetrofit, String accessToken,
|
||||
Locale locale, String subredditName, String title, String crosspostFullname,
|
||||
Flair flair, boolean isSpoiler, boolean isNSFW, String kind,
|
||||
SubmitPostListener submitPostListener) {
|
||||
submitPost(oauthRetrofit, accessToken, locale, subredditName, title, crosspostFullname,
|
||||
flair, isSpoiler, isNSFW, kind, null, submitPostListener);
|
||||
}
|
||||
|
||||
private static void submitPost(Retrofit oauthRetrofit, String accessToken,
|
||||
Locale locale, String subredditName, String title, String content,
|
||||
Flair flair, boolean isSpoiler, boolean isNSFW, String kind,
|
||||
@ -185,6 +193,9 @@ public class SubmitPost {
|
||||
params.put(APIUtils.URL_KEY, content);
|
||||
params.put(APIUtils.VIDEO_POSTER_URL_KEY, posterUrl);
|
||||
break;
|
||||
case APIUtils.KIND_CROSSPOST:
|
||||
params.put(APIUtils.CROSSPOST_FULLNAME_KEY, content);
|
||||
break;
|
||||
}
|
||||
|
||||
if (flair != null) {
|
||||
|
@ -34,6 +34,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitCrosspostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitImagePostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitVideoOrGifPostEvent;
|
||||
@ -43,6 +44,7 @@ import ml.docilealligator.infinityforreddit.NotificationUtils;
|
||||
import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.Post.SubmitPost;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class SubmitPostService extends Service {
|
||||
@ -58,6 +60,7 @@ public class SubmitPostService extends Service {
|
||||
public static final int EXTRA_POST_TEXT_OR_LINK = 0;
|
||||
public static final int EXTRA_POST_TYPE_IMAGE = 1;
|
||||
public static final int EXTRA_POST_TYPE_VIDEO = 2;
|
||||
public static final int EXTRA_POST_TYPE_CROSSPOST = 3;
|
||||
@Inject
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
@ -115,6 +118,10 @@ public class SubmitPostService extends Service {
|
||||
kind = intent.getStringExtra(EXTRA_KIND);
|
||||
startForeground(NotificationUtils.SUBMIT_POST_SERVICE_NOTIFICATION_ID, createNotification(R.string.posting));
|
||||
submitTextOrLinkPost();
|
||||
} else if (postType == EXTRA_POST_TYPE_CROSSPOST) {
|
||||
content = intent.getStringExtra(EXTRA_CONTENT);
|
||||
startForeground(NotificationUtils.SUBMIT_POST_SERVICE_NOTIFICATION_ID, createNotification(R.string.posting));
|
||||
submitCrosspost();
|
||||
} else if (postType == EXTRA_POST_TYPE_IMAGE) {
|
||||
mediaUri = intent.getData();
|
||||
startForeground(NotificationUtils.SUBMIT_POST_SERVICE_NOTIFICATION_ID, createNotification(R.string.posting_image));
|
||||
@ -156,6 +163,25 @@ public class SubmitPostService extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
private void submitCrosspost() {
|
||||
SubmitPost.submitCrosspost(mOauthRetrofit, mAccessToken, getResources().getConfiguration().locale,
|
||||
subredditName, title, content, flair, isSpoiler, isNSFW, APIUtils.KIND_CROSSPOST, new SubmitPost.SubmitPostListener() {
|
||||
@Override
|
||||
public void submitSuccessful(Post post) {
|
||||
EventBus.getDefault().post(new SubmitCrosspostEvent(true, post, null));
|
||||
|
||||
stopService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitFailed(@Nullable String errorMessage) {
|
||||
EventBus.getDefault().post(new SubmitCrosspostEvent(false, null, errorMessage));
|
||||
|
||||
stopService();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void submitImagePost() {
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
|
@ -71,12 +71,14 @@ public class APIUtils {
|
||||
public static final String FLAIR_TEXT_KEY = "flair_text";
|
||||
public static final String SPOILER_KEY = "spoiler";
|
||||
public static final String NSFW_KEY = "nsfw";
|
||||
public static final String CROSSPOST_FULLNAME_KEY = "crosspost_fullname";
|
||||
public static final String KIND_KEY = "kind";
|
||||
public static final String KIND_SELF = "self";
|
||||
public static final String KIND_LINK = "link";
|
||||
public static final String KIND_IMAGE = "image";
|
||||
public static final String KIND_VIDEO = "video";
|
||||
public static final String KIND_VIDEOGIF = "videogif";
|
||||
public static final String KIND_CROSSPOST = "crosspost";
|
||||
|
||||
public static final String FILEPATH_KEY = "filepath";
|
||||
public static final String MIMETYPE_KEY = "mimetype";
|
||||
|
191
app/src/main/res/layout/activity_submit_crosspost.xml
Normal file
191
app/src/main/res/layout/activity_submit_crosspost.xml
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_submit_crosspost_activity"
|
||||
tools:context=".Activity.SubmitCrosspostActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/subreddit_icon_gif_image_view_submit_crosspost_activity"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_submit_crosspost_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_toStartOf="@id/rules_button_submit_crosspost_activity"
|
||||
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_submit_crosspost_activity"
|
||||
android:text="@string/choose_a_subreddit"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rules_button_submit_crosspost_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/rules"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_1_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_submit_crosspost_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:padding="4dp"
|
||||
android:text="@string/flair"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_submit_crosspost_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:padding="4dp"
|
||||
android:text="@string/spoiler"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:lib_setRadius="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_submit_crosspost_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="3dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_2_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/post_title_edit_text_submit_crosspost_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" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_3_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_content_text_view_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:textSize="?attr/content_font_default"
|
||||
android:fontFamily="?attr/content_font_family"
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_layout_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
android:id="@+id/image_view_submit_crosspost_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitStart" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/play_button_image_view_submit_crosspost_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="start"
|
||||
android:background="@drawable/play_button_round_background"
|
||||
android:src="@drawable/ic_play_circle_36dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
10
app/src/main/res/menu/submit_crosspost_activity.xml
Normal file
10
app/src/main/res/menu/submit_crosspost_activity.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_send_submit_crosspost_activity"
|
||||
android:orderInCategory="1"
|
||||
android:title="@string/action_send"
|
||||
android:icon="@drawable/ic_send_toolbar_24dp"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -87,4 +87,10 @@
|
||||
android:title="@string/action_see_removed"
|
||||
app:showAsAction="never"
|
||||
android:visible="false" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_crosspost_view_post_detail_activity"
|
||||
android:orderInCategory="14"
|
||||
android:title="@string/action_crosspost"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="view_reddit_gallery_activity_image_label">Image %1$d/%2$d</string>
|
||||
<string name="view_reddit_gallery_activity_gif_label">Gif %1$d/%2$d</string>
|
||||
<string name="view_reddit_gallery_activity_video_label">Video %1$d/%2$d</string>
|
||||
<string name="submit_crosspost_activity_label">Crosspost</string>
|
||||
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
@ -66,6 +67,7 @@
|
||||
<string name="action_preview">Preview</string>
|
||||
<string name="action_report">Report</string>
|
||||
<string name="action_see_removed">See Removed</string>
|
||||
<string name="action_crosspost">Crosspost</string>
|
||||
<string name="action_set_wallpaper">Set as Wallpaper</string>
|
||||
<string name="action_send_private_message">Send Private Message</string>
|
||||
<string name="action_block_user">Block User</string>
|
||||
|
Loading…
Reference in New Issue
Block a user