Skip to content
A reusable native Android rich text editor component.
Branch: develop
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci CircleCI: Use Orb for running Firebase tests Mar 1, 2019
.github
.idea
app Update Gradle to 4.10.3 and Android Gradle Plugin to 3.3.1 Feb 27, 2019
aztec Add detail about empty html elements in the comment Mar 7, 2019
glide-loader Update Gradle to 4.10.3 and Android Gradle Plugin to 3.3.1 Feb 27, 2019
gradle/wrapper
picasso-loader Update Gradle to 4.10.3 and Android Gradle Plugin to 3.3.1 Feb 27, 2019
wordpress-comments
wordpress-shortcodes
.firebase.secrets.json.enc
.gitignore made sure all DS_Store files are ignored Jan 16, 2018
CHANGELOG.md
LICENSE.md
README.md Removed Travis CI config Mar 7, 2019
build.gradle
code_editor.png
gradle.properties Add CircleCI config Feb 28, 2019
gradlew Update build config for AS3 Oct 27, 2017
gradlew.bat
jitpack.yml Update Gradle to 4.10.3 and Android Gradle Plugin to 3.3.1 Feb 27, 2019
settings.gradle
visual_editor.png Add screenshots Mar 28, 2018

README.md

Aztec Logo Aztec: Native HTML Editor for Android

CircleCI

Aztec (which extends EditText) is a rich-text editor component for writing HTML documents in Android.

Supports Android 4.1+ (API 16 - Jelly Bean)

Visual Editor Visual Editor

Getting started

Declare the main components in your layout:

Visual editor

<org.wordpress.aztec.AztecText
    android:id="@+id/visual"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical"
    android:imeOptions="flagNoExtractUi"
    aztec:historyEnable="false" />

Source editor

<org.wordpress.aztec.source.SourceViewEditText
    android:id="@+id/source"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:inputType="textNoSuggestions|textMultiLine"
    android:scrollbars="vertical"
    android:imeOptions="flagNoExtractUi"
    aztec:codeBackgroundColor="@android:color/transparent"
    aztec:codeTextColor="@android:color/white" />

Toolbar

<org.wordpress.aztec.toolbar.AztecToolbar
    android:id="@+id/formatting_toolbar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/format_bar_height"
    android:layout_alignParentBottom="true" />

Inflate the views:

val visualEditor = findViewById<AztecText>(R.id.visual)
val sourceEditor = findViewById<SourceViewEditText>(R.id.source)
val toolbar = findViewById<AztecToolbar>(R.id.formatting_toolbar)

Configure Aztec with a provided image & video loaders:

Aztec.with(visualEditor, sourceEditor, toolbar, context)
    .setImageGetter(GlideImageLoader(context))
    .setVideoThumbnailGetter(GlideVideoThumbnailLoader(context))

For more options, such as edit history, listeners and plugins please refer to the demo app implementation.

Build and test

Build the library, build the example project and run unit tests:

$ ./gradlew build

Run unit tests only:

$ ./gradlew test

Before running instrumentation tests

Espresso advises disabling system animations on devices used for testing:

On your device, under Settings->Developer options disable the following 3 settings:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale

One additional setup step is also required to handle an Espresso issue with clicks (see the caveats below):

On your device, under Settings -> Accessibility -> Touch & hold delay, set the delay to Long.

Run the instrumentation tests:

$ ./gradlew cAT

Integrating Aztec in your project

You can import Aztec into your project using Jitpack:

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    api ('com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:v1.3.20')
}

Brave developers can either use the project as a source distribution or have fun with the latest snapshot at their own risk:

dependencies {
    api ('com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:develop-SNAPSHOT')
}

Code formatting

We use ktlint for Kotlin linting. You can run ktlint using ./gradlew ktlint, and you can also run ./gradlew ktlintFormat for auto-formatting. There is no IDEA plugin (like Checkstyle's) at this time.

Reference

License

Aztec is an Open Source project covered by the GNU General Public License version 2.

You can’t perform that action at this time.