Fix opening Image view activity from embedded images

This commit is contained in:
Balazs Toldi 2023-08-20 10:33:10 +02:00
parent 76fee50cd5
commit d4fe5235e2
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
11 changed files with 15 additions and 15 deletions

View File

@ -204,7 +204,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
builder.linkColor(linkColor);
}
};
Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(getApplication(),
Markwon postBodyMarkwon = MarkdownUtils.createFullRedditMarkwon(this,
miscPlugin, parentTextColor, parentSpoilerBackgroundColor, null);
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();
binding.commentContentMarkdownView.setLayoutManager(new LinearLayoutManagerBugFixed(this));

View File

@ -138,7 +138,7 @@ public class FullMarkdownActivity extends BaseActivity {
builder.linkColor(linkColor);
}
};
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(getApplication(),
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(this,
miscPlugin, markdownColor, spoilerBackgroundColor, null);
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();

View File

@ -538,7 +538,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
return true;
};
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(getApplication(), miscPlugin, onLinkLongClickListener);
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener);
descriptionTextView.setOnLongClickListener(view -> {
if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) {

View File

@ -472,7 +472,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
urlMenuBottomSheetFragment.show(getSupportFragmentManager(), null);
return true;
};
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(getApplication(), miscPlugin, onLinkLongClickListener);
Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener);
descriptionTextView.setOnLongClickListener(view -> {
if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) {

View File

@ -175,7 +175,7 @@ public class WikiActivity extends BaseActivity {
urlMenuBottomSheetFragment.show(getSupportFragmentManager(), null);
return true;
};
markwon = MarkdownUtils.createFullRedditMarkwon(getApplication(),
markwon = MarkdownUtils.createFullRedditMarkwon(this,
miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener);
markwonAdapter = MarkdownUtils.createTablesAdapter();

View File

@ -168,7 +168,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
return true;
};
mMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity.getApplication(),
mMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
miscPlugin, mCommentColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
recycledViewPool = new RecyclerView.RecycledViewPool();
}

View File

@ -214,7 +214,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}
return true;
};
mCommentMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity.getApplication(),
mCommentMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
miscPlugin, mCommentTextColor, commentSpoilerBackgroundColor, onLinkLongClickListener);
recycledViewPool = new RecyclerView.RecycledViewPool();
mAccessToken = accessToken;

View File

@ -294,7 +294,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
}
return true;
};
mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity.getApplication(),
mPostDetailMarkwon = MarkdownUtils.createFullRedditMarkwon(mActivity,
miscPlugin, markdownColor, postSpoilerBackgroundColor, onLinkLongClickListener);
mMarkwonAdapter = MarkdownUtils.createTablesAdapter();

View File

@ -81,7 +81,7 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
}
return true;
};
markwon = MarkdownUtils.createFullRedditMarkwon(activity.getApplication(),
markwon = MarkdownUtils.createFullRedditMarkwon(activity,
miscPlugin, mPrimaryTextColor, spoilerBackgroundColor, onLinkLongClickListener);
}

View File

@ -147,7 +147,7 @@ public class SidebarFragment extends Fragment {
urlMenuBottomSheetFragment.show(getChildFragmentManager(), null);
return true;
};
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(activity.getApplication(),
Markwon markwon = MarkdownUtils.createFullRedditMarkwon(activity,
miscPlugin, markdownColor, spoilerBackgroundColor, onLinkLongClickListener);
MarkwonAdapter markwonAdapter = MarkdownUtils.createTablesAdapter();

View File

@ -1,6 +1,6 @@
package eu.toldi.infinityforlemmy.markdown;
import android.app.Application;
import android.app.Activity;
import android.content.Context;
import android.text.util.Linkify;
@ -34,13 +34,13 @@ public class MarkdownUtils {
* @return configured Markwon instance
*/
@NonNull
public static Markwon createFullRedditMarkwon(@NonNull Application context,
public static Markwon createFullRedditMarkwon(@NonNull Activity context,
@NonNull MarkwonPlugin miscPlugin,
int markdownColor,
int spoilerBackgroundColor,
@Nullable BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) {
return Markwon.builder(context)
.usePlugin(GlideImagesPlugin.create(context))
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
}))
@ -59,7 +59,7 @@ public class MarkdownUtils {
}
@NonNull
public static Markwon createDescriptionMarkwon(Application context, MarkwonPlugin miscPlugin,
public static Markwon createDescriptionMarkwon(Activity context, MarkwonPlugin miscPlugin,
BetterLinkMovementMethod.OnLinkLongClickListener onLinkLongClickListener) {
return Markwon.builder(context)
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
@ -73,7 +73,7 @@ public class MarkdownUtils {
.setOnLinkLongClickListener(onLinkLongClickListener)))
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.usePlugin(TableEntryPlugin.create(context))
.usePlugin(GlideImagesPlugin.create(context))
.usePlugin(GlideImagesPlugin.create(context.getApplicationContext()))
.usePlugin(new MarkwonLemmyLinkPlugin())
.build();
}