Skip to content

Commit 23e705d

Browse files
author
Hasan Badran
committed
Improved set color method,Migrated project to androidX, Improved overall code
2 parents a2b9156 + 217db87 commit 23e705d

File tree

28 files changed

+353
-688
lines changed

28 files changed

+353
-688
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Colors can be modified as you want
1010

1111
add this to your dependencies in build.gradle file
1212
```
13-
implementation 'com.github.Badranh:Syntax-View-Android:0.1.2'
13+
implementation 'com.github.Badranh:Syntax-View-Android:0.1.4'
1414
```
1515
Add it in your root build.gradle at the end of repositories:
1616

@@ -125,6 +125,13 @@ syntax_view.checkMyCode();
125125
- Added CheckMyCode Method To Check Code Paranthesis Validity
126126
- Changed the old font
127127
- Added a new method to change the Font
128+
129+
# Apps that has itegrated this library
130+
Let me know if you have implemented this library in your app : [email protected] so I can list your app below :)!
131+
Apps:
132+
133+
https://github.com/Badranh/Android-Coding-IDE-APP/
134+
128135
# Contribute
129136
Next update:
130137
- 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)

app/build.gradle

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
apply plugin: 'com.android.application'
2-
3-
android {
4-
compileSdkVersion 26
5-
defaultConfig {
6-
applicationId "net.cryptobrewery.syntaxviewexample"
7-
minSdkVersion 16
8-
targetSdkVersion 26
9-
versionCode 1
10-
versionName "1.0"
11-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12-
}
13-
buildTypes {
14-
release {
15-
minifyEnabled false
16-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17-
}
18-
}
19-
}
20-
21-
dependencies {
22-
implementation fileTree(include: ['*.jar'], dir: 'libs')
23-
implementation 'com.android.support:appcompat-v7:26.1.0'
24-
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
25-
testImplementation 'junit:junit:4.12'
26-
androidTestImplementation 'com.android.support.test:runner:1.0.1'
27-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
28-
implementation project(':syntax-view')
29-
}
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "net.cryptobrewery.syntaxviewexample"
7+
minSdkVersion 16
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(include: ['*.jar'], dir: 'libs')
23+
implementation 'androidx.appcompat:appcompat:1.0.2'
24+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
25+
testImplementation 'junit:junit:4.12'
26+
androidTestImplementation 'androidx.test:runner:1.1.1'
27+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
28+
implementation project(':syntax-view')
29+
}
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
package net.cryptobrewery.syntaxviewexample;
2-
3-
import android.content.Context;
4-
import android.support.test.InstrumentationRegistry;
5-
import android.support.test.runner.AndroidJUnit4;
6-
7-
import org.junit.Test;
8-
import org.junit.runner.RunWith;
9-
10-
import static org.junit.Assert.*;
11-
12-
/**
13-
* Instrumented test, which will execute on an Android device.
14-
*
15-
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16-
*/
17-
@RunWith(AndroidJUnit4.class)
18-
public class ExampleInstrumentedTest {
19-
@Test
20-
public void useAppContext() throws Exception {
21-
// Context of the app under test.
22-
Context appContext = InstrumentationRegistry.getTargetContext();
23-
24-
assertEquals("net.cryptobrewery.syntaxviewexample", appContext.getPackageName());
25-
}
26-
}
1+
package net.cryptobrewery.syntaxviewexample;
2+
3+
import android.content.Context;
4+
import androidx.test.InstrumentationRegistry;
5+
import androidx.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("net.cryptobrewery.syntaxviewexample", appContext.getPackageName());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,67 @@
1-
package net.cryptobrewery.syntaxviewexample;
2-
3-
import android.support.v7.app.AppCompatActivity;
4-
import android.os.Bundle;
5-
import android.text.Editable;
6-
import android.text.TextWatcher;
7-
import android.util.Log;
8-
9-
import net.cryptobrewery.syntaxview.SyntaxView;
10-
11-
public class MainActivity extends AppCompatActivity {
12-
13-
@Override
14-
protected void onCreate(Bundle savedInstanceState) {
15-
super.onCreate(savedInstanceState);
16-
setContentView(R.layout.
17-
activity_main);
18-
final SyntaxView syntax_view = findViewById(R.id.syn);
19-
20-
//this will set the color of Code Text background
21-
syntax_view.setBgColor("#2b2b2b");
22-
//this will set the color of strings between " "
23-
syntax_view.setPrintStatmentsColor("#6a8759");
24-
//this will set the default code text color other than programming keywords!
25-
syntax_view.setCodeTextColor("#ffffff");
26-
//this will set programming keywords color like String,int,for,etc...
27-
syntax_view.setKeywordsColor("#cc7832");
28-
//this will set the numbers color in code | ex: return 0; 0 will be colored
29-
syntax_view.setNumbersColor("#4a85a3");
30-
//this will set the line number view background color at left
31-
syntax_view.setRowNumbersBgColor("#2b2b2b");
32-
//this will set the color of numbers in the line number view at left
33-
syntax_view.setRowNumbersColor("#cc7832");
34-
//this will set color of Annotations like super,@Nullable,etc ....
35-
syntax_view.setAnnotationsColor("#1932F3");
36-
//this will set special characters color like ;
37-
syntax_view.setSpecialCharsColor("#cc7832");
38-
syntax_view.setAutoIndent(true);
39-
//you can change the font
40-
//code:
41-
// Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "yourFont.ttf");
42-
//syntax_view.setFont(tf);
43-
44-
//code Validation parenthesis this method will check code once called for one time only
45-
syntax_view.checkMyCode();
46-
47-
//on text change listener
48-
syntax_view.getCode().addTextChangedListener(new TextWatcher() {
49-
@Override
50-
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
51-
}
52-
53-
@Override
54-
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
55-
//listen for live changes
56-
Log.d("tester",charSequence.toString());
57-
58-
}
59-
60-
@Override
61-
public void afterTextChanged(Editable editable) {
62-
63-
}
64-
});
65-
}
66-
}
1+
package net.cryptobrewery.syntaxviewexample;
2+
3+
import android.os.Bundle;
4+
import android.text.Editable;
5+
import android.text.TextWatcher;
6+
import android.util.Log;
7+
8+
import androidx.appcompat.app.AppCompatActivity;
9+
10+
import net.cryptobrewery.syntaxview.SyntaxView;
11+
12+
public class MainActivity extends AppCompatActivity {
13+
14+
@Override
15+
protected void onCreate(Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
setContentView(R.layout.
18+
activity_main);
19+
final SyntaxView syntax_view = findViewById(R.id.syn);
20+
21+
//this will set the color of Code Text background
22+
syntax_view.setBgColor("#2b2b2b");
23+
//this will set the color of strings between " "
24+
syntax_view.setPrintStatmentsColor("#6a8759");
25+
//this will set the default code text color other than programming keywords!
26+
syntax_view.setCodeTextColor("#ffffff");
27+
//this will set programming keywords color like String,int,for,etc...
28+
syntax_view.setKeywordsColor("#cc7832");
29+
//this will set the numbers color in code | ex: return 0; 0 will be colored
30+
syntax_view.setNumbersColor("#4a85a3");
31+
//this will set the line number view background color at left
32+
syntax_view.setRowNumbersBgColor("#2b2b2b");
33+
//this will set the color of numbers in the line number view at left
34+
syntax_view.setRowNumbersColor("#cc7832");
35+
//this will set color of Annotations like super,@Nullable,etc ....
36+
syntax_view.setAnnotationsColor("#1932F3");
37+
//this will set special characters color like ;
38+
syntax_view.setSpecialCharsColor("#cc7832");
39+
syntax_view.setAutoIndent(false);
40+
//you can change the font
41+
//code:
42+
// Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "yourFont.ttf");
43+
//syntax_view.setFont(tf);
44+
45+
//code Validation parenthesis this method will check code once called for one time only
46+
syntax_view.checkMyCode();
47+
48+
//on text change listener
49+
syntax_view.getCode().addTextChangedListener(new TextWatcher() {
50+
@Override
51+
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
52+
}
53+
54+
@Override
55+
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
56+
//listen for live changes
57+
Log.d("tester",charSequence.toString());
58+
59+
}
60+
61+
@Override
62+
public void afterTextChanged(Editable editable) {
63+
64+
}
65+
});
66+
}
67+
}
+14-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
4-
xmlns:tools="http://schemas.android.com/tools"
5-
android:layout_width="match_parent"
6-
android:layout_height="match_parent"
7-
tools:context="net.cryptobrewery.syntaxviewexample.MainActivity">
8-
9-
<net.cryptobrewery.syntaxview.SyntaxView
10-
android:id="@+id/syn"
11-
android:layout_width="match_parent"
12-
android:layout_height="match_parent"/>
13-
14-
15-
</RelativeLayout>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
tools:context="net.cryptobrewery.syntaxviewexample.MainActivity">
7+
8+
<net.cryptobrewery.syntaxview.SyntaxView
9+
android:id="@+id/syn"
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"/>
12+
13+
14+
</RelativeLayout>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
package net.cryptobrewery.syntaxviewexample;
2-
3-
import org.junit.Test;
4-
5-
import static org.junit.Assert.*;
6-
7-
/**
8-
* Example local unit test, which will execute on the development machine (host).
9-
*
10-
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11-
*/
12-
public class ExampleUnitTest {
13-
@Test
14-
public void addition_isCorrect() throws Exception {
15-
assertEquals(4, 2 + 2);
16-
}
1+
package net.cryptobrewery.syntaxviewexample;
2+
3+
4+
import org.junit.Test;
5+
6+
import static org.junit.Assert.*;
7+
8+
/**
9+
* Example local unit test, which will execute on the development machine (host).
10+
*
11+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
12+
*/
13+
class ExampleUnitTest {
14+
@Test
15+
public void addition_isCorrect() {
16+
assertEquals(4, 2 + 2);
17+
}
1718
}

colorview/.gitignore

-1
This file was deleted.

colorview/build.gradle

-37
This file was deleted.

colorview/proguard-rules.pro

-21
This file was deleted.

0 commit comments

Comments
 (0)