├── .editorconfig
├── .github
└── FUNDING.yml
├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
└── runConfigurations.xml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── art
├── demo.gif
├── demo2.gif
└── logo.png
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── richeditor
├── build.gradle
└── src
│ ├── androidTest
│ └── java
│ │ └── jp
│ │ └── wasabeef
│ │ └── richeditor
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── editor.html
│ │ ├── normalize.css
│ │ ├── rich_editor.js
│ │ └── style.css
│ └── java
│ │ └── jp
│ │ └── wasabeef
│ │ └── richeditor
│ │ ├── RichEditor.java
│ │ └── Utils.java
│ └── test
│ └── java
│ └── richeditor
│ └── UrlDecoderTest.java
├── sample
├── build.gradle
└── src
│ ├── androidTest
│ └── java
│ │ └── jp
│ │ └── wasabeef
│ │ └── sample
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── jp
│ │ └── wasabeef
│ │ └── sample
│ │ └── MainActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ ├── bg.png
│ ├── bg_color.png
│ ├── blockquote.png
│ ├── bold.png
│ ├── bullets.png
│ ├── h1.png
│ ├── h2.png
│ ├── h3.png
│ ├── h4.png
│ ├── h5.png
│ ├── h6.png
│ ├── html_edit.png
│ ├── indent.png
│ ├── insert_image.png
│ ├── insert_link.png
│ ├── italic.png
│ ├── justify_center.png
│ ├── justify_left.png
│ ├── justify_right.png
│ ├── music.png
│ ├── numbers.png
│ ├── outdent.png
│ ├── redo.png
│ ├── strikethrough.png
│ ├── subscript.png
│ ├── superscript.png
│ ├── txt_color.png
│ ├── underline.png
│ ├── undo.png
│ ├── video.png
│ └── youtube.png
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── settings.gradle
└── signingConfigs
├── debug.gradle
├── debug.keystore
├── release.gradle
└── release.keystore
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*]
2 | indent_size = 2
3 | insert_final_newline = true
4 |
5 | [*.{kt, kts}]
6 | kotlin_imports_layout = ascii
7 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: wasabeef # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac OS
2 | .DS_store
3 |
4 | # Built application files
5 | *.apk
6 | *.ap_
7 |
8 | # Files for the ART/Dalvik VM
9 | *.dex
10 |
11 | # Java class files
12 | *.class
13 |
14 | # Generated files
15 | bin/
16 | gen/
17 | out/
18 |
19 | # Gradle files
20 | .gradle/
21 | build/
22 |
23 | # Local configuration file (sdk path, etc)
24 | local.properties
25 |
26 | # Proguard folder generated by Eclipse
27 | proguard/
28 |
29 | # Log Files
30 | *.log
31 |
32 | # Android Studio Navigation editor temp files
33 | .navigation/
34 |
35 | # Android Studio captures folder
36 | captures/
37 |
38 | # IntelliJ
39 | *.iml
40 | .idea/workspace.xml
41 | .idea/tasks.xml
42 | .idea/gradle.xml
43 | .idea/assetWizardSettings.xml
44 | .idea/dictionaries
45 | .idea/libraries
46 | .idea/caches
47 | .idea/misc.xml
48 | .idea/modules.xml
49 | .idea/navEditor.xml
50 | .idea/markdown*
51 | .idea/jarRepositories.xml
52 | .idea/inspectionProfiles/Project_Default.xml
53 | .idea/compiler.xml
54 | .idea/vcs.xml
55 | projectFilesBackup/
56 |
57 | # Keystore files
58 | # Uncomment the following line if you do not want to check your keystore files in.
59 | #*.jks
60 |
61 | # External native build folder generated in Android Studio 2.2 and later
62 | .externalNativeBuild
63 |
64 | # Google Services (e.g. APIs or Firebase)
65 | google-services.json
66 |
67 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
'); 181 | } 182 | 183 | RE.insertImage = function(url, alt) { 184 | var html = ''; 185 | RE.insertHTML(html); 186 | } 187 | 188 | RE.insertImageW = function(url, alt, width) { 189 | var html = '
'; 190 | RE.insertHTML(html); 191 | } 192 | 193 | RE.insertImageWH = function(url, alt, width, height) { 194 | var html = '
'; 195 | RE.insertHTML(html); 196 | } 197 | 198 | RE.insertVideo = function(url, alt) { 199 | var html = '
'; 200 | RE.insertHTML(html); 201 | } 202 | 203 | RE.insertVideoW = function(url, width) { 204 | var html = '
'; 205 | RE.insertHTML(html); 206 | } 207 | 208 | RE.insertVideoWH = function(url, width, height) { 209 | var html = '
'; 210 | RE.insertHTML(html); 211 | } 212 | 213 | RE.insertAudio = function(url, alt) { 214 | var html = '
'; 215 | RE.insertHTML(html); 216 | } 217 | 218 | RE.insertYoutubeVideo = function(url) { 219 | var html = '
' 220 | RE.insertHTML(html); 221 | } 222 | 223 | RE.insertYoutubeVideoW = function(url, width) { 224 | var html = '
' 225 | RE.insertHTML(html); 226 | } 227 | 228 | RE.insertYoutubeVideoWH = function(url, width, height) { 229 | var html = '
' 230 | RE.insertHTML(html); 231 | } 232 | 233 | RE.insertHTML = function(html) { 234 | RE.restorerange(); 235 | document.execCommand('insertHTML', false, html); 236 | } 237 | 238 | RE.insertLink = function(url, title) { 239 | RE.restorerange(); 240 | var sel = document.getSelection(); 241 | if (sel.toString().length == 0) { 242 | document.execCommand("insertHTML",false,""+title+""); 243 | } else if (sel.rangeCount) { 244 | var el = document.createElement("a"); 245 | el.setAttribute("href", url); 246 | el.setAttribute("title", title); 247 | 248 | var range = sel.getRangeAt(0).cloneRange(); 249 | range.surroundContents(el); 250 | sel.removeAllRanges(); 251 | sel.addRange(range); 252 | } 253 | RE.callback(); 254 | } 255 | 256 | RE.setTodo = function(text) { 257 | var html = ' '; 258 | document.execCommand('insertHTML', false, html); 259 | } 260 | 261 | RE.prepareInsert = function() { 262 | RE.backuprange(); 263 | } 264 | 265 | RE.backuprange = function(){ 266 | var selection = window.getSelection(); 267 | if (selection.rangeCount > 0) { 268 | var range = selection.getRangeAt(0); 269 | RE.currentSelection = { 270 | "startContainer": range.startContainer, 271 | "startOffset": range.startOffset, 272 | "endContainer": range.endContainer, 273 | "endOffset": range.endOffset}; 274 | } 275 | } 276 | 277 | RE.restorerange = function(){ 278 | var selection = window.getSelection(); 279 | selection.removeAllRanges(); 280 | var range = document.createRange(); 281 | range.setStart(RE.currentSelection.startContainer, RE.currentSelection.startOffset); 282 | range.setEnd(RE.currentSelection.endContainer, RE.currentSelection.endOffset); 283 | selection.addRange(range); 284 | } 285 | 286 | RE.enabledEditingItems = function(e) { 287 | var items = []; 288 | if (document.queryCommandState('bold')) { 289 | items.push('bold'); 290 | } 291 | if (document.queryCommandState('italic')) { 292 | items.push('italic'); 293 | } 294 | if (document.queryCommandState('subscript')) { 295 | items.push('subscript'); 296 | } 297 | if (document.queryCommandState('superscript')) { 298 | items.push('superscript'); 299 | } 300 | if (document.queryCommandState('strikeThrough')) { 301 | items.push('strikeThrough'); 302 | } 303 | if (document.queryCommandState('underline')) { 304 | items.push('underline'); 305 | } 306 | if (document.queryCommandState('insertOrderedList')) { 307 | items.push('orderedList'); 308 | } 309 | if (document.queryCommandState('insertUnorderedList')) { 310 | items.push('unorderedList'); 311 | } 312 | if (document.queryCommandState('justifyCenter')) { 313 | items.push('justifyCenter'); 314 | } 315 | if (document.queryCommandState('justifyFull')) { 316 | items.push('justifyFull'); 317 | } 318 | if (document.queryCommandState('justifyLeft')) { 319 | items.push('justifyLeft'); 320 | } 321 | if (document.queryCommandState('justifyRight')) { 322 | items.push('justifyRight'); 323 | } 324 | if (document.queryCommandState('insertHorizontalRule')) { 325 | items.push('horizontalRule'); 326 | } 327 | var formatBlock = document.queryCommandValue('formatBlock'); 328 | if (formatBlock.length > 0) { 329 | items.push(formatBlock); 330 | } 331 | 332 | window.location.href = "re-state://" + encodeURI(items.join(',')); 333 | } 334 | 335 | RE.focus = function() { 336 | var range = document.createRange(); 337 | range.selectNodeContents(RE.editor); 338 | range.collapse(false); 339 | var selection = window.getSelection(); 340 | selection.removeAllRanges(); 341 | selection.addRange(range); 342 | RE.editor.focus(); 343 | } 344 | 345 | RE.blurFocus = function() { 346 | RE.editor.blur(); 347 | } 348 | 349 | RE.removeFormat = function() { 350 | document.execCommand('removeFormat', false, null); 351 | } 352 | 353 | // Event Listeners 354 | RE.editor.addEventListener("input", RE.callback); 355 | RE.editor.addEventListener("keyup", function(e) { 356 | var KEY_LEFT = 37, KEY_RIGHT = 39; 357 | if (e.which == KEY_LEFT || e.which == KEY_RIGHT) { 358 | RE.enabledEditingItems(e); 359 | } 360 | }); 361 | RE.editor.addEventListener("click", RE.enabledEditingItems); 362 | -------------------------------------------------------------------------------- /richeditor/src/main/assets/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Wasabeef 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @charset "UTF-8"; 18 | 19 | 20 | html { 21 | height: 100%; 22 | } 23 | 24 | body { 25 | overflow: scroll; 26 | display: table; 27 | table-layout: fixed; 28 | width: 100%; 29 | min-height:100%; 30 | } 31 | 32 | #editor { 33 | display: table-cell; 34 | outline: 0px solid transparent; 35 | background-repeat: no-repeat; 36 | background-position: center; 37 | background-size: cover; 38 | } 39 | 40 | #editor[placeholder]:empty:not(:focus):before { 41 | content: attr(placeholder); 42 | opacity: .5; 43 | } 44 | -------------------------------------------------------------------------------- /richeditor/src/main/java/jp/wasabeef/richeditor/RichEditor.java: -------------------------------------------------------------------------------- 1 | package jp.wasabeef.richeditor; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.annotation.TargetApi; 5 | import android.content.Context; 6 | import android.content.res.TypedArray; 7 | import android.graphics.Bitmap; 8 | import android.graphics.drawable.Drawable; 9 | import android.net.Uri; 10 | import android.os.Build; 11 | import android.text.TextUtils; 12 | import android.util.AttributeSet; 13 | import android.util.Log; 14 | import android.view.Gravity; 15 | import android.webkit.WebChromeClient; 16 | import android.webkit.WebResourceRequest; 17 | import android.webkit.WebView; 18 | import android.webkit.WebViewClient; 19 | 20 | import java.io.UnsupportedEncodingException; 21 | import java.net.URLEncoder; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | import java.util.Locale; 25 | 26 | /** 27 | * Copyright (C) 2020 Wasabeef 28 | *29 | * Licensed under the Apache License, Version 2.0 (the "License"); 30 | * you may not use this file except in compliance with the License. 31 | * You may obtain a copy of the License at 32 | *
33 | * http://www.apache.org/licenses/LICENSE-2.0 34 | *
35 | * Unless required by applicable law or agreed to in writing, software 36 | * distributed under the License is distributed on an "AS IS" BASIS, 37 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 38 | * See the License for the specific language governing permissions and 39 | * limitations under the License. 40 | */ 41 | 42 | public class RichEditor extends WebView { 43 | 44 | public enum Type { 45 | BOLD, 46 | ITALIC, 47 | SUBSCRIPT, 48 | SUPERSCRIPT, 49 | STRIKETHROUGH, 50 | UNDERLINE, 51 | H1, 52 | H2, 53 | H3, 54 | H4, 55 | H5, 56 | H6, 57 | ORDEREDLIST, 58 | UNORDEREDLIST, 59 | JUSTIFYCENTER, 60 | JUSTIFYFULL, 61 | JUSTIFYLEFT, 62 | JUSTIFYRIGHT 63 | } 64 | 65 | public interface OnTextChangeListener { 66 | 67 | void onTextChange(String text); 68 | } 69 | 70 | public interface OnDecorationStateListener { 71 | 72 | void onStateChangeListener(String text, List
types); 73 | } 74 | 75 | public interface AfterInitialLoadListener { 76 | 77 | void onAfterInitialLoad(boolean isReady); 78 | } 79 | 80 | private static final String SETUP_HTML = "file:///android_asset/editor.html"; 81 | private static final String CALLBACK_SCHEME = "re-callback://"; 82 | private static final String STATE_SCHEME = "re-state://"; 83 | private boolean isReady = false; 84 | private String mContents; 85 | private OnTextChangeListener mTextChangeListener; 86 | private OnDecorationStateListener mDecorationStateListener; 87 | private AfterInitialLoadListener mLoadListener; 88 | 89 | public RichEditor(Context context) { 90 | this(context, null); 91 | } 92 | 93 | public RichEditor(Context context, AttributeSet attrs) { 94 | this(context, attrs, android.R.attr.webViewStyle); 95 | } 96 | 97 | @SuppressLint("SetJavaScriptEnabled") 98 | public RichEditor(Context context, AttributeSet attrs, int defStyleAttr) { 99 | super(context, attrs, defStyleAttr); 100 | 101 | setVerticalScrollBarEnabled(false); 102 | setHorizontalScrollBarEnabled(false); 103 | getSettings().setJavaScriptEnabled(true); 104 | setWebChromeClient(new WebChromeClient()); 105 | setWebViewClient(createWebviewClient()); 106 | loadUrl(SETUP_HTML); 107 | 108 | applyAttributes(context, attrs); 109 | } 110 | 111 | protected EditorWebViewClient createWebviewClient() { 112 | return new EditorWebViewClient(); 113 | } 114 | 115 | public void setOnTextChangeListener(OnTextChangeListener listener) { 116 | mTextChangeListener = listener; 117 | } 118 | 119 | public void setOnDecorationChangeListener(OnDecorationStateListener listener) { 120 | mDecorationStateListener = listener; 121 | } 122 | 123 | public void setOnInitialLoadListener(AfterInitialLoadListener listener) { 124 | mLoadListener = listener; 125 | } 126 | 127 | private void callback(String text) { 128 | mContents = text.replaceFirst(CALLBACK_SCHEME, ""); 129 | if (mTextChangeListener != null) { 130 | mTextChangeListener.onTextChange(mContents); 131 | } 132 | } 133 | 134 | private void stateCheck(String text) { 135 | String state = text.replaceFirst(STATE_SCHEME, "").toUpperCase(Locale.ENGLISH); 136 | List types = new ArrayList<>(); 137 | for (Type type : Type.values()) { 138 | if (TextUtils.indexOf(state, type.name()) != -1) { 139 | types.add(type); 140 | } 141 | } 142 | 143 | if (mDecorationStateListener != null) { 144 | mDecorationStateListener.onStateChangeListener(state, types); 145 | } 146 | } 147 | 148 | private void applyAttributes(Context context, AttributeSet attrs) { 149 | final int[] attrsArray = new int[]{ 150 | android.R.attr.gravity 151 | }; 152 | TypedArray ta = context.obtainStyledAttributes(attrs, attrsArray); 153 | 154 | int gravity = ta.getInt(0, NO_ID); 155 | switch (gravity) { 156 | case Gravity.LEFT: 157 | exec("javascript:RE.setTextAlign(\"left\")"); 158 | break; 159 | case Gravity.RIGHT: 160 | exec("javascript:RE.setTextAlign(\"right\")"); 161 | break; 162 | case Gravity.TOP: 163 | exec("javascript:RE.setVerticalAlign(\"top\")"); 164 | break; 165 | case Gravity.BOTTOM: 166 | exec("javascript:RE.setVerticalAlign(\"bottom\")"); 167 | break; 168 | case Gravity.CENTER_VERTICAL: 169 | exec("javascript:RE.setVerticalAlign(\"middle\")"); 170 | break; 171 | case Gravity.CENTER_HORIZONTAL: 172 | exec("javascript:RE.setTextAlign(\"center\")"); 173 | break; 174 | case Gravity.CENTER: 175 | exec("javascript:RE.setVerticalAlign(\"middle\")"); 176 | exec("javascript:RE.setTextAlign(\"center\")"); 177 | break; 178 | } 179 | 180 | ta.recycle(); 181 | } 182 | 183 | public void setHtml(String contents) { 184 | if (contents == null) { 185 | contents = ""; 186 | } 187 | try { 188 | exec("javascript:RE.setHtml('" + URLEncoder.encode(contents, "UTF-8") + "');"); 189 | } catch (UnsupportedEncodingException e) { 190 | // No handling 191 | } 192 | mContents = contents; 193 | } 194 | 195 | public String getHtml() { 196 | return mContents; 197 | } 198 | 199 | public void setEditorFontColor(int color) { 200 | String hex = convertHexColorString(color); 201 | exec("javascript:RE.setBaseTextColor('" + hex + "');"); 202 | } 203 | 204 | public void setEditorFontSize(int px) { 205 | exec("javascript:RE.setBaseFontSize('" + px + "px');"); 206 | } 207 | 208 | @Override 209 | public void setPadding(int left, int top, int right, int bottom) { 210 | super.setPadding(left, top, right, bottom); 211 | exec("javascript:RE.setPadding('" + left + "px', '" + top + "px', '" + right + "px', '" + bottom 212 | + "px');"); 213 | } 214 | 215 | @Override 216 | public void setPaddingRelative(int start, int top, int end, int bottom) { 217 | // still not support RTL. 218 | setPadding(start, top, end, bottom); 219 | } 220 | 221 | public void setEditorBackgroundColor(int color) { 222 | setBackgroundColor(color); 223 | } 224 | 225 | @Override 226 | public void setBackgroundColor(int color) { 227 | super.setBackgroundColor(color); 228 | } 229 | 230 | @Override 231 | public void setBackgroundResource(int resid) { 232 | Bitmap bitmap = Utils.decodeResource(getContext(), resid); 233 | String base64 = Utils.toBase64(bitmap); 234 | bitmap.recycle(); 235 | 236 | exec("javascript:RE.setBackgroundImage('url(data:image/png;base64," + base64 + ")');"); 237 | } 238 | 239 | @Override 240 | public void setBackground(Drawable background) { 241 | Bitmap bitmap = Utils.toBitmap(background); 242 | String base64 = Utils.toBase64(bitmap); 243 | bitmap.recycle(); 244 | 245 | exec("javascript:RE.setBackgroundImage('url(data:image/png;base64," + base64 + ")');"); 246 | } 247 | 248 | public void setBackground(String url) { 249 | exec("javascript:RE.setBackgroundImage('url(" + url + ")');"); 250 | } 251 | 252 | public void setEditorWidth(int px) { 253 | exec("javascript:RE.setWidth('" + px + "px');"); 254 | } 255 | 256 | public void setEditorHeight(int px) { 257 | exec("javascript:RE.setHeight('" + px + "px');"); 258 | } 259 | 260 | public void setPlaceholder(String placeholder) { 261 | exec("javascript:RE.setPlaceholder('" + placeholder + "');"); 262 | } 263 | 264 | public void setInputEnabled(Boolean inputEnabled) { 265 | exec("javascript:RE.setInputEnabled(" + inputEnabled + ")"); 266 | } 267 | 268 | public void loadCSS(String cssFile) { 269 | String jsCSSImport = "(function() {" + 270 | " var head = document.getElementsByTagName(\"head\")[0];" + 271 | " var link = document.createElement(\"link\");" + 272 | " link.rel = \"stylesheet\";" + 273 | " link.type = \"text/css\";" + 274 | " link.href = \"" + cssFile + "\";" + 275 | " link.media = \"all\";" + 276 | " head.appendChild(link);" + 277 | "}) ();"; 278 | exec("javascript:" + jsCSSImport + ""); 279 | } 280 | 281 | public void undo() { 282 | exec("javascript:RE.undo();"); 283 | } 284 | 285 | public void redo() { 286 | exec("javascript:RE.redo();"); 287 | } 288 | 289 | public void setBold() { 290 | exec("javascript:RE.setBold();"); 291 | } 292 | 293 | public void setItalic() { 294 | exec("javascript:RE.setItalic();"); 295 | } 296 | 297 | public void setSubscript() { 298 | exec("javascript:RE.setSubscript();"); 299 | } 300 | 301 | public void setSuperscript() { 302 | exec("javascript:RE.setSuperscript();"); 303 | } 304 | 305 | public void setStrikeThrough() { 306 | exec("javascript:RE.setStrikeThrough();"); 307 | } 308 | 309 | public void setUnderline() { 310 | exec("javascript:RE.setUnderline();"); 311 | } 312 | 313 | public void setTextColor(int color) { 314 | exec("javascript:RE.prepareInsert();"); 315 | 316 | String hex = convertHexColorString(color); 317 | exec("javascript:RE.setTextColor('" + hex + "');"); 318 | } 319 | 320 | public void setTextBackgroundColor(int color) { 321 | exec("javascript:RE.prepareInsert();"); 322 | 323 | String hex = convertHexColorString(color); 324 | exec("javascript:RE.setTextBackgroundColor('" + hex + "');"); 325 | } 326 | 327 | public void setFontSize(int fontSize) { 328 | if (fontSize > 7 || fontSize < 1) { 329 | Log.e("RichEditor", "Font size should have a value between 1-7"); 330 | } 331 | exec("javascript:RE.setFontSize('" + fontSize + "');"); 332 | } 333 | 334 | public void removeFormat() { 335 | exec("javascript:RE.removeFormat();"); 336 | } 337 | 338 | public void setHeading(int heading) { 339 | exec("javascript:RE.setHeading('" + heading + "');"); 340 | } 341 | 342 | public void setIndent() { 343 | exec("javascript:RE.setIndent();"); 344 | } 345 | 346 | public void setOutdent() { 347 | exec("javascript:RE.setOutdent();"); 348 | } 349 | 350 | public void setAlignLeft() { 351 | exec("javascript:RE.setJustifyLeft();"); 352 | } 353 | 354 | public void setAlignCenter() { 355 | exec("javascript:RE.setJustifyCenter();"); 356 | } 357 | 358 | public void setAlignRight() { 359 | exec("javascript:RE.setJustifyRight();"); 360 | } 361 | 362 | public void setBlockquote() { 363 | exec("javascript:RE.setBlockquote();"); 364 | } 365 | 366 | public void setBullets() { 367 | exec("javascript:RE.setBullets();"); 368 | } 369 | 370 | public void setNumbers() { 371 | exec("javascript:RE.setNumbers();"); 372 | } 373 | 374 | public void insertImage(String url, String alt) { 375 | exec("javascript:RE.prepareInsert();"); 376 | exec("javascript:RE.insertImage('" + url + "', '" + alt + "');"); 377 | } 378 | 379 | /** 380 | * the image according to the specific width of the image automatically 381 | * 382 | * @param url 383 | * @param alt 384 | * @param width 385 | */ 386 | public void insertImage(String url, String alt, int width) { 387 | exec("javascript:RE.prepareInsert();"); 388 | exec("javascript:RE.insertImageW('" + url + "', '" + alt + "','" + width + "');"); 389 | } 390 | 391 | /** 392 | * {@link RichEditor#insertImage(String, String)} will show the original size of the image. 393 | * So this method can manually process the image by adjusting specific width and height to fit into different mobile screens. 394 | * 395 | * @param url 396 | * @param alt 397 | * @param width 398 | * @param height 399 | */ 400 | public void insertImage(String url, String alt, int width, int height) { 401 | exec("javascript:RE.prepareInsert();"); 402 | exec("javascript:RE.insertImageWH('" + url + "', '" + alt + "','" + width + "', '" + height + "');"); 403 | } 404 | 405 | public void insertVideo(String url) { 406 | exec("javascript:RE.prepareInsert();"); 407 | exec("javascript:RE.insertVideo('" + url + "');"); 408 | } 409 | 410 | public void insertVideo(String url, int width) { 411 | exec("javascript:RE.prepareInsert();"); 412 | exec("javascript:RE.insertVideoW('" + url + "', '" + width + "');"); 413 | } 414 | 415 | public void insertVideo(String url, int width, int height) { 416 | exec("javascript:RE.prepareInsert();"); 417 | exec("javascript:RE.insertVideoWH('" + url + "', '" + width + "', '" + height + "');"); 418 | } 419 | 420 | public void insertAudio(String url) { 421 | exec("javascript:RE.prepareInsert();"); 422 | exec("javascript:RE.insertAudio('" + url + "');"); 423 | } 424 | 425 | public void insertYoutubeVideo(String url) { 426 | exec("javascript:RE.prepareInsert();"); 427 | exec("javascript:RE.insertYoutubeVideo('" + url + "');"); 428 | } 429 | 430 | public void insertYoutubeVideo(String url, int width) { 431 | exec("javascript:RE.prepareInsert();"); 432 | exec("javascript:RE.insertYoutubeVideoW('" + url + "', '" + width + "');"); 433 | } 434 | 435 | public void insertYoutubeVideo(String url, int width, int height) { 436 | exec("javascript:RE.prepareInsert();"); 437 | exec("javascript:RE.insertYoutubeVideoWH('" + url + "', '" + width + "', '" + height + "');"); 438 | } 439 | 440 | public void insertLink(String href, String title) { 441 | exec("javascript:RE.prepareInsert();"); 442 | exec("javascript:RE.insertLink('" + href + "', '" + title + "');"); 443 | } 444 | 445 | public void insertTodo() { 446 | exec("javascript:RE.prepareInsert();"); 447 | exec("javascript:RE.setTodo('" + Utils.getCurrentTime() + "');"); 448 | } 449 | 450 | public void focusEditor() { 451 | requestFocus(); 452 | exec("javascript:RE.focus();"); 453 | } 454 | 455 | public void clearFocusEditor() { 456 | exec("javascript:RE.blurFocus();"); 457 | } 458 | 459 | private String convertHexColorString(int color) { 460 | return String.format("#%06X", (0xFFFFFF & color)); 461 | } 462 | 463 | protected void exec(final String trigger) { 464 | if (isReady) { 465 | load(trigger); 466 | } else { 467 | postDelayed(new Runnable() { 468 | @Override 469 | public void run() { 470 | exec(trigger); 471 | } 472 | }, 100); 473 | } 474 | } 475 | 476 | private void load(String trigger) { 477 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 478 | evaluateJavascript(trigger, null); 479 | } else { 480 | loadUrl(trigger); 481 | } 482 | } 483 | 484 | protected class EditorWebViewClient extends WebViewClient { 485 | @Override 486 | public void onPageFinished(WebView view, String url) { 487 | isReady = url.equalsIgnoreCase(SETUP_HTML); 488 | if (mLoadListener != null) { 489 | mLoadListener.onAfterInitialLoad(isReady); 490 | } 491 | } 492 | 493 | @Override 494 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 495 | String decode = Uri.decode(url); 496 | 497 | if (TextUtils.indexOf(url, CALLBACK_SCHEME) == 0) { 498 | callback(decode); 499 | return true; 500 | } else if (TextUtils.indexOf(url, STATE_SCHEME) == 0) { 501 | stateCheck(decode); 502 | return true; 503 | } 504 | 505 | return super.shouldOverrideUrlLoading(view, url); 506 | } 507 | 508 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 509 | @Override 510 | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { 511 | final String url = request.getUrl().toString(); 512 | String decode = Uri.decode(url); 513 | 514 | if (TextUtils.indexOf(url, CALLBACK_SCHEME) == 0) { 515 | callback(decode); 516 | return true; 517 | } else if (TextUtils.indexOf(url, STATE_SCHEME) == 0) { 518 | stateCheck(decode); 519 | return true; 520 | } 521 | return super.shouldOverrideUrlLoading(view, request); 522 | } 523 | } 524 | } 525 | -------------------------------------------------------------------------------- /richeditor/src/main/java/jp/wasabeef/richeditor/Utils.java: -------------------------------------------------------------------------------- 1 | package jp.wasabeef.richeditor; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.graphics.Canvas; 7 | import android.graphics.drawable.BitmapDrawable; 8 | import android.graphics.drawable.Drawable; 9 | import android.util.Base64; 10 | 11 | import java.io.ByteArrayOutputStream; 12 | 13 | /** 14 | * Copyright (C) 2020 Wasabeef 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | *
20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | *
22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | public final class Utils { 30 | 31 | private Utils() throws InstantiationException { 32 | throw new InstantiationException("This class is not for instantiation"); 33 | } 34 | 35 | public static String toBase64(Bitmap bitmap) { 36 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 37 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); 38 | byte[] bytes = baos.toByteArray(); 39 | 40 | return Base64.encodeToString(bytes, Base64.NO_WRAP); 41 | } 42 | 43 | public static Bitmap toBitmap(Drawable drawable) { 44 | if (drawable instanceof BitmapDrawable) { 45 | return ((BitmapDrawable) drawable).getBitmap(); 46 | } 47 | 48 | int width = drawable.getIntrinsicWidth(); 49 | width = width > 0 ? width : 1; 50 | int height = drawable.getIntrinsicHeight(); 51 | height = height > 0 ? height : 1; 52 | 53 | Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 54 | Canvas canvas = new Canvas(bitmap); 55 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 56 | drawable.draw(canvas); 57 | 58 | return bitmap; 59 | } 60 | 61 | public static Bitmap decodeResource(Context context, int resId) { 62 | return BitmapFactory.decodeResource(context.getResources(), resId); 63 | } 64 | 65 | public static long getCurrentTime() { 66 | return System.currentTimeMillis(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /richeditor/src/test/java/richeditor/UrlDecoderTest.java: -------------------------------------------------------------------------------- 1 | package richeditor; 2 | 3 | import android.net.Uri; 4 | 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.robolectric.RobolectricTestRunner; 9 | 10 | @RunWith(RobolectricTestRunner.class) 11 | public class UrlDecoderTest { 12 | 13 | @Test 14 | public void urlDecodeTest() throws Exception { 15 | String encoded = "re-callback://%20%20%3Cdiv%3E%3Cfont%20face=%22Arial%22%20size=%222%22%20color=%22#333333%22%3EDJK%20Besteck%3C/font%3E%3Cb%3E%3Cfont%20face=%22Arial%22%20size=%222%22%20color=%22#333333%22%3E Kenntnisse++_%20++ 下 ぁ ص%3C/font%3E%3C/b%3E%3C/div%3E%20"; 16 | String decoded = Uri.decode(encoded); 17 | 18 | String test = "re-callback://
DJK Besteck Kenntnisse++_ ++ 下 ぁ ص"; 19 | 20 | Assert.assertEquals(test, decoded); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion COMPILE_SDK_VERSION as int 5 | 6 | defaultConfig { 7 | minSdkVersion MIN_SDK_VERSION as int 8 | targetSdkVersion TARGET_SDK_VERSION as int 9 | versionCode VERSION_CODE as int 10 | versionName VERSION_NAME 11 | } 12 | 13 | // SigningConfigs 14 | apply from: '../signingConfigs/debug.gradle', to: android 15 | apply from: '../signingConfigs/release.gradle', to: android 16 | 17 | buildTypes { 18 | debug { 19 | debuggable true 20 | zipAlignEnabled true 21 | signingConfig signingConfigs.debug 22 | } 23 | release { 24 | debuggable false 25 | zipAlignEnabled true 26 | minifyEnabled true 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | shrinkResources true 29 | signingConfig signingConfigs.release 30 | } 31 | } 32 | } 33 | 34 | repositories { 35 | // maven { url = "https://oss.sonatype.org/content/repositories/snapshots"} 36 | } 37 | 38 | dependencies { 39 | implementation project(':richeditor') 40 | implementation "androidx.appcompat:appcompat:1.2.0" 41 | } 42 | -------------------------------------------------------------------------------- /sample/src/androidTest/java/jp/wasabeef/sample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package jp.wasabeef.sample; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase{ 10 | 11 | public ApplicationTest() { 12 | super(Application.class); 13 | } 14 | } -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 27 | -------------------------------------------------------------------------------- /sample/src/main/java/jp/wasabeef/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package jp.wasabeef.sample; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import androidx.appcompat.app.AppCompatActivity; 9 | 10 | import jp.wasabeef.richeditor.RichEditor; 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | 14 | private RichEditor mEditor; 15 | private TextView mPreview; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_main); 21 | mEditor = (RichEditor) findViewById(R.id.editor); 22 | mEditor.setEditorHeight(200); 23 | mEditor.setEditorFontSize(22); 24 | mEditor.setEditorFontColor(Color.RED); 25 | //mEditor.setEditorBackgroundColor(Color.BLUE); 26 | //mEditor.setBackgroundColor(Color.BLUE); 27 | //mEditor.setBackgroundResource(R.drawable.bg); 28 | mEditor.setPadding(10, 10, 10, 10); 29 | //mEditor.setBackground("https://raw.githubusercontent.com/wasabeef/art/master/chip.jpg"); 30 | mEditor.setPlaceholder("Insert text here..."); 31 | //mEditor.setInputEnabled(false); 32 | 33 | mPreview = (TextView) findViewById(R.id.preview); 34 | mEditor.setOnTextChangeListener(new RichEditor.OnTextChangeListener() { 35 | @Override 36 | public void onTextChange(String text) { 37 | mPreview.setText(text); 38 | } 39 | }); 40 | 41 | findViewById(R.id.action_undo).setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View v) { 44 | mEditor.undo(); 45 | } 46 | }); 47 | 48 | findViewById(R.id.action_redo).setOnClickListener(new View.OnClickListener() { 49 | @Override 50 | public void onClick(View v) { 51 | mEditor.redo(); 52 | } 53 | }); 54 | 55 | findViewById(R.id.action_bold).setOnClickListener(new View.OnClickListener() { 56 | @Override 57 | public void onClick(View v) { 58 | mEditor.setBold(); 59 | } 60 | }); 61 | 62 | findViewById(R.id.action_italic).setOnClickListener(new View.OnClickListener() { 63 | @Override 64 | public void onClick(View v) { 65 | mEditor.setItalic(); 66 | } 67 | }); 68 | 69 | findViewById(R.id.action_subscript).setOnClickListener(new View.OnClickListener() { 70 | @Override 71 | public void onClick(View v) { 72 | mEditor.setSubscript(); 73 | } 74 | }); 75 | 76 | findViewById(R.id.action_superscript).setOnClickListener(new View.OnClickListener() { 77 | @Override 78 | public void onClick(View v) { 79 | mEditor.setSuperscript(); 80 | } 81 | }); 82 | 83 | findViewById(R.id.action_strikethrough).setOnClickListener(new View.OnClickListener() { 84 | @Override 85 | public void onClick(View v) { 86 | mEditor.setStrikeThrough(); 87 | } 88 | }); 89 | 90 | findViewById(R.id.action_underline).setOnClickListener(new View.OnClickListener() { 91 | @Override 92 | public void onClick(View v) { 93 | mEditor.setUnderline(); 94 | } 95 | }); 96 | 97 | findViewById(R.id.action_heading1).setOnClickListener(new View.OnClickListener() { 98 | @Override 99 | public void onClick(View v) { 100 | mEditor.setHeading(1); 101 | } 102 | }); 103 | 104 | findViewById(R.id.action_heading2).setOnClickListener(new View.OnClickListener() { 105 | @Override 106 | public void onClick(View v) { 107 | mEditor.setHeading(2); 108 | } 109 | }); 110 | 111 | findViewById(R.id.action_heading3).setOnClickListener(new View.OnClickListener() { 112 | @Override 113 | public void onClick(View v) { 114 | mEditor.setHeading(3); 115 | } 116 | }); 117 | 118 | findViewById(R.id.action_heading4).setOnClickListener(new View.OnClickListener() { 119 | @Override 120 | public void onClick(View v) { 121 | mEditor.setHeading(4); 122 | } 123 | }); 124 | 125 | findViewById(R.id.action_heading5).setOnClickListener(new View.OnClickListener() { 126 | @Override 127 | public void onClick(View v) { 128 | mEditor.setHeading(5); 129 | } 130 | }); 131 | 132 | findViewById(R.id.action_heading6).setOnClickListener(new View.OnClickListener() { 133 | @Override 134 | public void onClick(View v) { 135 | mEditor.setHeading(6); 136 | } 137 | }); 138 | 139 | findViewById(R.id.action_txt_color).setOnClickListener(new View.OnClickListener() { 140 | private boolean isChanged; 141 | 142 | @Override 143 | public void onClick(View v) { 144 | mEditor.setTextColor(isChanged ? Color.BLACK : Color.RED); 145 | isChanged = !isChanged; 146 | } 147 | }); 148 | 149 | findViewById(R.id.action_bg_color).setOnClickListener(new View.OnClickListener() { 150 | private boolean isChanged; 151 | 152 | @Override 153 | public void onClick(View v) { 154 | mEditor.setTextBackgroundColor(isChanged ? Color.TRANSPARENT : Color.YELLOW); 155 | isChanged = !isChanged; 156 | } 157 | }); 158 | 159 | findViewById(R.id.action_indent).setOnClickListener(new View.OnClickListener() { 160 | @Override 161 | public void onClick(View v) { 162 | mEditor.setIndent(); 163 | } 164 | }); 165 | 166 | findViewById(R.id.action_outdent).setOnClickListener(new View.OnClickListener() { 167 | @Override 168 | public void onClick(View v) { 169 | mEditor.setOutdent(); 170 | } 171 | }); 172 | 173 | findViewById(R.id.action_align_left).setOnClickListener(new View.OnClickListener() { 174 | @Override 175 | public void onClick(View v) { 176 | mEditor.setAlignLeft(); 177 | } 178 | }); 179 | 180 | findViewById(R.id.action_align_center).setOnClickListener(new View.OnClickListener() { 181 | @Override 182 | public void onClick(View v) { 183 | mEditor.setAlignCenter(); 184 | } 185 | }); 186 | 187 | findViewById(R.id.action_align_right).setOnClickListener(new View.OnClickListener() { 188 | @Override 189 | public void onClick(View v) { 190 | mEditor.setAlignRight(); 191 | } 192 | }); 193 | 194 | findViewById(R.id.action_blockquote).setOnClickListener(new View.OnClickListener() { 195 | @Override 196 | public void onClick(View v) { 197 | mEditor.setBlockquote(); 198 | } 199 | }); 200 | 201 | findViewById(R.id.action_insert_bullets).setOnClickListener(new View.OnClickListener() { 202 | @Override 203 | public void onClick(View v) { 204 | mEditor.setBullets(); 205 | } 206 | }); 207 | 208 | findViewById(R.id.action_insert_numbers).setOnClickListener(new View.OnClickListener() { 209 | @Override 210 | public void onClick(View v) { 211 | mEditor.setNumbers(); 212 | } 213 | }); 214 | 215 | findViewById(R.id.action_insert_image).setOnClickListener(new View.OnClickListener() { 216 | @Override 217 | public void onClick(View v) { 218 | mEditor.insertImage("https://raw.githubusercontent.com/wasabeef/art/master/chip.jpg", 219 | "dachshund", 320); 220 | } 221 | }); 222 | 223 | findViewById(R.id.action_insert_youtube).setOnClickListener(new View.OnClickListener() { 224 | @Override 225 | public void onClick(View v) { 226 | mEditor.insertYoutubeVideo("https://www.youtube.com/embed/pS5peqApgUA"); 227 | } 228 | }); 229 | 230 | findViewById(R.id.action_insert_audio).setOnClickListener(new View.OnClickListener() { 231 | @Override 232 | public void onClick(View v) { 233 | mEditor.insertAudio("https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3"); 234 | } 235 | }); 236 | 237 | findViewById(R.id.action_insert_video).setOnClickListener(new View.OnClickListener() { 238 | @Override 239 | public void onClick(View v) { 240 | mEditor.insertVideo("https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_10MB.mp4", 360); 241 | } 242 | }); 243 | 244 | findViewById(R.id.action_insert_link).setOnClickListener(new View.OnClickListener() { 245 | @Override 246 | public void onClick(View v) { 247 | mEditor.insertLink("https://github.com/wasabeef", "wasabeef"); 248 | } 249 | }); 250 | findViewById(R.id.action_insert_checkbox).setOnClickListener(new View.OnClickListener() { 251 | @Override 252 | public void onClick(View v) { 253 | mEditor.insertTodo(); 254 | } 255 | }); 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/bg.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/bg_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/bg_color.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/blockquote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/blockquote.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/bold.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/bullets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/bullets.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/h1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/h1.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/h2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/h2.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/h3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/h3.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/h4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/h4.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/h5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/h5.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/h6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/h6.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/html_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/html_edit.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/indent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/indent.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/insert_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/insert_image.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/insert_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/insert_link.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/italic.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/justify_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/justify_center.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/justify_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/justify_left.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/justify_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/justify_right.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/music.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/numbers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/numbers.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/outdent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/outdent.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/redo.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/strikethrough.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/strikethrough.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/subscript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/subscript.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/superscript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/superscript.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/txt_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/txt_color.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/underline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/underline.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/undo.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/video.png -------------------------------------------------------------------------------- /sample/src/main/res/drawable-xxhdpi/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/drawable-xxhdpi/youtube.png -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 |9 | 10 | 16 | 25 | 26 |19 | 24 |20 | 23 |21 | 22 | 5 | 6 | 279 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 |10 | 11 | 259 | 260 |15 | 16 | 258 |23 | 24 | 31 | 32 | 39 | 40 | 47 | 48 | 55 | 56 | 63 | 64 | 71 | 72 | 79 | 80 | 87 | 88 | 95 | 96 | 103 | 104 | 111 | 112 | 119 | 120 | 127 | 128 | 135 | 136 | 143 | 144 | 145 | 152 | 153 | 160 | 161 | 168 | 169 | 176 | 177 | 184 | 185 | 192 | 193 | 200 | 201 | 208 | 209 | 216 | 217 | 224 | 225 | 232 | 233 | 240 | 241 | 248 | 249 | 256 | 257 | 264 | 265 | 271 | 272 | 277 | 278 | 2 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 |richeditor-android 3 |RichEditor Demo 4 |2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':richeditor' 2 | -------------------------------------------------------------------------------- /signingConfigs/debug.gradle: -------------------------------------------------------------------------------- 1 | signingConfigs { 2 | debug { 3 | storeFile file("debug.keystore") 4 | storePassword "android" 5 | keyAlias "androiddebugkey" 6 | keyPassword "android" 7 | } 8 | } 9 | 10 | // $ keytool -v -list -keystore 11 | // Certificate fingerprints: 12 | // MD5: 28:22:7C:A4:B9:2F:6E:C7:D5:58:62:48:EB:7E:82:C3 13 | // SHA1: 94:25:A9:50:9C:0E:AE:AA:00:37:5E:D6:71:E3:BC:ED:17:E5:0C:A3 14 | // SHA256: 04:92:39:09:3D:1C:B6:16:BE:55:58:A3:5F:3B:BB:CB:0B:E7:F1:DA:AA:26:C5:2D:BD:2F:44:CF:AE:47:CF:87 15 | -------------------------------------------------------------------------------- /signingConfigs/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/signingConfigs/debug.keystore -------------------------------------------------------------------------------- /signingConfigs/release.gradle: -------------------------------------------------------------------------------- 1 | signingConfigs { 2 | release { 3 | storeFile file("release.keystore") 4 | storePassword "takttakt" 5 | keyAlias "dummy" 6 | keyPassword "takttakt" 7 | } 8 | } 9 | 10 | // $ keytool -v -list -keystore 11 | // Certificate fingerprints: 12 | // MD5: E8:AB:EB:87:91:DA:8C:C1:0B:15:5C:0F:55:17:66:83 13 | // SHA1: 6C:EA:F9:AA:87:9E:4E:7F:98:EF:DE:EA:95:91:B5:82:82:F2:E7:61 14 | // SHA256: 2A:E7:56:DF:EB:4E:A6:F6:52:A3:9D:6B:50:BE:10:E8:40:4A:DA:0A:7C:76:58:1F:FD:A6:50:05:0B:D1:68:3D 15 | -------------------------------------------------------------------------------- /signingConfigs/release.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wasabeef/richeditor-android/ce152b910a59c66863baa68b007ac67e6b9de671/signingConfigs/release.keystore --------------------------------------------------------------------------------