mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-04 07:17:12 +01:00
Viewing comment's full markdown is available.
This commit is contained in:
parent
4cf401756f
commit
acaece6e3e
@ -26,11 +26,15 @@
|
|||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:replace="android:label">
|
tools:replace="android:label">
|
||||||
<activity android:name=".Activity.SubmitCrosspostActivity"
|
<activity android:name=".Activity.CommentFullMarkdownActivity"
|
||||||
|
android:parentActivityName=".Activity.MainActivity"
|
||||||
|
android:theme="@style/AppTheme.Slidable" />
|
||||||
|
<activity
|
||||||
|
android:name=".Activity.SubmitCrosspostActivity"
|
||||||
android:label="@string/submit_crosspost_activity_label"
|
android:label="@string/submit_crosspost_activity_label"
|
||||||
android:parentActivityName=".Activity.MainActivity"
|
android:parentActivityName=".Activity.MainActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:windowSoftInputMode="adjustResize"/>
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".Service.DownloadMediaService"
|
android:name=".Service.DownloadMediaService"
|
||||||
|
@ -0,0 +1,249 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.Activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.TextPaint;
|
||||||
|
import android.text.style.ClickableSpan;
|
||||||
|
import android.text.style.SuperscriptSpan;
|
||||||
|
import android.text.util.Linkify;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||||
|
import com.r0adkll.slidr.Slidr;
|
||||||
|
import com.r0adkll.slidr.model.SlidrInterface;
|
||||||
|
|
||||||
|
import org.commonmark.ext.gfm.tables.TableBlock;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
|
import io.noties.markwon.Markwon;
|
||||||
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
|
import io.noties.markwon.recycler.MarkwonAdapter;
|
||||||
|
import io.noties.markwon.recycler.table.TableEntry;
|
||||||
|
import io.noties.markwon.recycler.table.TableEntryPlugin;
|
||||||
|
import io.noties.markwon.simple.ext.SimpleExtPlugin;
|
||||||
|
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||||
|
import ml.docilealligator.infinityforreddit.CustomView.MarkwonLinearLayoutManager;
|
||||||
|
import ml.docilealligator.infinityforreddit.Infinity;
|
||||||
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
|
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||||
|
|
||||||
|
public class CommentFullMarkdownActivity extends BaseActivity {
|
||||||
|
|
||||||
|
public static final String EXTRA_COMMENT_MARKDOWN = "ECM";
|
||||||
|
public static final String EXTRA_IS_NSFW = "EIN";
|
||||||
|
|
||||||
|
@BindView(R.id.coordinator_layout_comment_full_markdown_activity)
|
||||||
|
CoordinatorLayout coordinatorLayout;
|
||||||
|
@BindView(R.id.appbar_layout_comment_full_markdown_activity)
|
||||||
|
AppBarLayout appBarLayout;
|
||||||
|
@BindView(R.id.collapsing_toolbar_layout_comment_full_markdown_activity)
|
||||||
|
CollapsingToolbarLayout collapsingToolbarLayout;
|
||||||
|
@BindView(R.id.toolbar_comment_full_markdown_activity)
|
||||||
|
Toolbar toolbar;
|
||||||
|
@BindView(R.id.content_markdown_view_comment_full_markdown_activity)
|
||||||
|
RecyclerView markdownRecyclerView;
|
||||||
|
@Inject
|
||||||
|
@Named("default")
|
||||||
|
SharedPreferences mSharedPreferences;
|
||||||
|
@Inject
|
||||||
|
CustomThemeWrapper mCustomThemeWrapper;
|
||||||
|
private SlidrInterface mSlidrInterface;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_comment_full_markdown);
|
||||||
|
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
applyCustomTheme();
|
||||||
|
|
||||||
|
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) {
|
||||||
|
mSlidrInterface = Slidr.attach(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
Window window = getWindow();
|
||||||
|
|
||||||
|
if (isChangeStatusBarIconColor()) {
|
||||||
|
addOnOffsetChangedListener(appBarLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isImmersiveInterface()) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
coordinatorLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||||
|
} else {
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
}
|
||||||
|
adjustToolbar(toolbar);
|
||||||
|
markdownRecyclerView.setPadding(0, 0, 0, getNavBarHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String commentMarkdown = getIntent().getStringExtra(EXTRA_COMMENT_MARKDOWN);
|
||||||
|
boolean isNsfw = getIntent().getBooleanExtra(EXTRA_IS_NSFW, false);
|
||||||
|
int markdownColor = mCustomThemeWrapper.getCommentColor();
|
||||||
|
int linkColor = mCustomThemeWrapper.getLinkColor();
|
||||||
|
Markwon markwon = Markwon.builder(this)
|
||||||
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
|
StringBuilder markdownStringBuilder = new StringBuilder(markdown);
|
||||||
|
Pattern spoilerPattern = Pattern.compile(">![\\S\\s]*?!<");
|
||||||
|
Matcher matcher = spoilerPattern.matcher(markdownStringBuilder);
|
||||||
|
while (matcher.find()) {
|
||||||
|
markdownStringBuilder.replace(matcher.start(), matcher.start() + 1, ">");
|
||||||
|
}
|
||||||
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
|
textView.setHighlightColor(Color.TRANSPARENT);
|
||||||
|
SpannableStringBuilder markdownStringBuilder = new SpannableStringBuilder(textView.getText().toString());
|
||||||
|
Pattern spoilerPattern = Pattern.compile(">![\\S\\s]*?!<");
|
||||||
|
Matcher matcher = spoilerPattern.matcher(markdownStringBuilder);
|
||||||
|
int start = 0;
|
||||||
|
boolean find = false;
|
||||||
|
while (matcher.find(start)) {
|
||||||
|
find = true;
|
||||||
|
markdownStringBuilder.delete(matcher.end() - 2, matcher.end());
|
||||||
|
markdownStringBuilder.delete(matcher.start(), matcher.start() + 2);
|
||||||
|
ClickableSpan clickableSpan = new ClickableSpan() {
|
||||||
|
private boolean isShowing = false;
|
||||||
|
@Override
|
||||||
|
public void updateDrawState(@NonNull TextPaint ds) {
|
||||||
|
if (isShowing) {
|
||||||
|
super.updateDrawState(ds);
|
||||||
|
ds.setColor(markdownColor);
|
||||||
|
} else {
|
||||||
|
ds.bgColor = markdownColor;
|
||||||
|
ds.setColor(markdownColor);
|
||||||
|
}
|
||||||
|
ds.setUnderlineText(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(@NonNull View view) {
|
||||||
|
isShowing = !isShowing;
|
||||||
|
view.invalidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
markdownStringBuilder.setSpan(clickableSpan, matcher.start(), matcher.end() - 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
start = matcher.end() - 4;
|
||||||
|
}
|
||||||
|
if (find) {
|
||||||
|
textView.setText(markdownStringBuilder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
|
||||||
|
textView.setTextColor(markdownColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
||||||
|
builder.linkResolver((view, link) -> {
|
||||||
|
Intent intent = new Intent(CommentFullMarkdownActivity.this, LinkResolverActivity.class);
|
||||||
|
Uri uri = Uri.parse(link);
|
||||||
|
if (uri.getScheme() == null && uri.getHost() == null) {
|
||||||
|
intent.setData(LinkResolverActivity.getRedditUriByPath(link));
|
||||||
|
} else {
|
||||||
|
intent.setData(uri);
|
||||||
|
}
|
||||||
|
intent.putExtra(LinkResolverActivity.EXTRA_IS_NSFW, isNsfw);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||||
|
builder.linkColor(linkColor);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
|
.usePlugin(SimpleExtPlugin.create(plugin ->
|
||||||
|
plugin.addExtension(1, '^', (configuration, props) -> {
|
||||||
|
return new SuperscriptSpan();
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.usePlugin(TableEntryPlugin.create(this))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MarkwonAdapter markwonAdapter = MarkwonAdapter.builder(R.layout.adapter_default_entry, R.id.text)
|
||||||
|
.include(TableBlock.class, TableEntry.create(builder -> builder
|
||||||
|
.tableLayout(R.layout.adapter_table_block, R.id.table_layout)
|
||||||
|
.textLayoutIsRoot(R.layout.view_table_entry_cell)))
|
||||||
|
.build();
|
||||||
|
LinearLayoutManager linearLayoutManager = new MarkwonLinearLayoutManager(this, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolledLeft() {
|
||||||
|
if (mSlidrInterface != null) {
|
||||||
|
mSlidrInterface.lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScrolledRight() {
|
||||||
|
if (mSlidrInterface != null) {
|
||||||
|
mSlidrInterface.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
markdownRecyclerView.setLayoutManager(linearLayoutManager);
|
||||||
|
markdownRecyclerView.setAdapter(markwonAdapter);
|
||||||
|
markwonAdapter.setMarkdown(markwon, commentMarkdown);
|
||||||
|
markwonAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SharedPreferences getDefaultSharedPreferences() {
|
||||||
|
return mSharedPreferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CustomThemeWrapper getCustomThemeWrapper() {
|
||||||
|
return mCustomThemeWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyCustomTheme() {
|
||||||
|
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getCommentBackgroundColor());
|
||||||
|
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
|
||||||
|
}
|
||||||
|
}
|
@ -3202,6 +3202,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
} else {
|
} else {
|
||||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 1);
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 1);
|
||||||
}
|
}
|
||||||
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_COMMENT_MARKDOWN, comment.getCommentMarkdown());
|
||||||
|
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_IS_NSFW, mPost.isNSFW());
|
||||||
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||||
commentMoreBottomSheetFragment.setArguments(bundle);
|
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||||
commentMoreBottomSheetFragment.show(mActivity.getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
commentMoreBottomSheetFragment.show(mActivity.getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
||||||
|
@ -299,6 +299,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
}
|
}
|
||||||
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, holder.getAdapterPosition() - 1);
|
||||||
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_COMMENT_MARKDOWN, comment.getCommentMarkdown());
|
||||||
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||||
commentMoreBottomSheetFragment.setArguments(bundle);
|
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||||
commentMoreBottomSheetFragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
commentMoreBottomSheetFragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag());
|
||||||
|
@ -6,6 +6,7 @@ import dagger.Component;
|
|||||||
import ml.docilealligator.infinityforreddit.Activity.AccountPostsActivity;
|
import ml.docilealligator.infinityforreddit.Activity.AccountPostsActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.AccountSavedThingActivity;
|
import ml.docilealligator.infinityforreddit.Activity.AccountSavedThingActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.CommentActivity;
|
import ml.docilealligator.infinityforreddit.Activity.CommentActivity;
|
||||||
|
import ml.docilealligator.infinityforreddit.Activity.CommentFullMarkdownActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.CreateMultiRedditActivity;
|
import ml.docilealligator.infinityforreddit.Activity.CreateMultiRedditActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.CustomThemeListingActivity;
|
import ml.docilealligator.infinityforreddit.Activity.CustomThemeListingActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
|
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
|
||||||
@ -197,4 +198,6 @@ public interface AppComponent {
|
|||||||
void inject(DownloadLocationPreferenceFragment downloadLocationPreferenceFragment);
|
void inject(DownloadLocationPreferenceFragment downloadLocationPreferenceFragment);
|
||||||
|
|
||||||
void inject(SubmitCrosspostActivity submitCrosspostActivity);
|
void inject(SubmitCrosspostActivity submitCrosspostActivity);
|
||||||
|
|
||||||
|
void inject(CommentFullMarkdownActivity commentFullMarkdownActivity);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
|
|||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import ml.docilealligator.infinityforreddit.Activity.CommentFullMarkdownActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
||||||
@ -37,6 +38,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
public static final String EXTRA_COMMENT = "ECF";
|
public static final String EXTRA_COMMENT = "ECF";
|
||||||
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
||||||
public static final String EXTRA_POSITION = "EP";
|
public static final String EXTRA_POSITION = "EP";
|
||||||
|
public static final String EXTRA_COMMENT_MARKDOWN = "ECM";
|
||||||
|
public static final String EXTRA_IS_NSFW = "EIN";
|
||||||
@BindView(R.id.edit_text_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.edit_text_view_comment_more_bottom_sheet_fragment)
|
||||||
TextView editTextView;
|
TextView editTextView;
|
||||||
@BindView(R.id.delete_text_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.delete_text_view_comment_more_bottom_sheet_fragment)
|
||||||
@ -45,6 +48,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
TextView shareTextView;
|
TextView shareTextView;
|
||||||
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
|
||||||
TextView copyTextView;
|
TextView copyTextView;
|
||||||
|
@BindView(R.id.view_full_markdown_text_view_comment_more_bottom_sheet_fragment)
|
||||||
|
TextView viewFullMarkdownTextView;
|
||||||
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
|
||||||
TextView reportTextView;
|
TextView reportTextView;
|
||||||
@BindView(R.id.see_removed_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.see_removed_view_comment_more_bottom_sheet_fragment)
|
||||||
@ -67,6 +72,10 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bundle bundle = getArguments();
|
Bundle bundle = getArguments();
|
||||||
|
if (bundle == null) {
|
||||||
|
dismiss();
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
Comment comment = bundle.getParcelable(EXTRA_COMMENT);
|
Comment comment = bundle.getParcelable(EXTRA_COMMENT);
|
||||||
if (comment == null) {
|
if (comment == null) {
|
||||||
dismiss();
|
dismiss();
|
||||||
@ -125,6 +134,15 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
|
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
viewFullMarkdownTextView.setOnClickListener(view -> {
|
||||||
|
Intent intent = new Intent(activity, CommentFullMarkdownActivity.class);
|
||||||
|
intent.putExtra(CommentFullMarkdownActivity.EXTRA_IS_NSFW, bundle.getBoolean(EXTRA_IS_NSFW, false));
|
||||||
|
intent.putExtra(CommentFullMarkdownActivity.EXTRA_COMMENT_MARKDOWN, bundle.getString(EXTRA_COMMENT_MARKDOWN, ""));
|
||||||
|
activity.startActivity(intent);
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
reportTextView.setOnClickListener(view -> {
|
reportTextView.setOnClickListener(view -> {
|
||||||
Intent intent = new Intent(activity, ReportActivity.class);
|
Intent intent = new Intent(activity, ReportActivity.class);
|
||||||
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, comment.getSubredditName());
|
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, comment.getSubredditName());
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M14,17L4,17v2h10v-2zM20,9L4,9v2h16L20,9zM4,15h16v-2L4,13v2zM4,5v2h16L20,5L4,5z"
|
||||||
|
android:fillColor="#FFFFFF"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_full_markdown_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_full_markdown_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M14,17L4,17v2h10v-2zM20,9L4,9v2h16L20,9zM4,15h16v-2L4,13v2zM4,5v2h16L20,5L4,5z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
42
app/src/main/res/layout/activity_comment_full_markdown.xml
Normal file
42
app/src/main/res/layout/activity_comment_full_markdown.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/coordinator_layout_comment_full_markdown_activity"
|
||||||
|
tools:context=".Activity.CommentFullMarkdownActivity">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar_layout_comment_full_markdown_activity"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
|
android:id="@+id/collapsing_toolbar_layout_comment_full_markdown_activity"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
app:titleEnabled="false"
|
||||||
|
app:toolbarId="@+id/toolbar_comment_full_markdown_activity">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar_comment_full_markdown_activity"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
|
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/content_markdown_view_comment_full_markdown_activity"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -85,6 +85,25 @@
|
|||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family" />
|
android:fontFamily="?attr/font_family" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/view_full_markdown_text_view_comment_more_bottom_sheet_fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawableStart="@drawable/ic_full_markdown_24dp"
|
||||||
|
android:drawablePadding="48dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:text="@string/view_full_comment_markdown"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default"
|
||||||
|
android:fontFamily="?attr/font_family" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/report_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/report_view_comment_more_bottom_sheet_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -875,19 +875,7 @@
|
|||||||
<string name="block_user">Block User</string>
|
<string name="block_user">Block User</string>
|
||||||
<string name="block_user_success">Blocked</string>
|
<string name="block_user_success">Blocked</string>
|
||||||
<string name="block_user_failed">Failed to block user</string>
|
<string name="block_user_failed">Failed to block user</string>
|
||||||
<!-- Preference Titles -->
|
|
||||||
<string name="messages_header">Messages</string>
|
|
||||||
<string name="sync_header">Sync</string>
|
|
||||||
|
|
||||||
<!-- Messages Preferences -->
|
<string name="view_full_comment_markdown">View Full Markdown</string>
|
||||||
<string name="signature_title">Your signature</string>
|
|
||||||
<string name="reply_title">Default reply action</string>
|
|
||||||
|
|
||||||
<!-- Sync Preferences -->
|
|
||||||
<string name="sync_title">Sync email periodically</string>
|
|
||||||
<string name="attachment_title">Download incoming attachments</string>
|
|
||||||
<string name="attachment_summary_on">Automatically download attachments for incoming emails
|
|
||||||
</string>
|
|
||||||
<string name="attachment_summary_off">Only download attachments when manually requested</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user