mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-06 18:57:26 +01:00
parent
debb3e04df
commit
3c91007d93
@ -74,6 +74,9 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.events.SubmitGalleryPostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.UploadImageUtils;
|
||||
@ -102,6 +105,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
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 String COMMUNITY_DATA_STATE = "CDS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_gallery_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@ -123,10 +127,6 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
MaterialButton rulesButton;
|
||||
@BindView(R.id.divider_1_post_gallery_activity)
|
||||
MaterialDivider divider1;
|
||||
@BindView(R.id.flair_custom_text_view_post_gallery_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_post_gallery_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_post_gallery_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.receive_post_reply_notifications_linear_layout_post_gallery_activity)
|
||||
@ -168,6 +168,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
private String mAccountName;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private SubscribedSubredditData communityData;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private boolean loadSubredditIconSuccessful = true;
|
||||
@ -245,6 +246,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||
@ -279,7 +281,6 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
@ -290,17 +291,6 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
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);
|
||||
@ -314,11 +304,25 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
if (getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
loadSubredditIconSuccessful = false;
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
loadSubredditIcon();
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), subredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
{
|
||||
communityData = new SubscribedSubredditData(subredditData);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
@ -347,40 +351,12 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, communityData.getQualified_name());
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
flairTextView.setOnClickListener(view -> {
|
||||
if (flair == null) {
|
||||
flairSelectionBottomSheetFragment = new FlairBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
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) {
|
||||
@ -449,8 +425,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
@ -458,8 +433,6 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
rulesButton.setTypeface(typeface);
|
||||
receivePostReplyNotificationsTextView.setTypeface(typeface);
|
||||
flairTextView.setTypeface(typeface);
|
||||
spoilerTextView.setTypeface(typeface);
|
||||
nsfwTextView.setTypeface(typeface);
|
||||
titleEditText.setTypeface(typeface);
|
||||
}
|
||||
@ -612,7 +585,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
|
||||
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_GALLERY);
|
||||
ArrayList<RedditGalleryPayload.Item> items = new ArrayList<>();
|
||||
for (RedditGallerySubmissionRecyclerViewAdapter.RedditGalleryImageInfo i : redditGalleryImageInfoList) {
|
||||
@ -648,6 +621,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
|
||||
@ -666,19 +640,16 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
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);
|
||||
communityData = data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
subredditIsUser = false;
|
||||
|
||||
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;
|
||||
}
|
||||
} else if (requestCode == PICK_IMAGE_REQUEST_CODE) {
|
||||
@ -709,10 +680,6 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,6 +64,9 @@ import eu.toldi.infinityforlemmy.events.SubmitImagePostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SubmitVideoOrGifPostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
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 jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
@ -89,6 +92,7 @@ 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 String COMMUNITY_DATA_STATE = "CDS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_image_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@ -110,10 +114,6 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
MaterialButton rulesButton;
|
||||
@BindView(R.id.divider_1_post_image_activity)
|
||||
MaterialDivider divider1;
|
||||
@BindView(R.id.flair_custom_text_view_post_image_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_post_image_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_post_image_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.receive_post_reply_notifications_linear_layout_post_image_activity)
|
||||
@ -162,6 +162,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
private String mAccountName;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private SubscribedSubredditData communityData;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private boolean loadSubredditIconSuccessful = true;
|
||||
@ -217,6 +218,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||
@ -247,7 +249,6 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
@ -258,17 +259,6 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
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);
|
||||
@ -282,11 +272,25 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
loadSubredditIconSuccessful = false;
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
loadSubredditIcon();
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), subredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
{
|
||||
communityData = new SubscribedSubredditData(subredditData);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
@ -320,40 +324,12 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, communityData.getQualified_name());
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
flairTextView.setOnClickListener(view -> {
|
||||
if (flair == null) {
|
||||
flairSelectionBottomSheetFragment = new FlairBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
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) {
|
||||
@ -451,8 +427,6 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
@ -463,8 +437,6 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
rulesButton.setTypeface(typeface);
|
||||
receivePostReplyNotificationsTextView.setTypeface(typeface);
|
||||
flairTextView.setTypeface(typeface);
|
||||
spoilerTextView.setTypeface(typeface);
|
||||
nsfwTextView.setTypeface(typeface);
|
||||
titleEditText.setTypeface(typeface);
|
||||
selectAgainTextView.setTypeface(typeface);
|
||||
@ -570,7 +542,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.setData(imageUri);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
|
||||
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||
@ -608,6 +580,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
@ -628,19 +601,15 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
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);
|
||||
communityData = data.getExtras().getParcelable(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
|
||||
subredditIsUser = false;
|
||||
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;
|
||||
}
|
||||
} else if (requestCode == PICK_IMAGE_REQUEST_CODE) {
|
||||
@ -669,10 +638,6 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -700,8 +665,8 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
isPosting = false;
|
||||
mPostingSnackbar.dismiss();
|
||||
if (submitImagePostEvent.postSuccess) {
|
||||
Intent intent = new Intent(PostImageActivity.this, ViewUserDetailActivity.class);
|
||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName);
|
||||
Intent intent = new Intent(PostImageActivity.this, ViewPostDetailActivity.class);
|
||||
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, submitImagePostEvent.post);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
|
@ -8,7 +8,6 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.webkit.URLUtil;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
@ -56,6 +55,9 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.events.SubmitTextOrLinkPostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
|
||||
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 jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
@ -73,6 +75,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
static final String EXTRA_LINK = "EL";
|
||||
|
||||
private static final String SELECTED_ACCOUNT_STATE = "SAS";
|
||||
private static final String COMMUNITY_DATA_STATE = "CDS";
|
||||
private static final String SUBREDDIT_NAME_STATE = "SNS";
|
||||
private static final String SUBREDDIT_ICON_STATE = "SIS";
|
||||
private static final String SUBREDDIT_SELECTED_STATE = "SSS";
|
||||
@ -107,10 +110,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
MaterialDivider divider1;
|
||||
@BindView(R.id.divider_2_post_link_activity)
|
||||
MaterialDivider divider2;
|
||||
@BindView(R.id.flair_custom_text_view_post_link_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_post_link_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_post_link_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.receive_post_reply_notifications_linear_layout_post_link_activity)
|
||||
@ -147,6 +146,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
private String mAccessToken;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private SubscribedSubredditData communityData;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private boolean loadSubredditIconSuccessful = true;
|
||||
@ -200,6 +200,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||
@ -225,7 +226,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
@ -236,17 +236,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
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);
|
||||
@ -260,11 +249,25 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
loadSubredditIconSuccessful = false;
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
loadSubredditIcon();
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), subredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
{
|
||||
communityData = new SubscribedSubredditData(subredditData);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
@ -298,40 +301,12 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, communityData.getQualified_name());
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
flairTextView.setOnClickListener(view -> {
|
||||
if (flair == null) {
|
||||
flairSelectionBottomSheetFragment = new FlairBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
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) {
|
||||
@ -426,8 +401,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
@ -439,8 +412,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
rulesButton.setTypeface(typeface);
|
||||
receivePostReplyNotificationsTextView.setTypeface(typeface);
|
||||
flairTextView.setTypeface(typeface);
|
||||
spoilerTextView.setTypeface(typeface);
|
||||
nsfwTextView.setTypeface(typeface);
|
||||
titleEditText.setTypeface(typeface);
|
||||
suggestTitleButton.setTypeface(typeface);
|
||||
@ -541,7 +512,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
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_KIND, APIUtils.KIND_LINK);
|
||||
@ -575,6 +546,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
|
||||
@ -591,19 +563,16 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
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);
|
||||
communityData = data.getExtras().getParcelable(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
subredditIsUser = false;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -618,10 +587,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,6 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@ -64,6 +63,9 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.events.SubmitPollPostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
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;
|
||||
@ -87,6 +89,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
private static final String IS_NSFW_STATE = "INS";
|
||||
|
||||
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
|
||||
private static final String COMMUNITY_DATA_STATE = "CDS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_poll_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@ -108,10 +111,6 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
MaterialButton rulesButton;
|
||||
@BindView(R.id.divider_1_post_poll_activity)
|
||||
MaterialDivider divider1;
|
||||
@BindView(R.id.flair_custom_text_view_post_poll_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_post_poll_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_post_poll_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.receive_post_reply_notifications_linear_layout_post_poll_activity)
|
||||
@ -173,6 +172,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
@Inject
|
||||
Executor mExecutor;
|
||||
private Account selectedAccount;
|
||||
private SubscribedSubredditData communityData;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
private String iconUrl;
|
||||
@ -232,6 +232,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||
@ -257,7 +258,6 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
@ -268,17 +268,6 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
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);
|
||||
@ -292,11 +281,25 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
loadSubredditIconSuccessful = false;
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
loadSubredditIcon();
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), subredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
{
|
||||
communityData = new SubscribedSubredditData(subredditData);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
@ -325,40 +328,12 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, communityData.getQualified_name());
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
flairTextView.setOnClickListener(view -> {
|
||||
if (flair == null) {
|
||||
flairSelectionBottomSheetFragment = new FlairBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
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) {
|
||||
@ -431,8 +406,6 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
@ -481,8 +454,6 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
rulesButton.setTypeface(typeface);
|
||||
receivePostReplyNotificationsTextView.setTypeface(typeface);
|
||||
flairTextView.setTypeface(typeface);
|
||||
spoilerTextView.setTypeface(typeface);
|
||||
nsfwTextView.setTypeface(typeface);
|
||||
titleEditText.setTypeface(typeface);
|
||||
option1TextInputEditText.setTypeface(typeface);
|
||||
@ -631,7 +602,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
|
||||
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_POLL);
|
||||
PollPayload payload = new PollPayload(subredditName, titleEditText.getText().toString(),
|
||||
optionList.toArray(new String[0]), (int) votingLengthSlider.getValue(), isNSFW, isSpoiler, flair, receivePostReplyNotificationsSwitchMaterial.isChecked(),
|
||||
@ -669,6 +640,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
|
||||
@ -685,19 +657,16 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
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);
|
||||
communityData = data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
subredditIsUser = false;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -706,10 +675,6 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,6 @@ import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@ -69,6 +68,9 @@ import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
|
||||
import eu.toldi.infinityforlemmy.events.SubmitTextOrLinkPostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
|
||||
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;
|
||||
@ -78,7 +80,6 @@ import retrofit2.Retrofit;
|
||||
|
||||
public class PostTextActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback,
|
||||
UploadImageEnabledActivity, AccountChooserBottomSheetFragment.AccountChooserListener {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
static final String EXTRA_CONTENT = "EC";
|
||||
|
||||
@ -98,6 +99,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
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;
|
||||
private static final String COMMUNITY_DATA_STATE = "CDS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_text_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@ -119,10 +121,6 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
MaterialButton rulesButton;
|
||||
@BindView(R.id.divider_1_post_text_activity)
|
||||
MaterialDivider divider1;
|
||||
@BindView(R.id.flair_custom_text_view_post_text_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_post_text_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_post_text_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.receive_post_reply_notifications_linear_layout_post_text_activity)
|
||||
@ -164,6 +162,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
private String mAccessToken;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private SubscribedSubredditData communityData;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private boolean loadSubredditIconSuccessful = true;
|
||||
@ -219,6 +218,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
|
||||
@ -245,7 +245,6 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
@ -256,17 +255,6 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
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);
|
||||
@ -280,11 +268,25 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
loadSubredditIconSuccessful = false;
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
loadSubredditIcon();
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), subredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
{
|
||||
communityData = new SubscribedSubredditData(subredditData);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
@ -318,44 +320,12 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, communityData.getQualified_name());
|
||||
}
|
||||
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) {
|
||||
@ -448,8 +418,6 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
@ -459,8 +427,6 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
rulesButton.setTypeface(typeface);
|
||||
receivePostReplyNotificationsTextView.setTypeface(typeface);
|
||||
flairTextView.setTypeface(typeface);
|
||||
spoilerTextView.setTypeface(typeface);
|
||||
nsfwTextView.setTypeface(typeface);
|
||||
titleEditText.setTypeface(typeface);
|
||||
}
|
||||
@ -562,16 +528,10 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
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_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
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_KIND, APIUtils.KIND_SELF);
|
||||
@ -599,6 +559,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
@ -617,19 +578,16 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
|
||||
subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
|
||||
communityData = data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
subredditIsUser = false;
|
||||
|
||||
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;
|
||||
|
||||
} else if (requestCode == PICK_IMAGE_REQUEST_CODE) {
|
||||
@ -658,10 +616,6 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -67,6 +67,9 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.events.SubmitVideoOrGifPostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
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 jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
@ -92,6 +95,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
|
||||
private static final int PICK_VIDEO_REQUEST_CODE = 1;
|
||||
private static final int CAPTURE_VIDEO_REQUEST_CODE = 2;
|
||||
private static final String COMMUNITY_DATA_STATE = "CDS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_video_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@ -113,10 +117,6 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
MaterialButton rulesButton;
|
||||
@BindView(R.id.divider_1_post_video_activity)
|
||||
MaterialDivider divider1;
|
||||
@BindView(R.id.flair_custom_text_view_post_video_activity)
|
||||
CustomTextView flairTextView;
|
||||
@BindView(R.id.spoiler_custom_text_view_post_video_activity)
|
||||
CustomTextView spoilerTextView;
|
||||
@BindView(R.id.nsfw_custom_text_view_post_video_activity)
|
||||
CustomTextView nsfwTextView;
|
||||
@BindView(R.id.receive_post_reply_notifications_linear_layout_post_video_activity)
|
||||
@ -168,6 +168,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
private String mAccountName;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private SubscribedSubredditData communityData;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private Uri videoUri;
|
||||
@ -235,6 +236,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
@ -266,7 +268,6 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (subredditName != null) {
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
if (!loadSubredditIconSuccessful) {
|
||||
loadSubredditIcon();
|
||||
}
|
||||
@ -277,17 +278,6 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
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);
|
||||
@ -301,11 +291,25 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
|
||||
loadSubredditIconSuccessful = false;
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
flairTextView.setVisibility(View.VISIBLE);
|
||||
loadSubredditIcon();
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), subredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
{
|
||||
communityData = new SubscribedSubredditData(subredditData);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
subredditSelected = true;
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
loadSubredditIcon();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mGlide.load(R.drawable.subreddit_default_icon)
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||
@ -341,40 +345,12 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (subredditIsUser) {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
|
||||
} else {
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(RulesActivity.EXTRA_SUBREDDIT_NAME, communityData.getQualified_name());
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
flairTextView.setOnClickListener(view -> {
|
||||
if (flair == null) {
|
||||
mFlairSelectionBottomSheetFragment = new FlairBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
bundle.putString(FlairBottomSheetFragment.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
mFlairSelectionBottomSheetFragment.setArguments(bundle);
|
||||
mFlairSelectionBottomSheetFragment.show(getSupportFragmentManager(), mFlairSelectionBottomSheetFragment.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) {
|
||||
@ -468,8 +444,6 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
|
||||
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
|
||||
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
|
||||
flairTextView.setTextColor(primaryTextColor);
|
||||
spoilerTextView.setTextColor(primaryTextColor);
|
||||
nsfwTextView.setTextColor(primaryTextColor);
|
||||
titleEditText.setTextColor(primaryTextColor);
|
||||
titleEditText.setHintTextColor(secondaryTextColor);
|
||||
@ -480,8 +454,6 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
subredditNameTextView.setTypeface(typeface);
|
||||
rulesButton.setTypeface(typeface);
|
||||
receivePostReplyNotificationsTextView.setTypeface(typeface);
|
||||
flairTextView.setTypeface(typeface);
|
||||
spoilerTextView.setTypeface(typeface);
|
||||
nsfwTextView.setTypeface(typeface);
|
||||
titleEditText.setTypeface(typeface);
|
||||
selectAgainTextView.setTypeface(typeface);
|
||||
@ -589,7 +561,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.setData(videoUri);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, communityData.getId());
|
||||
intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());
|
||||
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
|
||||
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
|
||||
@ -637,6 +609,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
|
||||
@ -657,19 +630,16 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (data != null) {
|
||||
subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
|
||||
communityData = data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getBooleanExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER, false);
|
||||
subredditIsUser = false;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -707,10 +677,6 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
@Override
|
||||
public void flairSelected(Flair flair) {
|
||||
this.flair = flair;
|
||||
flairTextView.setText(flair.getText());
|
||||
flairTextView.setBackgroundColor(flairBackgroundColor);
|
||||
flairTextView.setBorderColor(flairBackgroundColor);
|
||||
flairTextView.setTextColor(flairTextColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,6 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@ -31,7 +30,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.toldi.infinityforlemmy.FetchRules;
|
||||
import eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder;
|
||||
@ -41,6 +39,8 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.slidr.Slidr;
|
||||
import eu.toldi.infinityforlemmy.customviews.slidr.widget.SliderPanel;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -134,26 +134,27 @@ public class RulesActivity extends BaseActivity {
|
||||
|
||||
mAdapter = new RulesRecyclerViewAdapter(this, mCustomThemeWrapper, sliderPanel);
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
|
||||
FetchRules.fetchRules(mExecutor, new Handler(), mAccessToken == null ? mRetrofit.getRetrofit() : mOauthRetrofit, mAccessToken, mSubredditName, new FetchRules.FetchRulesListener() {
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), mSubredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void success(ArrayList<Rule> rules) {
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (rules == null || rules.size() == 0) {
|
||||
String description = subredditData.getDescription();
|
||||
if (description == null || description.isEmpty()) {
|
||||
errorTextView.setVisibility(View.VISIBLE);
|
||||
errorTextView.setText(R.string.no_rule);
|
||||
errorTextView.setOnClickListener(view -> {
|
||||
});
|
||||
}
|
||||
ArrayList<Rule> rules = new ArrayList<>();
|
||||
rules.add(new Rule("Rules", description));
|
||||
mAdapter.changeDataset(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
displayError();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -184,21 +185,24 @@ public class RulesActivity extends BaseActivity {
|
||||
errorTextView.setOnClickListener(view -> {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
errorTextView.setVisibility(View.GONE);
|
||||
FetchRules.fetchRules(mExecutor, new Handler(), mAccessToken == null ? mRetrofit.getRetrofit() : mOauthRetrofit, mAccessToken, mSubredditName, new FetchRules.FetchRulesListener() {
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit.getRetrofit(), mSubredditName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void success(ArrayList<Rule> rules) {
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (rules == null || rules.size() == 0) {
|
||||
String description = subredditData.getDescription();
|
||||
if (description == null || description.isEmpty()) {
|
||||
errorTextView.setVisibility(View.VISIBLE);
|
||||
errorTextView.setText(R.string.no_rule);
|
||||
errorTextView.setOnClickListener(view -> {
|
||||
});
|
||||
}
|
||||
ArrayList<Rule> rules = new ArrayList<>();
|
||||
rules.add(new Rule("Rules", description));
|
||||
mAdapter.changeDataset(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed() {
|
||||
public void onFetchSubredditDataFail(boolean isQuarantined) {
|
||||
displayError();
|
||||
}
|
||||
});
|
||||
|
@ -52,6 +52,7 @@ import eu.toldi.infinityforlemmy.recentsearchquery.RecentSearchQuery;
|
||||
import eu.toldi.infinityforlemmy.recentsearchquery.RecentSearchQueryViewModel;
|
||||
import eu.toldi.infinityforlemmy.subreddit.ParseSubredditData;
|
||||
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;
|
||||
@ -128,6 +129,8 @@ public class SearchActivity extends BaseActivity {
|
||||
private String query;
|
||||
private String subredditName;
|
||||
|
||||
private SubscribedSubredditData communityData;
|
||||
|
||||
private String communityQualifiedName;
|
||||
private boolean subredditIsUser;
|
||||
private boolean searchOnlySubreddits;
|
||||
@ -183,7 +186,7 @@ public class SearchActivity extends BaseActivity {
|
||||
subredditNameList.add(subredditData.getName());
|
||||
returnIntent.putStringArrayListExtra(RETURN_EXTRA_SELECTED_SUBREDDIT_NAMES, subredditNameList);
|
||||
} else {
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, subredditData.getName());
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, new SubscribedSubredditData(subredditData));
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, subredditData.getIconUrl());
|
||||
}
|
||||
setResult(Activity.RESULT_OK, returnIntent);
|
||||
@ -429,8 +432,9 @@ public class SearchActivity extends BaseActivity {
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
|
||||
subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
subredditIsUser = data.getBooleanExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER, false);
|
||||
communityData = data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
subredditIsUser = false;
|
||||
|
||||
if (subredditName == null) {
|
||||
subredditNameTextView.setText(R.string.all_communities);
|
||||
@ -442,9 +446,9 @@ public class SearchActivity extends BaseActivity {
|
||||
if (getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false)) {
|
||||
returnIntent.putStringArrayListExtra(RETURN_EXTRA_SELECTED_SUBREDDIT_NAMES, data.getStringArrayListExtra(SearchSubredditsResultActivity.RETURN_EXTRA_SELECTED_SUBREDDIT_NAMES));
|
||||
} else {
|
||||
String name = data.getStringExtra(SearchSubredditsResultActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
SubscribedSubredditData communityData = data.getParcelableExtra(SearchSubredditsResultActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
String iconUrl = data.getStringExtra(SearchSubredditsResultActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, communityData);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
|
||||
}
|
||||
setResult(Activity.RESULT_OK, returnIntent);
|
||||
|
@ -34,6 +34,8 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.slidr.Slidr;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.fragments.SubredditListingFragment;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
|
||||
public class SearchSubredditsResultActivity extends BaseActivity implements ActivityToolbarInterface {
|
||||
@ -144,10 +146,10 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
|
||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar);
|
||||
}
|
||||
|
||||
public void getSelectedSubreddit(String name, String iconUrl) {
|
||||
public void getSelectedSubreddit(SubredditData subredditData) {
|
||||
Intent returnIntent = new Intent();
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, new SubscribedSubredditData(subredditData));
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, subredditData.getIconUrl());
|
||||
setResult(Activity.RESULT_OK, returnIntent);
|
||||
finish();
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ import eu.toldi.infinityforlemmy.events.SubmitCrosspostEvent;
|
||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||
import eu.toldi.infinityforlemmy.post.Post;
|
||||
import eu.toldi.infinityforlemmy.services.SubmitPostService;
|
||||
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
|
||||
import eu.toldi.infinityforlemmy.utils.APIUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
@ -87,6 +88,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
private static final String IS_NSFW_STATE = "INS";
|
||||
|
||||
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
|
||||
private static final String COMMUNITY_DATA_STATE = "CDS";
|
||||
|
||||
@BindView(R.id.coordinator_layout_submit_crosspost_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@ -159,6 +161,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
private Post post;
|
||||
private String iconUrl;
|
||||
private String subredditName;
|
||||
private SubscribedSubredditData communityData;
|
||||
private boolean subredditSelected = false;
|
||||
private boolean subredditIsUser;
|
||||
private boolean loadSubredditIconSuccessful = true;
|
||||
@ -212,6 +215,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
communityData = savedInstanceState.getParcelable(COMMUNITY_DATA_STATE);
|
||||
selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE);
|
||||
subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
|
||||
iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
|
||||
@ -566,7 +570,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
|
||||
Intent intent = new Intent(this, SubmitPostService.class);
|
||||
intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);
|
||||
intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
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());
|
||||
@ -604,6 +608,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(SELECTED_ACCOUNT_STATE, selectedAccount);
|
||||
outState.putParcelable(COMMUNITY_DATA_STATE, communityData);
|
||||
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
|
||||
outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
|
||||
outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
|
||||
@ -620,10 +625,11 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
|
||||
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);
|
||||
communityData = data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA);
|
||||
subredditName = communityData.getName();
|
||||
iconUrl = communityData.getIconUrl();
|
||||
subredditSelected = true;
|
||||
subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
|
||||
subredditIsUser = false;
|
||||
|
||||
subredditNameTextView.setTextColor(primaryTextColor);
|
||||
subredditNameTextView.setText(subredditName);
|
||||
|
@ -52,9 +52,7 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity
|
||||
|
||||
public static final String EXTRA_SPECIFIED_ACCOUNT = "ESA";
|
||||
public static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS";
|
||||
public static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
|
||||
public static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIURL";
|
||||
public static final String EXTRA_RETURN_SUBREDDIT_IS_USER = "ERSIU";
|
||||
public static final String EXTRA_RETURN_COMMUNITY_DATA = "ERCD";
|
||||
|
||||
private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 0;
|
||||
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
|
||||
@ -248,11 +246,9 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity
|
||||
return false;
|
||||
}
|
||||
|
||||
public void getSelectedSubreddit(String name, String iconUrl, boolean subredditIsUser) {
|
||||
public void getSelectedSubreddit(SubscribedSubredditData communityData) {
|
||||
Intent returnIntent = new Intent();
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_IS_USER, subredditIsUser);
|
||||
returnIntent.putExtra(EXTRA_RETURN_COMMUNITY_DATA, communityData);
|
||||
setResult(Activity.RESULT_OK, returnIntent);
|
||||
finish();
|
||||
}
|
||||
@ -261,13 +257,13 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
if (requestCode == SUBREDDIT_SEARCH_REQUEST_CODE) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
String name = data.getStringExtra(SearchActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
String iconUrl = data.getStringExtra(SearchActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
|
||||
|
||||
SubscribedSubredditData communityData = data.getParcelableExtra(SearchActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
String iconUrl = communityData.getIconUrl();
|
||||
Intent returnIntent = new Intent();
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
|
||||
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_IS_USER, false);
|
||||
returnIntent.putExtra(EXTRA_RETURN_COMMUNITY_DATA, communityData);
|
||||
setResult(Activity.RESULT_OK, returnIntent);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
switch (postType) {
|
||||
case PostTypeBottomSheetFragment.TYPE_TEXT:
|
||||
intent = new Intent(this, PostTextActivity.class);
|
||||
intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, communityName);
|
||||
intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, qualifiedName);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case PostTypeBottomSheetFragment.TYPE_LINK:
|
||||
|
@ -125,7 +125,7 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
|
||||
if (isMultiSelection) {
|
||||
((DataViewHolder) holder).checkBox.performClick();
|
||||
} else {
|
||||
callback.subredditSelected(subredditData.getName(), LemmyUtils.actorID2FullName(subredditData.getActorId()), subredditData.getIconUrl());
|
||||
callback.subredditSelected(subredditData);
|
||||
}
|
||||
});
|
||||
|
||||
@ -252,7 +252,7 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
|
||||
public interface Callback {
|
||||
void retryLoadingMore();
|
||||
|
||||
void subredditSelected(String subredditName, String communityFullName,String iconUrl);
|
||||
void subredditSelected(SubredditData communityData);
|
||||
}
|
||||
|
||||
class DataViewHolder extends RecyclerView.ViewHolder {
|
||||
|
@ -149,17 +149,17 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
|
||||
if (hasClearSelectionRow && viewHolder.getBindingAdapterPosition() == 0) {
|
||||
((SubredditViewHolder) viewHolder).subredditNameTextView.setText(R.string.all_communities);
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(null, null, false));
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(null));
|
||||
return;
|
||||
} else {
|
||||
int offset = hasClearSelectionRow ? 1 : 0;
|
||||
|
||||
SubscribedSubredditData communityData = mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset);
|
||||
name = mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getName();
|
||||
fullname = mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getQualified_name();
|
||||
iconUrl = mSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl();
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, false));
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(communityData));
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,11 +197,12 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
} else {
|
||||
offset = 1;
|
||||
}
|
||||
SubscribedSubredditData communityData = mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset);
|
||||
String name = mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getName();
|
||||
String iconUrl = mFavoriteSubscribedSubredditData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl();
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, false));
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(communityData));
|
||||
} else {
|
||||
viewHolder.itemView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
@ -230,11 +231,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
if (mSubscribedSubredditData != null) {
|
||||
|
||||
if (itemClickListener != null) {
|
||||
if (hasClearSelectionRow) {
|
||||
return mSubscribedSubredditData.size() > 0 ? mSubscribedSubredditData.size() + 1 : 0;
|
||||
} else {
|
||||
return mSubscribedSubredditData.size() > 0 ? mSubscribedSubredditData.size() + 1 : 0;
|
||||
}
|
||||
return mSubscribedSubredditData.size() > 0 ? mSubscribedSubredditData.size() + ((hasClearSelectionRow) ? 1 : 0) : 0;
|
||||
}
|
||||
|
||||
return mSubscribedSubredditData.size();
|
||||
@ -312,7 +309,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
}
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onClick(String name, String iconUrl, boolean subredditIsUser);
|
||||
void onClick(SubscribedSubredditData subredditData);
|
||||
}
|
||||
|
||||
class SubredditViewHolder extends RecyclerView.ViewHolder {
|
||||
|
@ -10,6 +10,7 @@ import eu.toldi.infinityforlemmy.dto.FollowCommunityDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.PostVoteDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.SaveCommentDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.SavePostDTO;
|
||||
import eu.toldi.infinityforlemmy.dto.SubmitPostDTO;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
@ -37,6 +38,10 @@ public interface LemmyAPI {
|
||||
@GET("api/v3/post")
|
||||
Call<String> postInfo(@Query("id") Integer postID, @Query("comment_id") Integer comment_id, @Query("auth") String access_token);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("api/v3/post")
|
||||
Call<String> postCreate(@Body SubmitPostDTO params);
|
||||
|
||||
@GET("api/v3/user")
|
||||
ListenableFuture<Response<String>> getUserPosts(
|
||||
@Query("username") String username,
|
||||
|
@ -0,0 +1,56 @@
|
||||
package eu.toldi.infinityforlemmy.dto;
|
||||
|
||||
public class SubmitPostDTO {
|
||||
|
||||
private String name;
|
||||
private int community_id;
|
||||
private String url;
|
||||
private String body;
|
||||
private String honeypot;
|
||||
private boolean nsfw;
|
||||
private Integer language_id;
|
||||
private String auth;
|
||||
|
||||
public SubmitPostDTO(String name, int community_id, String url, String body, String honeypot, boolean nsfw, Integer language_id, String auth) {
|
||||
this.name = name;
|
||||
this.community_id = community_id;
|
||||
this.url = url;
|
||||
this.body = body;
|
||||
this.honeypot = honeypot;
|
||||
this.nsfw = nsfw;
|
||||
this.language_id = language_id;
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getCommunity_id() {
|
||||
return community_id;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public String getHoneypot() {
|
||||
return honeypot;
|
||||
}
|
||||
|
||||
public boolean isNsfw() {
|
||||
return nsfw;
|
||||
}
|
||||
|
||||
public Integer getLanguage_id() {
|
||||
return language_id;
|
||||
}
|
||||
|
||||
public String getAuth() {
|
||||
return auth;
|
||||
}
|
||||
}
|
@ -1,11 +1,15 @@
|
||||
package eu.toldi.infinityforlemmy.events;
|
||||
|
||||
import eu.toldi.infinityforlemmy.post.Post;
|
||||
|
||||
public class SubmitImagePostEvent {
|
||||
public boolean postSuccess;
|
||||
public String errorMessage;
|
||||
public Post post;
|
||||
|
||||
public SubmitImagePostEvent(boolean postSuccess, String errorMessage) {
|
||||
public SubmitImagePostEvent(boolean postSuccess, String errorMessage, Post post) {
|
||||
this.postSuccess = postSuccess;
|
||||
this.errorMessage = errorMessage;
|
||||
this.post = post;
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||
import eu.toldi.infinityforlemmy.customviews.LinearLayoutManagerBugFixed;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditListingViewModel;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
|
||||
|
||||
@ -149,13 +150,13 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subredditSelected(String subredditName, String communityFullName, String iconUrl) {
|
||||
public void subredditSelected(SubredditData communityData) {
|
||||
if (isGettingSubredditInfo) {
|
||||
((SearchSubredditsResultActivity) mActivity).getSelectedSubreddit(subredditName, iconUrl);
|
||||
((SearchSubredditsResultActivity) mActivity).getSelectedSubreddit(communityData);
|
||||
} else {
|
||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY, communityFullName);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, communityData.getName());
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY, LemmyUtils.actorID2FullName(communityData.getActorId()));
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
|
||||
if (getArguments().getBoolean(EXTRA_IS_SUBREDDIT_SELECTION)) {
|
||||
adapter = new SubscribedSubredditsRecyclerViewAdapter(mActivity, mExecutor, mOauthRetrofit, mRedditDataRoomDatabase,
|
||||
mCustomThemeWrapper, accessToken, getArguments().getBoolean(EXTRA_EXTRA_CLEAR_SELECTION),
|
||||
(name, iconUrl, subredditIsUser) -> ((SubredditSelectionActivity) mActivity).getSelectedSubreddit(name, iconUrl, subredditIsUser));
|
||||
(communityData) -> ((SubredditSelectionActivity) mActivity).getSelectedSubreddit(communityData));
|
||||
} else {
|
||||
adapter = new SubscribedSubredditsRecyclerViewAdapter(mActivity, mExecutor, mOauthRetrofit, mRedditDataRoomDatabase,
|
||||
mCustomThemeWrapper, accessToken);
|
||||
|
@ -5,21 +5,17 @@ import android.os.Handler;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import eu.toldi.infinityforlemmy.Flair;
|
||||
import eu.toldi.infinityforlemmy.RetrofitHolder;
|
||||
import eu.toldi.infinityforlemmy.apis.RedditAPI;
|
||||
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
|
||||
import eu.toldi.infinityforlemmy.dto.SubmitPostDTO;
|
||||
import eu.toldi.infinityforlemmy.utils.APIUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.UploadImageUtils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
@ -27,24 +23,24 @@ import retrofit2.Retrofit;
|
||||
|
||||
public class SubmitPost {
|
||||
public static void submitTextOrLinkPost(Executor executor, Handler handler, Retrofit oauthRetrofit, String accessToken,
|
||||
String subredditName, String title, String content,
|
||||
int communityId, String title, String content,
|
||||
Flair flair, boolean isSpoiler, boolean isNSFW,
|
||||
boolean receivePostReplyNotifications, String kind,
|
||||
SubmitPostListener submitPostListener) {
|
||||
submitPost(executor, handler, oauthRetrofit, accessToken, subredditName, title, content,
|
||||
submitPost(executor, handler, oauthRetrofit, accessToken, communityId, title, content,
|
||||
flair, isSpoiler, isNSFW, receivePostReplyNotifications, kind, null, submitPostListener);
|
||||
}
|
||||
|
||||
public static void submitImagePost(Executor executor, Handler handler, RetrofitHolder mRetrofit,
|
||||
String accessToken, String subredditName, String title, Bitmap image,
|
||||
String accessToken, int communityId, String title, 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,
|
||||
subredditName, title, imageUrlOrError, flair, isSpoiler, isNSFW,
|
||||
receivePostReplyNotifications, APIUtils.KIND_IMAGE, null, submitPostListener);
|
||||
communityId, title, null, flair, isSpoiler, isNSFW,
|
||||
receivePostReplyNotifications, APIUtils.KIND_IMAGE, imageUrlOrError, submitPostListener);
|
||||
} else {
|
||||
submitPostListener.submitFailed(imageUrlOrError);
|
||||
}
|
||||
@ -55,57 +51,23 @@ public class SubmitPost {
|
||||
}
|
||||
|
||||
public static void submitCrosspost(Executor executor, Handler handler, Retrofit oauthRetrofit, String accessToken,
|
||||
String subredditName, String title, String crosspostFullname,
|
||||
int communityId, String title, String crosspostFullname,
|
||||
Flair flair, boolean isSpoiler, boolean isNSFW,
|
||||
boolean receivePostReplyNotifications, String kind,
|
||||
SubmitPostListener submitPostListener) {
|
||||
submitPost(executor, handler, oauthRetrofit, accessToken, subredditName, title, crosspostFullname,
|
||||
submitPost(executor, handler, oauthRetrofit, accessToken, communityId, title, crosspostFullname,
|
||||
flair, isSpoiler, isNSFW, receivePostReplyNotifications, kind, null, submitPostListener);
|
||||
}
|
||||
|
||||
private static void submitPost(Executor executor, Handler handler, Retrofit oauthRetrofit, String accessToken,
|
||||
String subredditName, String title, String content,
|
||||
int communityId, String title, String content,
|
||||
Flair flair, boolean isSpoiler, boolean isNSFW,
|
||||
boolean receivePostReplyNotifications, String kind,
|
||||
@Nullable String posterUrl, SubmitPostListener submitPostListener) {
|
||||
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
|
||||
LemmyAPI api = oauthRetrofit.create(LemmyAPI.class);
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put(APIUtils.API_TYPE_KEY, APIUtils.API_TYPE_JSON);
|
||||
params.put(APIUtils.SR_KEY, subredditName);
|
||||
params.put(APIUtils.TITLE_KEY, title);
|
||||
params.put(APIUtils.KIND_KEY, kind);
|
||||
switch (kind) {
|
||||
case APIUtils.KIND_SELF:
|
||||
params.put(APIUtils.TEXT_KEY, content);
|
||||
break;
|
||||
case APIUtils.KIND_LINK:
|
||||
case APIUtils.KIND_IMAGE:
|
||||
params.put(APIUtils.URL_KEY, content);
|
||||
break;
|
||||
case APIUtils.KIND_VIDEOGIF:
|
||||
params.put(APIUtils.KIND_KEY, APIUtils.KIND_IMAGE);
|
||||
params.put(APIUtils.URL_KEY, content);
|
||||
params.put(APIUtils.VIDEO_POSTER_URL_KEY, posterUrl);
|
||||
break;
|
||||
case APIUtils.KIND_VIDEO:
|
||||
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) {
|
||||
params.put(APIUtils.FLAIR_TEXT_KEY, flair.getText());
|
||||
params.put(APIUtils.FLAIR_ID_KEY, flair.getId());
|
||||
}
|
||||
params.put(APIUtils.SPOILER_KEY, Boolean.toString(isSpoiler));
|
||||
params.put(APIUtils.NSFW_KEY, Boolean.toString(isNSFW));
|
||||
params.put(APIUtils.SEND_REPLIES_KEY, Boolean.toString(receivePostReplyNotifications));
|
||||
|
||||
Call<String> submitPostCall = api.submit(APIUtils.getOAuthHeader(accessToken), params);
|
||||
Call<String> submitPostCall = api.postCreate(new SubmitPostDTO(title, communityId, posterUrl, content, null, isNSFW, null, accessToken));
|
||||
|
||||
try {
|
||||
Response<String> response = submitPostCall.execute();
|
||||
@ -124,50 +86,18 @@ public class SubmitPost {
|
||||
private static void getSubmittedPost(Executor executor, Handler handler, String response, String kind,
|
||||
Retrofit oauthRetrofit, String accessToken,
|
||||
SubmitPostListener submitPostListener) throws JSONException, IOException {
|
||||
JSONObject responseObject = new JSONObject(response).getJSONObject(JSONUtils.JSON_KEY);
|
||||
if (responseObject.getJSONArray(JSONUtils.ERRORS_KEY).length() != 0) {
|
||||
JSONArray error = responseObject.getJSONArray(JSONUtils.ERRORS_KEY)
|
||||
.getJSONArray(responseObject.getJSONArray(JSONUtils.ERRORS_KEY).length() - 1);
|
||||
if (error.length() != 0) {
|
||||
String errorString;
|
||||
if (error.length() >= 2) {
|
||||
errorString = error.getString(1);
|
||||
} else {
|
||||
errorString = error.getString(0);
|
||||
}
|
||||
submitPostListener.submitFailed(errorString);
|
||||
} else {
|
||||
|
||||
ParsePost.parsePost(executor, handler, response, new ParsePost.ParsePostListener() {
|
||||
@Override
|
||||
public void onParsePostSuccess(Post post) {
|
||||
submitPostListener.submitSuccessful(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParsePostFail() {
|
||||
submitPostListener.submitFailed(null);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!kind.equals(APIUtils.KIND_IMAGE) && !kind.equals(APIUtils.KIND_VIDEO) && !kind.equals(APIUtils.KIND_VIDEOGIF)) {
|
||||
String postId = responseObject.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.ID_KEY);
|
||||
|
||||
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
|
||||
|
||||
Call<String> getPostCall = api.getPostOauth(postId, APIUtils.getOAuthHeader(accessToken));
|
||||
Response<String> getPostCallResponse = getPostCall.execute();
|
||||
if (getPostCallResponse.isSuccessful()) {
|
||||
ParsePost.parsePost(executor, handler, getPostCallResponse.body(), new ParsePost.ParsePostListener() {
|
||||
@Override
|
||||
public void onParsePostSuccess(Post post) {
|
||||
submitPostListener.submitSuccessful(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParsePostFail() {
|
||||
submitPostListener.submitFailed(null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
submitPostListener.submitFailed(getPostCallResponse.message());
|
||||
}
|
||||
} else {
|
||||
submitPostListener.submitSuccessful(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface SubmitPostListener {
|
||||
|
@ -35,12 +35,10 @@ import java.io.OutputStream;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import eu.toldi.infinityforlemmy.AnyAccountAccessTokenAuthenticator;
|
||||
import eu.toldi.infinityforlemmy.Flair;
|
||||
import eu.toldi.infinityforlemmy.Infinity;
|
||||
import eu.toldi.infinityforlemmy.R;
|
||||
@ -59,8 +57,6 @@ import eu.toldi.infinityforlemmy.post.SubmitPost;
|
||||
import eu.toldi.infinityforlemmy.utils.APIUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.JSONUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.NotificationUtils;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -88,9 +84,7 @@ public class SubmitPostService extends Service {
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
RetrofitHolder mRetrofit;
|
||||
@Inject
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
|
||||
@Inject
|
||||
@Named("upload_media")
|
||||
Retrofit mUploadMediaRetrofit;
|
||||
@ -128,7 +122,7 @@ public class SubmitPostService extends Service {
|
||||
super.handleMessage(msg);
|
||||
Bundle bundle = msg.getData();
|
||||
Account account = bundle.getParcelable(EXTRA_ACCOUNT);
|
||||
String subredditName = bundle.getString(EXTRA_SUBREDDIT_NAME);
|
||||
int subredditName = bundle.getInt(EXTRA_SUBREDDIT_NAME);
|
||||
String title = bundle.getString(EXTRA_TITLE);
|
||||
Flair flair = bundle.getParcelable(EXTRA_FLAIR);
|
||||
boolean isSpoiler = bundle.getBoolean(EXTRA_IS_SPOILER, false);
|
||||
@ -136,31 +130,24 @@ public class SubmitPostService extends Service {
|
||||
boolean receivePostReplyNotifications = bundle.getBoolean(EXTRA_RECEIVE_POST_REPLY_NOTIFICATIONS, true);
|
||||
int postType = bundle.getInt(EXTRA_POST_TYPE, EXTRA_POST_TEXT_OR_LINK);
|
||||
|
||||
Retrofit newAuthenticatorOauthRetrofit = mOauthRetrofit.newBuilder().client(new OkHttpClient.Builder().authenticator(new AnyAccountAccessTokenAuthenticator(mRetrofit.getRetrofit(), mRedditDataRoomDatabase, account, mCurrentAccountSharedPreferences))
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
.build())
|
||||
.build();
|
||||
|
||||
if (postType == EXTRA_POST_TEXT_OR_LINK) {
|
||||
String content = bundle.getString(EXTRA_CONTENT);
|
||||
String kind = bundle.getString(EXTRA_KIND);
|
||||
submitTextOrLinkPost(newAuthenticatorOauthRetrofit, account, subredditName, title, content, flair, isSpoiler, isNSFW,
|
||||
submitTextOrLinkPost(mRetrofit.getRetrofit(), account, subredditName, title, content, flair, isSpoiler, isNSFW,
|
||||
receivePostReplyNotifications, kind);
|
||||
} else if (postType == EXTRA_POST_TYPE_CROSSPOST) {
|
||||
String content = bundle.getString(EXTRA_CONTENT);
|
||||
submitCrosspost(mExecutor, handler, newAuthenticatorOauthRetrofit, account, subredditName, title, content,
|
||||
submitCrosspost(mExecutor, handler, mRetrofit.getRetrofit(), account, subredditName, title, content,
|
||||
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,
|
||||
receivePostReplyNotifications);
|
||||
} else if (postType == EXTRA_POST_TYPE_GALLERY) {
|
||||
submitGalleryPost(newAuthenticatorOauthRetrofit, account, bundle.getString(EXTRA_REDDIT_GALLERY_PAYLOAD));
|
||||
submitGalleryPost(mRetrofit.getRetrofit(), account, bundle.getString(EXTRA_REDDIT_GALLERY_PAYLOAD));
|
||||
} else {
|
||||
submitPollPost(newAuthenticatorOauthRetrofit, account, bundle.getString(EXTRA_POLL_PAYLOAD));
|
||||
submitPollPost(mRetrofit.getRetrofit(), account, bundle.getString(EXTRA_POLL_PAYLOAD));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,11 +214,11 @@ public class SubmitPostService extends Service {
|
||||
.build();
|
||||
}
|
||||
|
||||
private void submitTextOrLinkPost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, String subredditName, String title, String content,
|
||||
private void submitTextOrLinkPost(Retrofit newAuthenticatorOauthRetrofit, Account selectedAccount, int communityId, String title, String content,
|
||||
Flair flair, boolean isSpoiler, boolean isNSFW, boolean receivePostReplyNotifications,
|
||||
String kind) {
|
||||
SubmitPost.submitTextOrLinkPost(mExecutor, handler, newAuthenticatorOauthRetrofit, selectedAccount.getAccessToken(),
|
||||
subredditName, title, content, flair, isSpoiler,
|
||||
communityId, title, content, flair, isSpoiler,
|
||||
isNSFW, receivePostReplyNotifications, kind, new SubmitPost.SubmitPostListener() {
|
||||
@Override
|
||||
public void submitSuccessful(Post post) {
|
||||
@ -250,10 +237,10 @@ public class SubmitPostService extends Service {
|
||||
}
|
||||
|
||||
private void submitCrosspost(Executor executor, Handler handler, Retrofit newAuthenticatorOauthRetrofit,
|
||||
Account selectedAccount, String subredditName,
|
||||
Account selectedAccount, int communityId,
|
||||
String title, String content, Flair flair, boolean isSpoiler, boolean isNSFW,
|
||||
boolean receivePostReplyNotifications) {
|
||||
SubmitPost.submitCrosspost(executor, handler, newAuthenticatorOauthRetrofit, selectedAccount.getAccessToken(), subredditName, title,
|
||||
SubmitPost.submitCrosspost(executor, handler, newAuthenticatorOauthRetrofit, selectedAccount.getAccessToken(), communityId, title,
|
||||
content, flair, isSpoiler, isNSFW, receivePostReplyNotifications, APIUtils.KIND_CROSSPOST,
|
||||
new SubmitPost.SubmitPostListener() {
|
||||
@Override
|
||||
@ -272,17 +259,17 @@ public class SubmitPostService extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
private void submitImagePost(RetrofitHolder newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, String subredditName, String title,
|
||||
private void submitImagePost(RetrofitHolder newAuthenticatorOauthRetrofit, Account selectedAccount, Uri mediaUri, int communityId, String title,
|
||||
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(), subredditName, title, resource, flair, isSpoiler, isNSFW, receivePostReplyNotifications,
|
||||
selectedAccount.getAccessToken(), communityId, title, resource, flair, isSpoiler, isNSFW, receivePostReplyNotifications,
|
||||
new SubmitPost.SubmitPostListener() {
|
||||
@Override
|
||||
public void submitSuccessful(Post post) {
|
||||
handler.post(() -> {
|
||||
EventBus.getDefault().post(new SubmitImagePostEvent(true, null));
|
||||
EventBus.getDefault().post(new SubmitImagePostEvent(true, null, post));
|
||||
Toast.makeText(SubmitPostService.this, R.string.image_is_processing, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
@ -291,14 +278,14 @@ public class SubmitPostService extends Service {
|
||||
|
||||
@Override
|
||||
public void submitFailed(@Nullable String errorMessage) {
|
||||
handler.post(() -> EventBus.getDefault().post(new SubmitImagePostEvent(false, errorMessage)));
|
||||
handler.post(() -> EventBus.getDefault().post(new SubmitImagePostEvent(false, errorMessage, null)));
|
||||
|
||||
stopService();
|
||||
}
|
||||
});
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
handler.post(() -> EventBus.getDefault().post(new SubmitImagePostEvent(false, getString(R.string.error_processing_image))));
|
||||
handler.post(() -> EventBus.getDefault().post(new SubmitImagePostEvent(false, getString(R.string.error_processing_image), null)));
|
||||
stopService();
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import eu.toldi.infinityforlemmy.activities.SearchActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.SettingsActivity;
|
||||
import eu.toldi.infinityforlemmy.activities.SubredditSelectionActivity;
|
||||
import eu.toldi.infinityforlemmy.multireddit.MultiReddit;
|
||||
import eu.toldi.infinityforlemmy.subscribedsubreddit.SubscribedSubredditData;
|
||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||
|
||||
@ -683,8 +684,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
switch (requestCode) {
|
||||
case 0:
|
||||
if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME)) {
|
||||
tab1CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA)) {
|
||||
tab1CurrentName = ((SubscribedSubredditData) data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA)).getName();
|
||||
tab1NameSummaryTextView.setText(tab1CurrentName);
|
||||
mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_1_NAME, tab1CurrentName).apply();
|
||||
} else if (data.hasExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
|
||||
@ -701,8 +702,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME)) {
|
||||
tab2CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA)) {
|
||||
tab2CurrentName = ((SubscribedSubredditData) data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA)).getName();
|
||||
tab2NameSummaryTextView.setText(tab2CurrentName);
|
||||
mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, tab2CurrentName).apply();
|
||||
} else if (data.hasExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
|
||||
@ -719,8 +720,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME)) {
|
||||
tab3CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
|
||||
if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA)) {
|
||||
tab3CurrentName = ((SubscribedSubredditData) data.getParcelableExtra(SubredditSelectionActivity.EXTRA_RETURN_COMMUNITY_DATA)).getName();
|
||||
tab3NameSummaryTextView.setText(tab3CurrentName);
|
||||
mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, tab3CurrentName).apply();
|
||||
} else if (data.hasExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
|
||||
|
@ -1,16 +1,21 @@
|
||||
package eu.toldi.infinityforlemmy.subscribedsubreddit;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.ForeignKey;
|
||||
|
||||
import eu.toldi.infinityforlemmy.account.Account;
|
||||
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
|
||||
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
|
||||
|
||||
@Entity(tableName = "subscribed_subreddits", primaryKeys = {"id", "username"},
|
||||
foreignKeys = @ForeignKey(entity = Account.class, parentColumns = "username",
|
||||
childColumns = "username", onDelete = ForeignKey.CASCADE))
|
||||
public class SubscribedSubredditData {
|
||||
childColumns = "username", onDelete = ForeignKey.CASCADE))
|
||||
public class SubscribedSubredditData implements Parcelable {
|
||||
@NonNull
|
||||
@ColumnInfo(name = "id")
|
||||
private int id;
|
||||
@ -25,12 +30,20 @@ public class SubscribedSubredditData {
|
||||
@ColumnInfo(name = "username")
|
||||
private String username;
|
||||
|
||||
public SubscribedSubredditData(@NonNull int id, String name,@NonNull String qualified_name, String iconUrl, @NonNull String username) {
|
||||
public SubscribedSubredditData(@NonNull int id, String name, @NonNull String qualified_name, String iconUrl, @NonNull String username) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.iconUrl = iconUrl;
|
||||
this.username = username;
|
||||
this.qualified_name =qualified_name;
|
||||
this.qualified_name = qualified_name;
|
||||
}
|
||||
|
||||
public SubscribedSubredditData(@NonNull SubredditData communityData) {
|
||||
this.id = communityData.getId();
|
||||
this.name = communityData.getName();
|
||||
this.iconUrl = communityData.getIconUrl();
|
||||
this.username = "-";
|
||||
this.qualified_name = LemmyUtils.actorID2FullName(communityData.getActorId());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -63,4 +76,38 @@ public class SubscribedSubredditData {
|
||||
public void setUsername(@NonNull String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
||||
parcel.writeInt(id);
|
||||
parcel.writeString(name);
|
||||
parcel.writeString(iconUrl);
|
||||
parcel.writeString(username);
|
||||
parcel.writeString(qualified_name);
|
||||
}
|
||||
|
||||
public SubscribedSubredditData(Parcel in) {
|
||||
id = in.readInt();
|
||||
name = in.readString();
|
||||
iconUrl = in.readString();
|
||||
username = in.readString();
|
||||
qualified_name = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<SubscribedSubredditData> CREATOR = new Creator<>() {
|
||||
@Override
|
||||
public SubscribedSubredditData createFromParcel(Parcel in) {
|
||||
return new SubscribedSubredditData(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscribedSubredditData[] newArray(int size) {
|
||||
return new SubscribedSubredditData[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -109,35 +109,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_post_gallery_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_post_gallery_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_post_gallery_activity"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -109,35 +109,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_post_image_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_post_image_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_post_image_activity"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -109,35 +109,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_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/flair"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_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/spoiler"
|
||||
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.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_post_link_activity"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -109,35 +109,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_post_poll_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_post_poll_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_post_poll_activity"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -115,33 +115,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_post_text_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:padding="4dp"
|
||||
android:text="@string/flair"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_post_text_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:padding="4dp"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_post_text_activity"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -109,35 +109,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_post_video_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_post_video_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="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_custom_text_view_post_video_activity"
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user