6 Commits

Author SHA1 Message Date
Balazs Toldi
907f6e92c3 Bump version 2023-07-31 22:33:42 +02:00
Balazs Toldi
426c3e6979 Better posting activities
You can now add content to Image and Link type posts!
2023-07-31 22:18:37 +02:00
Balazs Toldi
92292be472 Groundwork for editing posts 2023-07-31 16:21:45 +02:00
Balazs Toldi
3e10186c7c Mark as read functionality
This commits adds the mark post as read functionality. Previously, the app crashed if it tried to mark a post as read.
2023-07-31 15:33:59 +02:00
Balazs Toldi
1974322013 Resolve comments from links
Now you can set the app as a the default app for lemmy URLs.
Closes #32 and #18
2023-07-31 14:34:21 +02:00
Balazs Toldi
a2e22bc525 Resolve posts from links 2023-07-31 13:46:34 +02:00
28 changed files with 1113 additions and 424 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "eu.toldi.infinityforlemmy"
minSdk 21
targetSdk 33
versionCode 125
versionName "0.0.5"
versionCode 126
versionName "0.0.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
@@ -52,6 +52,10 @@ android {
buildFeatures {
viewBinding true
}
packagingOptions {
doNotStrip '**/*.so'
}
namespace 'eu.toldi.infinityforlemmy'
}

View File

@@ -307,6 +307,7 @@ public interface AppComponent {
void inject(MorePostsInfoFragment morePostsInfoFragment);
@Component.Factory
interface Factory {
AppComponent create(@BindsInstance Application application);

View File

@@ -22,6 +22,8 @@ import dagger.Module;
import dagger.Provides;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.customviews.LoopAvailableExoCreator;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.ObjectResolver;
import eu.toldi.infinityforlemmy.utils.CustomThemeSharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.videoautoplay.Config;
@@ -192,8 +194,8 @@ abstract class AppModule {
@Provides
@Singleton
static ExoCreator provideExoCreator(Config config,
ToroExo toroExo,
@Named("default") SharedPreferences sharedPreferences) {
ToroExo toroExo,
@Named("default") SharedPreferences sharedPreferences) {
return new LoopAvailableExoCreator(toroExo, config, sharedPreferences);
}
@@ -202,4 +204,16 @@ abstract class AppModule {
static Executor provideExecutor() {
return Executors.newFixedThreadPool(4);
}
@Provides
@Singleton
static ObjectResolver provideObjectResolver(@Named("no_oauth") RetrofitHolder retrofitHolder) {
return new ObjectResolver(retrofitHolder);
}
@Provides
@Singleton
static MarkPostAsRead provideMarkPostAsRead(@Named("no_oauth") RetrofitHolder retrofitHolder) {
return new MarkPostAsRead(retrofitHolder);
}
}

View File

@@ -8,6 +8,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -40,6 +41,7 @@ import eu.toldi.infinityforlemmy.events.ChangeNSFWEvent;
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
import eu.toldi.infinityforlemmy.fragments.CommentsListingFragment;
import eu.toldi.infinityforlemmy.fragments.PostFragment;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
@@ -64,10 +66,15 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
CustomThemeWrapper mCustomThemeWrapper;
@Inject
Executor mExecutor;
@Inject
MarkPostAsRead markPostAsRead;
private FragmentManager fragmentManager;
private SectionsPagerAdapter sectionsPagerAdapter;
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
private ActivityAccountSavedThingBinding binding;
@@ -116,6 +123,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
initializeViewPager();
}
@@ -249,7 +257,17 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
@Override
public void markPostAsRead(Post post) {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId());
markPostAsRead.markPostAsRead(post.getId(), mAccessToken, new MarkPostAsRead.MarkPostAsReadListener() {
@Override
public void onMarkPostAsReadSuccess() {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, post.getId());
}
@Override
public void onMarkPostAsReadFailed() {
Toast.makeText(AccountSavedThingActivity.this, R.string.mark_post_as_read_failed, Toast.LENGTH_SHORT).show();
}
});
}
private class SectionsPagerAdapter extends FragmentStateAdapter {

View File

@@ -13,7 +13,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -81,7 +80,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
@BindView(R.id.toolbar_edit_post_activity)
Toolbar toolbar;
@BindView(R.id.post_title_text_view_edit_post_activity)
TextView titleTextView;
EditText titleEditText;
@BindView(R.id.divider_edit_post_activity)
View divider;
@BindView(R.id.post_text_content_edit_text_edit_post_activity)
@@ -140,7 +139,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
mFullName = getIntent().getStringExtra(EXTRA_FULLNAME);
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
titleTextView.setText(getIntent().getStringExtra(EXTRA_TITLE));
titleEditText.setText(getIntent().getStringExtra(EXTRA_TITLE));
mPostContent = getIntent().getStringExtra(EXTRA_CONTENT);
contentEditText.setText(mPostContent);
@@ -190,12 +189,12 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar);
titleTextView.setTextColor(mCustomThemeWrapper.getPostTitleColor());
titleEditText.setTextColor(mCustomThemeWrapper.getPostTitleColor());
divider.setBackgroundColor(mCustomThemeWrapper.getPostTitleColor());
contentEditText.setTextColor(mCustomThemeWrapper.getPostContentColor());
if (titleTypeface != null) {
titleTextView.setTypeface(titleTypeface);
titleEditText.setTypeface(titleTypeface);
}
if (contentTypeface != null) {
contentEditText.setTypeface(contentTypeface);

View File

@@ -103,6 +103,8 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
public SubredditViewModel mSubredditViewModel;
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
private String name;
private String userWhere;
private int postType;
@@ -158,6 +160,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
name = getIntent().getStringExtra(EXTRA_NAME);
postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostPagingSource.TYPE_FRONT_PAGE);
@@ -470,7 +473,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
@Override
public void markPostAsRead(Post post) {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId());
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, post.getId());
}
@Override

