mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Merge pull request #5114 from nextcloud/richWorkspaceFixes
- fix not clickable rich workspace area
This commit is contained in:
commit
1343ba08e2
4 changed files with 16 additions and 7 deletions
|
@ -1 +1 @@
|
|||
413
|
||||
414
|
||||
|
|
|
@ -329,7 +329,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
OCFileListHeaderViewHolder headerViewHolder = (OCFileListHeaderViewHolder) holder;
|
||||
String text = currentDirectory.getRichWorkspace();
|
||||
|
||||
PreviewTextFragment.setText(headerViewHolder.headerText, text, getItem(position), activity);
|
||||
PreviewTextFragment.setText(headerViewHolder.headerText, text, null, activity, true, true);
|
||||
headerViewHolder.headerView.setOnClickListener(v -> ocFileListFragmentInterface.onHeaderClicked());
|
||||
} else {
|
||||
OCFileListGridImageViewHolder gridViewHolder = (OCFileListGridImageViewHolder) holder;
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.owncloud.android.utils.ThemeUtils;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
|
@ -226,14 +227,22 @@ public abstract class PreviewTextFragment extends FileFragment implements Search
|
|||
}
|
||||
|
||||
public static void setText(TextView textView, String text, OCFile file, Activity activity) {
|
||||
setText(textView, text, file, activity, false);
|
||||
setText(textView, text, file, activity, false, false);
|
||||
}
|
||||
|
||||
public static void setText(TextView textView, String text, OCFile file, Activity activity, boolean ignoreMimetype) {
|
||||
if ((MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN.equals(file.getMimeType()) || ignoreMimetype) &&
|
||||
public static void setText(TextView textView,
|
||||
String text,
|
||||
@Nullable OCFile file,
|
||||
Activity activity,
|
||||
boolean ignoreMimetype,
|
||||
boolean preview) {
|
||||
if ((ignoreMimetype || file != null && MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN.equals(file.getMimeType())) &&
|
||||
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN
|
||||
&& activity != null) {
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if (!preview) {
|
||||
// clickable links prevent to open full view of rich workspace
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
textView.setText(getRenderedMarkdownText(activity, text));
|
||||
} else {
|
||||
textView.setText(text);
|
||||
|
|
|
@ -145,7 +145,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment {
|
|||
void loadAndShowTextPreview() {
|
||||
if (mTextPreview != null) {
|
||||
mOriginalText = getFile().getRichWorkspace();
|
||||
setText(mTextPreview, mOriginalText, getFile(), requireActivity(), true);
|
||||
setText(mTextPreview, mOriginalText, getFile(), requireActivity(), true, false);
|
||||
mTextPreview.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue