All Projects → yydcdut → Rxmarkdown

yydcdut / Rxmarkdown

📠Markdown for Android, supports TextView && EditText (Live Preview), supports code high light.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Rxmarkdown

Xrichtext
一个Android富文本类库,支持图文混排,支持编辑和预览,支持插入和删除图片。
Stars: ✭ 1,639 (+129.55%)
Mutual labels:  markdown, edittext, textview
Rxbiometric
☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android
Stars: ✭ 295 (-58.68%)
Mutual labels:  rxjava, rxandroid
Spedittool
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292 (-59.1%)
Mutual labels:  edittext, textview
Freezer
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
Stars: ✭ 326 (-54.34%)
Mutual labels:  rxjava, rxandroid
CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-96.36%)
Mutual labels:  textview, edittext
Readhub
Readhub AndroidClient
Stars: ✭ 40 (-94.4%)
Mutual labels:  rxjava, rxandroid
Swipe
👉 detects swipe events on Android
Stars: ✭ 324 (-54.62%)
Mutual labels:  rxjava, rxandroid
ReactiveBus
🚍 Reactive Event Bus for JVM (1.7+) and Android apps built with RxJava 2
Stars: ✭ 17 (-97.62%)
Mutual labels:  rxjava, rxandroid
Rxbluetooth
Android reactive bluetooth
Stars: ✭ 405 (-43.28%)
Mutual labels:  rxjava, rxandroid
Rxblur
用RxJava处理和操作高斯模糊效果的简单用例。
Stars: ✭ 541 (-24.23%)
Mutual labels:  rxjava, rxandroid
Rxjava2 Android Samples
RxJava 2 Android Examples - Migration From RxJava 1 to RxJava 2 - How to use RxJava 2 in Android
Stars: ✭ 4,950 (+593.28%)
Mutual labels:  rxjava, rxandroid
textmatcher
A simple text watcher that matches specific targets like mention or hashtag in a string by defining rules
Stars: ✭ 67 (-90.62%)
Mutual labels:  textview, edittext
AndroidMVPArchitecture
Android MVP architecture sample project with or without RxJava and Dagger2 and Kotlin
Stars: ✭ 78 (-89.08%)
Mutual labels:  rxjava, rxandroid
Myblog
vue + node 实现的一个博客系统
Stars: ✭ 285 (-60.08%)
Mutual labels:  markdown, highlight
Fineract-CN-mobile
DEPRECATED project - Check the Apache fineract-cn-mobile project instead
Stars: ✭ 17 (-97.62%)
Mutual labels:  rxjava, rxandroid
Autodispose
Automatic binding+disposal of RxJava streams.
Stars: ✭ 3,209 (+349.44%)
Mutual labels:  rxjava, rxandroid
Aosf
AOSF:全称为Android Open Source Framework,即Android优秀开源框架汇总。包含:网络请求okhttp,图片下载glide,数据库greenDAO,链式框架RxJava,组件路由ARouter,消息传递通信EventBus,热更新Tinker,插件化框架Replugin,文件下载FileDownloaer,图片选择PhotoPicker,图片滤镜/毛玻璃等特效处理,GIF图片展示控件,图片九宫格控件NineGridView,对话框Dialog,导航指示器ViewpagerIndicator,进度条ProgressWheel,下拉刷新SmartRefreshLayout,key-value高效数据存储MMKV等,应有尽有。
Stars: ✭ 601 (-15.83%)
Mutual labels:  rxjava, rxandroid
EasyMoney-Widgets
The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.
Stars: ✭ 91 (-87.25%)
Mutual labels:  textview, edittext
SQLitePractice
数据库案例:1.使用时间和日期函数,增,查时间字段。2.利用ContentProvider,CursorLoader,SQLite实现数据库的观察者模式。3.RxJava,SQLBrite实现数据库的观察者模式。4.拷贝外部db文件到数据库中
Stars: ✭ 21 (-97.06%)
Mutual labels:  rxjava, rxandroid
Rxbus
🚌 The RxBus as steady as an old dog.
Stars: ✭ 334 (-53.22%)
Mutual labels:  rxjava, rxandroid

RxMarkdown

License API Android Arsenal

RxMarkdown is an Android library that helps to display simple markdown text in android.widget.EditText or android.widget.TextView, at same time, it supports code high light .

It is backed by RxJava, implementing complicated APIs as handy reactive observables.

中文:README-zh-rCN.md

Demo apk : DOWNLOAD

QR Code : CLICK

Change Log : SEE

RxMarkdown.gif

Gradle

