Skip to content

Commit

Permalink
Create Readme file
Browse files Browse the repository at this point in the history
Create readme for doc, demo and how to use
  • Loading branch information
AmrDeveloper authored Aug 16, 2020
1 parent 71849c2 commit 5abbaec
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# CodeView
[![Min API Level](https://img.shields.io/badge/API-%2B14-brightgreen)]()

Android Library to make it easy to create your CodeEditor or IDE for any programming language
even for your own programming language, just config the view with your langauge keywords and other attributes
and you can change CodeView theme in the runtime so it's make easy to support any number of themes,
and CodeView has AutoComplete and you can customize it with different keywords and tokenizers

### Demo
<p align="center">
<img src="screenshots/python_demo.gif" alt="animated" />
<img src="screenshots/java_demo.gif" alt="animated" />
<img src="screenshots/golang_demo.gif" alt="animated" />
</p>

### Main Features:
- Can support any programming langauge you want
- Can support AutoComplete and customize it with different tokenizers and design
- Can support any theme you want and change it in the runtime
- Syntax Hightlighter depend on your patterns so you can support any features like TODO comment
- Can support errors and warns with different colors and remove them in the runtime
- Can change highlgihter update delay time

#### Who uses CodeView?
- [MathScript](https://play.google.com/store/apps/details?id=com.amrdeveloper.mathscript)

##### If you use CodeView in an interesting project, I would like to know!

#### Documentation:
CodeView is based on AppCompatMultiAutoCompleteTextView

Add CodeView on your xml

```xml
<com.amrdeveloper.codeview.CodeView
android:id="@+id/codeView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/darkGrey"
android:dropDownWidth="@dimen/dimen150dp"
android:dropDownHorizontalOffset="0dp"
android:dropDownSelector="@color/darkGrey"
android:gravity="top|start" />
```

Initalize CodeView

```java
CodeView codeView = findViewById(R.id.codeview);
```

Clear all patterns from CodeView

```java
codeView.resetSyntaxPatternList();
```

Add Patterns for your language, you can add any number of patterns

```java
codeView.addSyntaxPattern(pattern, Color);
```

Or add all patterns as an Map Object

```java
codeView.setSyntaxPatternsMap(syntaxPatterns);
```

Rehighlight the text depend on the new patterns

```java
codeView.reHighlightSyntax();
```

Add error line with dynamic color to support error, hint, warn...etc

```java
codeView.addErrorLine(lineNumber, color);
```

Clear all error lines

```java
codeView.removeAllErrorLines();
```

Rehighlight the erros depend on the error lines

```java
codeView.reHighlightErrors();
```

Add Custom AutoComplete Adapter

```java
//Your langauge keywords
String[] languageKeywords = .....
//List item custom layout
int layoutId = .....
//TextView id on your custom layout to put suggestion on it
int viewId = .....
//Create ArrayAdapter object that contain all information
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, layoutId, viewId, languageKeywords);
//Set the adapter on CodeView object
codeView.setAdapter(adapter);
```

Add Custom AutoComplete Tokenizer

```java
codeView.setAutoCompleteTokenizer(tokenizer);
```

Set highlighter update delay

```java
codeView.setUpdateDelayTime();
```

#### For real examples on how to use CodeView check the example app

0 comments on commit 5abbaec

Please sign in to comment.