MarkdownView


Source link: https://github.com/tiagohm/MarkdownView

MarkdownView

Android library to display markdown text.

It uses Flexmark and some of its extensions.

Setup

Add it in your root build.gradle at the end of repositories:

allprojects {

repositories {

 ...
 maven {
 url 'https://jitpack.io' 
}

}
  
}

Add the dependency:

compile 'com.github.tiagohm.MarkdownView:library:LATEST-VERSION'

LATEST-VERSION is

Usage

<br.tiagohm.markdownview.MarkdownView  android:id="@+id/markdown_view"  app:escapeHtml="false"  android:layout_width="match_parent"  android:layout_height="match_parent"/>
mMarkdownView = (MarkdownView)findViewById(R.id.markdown_view);
 mMarkdownView.addStyleSheet(new Github());
 mMarkdownView.loadMarkdown("**MarkdownView**");
 mMarkdownView.loadMarkdownFromAsset("markdown1.md");
 mMarkdownView.loadMarkdownFromFile(new File());
 mMarkdownView.loadMarkdownFromUrl("url");

Using Emojies

Without internet

Add the dependency:

compile 'com.github.tiagohm.MarkdownView:emoji:LATEST-VERSION'
With internet

Add the permission:

<uses-permission android:name="android.permission.INTERNET"/>
mMarkdownView.setEmojiRootPath("http://emojione.com/wp-content/uploads/assets/emojis/");
 mMarkdownView.setEmojiImageExtension("svg");

Custom CSS

//InternalStyleSheet css = new InternalStyleSheet();
 InternalStyleSheet css = new Github();
 css.addFontFace("MyFont", "condensed", "italic", "bold", "url('myfont.ttf')");
 css.addMedia("screen and (min-width: 1281px)");
 css.addRule("h1", "color: orange");
 css.endMedia();
 css.addRule("h1", "color: green", "font-family: MyFont");
 mMarkdownView.addStyleSheet(css);
  mMarkdownView.addStyleSheet(ExternalStyleSheet.fromAsset("github.css", null);
 mMarkdownView.addStyleSheet(ExternalStyleSheet.fromAsset("github2.css", "screen and (min-width: 1281px)");

JavaScript

JavaScript js = new ExternalJavaScript(url, async, defer);
 mMarkdownView.addJavascript(js);

Twitter

Embed a Single Tweet

From https://twitter.com/RealGrumpyCat/status/845101936550469634

  • #[tweet](845101936550469634)
  • #[tweet-hide-cards](845101936550469634)

Follow Button

From https://twitter.com/tiag0hm

  • #[follow](tiag0hm)

Tap Events

mMarkdownView.setOnElementListener(new MarkdownView.OnElementListener(){
 /*...*/ 
}
);

Localization

See more here

Themes

  • GitHub

Support

  • Bold **Text** or __Text__
  • Italic *Text* or _Text_
  • Strikethrough ~~Text~~
  • Horizontal Rules ---
  • Headings #
  • Links [alt](url)
  • Images ![alt](url)
  • Code
  • Blockquote
  • Nested Blockquote
  • Lists
  • Tables
  • TaskList
  • AutoLink
  • Abbreviation
  • Mark ==Text==
  • Subscript H~2~O
  • Superscript 10^-10^
  • Keystroke @ctrl+alt+del@
  • MathJax $x = { -b \pm \sqrt{ b^2-4ac } \over 2a } $
  • Footnotes
  • Image Resizing ![alt](url@100px|auto)
  • Syntax Highlighting (using Highlight.js)
  • Emoji ( EmojiOne) :smile:
  • Custom CSS
  • Youtube @[youtube](fM-J08X6l_Q)
  • Twitter
  • JavaScripts
  • Label --DEFAULT-- ---SUCCESS--- ----WARNING---- -----DANGER-----
  • Button B[text](id)
  • Click/Tap Events
  • Localization { { resource_name } }

LICENSE

Copyright 2017 tiagohm  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. 

Resources

An example app to download pdf from url and saved into your internal storage.

A sample app that shows basic usage of Firebase Auth and Database in form of a very simple chat hub app.

A sample project based on the new Android Component Architecture.

Lifecycle, LiveData, MVVM, ViewModels, DataBinding, Dagger

Using DragableView you can merge various views into one layout with drag and drop animation. For example if you have 3 ImageViews(source view) and one MainImageView(destination view) and you want to implement drag-drop animation to drag one of the ImageView (source) and drop on MainImageView (destination view).

Record moments of your life or choose exist video or gif animation as watch face for your Android Wear device.

A ConstraintLayout group that allows for simple staggered animations.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes