GithubHelp home page GithubHelp logo

pistolcaffe / azteceditor-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wordpress-mobile/azteceditor-android

0.0 0.0 0.0 5.49 MB

A reusable native Android rich text editor component.

License: GNU General Public License v2.0

Java 3.72% Kotlin 96.28%

azteceditor-android's Introduction

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.27')
}

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.

azteceditor-android's People

Contributors

0nko avatar khaykov avatar theck13 avatar hypest avatar daniloercoli avatar mzorz avatar maxme avatar rachelmcr avatar jtreanor avatar malinajirka avatar amandariu avatar planarvoid avatar kwonye avatar marecar3 avatar adrielcafe avatar mkevins avatar tug avatar loremattei avatar maskedpony avatar matissehack avatar nbradbury avatar iamthomasbishop avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.