Penmanship Android Helpers

Useful helper methods for integrating Penmanship with your Android app.

Лицензия

Лицензия

Группа

Группа

com.mindsnacks
Идентификатор

Идентификатор

penmanship-helper
Последняя версия

Последняя версия

0.9
Дата

Дата

Тип

Тип

aar
Описание

Описание

Penmanship Android Helpers
Useful helper methods for integrating Penmanship with your Android app.
Ссылка на сайт

Ссылка на сайт

http://github.com/mindsnacks/penmanship
Система контроля версий

Система контроля версий

http://github.com/mindsnacks/penmanship

Скачать penmanship-helper

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.mindsnacks/penmanship-helper/ -->
<dependency>
    <groupId>com.mindsnacks</groupId>
    <artifactId>penmanship-helper</artifactId>
    <version>0.9</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.mindsnacks/penmanship-helper/
implementation 'com.mindsnacks:penmanship-helper:0.9'
// https://jarcasting.com/artifacts/com.mindsnacks/penmanship-helper/
implementation ("com.mindsnacks:penmanship-helper:0.9")
'com.mindsnacks:penmanship-helper:aar:0.9'
<dependency org="com.mindsnacks" name="penmanship-helper" rev="0.9">
  <artifact name="penmanship-helper" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.mindsnacks', module='penmanship-helper', version='0.9')
)
libraryDependencies += "com.mindsnacks" % "penmanship-helper" % "0.9"
[com.mindsnacks/penmanship-helper "0.9"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Penmanship

A simple Gradle plug-in that makes it easy to convert Markdown documents into native Android layout XML files.

Useful for apps that require rich content and an easy way to maintain.

Screenshot 1 Screenshot 2

Build Process Integration

Add Penmanship to your buildscript depdencies and apply the plug-in:

buildscript {
  repositories {
    mavenCentral()
  }
  
  dependencies {
    classpath 'com.android.tools.build:gradle:0.7+'
    classpath 'com.mindsnacks:penmanship:CURRENT-VERSION'
  }
}

apply plugin: 'penmanship'

Then create a task to convert your Markdown files:

import com.mindsnacks.penmanship.gradle.ConvertMarkdownDirectoryToAndroidResourcesDirectoryTask
import com.android.build.gradle.tasks.ProcessAndroidResources

task generateMarkdownResources(type: ConvertMarkdownDirectoryToAndroidResourcesDirectoryTask) {
  def inputTree = file('path/to/directory/containing_only_your_markdown/and_images')
  inputs.dir inputTree
  outputs.dir file("penmanship_gen/res")
}

tasks.withType(ProcessAndroidResources) { processResourcesTask ->
  processResourcesTask.dependsOn generateMarkdownResources
}

Finally, just add your generated XML directory to your source set:

android {
  sourceSets {
    main {
      res.srcDir 'penmanship_gen/res'
    }
  }
}

App Integration

Loading Layouts

Since there is not one super common way of using the generated XML, it's up to you to inflate the layouts and integrate them into your app. Markdroid provides a very small helper library to make this easy, just add it as an app dependency:

compile 'com.mindsnacks:penmanship-helper:CURRENT-VERSION@aar'

This library provides a few methods for easily loading layout files and enabling rich text. To see an example, check out MainActivity.java in the example project.

Styling Layouts

Each Markdown element gets its own layout in the generated layout XML files. It's up to you to implement these styles. For an example implementation, refer to the example project's styles file.

Markdown Support

Markdown support is still somewhat limited. The following features work:

  1. Text formatting (bold and italics)
  2. Headings
  3. Blockquotes
  4. Unordered and ordered lists
  5. Images (only local images, can't be inline with text)
  6. Links
com.mindsnacks

Elevate

Версии библиотеки

Версия
0.9