View File

@@ -25,7 +25,12 @@ import javax.inject.Named;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.comment.Comment;
import eu.toldi.infinityforlemmy.comment.FetchComment;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.post.ObjectResolver;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
@@ -35,10 +40,9 @@ public class LinkResolverActivity extends AppCompatActivity {
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
public static final String EXTRA_IS_NSFW = "EIN";
private static final String POST_PATTERN = "/r/[\\w-]+/comments/\\w+/?\\w+/?";
private static final String POST_PATTERN_2 = "/(u|U|user)/[\\w-]+/comments/\\w+/?\\w+/?";
private static final String POST_PATTERN = "https?:\\/\\/\\S+\\/post\\/\\d+";
private static final String POST_PATTERN_3 = "/[\\w-]+$";
private static final String COMMENT_PATTERN = "/(r|u|U|user)/[\\w-]+/comments/\\w+/?[\\w-]+/\\w+/?";
private static final String COMMENT_PATTERN = "https?:\\/\\/\\S+\\/comment\\/\\d+";
private static final String SUBREDDIT_PATTERN = "(?:https?://[\\w.-]+)?/c/[\\w-]+(@[\\w.-]+)?";
private static final String USER_PATTERN = "(?:https?://[\\w.-]+)?/u(sers)?/[\\w-]+(@[\\w.-]+)?";
private static final String SIDEBAR_PATTERN = "/[rR]/[\\w-]+/about/sidebar";
@@ -60,6 +64,19 @@ public class LinkResolverActivity extends AppCompatActivity {
@Inject
CustomThemeWrapper mCustomThemeWrapper;
@Inject
ObjectResolver mObjectResolver;
@Inject
@Named("current_account")
SharedPreferences mCurrentAccountSharedPreferences;
@Inject
@Named("no_oauth")
RetrofitHolder mRetrofit;
private String mAccessToken;
private Uri getRedditUriByPath(String path) {
if (path.charAt(0) != '/') {
return Uri.parse("https://www.reddit.com/" + path);
@@ -73,6 +90,7 @@ public class LinkResolverActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
((Infinity) getApplication()).getAppComponent().inject(this);
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
Uri uri = getIntent().getData();
if (uri == null) {
@@ -169,6 +187,75 @@ public class LinkResolverActivity extends AppCompatActivity {
intent.putExtra(ViewUserDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewUserDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else if (uri.toString().matches(POST_PATTERN)) {
if (mAccessToken == null) {
// switch retrofit to use the current instance for anonymous requests
mRetrofit.setBaseURL(uri.getScheme() + "://" + uri.getHost() + "/");
Intent intent = new Intent(LinkResolverActivity.this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, Integer.parseInt(segments.get(segments.size() - 1)));
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else {
mObjectResolver.resolvePost(uri.toString(), mAccessToken, new ObjectResolver.ObjectResolverListener() {
@Override
public void onResolveObjectSuccess(Object p) {
Post post = (Post) p;
Intent intent = new Intent(LinkResolverActivity.this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, post.getId());
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
}
@Override
public void onResolveObjectFailed() {
Toast.makeText(LinkResolverActivity.this, R.string.could_not_resolve_link, Toast.LENGTH_SHORT).show();
finish();
}
});
}
} else if (uri.toString().matches(COMMENT_PATTERN)) {
if (mAccessToken == null) {
mRetrofit.setBaseURL(uri.getScheme() + "://" + uri.getHost() + "/");
FetchComment.fetchSingleComment(mRetrofit.getRetrofit(), null, Integer.parseInt(segments.get(segments.size() - 1)), new FetchComment.FetchCommentListener() {
@Override
public void onFetchCommentSuccess(ArrayList<Comment> comments, Integer parentId, ArrayList<Integer> moreChildrenIds) {
Intent intent = new Intent(LinkResolverActivity.this, ViewPostDetailActivity.class);
Comment comment = comments.get(0);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, comment.getPostId());
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, comment.getId());
startActivity(intent);
}
@Override
public void onFetchCommentFailed() {
Toast.makeText(LinkResolverActivity.this, R.string.could_not_resolve_link, Toast.LENGTH_SHORT).show();
finish();
}
});
} else {
mObjectResolver.resolveComment(uri.toString(), mAccessToken, new ObjectResolver.ObjectResolverListener() {
@Override
public void onResolveObjectSuccess(Object c) {
Comment comment = (Comment) c;
Intent intent = new Intent(LinkResolverActivity.this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, comment.getPostId());
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, comment.getId());
startActivity(intent);
}
@Override
public void onResolveObjectFailed() {
Toast.makeText(LinkResolverActivity.this, R.string.could_not_resolve_link, Toast.LENGTH_SHORT).show();
finish();
}
});
}
} else if (authority.equals("v.redd.it")) {
Intent intent = new Intent(this, ViewVideoActivity.class);
intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_V_REDD_IT);
@@ -187,35 +274,12 @@ public class LinkResolverActivity extends AppCompatActivity {
startActivity(intent);
} else if (path.equals("/report")) {
openInWebView(uri);
} else if (path.matches(POST_PATTERN) || path.matches(POST_PATTERN_2)) {
int commentsIndex = segments.lastIndexOf("comments");
if (commentsIndex >= 0 && commentsIndex < segments.size() - 1) {
Intent intent = new Intent(this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, segments.get(commentsIndex + 1));
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else {
deepLinkError(uri);
}
} else if (path.matches(POST_PATTERN_3)) {
Intent intent = new Intent(this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1));
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else if (path.matches(COMMENT_PATTERN)) {
int commentsIndex = segments.lastIndexOf("comments");
if (commentsIndex >= 0 && commentsIndex < segments.size() - 1) {
Intent intent = new Intent(this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, segments.get(commentsIndex + 1));
intent.putExtra(ViewPostDetailActivity.EXTRA_SINGLE_COMMENT_ID, segments.get(segments.size() - 1));
intent.putExtra(ViewPostDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewPostDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else {
deepLinkError(uri);
}
} else if (path.matches(WIKI_PATTERN)) {
String[] pathSegments = path.split("/");
String wikiPage;

View File

@@ -113,6 +113,7 @@ import eu.toldi.infinityforlemmy.fragments.PostFragment;
import eu.toldi.infinityforlemmy.message.ReadMessage;
import eu.toldi.infinityforlemmy.multireddit.MultiReddit;
import eu.toldi.infinityforlemmy.multireddit.MultiRedditViewModel;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
@@ -213,6 +214,10 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
CustomThemeWrapper mCustomThemeWrapper;
@Inject
Executor mExecutor;
@Inject
MarkPostAsRead markPostAsRead;
private FragmentManager fragmentManager;
private SectionsPagerAdapter sectionsPagerAdapter;
private NavigationDrawerRecyclerViewMergedAdapter adapter;
@@ -1608,7 +1613,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
@Override
public void markPostAsRead(Post post) {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId());
markPostAsRead.markPostAsRead(post.getId(), mAccessToken, new MarkPostAsRead.MarkPostAsReadListener() {
@Override
public void onMarkPostAsReadSuccess() {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, post.getId());
}
@Override
public void onMarkPostAsReadFailed() {
Toast.makeText(MainActivity.this, R.string.mark_post_as_read_failed, Toast.LENGTH_SHORT).show();
}
});
}
public void doNotShowRedditAPIInfoAgain() {

View File

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

View File

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

View File

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

View File

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

View File

@@ -67,6 +67,7 @@ import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
import eu.toldi.infinityforlemmy.fragments.PostFragment;
import eu.toldi.infinityforlemmy.multireddit.DeleteMultiReddit;
import eu.toldi.infinityforlemmy.multireddit.MultiReddit;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
@@ -131,8 +132,11 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
CustomThemeWrapper mCustomThemeWrapper;
@Inject
Executor mExecutor;
@Inject
MarkPostAsRead markPostAsRead;
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
private String multiPath;
private Fragment mFragment;
private int fabOption;
@@ -221,6 +225,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
if (savedInstanceState != null) {
@@ -868,7 +873,17 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
@Override
public void markPostAsRead(Post post) {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId());
markPostAsRead.markPostAsRead(post.getId(), mAccessToken, new MarkPostAsRead.MarkPostAsReadListener() {
@Override
public void onMarkPostAsReadSuccess() {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, post.getId());
}
@Override
public void onMarkPostAsReadFailed() {
Toast.makeText(ViewMultiRedditDetailActivity.this, R.string.mark_post_as_read_failed, Toast.LENGTH_SHORT).show();
}
});
}
@Override

View File

@@ -93,6 +93,7 @@ import eu.toldi.infinityforlemmy.fragments.SidebarFragment;
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
import eu.toldi.infinityforlemmy.message.ReadMessage;
import eu.toldi.infinityforlemmy.multireddit.MultiReddit;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
@@ -196,6 +197,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
CustomThemeWrapper mCustomThemeWrapper;
@Inject
Executor mExecutor;
@Inject
MarkPostAsRead markPostAsRead;
private FragmentManager fragmentManager;
private SectionsPagerAdapter sectionsPagerAdapter;
private NavigationWrapper navigationWrapper;
@@ -1562,7 +1566,18 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
@Override
public void markPostAsRead(Post post) {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId());
markPostAsRead.markPostAsRead(post.getId(), mAccessToken, new MarkPostAsRead.MarkPostAsReadListener() {
@Override
public void onMarkPostAsReadSuccess() {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, post.getId());
}
@Override
public void onMarkPostAsReadFailed() {
Toast.makeText(ViewSubredditDetailActivity.this, R.string.mark_post_as_read_failed, Toast.LENGTH_SHORT).show();
}
});
}
@Override

View File

@@ -95,6 +95,7 @@ import eu.toldi.infinityforlemmy.fragments.PostFragment;
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
import eu.toldi.infinityforlemmy.message.ReadMessage;
import eu.toldi.infinityforlemmy.multireddit.MultiReddit;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
@@ -202,6 +203,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
CustomThemeWrapper mCustomThemeWrapper;
@Inject
Executor mExecutor;
@Inject
MarkPostAsRead markPostAsRead;
public UserViewModel userViewModel;
private FragmentManager fragmentManager;
private SectionsPagerAdapter sectionsPagerAdapter;
@@ -210,6 +214,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
private Call<String> subredditAutocompleteCall;
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
private String username;
private String qualifiedName;
private String description;
@@ -272,6 +277,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
@@ -1550,7 +1556,17 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
@Override
public void markPostAsRead(Post post) {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId());
markPostAsRead.markPostAsRead(post.getId(), mAccessToken, new MarkPostAsRead.MarkPostAsReadListener() {
@Override
public void onMarkPostAsReadSuccess() {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, post.getId());
}
@Override
public void onMarkPostAsReadFailed() {
Toast.makeText(ViewUserDetailActivity.this, R.string.mark_post_as_read_failed, Toast.LENGTH_SHORT).show();
}
});
}
@Override

View File

@@ -6,8 +6,10 @@ import eu.toldi.infinityforlemmy.dto.AccountLoginDTO;
import eu.toldi.infinityforlemmy.dto.CommentDTO;
import eu.toldi.infinityforlemmy.dto.CommentVoteDTO;
import eu.toldi.infinityforlemmy.dto.EditCommentDTO;
import eu.toldi.infinityforlemmy.dto.EditPostDTO;
import eu.toldi.infinityforlemmy.dto.FollowCommunityDTO;
import eu.toldi.infinityforlemmy.dto.PostVoteDTO;
import eu.toldi.infinityforlemmy.dto.ReadPostDTO;
import eu.toldi.infinityforlemmy.dto.SaveCommentDTO;
import eu.toldi.infinityforlemmy.dto.SavePostDTO;
import eu.toldi.infinityforlemmy.dto.SubmitPostDTO;
@@ -42,6 +44,10 @@ public interface LemmyAPI {
@POST("api/v3/post")
Call<String> postCreate(@Body SubmitPostDTO params);
@Headers("Content-Type: application/json")
@PUT("api/v3/post")
Call<String> postUpdate(@Body EditPostDTO params);
@GET("api/v3/user")
ListenableFuture<Response<String>> getUserPosts(
@Query("username") String username,
@@ -98,6 +104,10 @@ public interface LemmyAPI {
@PUT("api/v3/post/save")
Call<String> postSave(@Body SavePostDTO params);
@Headers("Content-Type: application/json")
@POST("api/v3/post/mark_as_read")
Call<String> postRead(@Body ReadPostDTO params);
@Headers("Content-Type: application/json")
@PUT("api/v3/comment/save")
Call<String> commentSave(@Body SaveCommentDTO params);
@@ -159,4 +169,16 @@ public interface LemmyAPI {
@Header("Cookie") String token,
@Part MultipartBody.Part filePart
);
@GET("api/v3/resolve_object")
Call<String> resolveObject(
@Query("q") String query,
@Query("auth") String auth
);
@GET("api/v3/comment")
Call<String> getComment(
@Query("id") int commentId,
@Query("auth") String auth
);
}

View File

@@ -5,6 +5,9 @@ import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.concurrent.Executor;
@@ -98,6 +101,32 @@ public class FetchComment {
});
}
public static void fetchSingleComment(Retrofit retrofit, @Nullable String accessToken, int commentId,
FetchCommentListener fetchCommentListener) {
LemmyAPI api = retrofit.create(LemmyAPI.class);
Call<String> comment = api.getComment(commentId, accessToken);
comment.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful() && response.body() != null) {
try {
Comment c = ParseComment.parseSingleComment(new JSONObject(response.body()).getJSONObject("comment_view"));
ArrayList<Comment> comments = new ArrayList<>();
comments.add(c);
fetchCommentListener.onFetchCommentSuccess(comments, null, null);
} catch (JSONException e) {
fetchCommentListener.onFetchCommentFailed();
}
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
fetchCommentListener.onFetchCommentFailed();
}
});
}
public interface FetchCommentListener {
void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children);

