Remove ReactiveX wrapper

This commit is contained in:
stefan-niedermann 2020-01-12 15:01:16 +01:00
parent 8b7a6780f5
commit feba44e679
4 changed files with 11 additions and 31 deletions

View file

@ -35,8 +35,6 @@ android {
dependencies { dependencies {
implementation "com.github.nextcloud:Android-SingleSignOn:0.5.0-rc1" implementation "com.github.nextcloud:Android-SingleSignOn:0.5.0-rc1"
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.8'
implementation 'com.yydcdut:markdown-processor:0.1.3' implementation 'com.yydcdut:markdown-processor:0.1.3'
implementation 'com.yydcdut:rxmarkdown-wrapper:0.1.3' implementation 'com.yydcdut:rxmarkdown-wrapper:0.1.3'

View file

@ -17,13 +17,12 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.yydcdut.markdown.MarkdownEditText;
import com.yydcdut.markdown.MarkdownProcessor;
import com.yydcdut.markdown.syntax.edit.EditFactory; import com.yydcdut.markdown.syntax.edit.EditFactory;
import com.yydcdut.rxmarkdown.RxMDEditText;
import com.yydcdut.rxmarkdown.RxMarkdown;
import java.util.Objects; import java.util.Objects;
@ -34,7 +33,6 @@ import it.niedermann.owncloud.notes.model.CloudNote;
import it.niedermann.owncloud.notes.util.ICallback; import it.niedermann.owncloud.notes.util.ICallback;
import it.niedermann.owncloud.notes.util.MarkDownUtil; import it.niedermann.owncloud.notes.util.MarkDownUtil;
import it.niedermann.owncloud.notes.util.StyleCallback; import it.niedermann.owncloud.notes.util.StyleCallback;
import rx.Subscriber;
public class NoteEditFragment extends BaseNoteFragment { public class NoteEditFragment extends BaseNoteFragment {
@ -43,7 +41,7 @@ public class NoteEditFragment extends BaseNoteFragment {
private static final long DELAY = 2000; // Wait for this time after typing before saving private static final long DELAY = 2000; // Wait for this time after typing before saving
private static final long DELAY_AFTER_SYNC = 5000; // Wait for this time after saving before checking for next save private static final long DELAY_AFTER_SYNC = 5000; // Wait for this time after saving before checking for next save
@BindView(R.id.editContent) @BindView(R.id.editContent)
RxMDEditText editContent; MarkdownEditText editContent;
private Handler handler; private Handler handler;
private boolean saveActive, unsavedEdit; private boolean saveActive, unsavedEdit;
private final Runnable runAutoSave = new Runnable() { private final Runnable runAutoSave = new Runnable() {
@ -138,26 +136,10 @@ public class NoteEditFragment extends BaseNoteFragment {
editContent.setText(note.getContent()); editContent.setText(note.getContent());
editContent.setEnabled(true); editContent.setEnabled(true);
RxMarkdown.live(editContent) MarkdownProcessor markdownProcessor = new MarkdownProcessor(getActivity());
.config(MarkDownUtil.getMarkDownConfiguration(editContent.getContext()).build()) markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(editContent.getContext()).build());
.factory(EditFactory.create()) markdownProcessor.factory(EditFactory.create());
.intoObservable() markdownProcessor.live(editContent);
.subscribe(new Subscriber<CharSequence>() {
@Override
public void onCompleted() {
// Nothing to do here
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
}
@Override
public void onNext(CharSequence charSequence) {
editContent.setText(charSequence, TextView.BufferType.SPANNABLE);
}
});
editContent.setCustomSelectionActionModeCallback(new StyleCallback(this.editContent)); editContent.setCustomSelectionActionModeCallback(new StyleCallback(this.editContent));
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext()); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());

View file

@ -4,8 +4,8 @@ import android.content.Context;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import com.yydcdut.rxmarkdown.RxMDConfiguration; import com.yydcdut.markdown.MarkdownConfiguration;
import com.yydcdut.rxmarkdown.RxMDConfiguration.Builder; import com.yydcdut.markdown.MarkdownConfiguration.Builder;
import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.R;
@ -26,7 +26,7 @@ public class MarkDownUtil {
} }
public static Builder getMarkDownConfiguration(Context context, Boolean darkTheme) { public static Builder getMarkDownConfiguration(Context context, Boolean darkTheme) {
return new RxMDConfiguration.Builder(context) return new MarkdownConfiguration.Builder(context)
.setUnOrderListColor(ResourcesCompat.getColor(context.getResources(), .setUnOrderListColor(ResourcesCompat.getColor(context.getResources(),
darkTheme ? R.color.widget_fg_dark_theme : R.color.widget_fg_default, null)) darkTheme ? R.color.widget_fg_dark_theme : R.color.widget_fg_default, null))
.setHeader2RelativeSize(1.35f) .setHeader2RelativeSize(1.35f)

View file

@ -7,7 +7,7 @@
android:orientation="vertical" android:orientation="vertical"
tools:context="it.niedermann.owncloud.notes.android.activity.EditNoteActivity"> tools:context="it.niedermann.owncloud.notes.android.activity.EditNoteActivity">
<com.yydcdut.rxmarkdown.RxMDEditText <com.yydcdut.markdown.MarkdownEditText
android:id="@+id/editContent" android:id="@+id/editContent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"