GithubHelp home page GithubHelp logo

luiseduardohdbackup / knife Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mthli/knife

0.0 2.0 0.0 1.04 MB

Knife is a rich text editor component for writing documents in Android.

License: Apache License 2.0

Java 100.00%

knife's Introduction

Knife

Knife (extend EditText) is a rich text editor component for writing documents in Android.

Just select text and use one line code to style it!

Support Android 4.0+

Example

example.gif

Here has a demo apk, and it's source code, very easy to understand~

Api

  • bold(boolean valid) bold the selected text.

  • italic(boolean valid) italic the selected text.

  • underline(boolean valid) <u>underline</u> the selected text.

  • strikethrough(boolean valid) strikethrough the selected text.

  • bullet(boolean valid) bullet the selected text.

  • quote(boolean valid) quote the selected text.

  • link(String link) and link(String link, int start, int end) to link the text.

  • contains(int FORMAT) return true if the selected text contains the FORMAT.

  • clearFormats() clear all formats.

  • redo() when text changed, you can redo it!

  • undo() when text change, you can also undo it!

If you want to get more control of the editable text, just extend KnifeText to get all protected method.

Custom

  • app:bulletColor

  • app:bulletGapWidth

  • app:historyEnable true to enable record history, so you can redo() and undo().

  • app:historySize the record max limit.

  • app:linkColor

  • app:linkUnderline true to enable link underline.

  • app:quoteColor

  • app:quoteStripeWidth the quote line width.

  • app:quoteCapWidth

TODO

  • Insert image.

  • Export as HTML file.

Gradle

At your top-level build.gradle file:

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

And then at your project build.gradle file:

dependencies {
    compile 'com.github.mthli:Knife:v1.0'
}

Done!

Reference

Thanks

License

Copyright 2015 Matthew Lee

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.

knife's People

Contributors

mthli avatar

Watchers

 avatar  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.