View File

@@ -0,0 +1,51 @@
package eu.toldi.infinityforlemmy.dto;
public class EditPostDTO {
private int post_id;
private String name;
private String url;
private String body;
private boolean nsfw;
private Integer language_id;
private String auth;
public EditPostDTO(int post_id, String name, String url, String body, boolean nsfw, Integer language_id, String auth) {
this.post_id = post_id;
this.name = name;
this.url = url;
this.body = body;
this.nsfw = nsfw;
this.language_id = language_id;
this.auth = auth;
}
public int getPost_id() {
return post_id;
}
public String getName() {
return name;
}
public String getUrl() {
return url;
}
public String getBody() {
return body;
}
public boolean isNsfw() {
return nsfw;
}
public Integer getLanguage_id() {
return language_id;
}
public String getAuth() {
return auth;
}
}

View File

@@ -0,0 +1,26 @@
package eu.toldi.infinityforlemmy.dto;
public class ReadPostDTO {
private int post_id;
private boolean read;
private String auth;
public ReadPostDTO(int post_id, boolean read, String auth) {
this.post_id = post_id;
this.read = read;
this.auth = auth;
}
public int getPost_id() {
return post_id;
}
public boolean isRead() {
return read;
}
public String getAuth() {
return auth;
}
}

View File

