Skip to content

Commit 5abbaec

Browse files
authored
Create Readme file
Create readme for doc, demo and how to use
1 parent 71849c2 commit 5abbaec

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

README.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# CodeView
2+
[![Min API Level](https://img.shields.io/badge/API-%2B14-brightgreen)]()
3+
4+
Android Library to make it easy to create your CodeEditor or IDE for any programming language
5+
even for your own programming language, just config the view with your langauge keywords and other attributes
6+
and you can change CodeView theme in the runtime so it's make easy to support any number of themes,
7+
and CodeView has AutoComplete and you can customize it with different keywords and tokenizers
8+
9+
### Demo
10+
<p align="center">
11+
<img src="screenshots/python_demo.gif" alt="animated" />
12+
<img src="screenshots/java_demo.gif" alt="animated" />
13+
<img src="screenshots/golang_demo.gif" alt="animated" />
14+
</p>
15+
16+
### Main Features:
17+
- Can support any programming langauge you want
18+
- Can support AutoComplete and customize it with different tokenizers and design
19+
- Can support any theme you want and change it in the runtime
20+
- Syntax Hightlighter depend on your patterns so you can support any features like TODO comment
21+
- Can support errors and warns with different colors and remove them in the runtime
22+
- Can change highlgihter update delay time
23+
24+
#### Who uses CodeView?
25+
- [MathScript](https://play.google.com/store/apps/details?id=com.amrdeveloper.mathscript)
26+
27+
##### If you use CodeView in an interesting project, I would like to know!
28+
29+
#### Documentation:
30+
CodeView is based on AppCompatMultiAutoCompleteTextView
31+
32+
Add CodeView on your xml
33+
34+
```xml
35+
<com.amrdeveloper.codeview.CodeView
36+
android:id="@+id/codeView"
37+
android:layout_width="match_parent"
38+
android:layout_height="match_parent"
39+
android:background="@color/darkGrey"
40+
android:dropDownWidth="@dimen/dimen150dp"
41+
android:dropDownHorizontalOffset="0dp"
42+
android:dropDownSelector="@color/darkGrey"
43+
android:gravity="top|start" />
44+
```
45+
46+
Initalize CodeView
47+
48+
```java
49+
CodeView codeView = findViewById(R.id.codeview);
50+
```
51+
52+
Clear all patterns from CodeView
53+
54+
```java
55+
codeView.resetSyntaxPatternList();
56+
```
57+
58+
Add Patterns for your language, you can add any number of patterns
59+
60+
```java
61+
codeView.addSyntaxPattern(pattern, Color);
62+
```
63+
64+
Or add all patterns as an Map Object
65+
66+
```java
67+
codeView.setSyntaxPatternsMap(syntaxPatterns);
68+
```
69+
70+
Rehighlight the text depend on the new patterns
71+
72+
```java
73+
codeView.reHighlightSyntax();
74+
```
75+
76+
Add error line with dynamic color to support error, hint, warn...etc
77+
78+
```java
79+
codeView.addErrorLine(lineNumber, color);
80+
```
81+
82+
Clear all error lines
83+
84+
```java
85+
codeView.removeAllErrorLines();
86+
```
87+
88+
Rehighlight the erros depend on the error lines
89+
90+
```java
91+
codeView.reHighlightErrors();
92+
```
93+
94+
Add Custom AutoComplete Adapter
95+
96+
```java
97+
//Your langauge keywords
98+
String[] languageKeywords = .....
99+
//List item custom layout
100+
int layoutId = .....
101+
//TextView id on your custom layout to put suggestion on it
102+
int viewId = .....
103+
//Create ArrayAdapter object that contain all information
104+
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, layoutId, viewId, languageKeywords);
105+
//Set the adapter on CodeView object
106+
codeView.setAdapter(adapter);
107+
```
108+
109+
Add Custom AutoComplete Tokenizer
110+
111+
```java
112+
codeView.setAutoCompleteTokenizer(tokenizer);
113+
```
114+
115+
Set highlighter update delay
116+
117+
```java
118+
codeView.setUpdateDelayTime();
119+
```
120+
121+
#### For real examples on how to use CodeView check the example app

0 commit comments

Comments
 (0)