Skip to content

Commit 36e3cbe

Browse files
committed
2 parents f37a8cb + 99b31b7 commit 36e3cbe

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

README.md

+87
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,89 @@
11
# Syntax-View-Android
22
Beautiful Android Syntax View with line counter it will automatically highlight the code,you can design your own IDE using this view
3+
4+
# Example
5+
Colors can be modified as you want
6+
7+
![Screenshot](http://cryptobrewery.net/scn/3.png)
8+
9+
# How to add to your app
10+
11+
add this to your dependencies in build.gradle file
12+
```
13+
implementation 'com.github.Badranh:Syntax-View-Android:0.1.0'
14+
```
15+
Add it in your root build.gradle at the end of repositories:
16+
17+
```
18+
allprojects {
19+
repositories {
20+
...
21+
maven { url 'https://jitpack.io' }
22+
}
23+
}
24+
```
25+
26+
# USAGE
27+
<b>1st way:</b>
28+
29+
- Step 1:
30+
add this to your activity_main.xml or any other activity you want:
31+
```
32+
<net.cryptobrewery.syntaxview.SyntaxView
33+
android:id="@+id/syn"
34+
android:layout_width="match_parent"
35+
android:layout_height="match_parent">
36+
</net.cryptobrewery.syntaxview.SyntaxView>
37+
```
38+
- Step 2:
39+
add this to your java code
40+
```
41+
//declaration
42+
SyntaxView syntax_view = findViewById(R.id.syn);
43+
44+
//this will set the color of Code Text background
45+
syntax_view.setBgColor("#2b2b2b");
46+
//this will set the color of strings between " "
47+
syntax_view.setPrintStatmentsColor("#6a8759");
48+
//this will set the default code text color other than programming keywords!
49+
syntax_view.setCodeTextColor("#ffffff");
50+
//this will set programming keywords color like String,int,for,etc...
51+
syntax_view.setKeywordsColor("#cc7832");
52+
//this will set the numbers color in code | ex: return 0; 0 will be colored
53+
syntax_view.setNumbersColor("#4a85a3");
54+
//this will set the line number view background color at left
55+
syntax_view.setRowNumbersBgColor("#2b2b2b");
56+
//this will set the color of numbers in the line number view at left
57+
syntax_view.setRowNumbersColor("#cc7832");
58+
//this will set color of Annotations like super,@Nullable,etc ....
59+
syntax_view.setAnnotationsColor("#1932F3");
60+
//this will set special characters color like ;
61+
syntax_view.setSpecialCharsColor("#cc7832");
62+
63+
```
64+
<b>2nd way:</b>
65+
```
66+
//this way will set default methods
67+
SyntaxView syntax_view = new SyntaxView(this);
68+
setContentView(syntax_view);
69+
```
70+
<b>3rd way:</b>
71+
```
72+
//other colors can be set manually if needed using set methods like setAnnotationsColor
73+
SyntaxView syntax_view = new SyntaxView(this,"#2b2b2b","#cc7832","#4a85a3","#cc7832","#6a8759");
74+
setContentView(syntax_view);
75+
```
76+
# Changes:
77+
6/25/2018:
78+
- Uploaded Syntax View
79+
- Syntax Highlighting
80+
- Line Number Counter
81+
- Color Flexibility to meet user requirements
82+
83+
# Contribute
84+
Next update:
85+
- User will have the ability to choose a language like " C,Java,Python" So we can do a faster UI and Highlighting(feel free to implement this update if you are able to do so)
86+
- You can contribute to this project for missing programming key words so we can include
87+
them in the next update.
88+
89+
License : MIT

0 commit comments

Comments
 (0)