@@ -107,6 +107,7 @@ import eu.toldi.infinityforlemmy.message.ReadMessage;
import eu.toldi.infinityforlemmy.post.FetchPost;
import eu.toldi.infinityforlemmy.post.FetchRemovedPost;
import eu.toldi.infinityforlemmy.post.HidePost;
import eu.toldi.infinityforlemmy.post.MarkPostAsRead;
import eu.toldi.infinityforlemmy.post.Post;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
@@ -190,6 +191,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
ExoCreator mExoCreator;
@Inject
Executor mExecutor;
@Inject
MarkPostAsRead markPostAsRead;
@State
Post mPost;
@State
@@ -225,6 +228,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
private Menu mMenu;
private String mAccessToken;
private String mAccountName;
private String mAccountQualifiedName;
private int postListPosition = -1;
private Integer mSingleCommentId;
private String mContextNumber;
@@ -277,6 +281,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
mSavedIcon = getMenuItemIcon(R.drawable.ic_bookmark_toolbar_24dp);
mUnsavedIcon = getMenuItemIcon(R.drawable.ic_bookmark_border_toolbar_24dp);
@@ -307,7 +312,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mLockFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mSwipeUpToHideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
mMarkPostsAsRead = mPostHistorySharedPreferences.getBoolean(mAccountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false);
mMarkPostsAsRead = mPostHistorySharedPreferences.getBoolean(mAccountQualifiedName + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false);
if (savedInstanceState == null) {
mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
viewPostDetailFragmentId = System.currentTimeMillis();
@@ -1166,8 +1171,18 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
private void tryMarkingPostAsRead() {
if (mMarkPostsAsRead && mPost != null && !mPost.isRead()) {
mPost.markAsRead();
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, mPost.getId());
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
markPostAsRead.markPostAsRead(mPost.getId(), mAccessToken, new MarkPostAsRead.MarkPostAsReadListener() {
@Override
public void onMarkPostAsReadSuccess() {
InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountQualifiedName, mPost.getId());
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
}
@Override
public void onMarkPostAsReadFailed() {
Toast.makeText(activity, R.string.mark_post_as_read_failed, Toast.LENGTH_SHORT).show();
}
});
}
}
@@ -1258,7 +1273,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mPostDetailsSharedPreferences, mExoCreator,
post1 -> EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)));
mSwipeRefreshLayout.setRefreshing(false);
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, subredditId, mSingleCommentId, sortType, mExpandChildren, 1, new FetchComment.FetchCommentListener() {
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, post.getId(), mSingleCommentId == 0 ? null : mSingleCommentId, sortType, mExpandChildren, 1, new FetchComment.FetchCommentListener() {
@Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children) {
pages_loaded++;

View File

@@ -0,0 +1,51 @@
package eu.toldi.infinityforlemmy.post;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.dto.ReadPostDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MarkPostAsRead {
RetrofitHolder retrofitHolder;
public MarkPostAsRead(RetrofitHolder retrofitHolder) {
this.retrofitHolder = retrofitHolder;
}
private void setPostAsRead(int post_id, boolean markAsRead, String auth, MarkPostAsReadListener markPostAsReadListener) {
LemmyAPI lemmyAPI = retrofitHolder.getRetrofit().create(LemmyAPI.class);
lemmyAPI.postRead(new ReadPostDTO(post_id, markAsRead, auth)).enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()
&& response.body() != null) {
markPostAsReadListener.onMarkPostAsReadSuccess();
} else {
markPostAsReadListener.onMarkPostAsReadFailed();
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
markPostAsReadListener.onMarkPostAsReadFailed();
}
});
}
public void markPostAsRead(int post_id, String auth, MarkPostAsReadListener markPostAsReadListener) {
setPostAsRead(post_id, true, auth, markPostAsReadListener);
}
public void markPostAsUnread(int post_id, String auth, MarkPostAsReadListener markPostAsReadListener) {
setPostAsRead(post_id, false, auth, markPostAsReadListener);
}
public interface MarkPostAsReadListener {
void onMarkPostAsReadSuccess();
void onMarkPostAsReadFailed();
}
}

