Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/susmit-a/androidaceeditor
Ace editor for use in android apps
https://github.com/susmit-a/androidaceeditor
android android-library hacktoberfest hacktoberfest18 hacktoberfest2018 help-wanted java javascript
Last synced: 4 months ago
JSON representation
Ace editor for use in android apps
- Host: GitHub
- URL: https://github.com/susmit-a/androidaceeditor
- Owner: Susmit-A
- License: bsd-3-clause
- Created: 2018-01-25T10:31:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T08:52:04.000Z (almost 7 years ago)
- Last Synced: 2023-03-06T18:32:56.899Z (almost 2 years ago)
- Topics: android, android-library, hacktoberfest, hacktoberfest18, hacktoberfest2018, help-wanted, java, javascript
- Language: JavaScript
- Size: 1.73 MB
- Stars: 12
- Watchers: 2
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AndroidAceEditor
This is a text/code editor meant for integration as a modular component of the overall UI.
The aim is to provide a powerful editor that can be used just like any other View.Ace text editor has been used for this purpose because it is feature-rich, fast, and easy to modify and embed in applications.
Please note that this library is currently supported on android versions 5.0(Lollipop) and above.
Integration with existing project
---### Setup
##### build.gradle (project)
```groovy
allprojects {
repositories {
...
maven {
url 'https://jitpack.io'
}
}
}
```#### build.gradle (app)
```groovy
dependencies {
...
compile 'com.github.Susmit-A:AndroidAceEditor:0.5.0'
}
```### Basic Usage
#### XML
```xml
......
```#### Java
Demo Activity:
```java
public class MainActivity extends Activity {@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editor = findViewById(R.id.editor);
//call this to set up themes or modes at time of creation of view.
//If you are setting the theme or mode through another view's action,
//call setTheme and/or setMode directly
editor.setOnLoadedEditorListener(new OnLoadedEditorListener() {
@Override
public void onCreate() {
editor.setTheme(AceEditor.Theme.TERMINAL);
editor.setMode(AceEditor.Mode.C_Cpp);
}
});
//Since a WebView is used for the content, you need to set the following listener to process the text
//It is also used to retrive other values, such as selected text or number of lines
editor.setResultReceivedListener(new ResultReceivedListener() {
@Override
public void onReceived(String text, int FLAG_VALUE) {
if(FLAG_VALUE == AceEditor.Request.VALUE_TEXT)
{
Toast.makeText(MainActivity.this, "Typed text:\n\n" + text, Toast.LENGTH_SHORT).show();
}
}
});
}
}
```