├── MarkdownView ├── .idea │ ├── .name │ ├── copyright │ │ └── profiles_settings.xml │ ├── vcs.xml │ ├── modules.xml │ ├── runConfigurations.xml │ ├── gradle.xml │ ├── compiler.xml │ └── misc.xml ├── app │ ├── .gitignore │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── markdown_themes.xml │ │ │ │ ├── markdown_view.xml │ │ │ │ └── activity_main.xml │ │ │ ├── assets │ │ │ ├── hello.md │ │ │ └── markdown_css_themes │ │ │ │ ├── alt.css │ │ │ │ ├── foghorn.css │ │ │ │ ├── classic.css │ │ │ │ └── paperwhite.css │ │ │ ├── java │ │ │ └── us │ │ │ │ └── feras │ │ │ │ └── mdv │ │ │ │ └── demo │ │ │ │ ├── LocalMarkdownActivity.java │ │ │ │ ├── RemoteMarkdownActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MarkdownDataActivity.java │ │ │ │ └── MarkdownThemesActivity.java │ │ │ └── AndroidManifest.xml │ ├── proguard-rules.pro │ └── build.gradle ├── markdownview │ ├── .gitignore │ ├── src │ │ └── main │ │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ └── us │ │ │ └── feras │ │ │ └── mdv │ │ │ ├── MarkdownView.java │ │ │ └── util │ │ │ └── HttpHelper.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── .gitignore ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── markdown-example.md ├── license.txt ├── .gitignore ├── css-themes ├── alt.css ├── foghorn.css ├── classic.css └── paperwhite.css └── README.md /MarkdownView/.idea/.name: -------------------------------------------------------------------------------- 1 | MarkdownView -------------------------------------------------------------------------------- /MarkdownView/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MarkdownView/markdownview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MarkdownView/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':markdownview' 2 | -------------------------------------------------------------------------------- /MarkdownView/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /MarkdownView/markdownview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MarkdownView 3 | 4 | -------------------------------------------------------------------------------- /MarkdownView/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /MarkdownView/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falnatsheh/MarkdownView/HEAD/MarkdownView/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falnatsheh/MarkdownView/HEAD/MarkdownView/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falnatsheh/MarkdownView/HEAD/MarkdownView/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falnatsheh/MarkdownView/HEAD/MarkdownView/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falnatsheh/MarkdownView/HEAD/MarkdownView/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falnatsheh/MarkdownView/HEAD/MarkdownView/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MarkdownView/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /MarkdownView/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 10 11:53:01 EST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/assets/hello.md: -------------------------------------------------------------------------------- 1 | ## What is MarkdownView? 2 | It's an Android WebView that is capable of loading Markdown file or text and display it as HTML. The library uses MarkdownJ and extends Android WebView. 3 | *** 4 | For more information, please visit the project page on [Github](https://github.com/falnatsheh/MarkdownView) -------------------------------------------------------------------------------- /MarkdownView/markdownview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MarkdownView Demo 3 | ### MarkdownView Live Preview \n * * * \n Edit the text to see it updated instantly. 4 | 5 | 6 | foghorn 7 | alt 8 | classic 9 | paperwhite 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /MarkdownView/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /markdown-example.md: -------------------------------------------------------------------------------- 1 | # Markdown 2 | 3 | ## Basic formatting 4 | 5 | Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else. 6 | 7 | Paragraphs must be separated by a blank line. Basic formatting of *italics* and **bold** is supported. 8 | 9 | ## Lists 10 | 11 | ### Ordered list 12 | 13 | 1. Item 1 14 | 2. A second item 15 | 3. Number 3 16 | 17 | ### Unordered list 18 | 19 | * An item 20 | * Another item 21 | * And there's more... 22 | -------------------------------------------------------------------------------- /MarkdownView/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /MarkdownView/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/java/us/feras/mdv/demo/LocalMarkdownActivity.java: -------------------------------------------------------------------------------- 1 | package us.feras.mdv.demo; 2 | 3 | import us.feras.mdv.MarkdownView; 4 | import android.app.Activity; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.Window; 8 | 9 | public class LocalMarkdownActivity extends AppCompatActivity { 10 | @Override 11 | public void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | MarkdownView webView = new MarkdownView(this); 14 | setContentView(webView); 15 | webView.loadMarkdownFile("file:///android_asset/hello.md"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011 Feras Alnatsheh 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/layout/markdown_themes.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/java/us/feras/mdv/demo/RemoteMarkdownActivity.java: -------------------------------------------------------------------------------- 1 | package us.feras.mdv.demo; 2 | 3 | import us.feras.mdv.MarkdownView; 4 | import android.app.Activity; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.Window; 8 | 9 | public class RemoteMarkdownActivity extends AppCompatActivity { 10 | @Override 11 | public void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | MarkdownView markdownView = new MarkdownView(this); 14 | setContentView(markdownView); 15 | markdownView.loadMarkdownFile("https://raw.github.com/falnatsheh/MarkdownView/master/README.md"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | 34 | # Mac OS X clutter 35 | *.DS_Store 36 | 37 | # Intellij IDEA 38 | .idea/workspace.xml 39 | .idea/tasks.xml 40 | .idea/datasources.xml 41 | .idea/dataSources.ids -------------------------------------------------------------------------------- /MarkdownView/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /MarkdownView/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/feras/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /MarkdownView/markdownview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/feras/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /MarkdownView/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MarkdownView/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "us.feras.mdv.demo" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 2 12 | versionName "1.1" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.1.0' 26 | compile project(':markdownview') 27 | } 28 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/layout/markdown_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | -------------------------------------------------------------------------------- /MarkdownView/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /MarkdownView/markdownview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | PUBLISH_GROUP_ID = 'us.feras.mdv' 5 | PUBLISH_ARTIFACT_ID = 'markdownview' 6 | PUBLISH_VERSION = '1.1.0' 7 | } 8 | 9 | android { 10 | compileSdkVersion 23 11 | buildToolsVersion "23.0.1" 12 | 13 | defaultConfig { 14 | minSdkVersion 14 15 | targetSdkVersion 23 16 | versionCode 2 17 | versionName "1.1" 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | } 26 | 27 | dependencies { 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | testCompile 'junit:junit:4.12' 30 | compile 'com.android.support:appcompat-v7:23.1.0' 31 | compile 'org.markdownj:markdownj-core:0.4' 32 | } 33 | 34 | apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle' 35 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/java/us/feras/mdv/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package us.feras.mdv.demo; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_main); 14 | } 15 | 16 | public void displayDataActivity(View view) { 17 | this.startActivity(new Intent(this, MarkdownDataActivity.class)); 18 | } 19 | 20 | public void displayThemesActivity(View view) { 21 | this.startActivity(new Intent(this, MarkdownThemesActivity.class)); 22 | } 23 | 24 | public void displayOnlineMdActivity(View view) { 25 | this.startActivity(new Intent(this, RemoteMarkdownActivity.class)); 26 | } 27 | 28 | public void displayLocalMdFileActivity(View view) { 29 | this.startActivity(new Intent(this, LocalMarkdownActivity.class)); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /css-themes/alt.css: -------------------------------------------------------------------------------- 1 | body { 2 | line-height: 1.4em; 3 | color: black; 4 | padding: 1em; 5 | margin: auto; 6 | max-width: 42em; 7 | } 8 | 9 | li { 10 | color: black; 11 | } 12 | 13 | h1,h2,h3,h4,h5,h6 { 14 | border: 0 none !important; 15 | } 16 | 17 | h1 { 18 | margin-top: 0.5em; 19 | margin-bottom: 0.5em; 20 | border-bottom: 2px solid #000080 !important; 21 | } 22 | 23 | h2 { 24 | margin-top: 1em; 25 | margin-bottom: 0.5em; 26 | border-bottom: 2px solid #000080 !important; 27 | } 28 | 29 | pre { 30 | background-color: #f8f8f8; 31 | border: 1px solid #2f6fab; 32 | border-radius: 3px; 33 | overflow: auto; 34 | padding: 5px; 35 | } 36 | 37 | pre code { 38 | background-color: inherit; 39 | border: none; 40 | padding: 0; 41 | } 42 | 43 | code { 44 | background-color: #ffffe0; 45 | border: 1px solid orange; 46 | border-radius: 3px; 47 | padding: 0 0.2em; 48 | } 49 | 50 | a { 51 | text-decoration: underline; 52 | } 53 | 54 | ul,ol { 55 | padding-left: 30px; 56 | } 57 | 58 | li { 59 | margin: 0.2em 0 0 0em; 60 | padding: 0px; 61 | } 62 | 63 | em { 64 | color: #b05000; 65 | } 66 | 67 | table.text th,table.text td { 68 | vertical-align: top; 69 | border-top: 1px solid #ccc; 70 | padding: 5px; 71 | } -------------------------------------------------------------------------------- /MarkdownView/app/src/main/assets/markdown_css_themes/alt.css: -------------------------------------------------------------------------------- 1 | body { 2 | line-height: 1.4em; 3 | color: black; 4 | padding: 1em; 5 | margin: auto; 6 | max-width: 42em; 7 | } 8 | 9 | li { 10 | color: black; 11 | } 12 | 13 | h1,h2,h3,h4,h5,h6 { 14 | border: 0 none !important; 15 | } 16 | 17 | h1 { 18 | margin-top: 0.5em; 19 | margin-bottom: 0.5em; 20 | border-bottom: 2px solid #000080 !important; 21 | } 22 | 23 | h2 { 24 | margin-top: 1em; 25 | margin-bottom: 0.5em; 26 | border-bottom: 2px solid #000080 !important; 27 | } 28 | 29 | pre { 30 | background-color: #f8f8f8; 31 | border: 1px solid #2f6fab; 32 | border-radius: 3px; 33 | overflow: auto; 34 | padding: 5px; 35 | } 36 | 37 | pre code { 38 | background-color: inherit; 39 | border: none; 40 | padding: 0; 41 | } 42 | 43 | code { 44 | background-color: #ffffe0; 45 | border: 1px solid orange; 46 | border-radius: 3px; 47 | padding: 0 0.2em; 48 | } 49 | 50 | a { 51 | text-decoration: underline; 52 | } 53 | 54 | ul,ol { 55 | padding-left: 30px; 56 | } 57 | 58 | li { 59 | margin: 0.2em 0 0 0em; 60 | padding: 0px; 61 | } 62 | 63 | em { 64 | color: #b05000; 65 | } 66 | 67 | table.text th,table.text td { 68 | vertical-align: top; 69 | border-top: 1px solid #ccc; 70 | padding: 5px; 71 | } -------------------------------------------------------------------------------- /MarkdownView/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/java/us/feras/mdv/demo/MarkdownDataActivity.java: -------------------------------------------------------------------------------- 1 | package us.feras.mdv.demo; 2 | 3 | import us.feras.mdv.MarkdownView; 4 | import android.app.Activity; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.text.Editable; 8 | import android.text.TextWatcher; 9 | import android.view.View; 10 | import android.view.View.OnClickListener; 11 | import android.widget.Button; 12 | import android.widget.EditText; 13 | 14 | public class MarkdownDataActivity extends AppCompatActivity { 15 | 16 | private EditText markdownEditText; 17 | private MarkdownView markdownView; 18 | 19 | @Override 20 | public void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.markdown_view); 23 | markdownEditText = (EditText) findViewById(R.id.markdownText); 24 | markdownView = (MarkdownView) findViewById(R.id.markdownView); 25 | String text = getResources().getString(R.string.md_sample_data); 26 | markdownEditText.setText(text); 27 | updateMarkdownView(); 28 | 29 | markdownEditText.addTextChangedListener(new TextWatcher() { 30 | 31 | @Override 32 | public void afterTextChanged(Editable s) {} 33 | 34 | @Override 35 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} 36 | 37 | @Override 38 | public void onTextChanged(CharSequence s, int start, int before, int count) { 39 | updateMarkdownView(); 40 | } 41 | }); 42 | 43 | 44 | } 45 | 46 | private void updateMarkdownView() { 47 | markdownView.loadMarkdown(markdownEditText.getText().toString()); 48 | } 49 | } -------------------------------------------------------------------------------- /MarkdownView/app/src/main/java/us/feras/mdv/demo/MarkdownThemesActivity.java: -------------------------------------------------------------------------------- 1 | package us.feras.mdv.demo; 2 | 3 | import us.feras.mdv.MarkdownView; 4 | import android.app.Activity; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | import android.widget.AdapterView; 9 | import android.widget.AdapterView.OnItemSelectedListener; 10 | import android.widget.ArrayAdapter; 11 | import android.widget.Spinner; 12 | 13 | public class MarkdownThemesActivity extends AppCompatActivity implements 14 | OnItemSelectedListener { 15 | @Override 16 | public void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.markdown_themes); 19 | Spinner themesSpinner = (Spinner) findViewById(R.id.themes_spinner); 20 | ArrayAdapter adapter = ArrayAdapter.createFromResource( 21 | this, R.array.md_themes, android.R.layout.simple_spinner_item); 22 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 23 | themesSpinner.setAdapter(adapter); 24 | themesSpinner.setSelection(0); 25 | themesSpinner.setOnItemSelectedListener(this); 26 | } 27 | 28 | @Override 29 | public void onItemSelected(AdapterView parent, View view, int pos, 30 | long id) { 31 | MarkdownView mdv = (MarkdownView) findViewById(R.id.markdownView); 32 | mdv.loadMarkdownFile("file:///android_asset/hello.md", 33 | "file:///android_asset/markdown_css_themes/" 34 | + parent.getItemAtPosition(pos).toString() + ".css"); 35 | } 36 | 37 | @Override 38 | public void onNothingSelected(AdapterView parent) { 39 | // no-op 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MarkdownView/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 21 | 22 |