implementation 'com.yydcdut:markdown-processor:0.1.3'
implementation 'com.yydcdut:rxmarkdown-wrapper:0.1.3'

Or if you don't want to use RxJava, you can simply refer to markdown-processor :

implementation 'com.yydcdut:markdown-processor:0.1.3'

Support Syntax

RxMarkdown now provides 2 factories to parse markdown, TextFactory and EditFactory .

TextFactory : Supports most of the markdown syntax,but it will destroy the integrity of the content. So, it applies to render in TextView .

EditFactory : Supports some syntax,and it won't destroy the integrity of the content, the parsing speed is faster than TextFactory , So, it applies to real-time preview in EditText .

TextFactory

  • [x] Header # / ## / ### / #### / ##### / #######
  • [x] BlockQuote >
  • [x] Nested BlockQuote > >
  • [x] Emphasis Bold ** __
  • [x] Emphasis Italic * _
  • [x] Nested Bold && Italic
  • [x] Ordered List 1.
  • [x] Nested Ordered List
  • [x] UnOrdered List * / + / -
  • [x] Nested UnOrdered List
  • [x] Image ![]()
  • [x] Hyper Link []()
  • [x] Inline Code
  • [x] Code
  • [x] Backslash \
  • [x] Horizontal Rules *** / ***** / --- / -----------------
  • [x] Strike Through ~~
  • [x] Footnote [^]
  • [x] Todo - [ ] / - [x]
  • [ ] Table | Table | Table |
  • [x] code high light

Other Syntax

  • [x] Center Align []

EditFactory

  • [x] Header # / ## / ### / #### / ##### / #######
  • [x] BlockQuote >
  • [x] Nested BlockQuote > >
  • [x] Emphasis Bold ** __
  • [x] Emphasis Italic * _
  • [x] Nested Bold && Italic
  • [x] Ordered List 1.
  • [x] Nested Ordered List
  • [x] UnOrdered List * / + / -
  • [x] Nested UnOrdered List
  • [ ] Image ![]()
  • [ ] Hyper Link []()
  • [x] Inline Code
  • [x] Code
  • [ ] Backslash \
  • [x] Horizontal Rules *** / ***** / --- / -----------------
  • [x] Strike Through ~~
  • [ ] Footnote [^]
  • [ ] Todo - [ ] / - [x]
  • [ ] Table | Table | Table |
  • [ ] code high light

Other Syntax

  • [x] Center Align []

HtmlFactory

//TODO

Quick Start

Setup

implementation 'com.yydcdut:markdown-processor:0.1.3'
implementation 'com.yydcdut:rxmarkdown-wrapper:0.1.3'

implementation 'io.reactivex:rxandroid:1.2.0'
implementation 'io.reactivex:rxjava:1.1.5'

Configuration

All options in Configuration builder are optional. Use only those you really want to customize (RxMDConfiguration#Builder and MarkdownConfiguration#Builder are the same usage):

RxMDConfiguration rxMDConfiguration = new RxMDConfiguration.Builder(context)
        .setHeader1RelativeSize(1.6f)//default relative size of header1
        .setHeader2RelativeSize(1.5f)//default relative size of header2
        .setHeader3RelativeSize(1.4f)//default relative size of header3
        .setHeader4RelativeSize(1.3f)//default relative size of header4
        .setHeader5RelativeSize(1.2f)//default relative size of header5
        .setHeader6RelativeSize(1.1f)//default relative size of header6
        .setBlockQuotesLineColor(Color.LTGRAY)//default color of block quotes line
        .setBlockQuotesBgColor(Color.LTGRAY, Color.RED, Color.BLUE)//default color of block quotes background and nested background
        .setBlockQuotesRelativeSize(Color.LTGRAY, Color.RED, Color.BLUE)//default relative size of block quotes text size
        .setHorizontalRulesColor(Color.LTGRAY)//default color of horizontal rules's background
        .setHorizontalRulesHeight(Color.LTGRAY)//default height of horizontal rules
        .setCodeFontColor(Color.LTGRAY)//default color of inline code's font
        .setCodeBgColor(Color.LTGRAY)//default color of inline code's background
        .setTheme(new ThemeDefault())//default code block theme
        .setTodoColor(Color.DKGRAY)//default color of todo
        .setTodoDoneColor(Color.DKGRAY)//default color of done
        .setOnTodoClickCallback(new OnTodoClickCallback() {//todo or done click callback
        	@Override
        	public CharSequence onTodoClicked(View view, String line) {
                return textView.getText();
        	}
        })
        .setUnOrderListColor(Color.BLACK)//default color of unorder list
        .setLinkFontColor(Color.RED)//default color of link text
        .showLinkUnderline(true)//default value of whether displays link underline
        .setOnLinkClickCallback(new OnLinkClickCallback() {//link click callback
        	@Override
        	public void onLinkClicked(View view, String link) {
        	}
        })
        .setRxMDImageLoader(new DefaultLoader(context))//default image loader
        .setDefaultImageSize(100, 100)//default image width & height
        .build();

Rx Usage

  • EditText , live preview :

    RxMarkdown.live(rxMDEditText)
            .config(rxMDConfiguration)
            .factory(EditFactory.create())
            .intoObservable()
            .subscribe();
    
  • cancel real-time preview :

    rxMDEditText.clear();
    
  • TextView render :

    RxMarkdown.with(content, this)
            .config(rxMDConfiguration)
            .factory(TextFactory.create())
            .intoObservable()
            .subscribeOn(Schedulers.computation())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Subscriber<CharSequence>() {
                @Override
                public void onCompleted() {}
    
                @Override
                public void onError(Throwable e) {}
    
                @Override
                public void onNext(CharSequence charSequence) {
                    rxMDTextView.setText(charSequence, TextView.BufferType.SPANNABLE);
                }
            });
    

non-Rx Usage

  • EditText , live preview :

    MarkdownProcessor markdownProcessor = new MarkdownProcessor(this);
    markdownProcessor.config(markdownConfiguration);
    markdownProcessor.factory(EditFactory.create());
    markdownProcessor.live(markdownEditText);
    
  • cancel real-time preview :

    markdownEditText.clear();
    
  • TextView render :

    MarkdownProcessor markdownProcessor = new MarkdownProcessor(this);
    markdownProcessor.factory(TextFactory.create());
    markdownProcessor.config(markdownConfiguration);
    textView.setText(markdownProcessor.parse(content));
    

Note

RxMDImageLoader

  • Acceptable URIs examples

    "http://web.com/image.png" // from Web
    "file:///mnt/sdcard/image.png" // from SD card
    "assets://image.png" // from assets
    "drawable://" + R.drawable.img // from drawables (non-9patch images)
    
  • Custom image loader

    public class MDLoader implements RxMDImageLoader {
        @Nullable
        @Override
        public byte[] loadSync(@NonNull String url) throws IOException {
            return new byte[0];
        }
    }
    

Image Size

The image of 320 pixels width and 320 pixels height will display on the screen :

![image](http://web.com/image.png/320$320)

Code HighLight Theme

The lib supports some themes, ThemeDefault, ThemeDesert, ThemeSonsOfObsidian and ThemeSunburst.

ThemeDefault ThemeDesert ThemeSonsOfObsidian ThemeSunburst
ThemeDefault ThemeDesert ThemeSonsOfObsidian ThemeSunburst

You can implement the interface Theme to realize your own theme.

public class CodeHighLightTheme implements Theme {

    @Override
    public int getBackgroundColor() {//background color
        return 0xffcccccc;
    }

    @Override
    public int getTypeColor() {//color for type
        return 0xff660066;
    }

    @Override
    public int getKeyWordColor() {//color for keyword
        return 0xff000088;
    }

    @Override
    public int getLiteralColor() {//color for literal
        return 0xff006666;
    }

    @Override
    public int getCommentColor() {//color for comment
        return 0xff880000;
    }

    @Override
    public int getStringColor() {//color for string
        return 0xff008800;
    }

    @Override
    public int getPunctuationColor() {//color for punctuation
        return 0xff666600;
    }

    @Override
    public int getTagColor() {//color for html/xml tag
        return 0xff000088;
    }

    @Override
    public int getPlainTextColor() {//color for a plain text
        return 0xff000000;
    }

    @Override
    public int getDecimalColor() {//color for a markup declaration such as a DOCTYPE
        return 0xff000000;
    }

    @Override
    public int getAttributeNameColor() {//color for html/xml attribute name
        return 0xff660066;
    }

    @Override
    public int getAttributeValueColor() {//color for html/xml attribute value
        return 0xff008800;
    }

    @Override
    public int getOpnColor() {//color for opn
        return 0xff666600;
    }

    @Override
    public int getCloColor() {//color for clo
        return 0xff666600;
    }

    @Override
    public int getVarColor() {//color for var
        return 0xff660066;
    }

    @Override
    public int getFunColor() {//color for fun
        return Color.RED;
    }

    @Override
    public int getNocodeColor() {color for nocode
        return 0xff000000;
    }
}

License

Copyright 2016 yydcdut

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].