View File

@@ -0,0 +1,90 @@
package eu.toldi.infinityforlemmy.post;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Objects;
import eu.toldi.infinityforlemmy.RetrofitHolder;
import eu.toldi.infinityforlemmy.apis.LemmyAPI;
import eu.toldi.infinityforlemmy.comment.Comment;
import eu.toldi.infinityforlemmy.comment.ParseComment;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ObjectResolver {
RetrofitHolder retrofitHolder;
public ObjectResolver(RetrofitHolder retrofitHolder) {
this.retrofitHolder = retrofitHolder;
}
public void resolvePost(String query, String auth, ObjectResolverListener objectResolverListener) {
LemmyAPI lemmyAPI = retrofitHolder.getRetrofit().create(LemmyAPI.class);
Call<String> response = lemmyAPI.resolveObject(query, auth);
response.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()
&& response.body() != null) {
try {
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(response.body())).getJSONObject("post");
Post p = ParsePost.parseBasicData(jsonObject);
objectResolverListener.onResolveObjectSuccess(p);
} catch (JSONException e) {
objectResolverListener.onResolveObjectFailed();
}
} else {
objectResolverListener.onResolveObjectFailed();
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
objectResolverListener.onResolveObjectFailed();
}
});
}
public void resolveComment(String query, String auth, ObjectResolverListener objectResolverListener) {
LemmyAPI lemmyAPI = retrofitHolder.getRetrofit().create(LemmyAPI.class);
Call<String> response = lemmyAPI.resolveObject(query, auth);
response.enqueue(
new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()
&& response.body() != null) {
try {
JSONObject jsonObject = new JSONObject(Objects.requireNonNull(response.body())).getJSONObject("comment");
Comment c = ParseComment.parseSingleComment(jsonObject);
objectResolverListener.onResolveObjectSuccess(c);
} catch (JSONException e) {
objectResolverListener.onResolveObjectFailed();
}
} else {
objectResolverListener.onResolveObjectFailed();
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
objectResolverListener.onResolveObjectFailed();
}
}
);
}
public interface ObjectResolverListener {
void onResolveObjectSuccess(Object resolvedObject);
void onResolveObjectFailed();
}
}

View File

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

View File

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

View File

@@ -39,7 +39,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
<EditText
android:id="@+id/post_title_text_view_edit_post_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

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

View File

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

View File

@@ -1341,4 +1341,6 @@
<string name="sort_time_9months">9 Months</string>
<string name="anonymous_account_instance">Anonymous Account Instance</string>
<string name="url_cannot_be_null_or_empty">URL cannot be null or empty</string>
<string name="could_not_resolve_link">Could not resolve URL :(</string>
<string name="mark_post_as_read_failed">Failed to mark post as read</string>
</resources>