mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
- fix not clickable rich workspace area
- fix crash on first loading Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
9a47a4d30b
commit
1ec8b067f0
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) {
|
||||
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