• Stars
    star
    2,107
  • Rank 21,901 (Top 0.5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Knife

Android Arsenal

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~

More experiments see mthli/Type.

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!

  • fromHtml() import from HTML file.

  • toHtml() export as HTML file.

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

Custom

  • app:bulletColor

  • app:bulletRadius

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

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.1'
}

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.

More Repositories

1

Ninja

Yet another web browser for Android.
Java
956
star
2

Slice

Android drawable that allows you custom round rect position.
Java
597
star
3

Mount

mount/umount apps that you don't like on Android, without root.
Java
309
star
4

lemonsqueepy

Lemon Squeezy with Python 🐍
Python
243
star
5

Bitocle

Bitocle is a simple android app which allows you to view your source code in GitHub.
Java
204
star
6

better-youtube-summary-server

Literally Better YouTube Summary 🎯
Python
199
star
7

webrtc-tutorial

Learning WebRTC the Hard Way 👀
JavaScript
179
star
8

Tweetin

Yet another Twitter unofficial client for Lollipop.
Java
174
star
9

Java

《Core Java》学习笔记。
Java
133
star
10

SugarTask

Android lifecycle safety task with sugar code style.
Java
130
star
11

Cracker

Collect UncaughtException when your Android App crash.
Java
65
star
12

Type

Typing experiment on Android.
Java
56
star
13

blog

Yet another blog of myself 👀
Assembly
42
star
14

Nongfu

A IntelliJ IDEA plugin that help you move files or directories to target module quickly.
Java
36
star
15

RxCoroutineSchedulers

Kotlin Coroutines as RxJava Schedulers 😈
Kotlin
30
star
16

Mp3

Windows下一个简陋的MP3播放器。使用C语言调用Windows API实现。
C
15
star
17

Ninja2

Yet another web browser for Android, version 2.
14
star
18

AndroidPlayground

A sample playground for (re)learning Android.
Kotlin
12
star
19

mthli.github.io

Deploy my blog on GitHub.
HTML
10
star
20

PyRobot

一些自动抓取内容的Python脚本集合。
Python
8
star
21

Geeky

GeekPark Unofficial Android Client.
Java
8
star
22

better-youtube-summary-extension

Literally Better YouTube Summary 🎯
TypeScript
7
star
23

EatWhat

吃神马是一个永恒的话题。让我们摇起来!
Java
7
star
24

EasyRust

一份简单的Rust中文入门教程。
6
star
25

mthli

My GitHub profile repo 👀
6
star
26

Send2SN

班级信息推送小应用,可以将班级信息发送到班级成员邮箱、微信公众平台和人人网。采用GTK+2.24、C语言和Python2开发。
C
4
star
27

COIMS

COIMS是应西安某救助站需求,义务为其开发的简易流浪者病历管理软件,基于GTK+2.24版本、SQLite3并采用C语言开发。不以成败论英雄。
C
4
star
28

jni_zero

Python
3
star
29

SwitcherPanel

Try to implement Firefox(for Android)'s switcher panel.
Java
2
star
30

Dribbble4J

Dribbble API for Java.
Java
2
star
31

gatsby-theme-apollo-docs

JavaScript
1
star
32

Bingw

抓取Bing每日图片并设置为桌面背景,目前支持Gnome桌面环境和Windows桌面环境。
C
1
star
33

Dara

Shielding notifications that you don't want to see.
Java
1
star
34

invest

Learning Invest the Hard Way 💸
JavaScript
1
star
35

lemontree

A lemonsqueepy example 🍋
TypeScript
1
star