Skip to content

Commit 411c933

Browse files
authored
Update README.md
1 parent 07b4aac commit 411c933

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,26 @@ CodeProcessor.init(this);
4040

4141
Having done ones on app start you can classify language for different snippets more faster, because algorithm needs time for training on sets for presented listings of languages library have.
4242

43-
Add view to your layout:
43+
Add view to your layout & bind as usual:
4444
```xml
4545
<io.github.kbiakov.codeview.CodeView
4646
android:id="@+id/code_view"
4747
android:layout_width="wrap_content"
4848
android:layout_height="wrap_content"/>
4949
```
50-
51-
So now you can set code:
5250
```java
53-
// bind view
5451
CodeView codeView = (CodeView) findViewById(R.id.code_view);
52+
```
53+
54+
So now you can set code using implicit form:
55+
```java
5556
// auto language recognition
5657
codeView.setCode(getString(R.string.listing_js));
57-
// explicit form (will work faster!), see available extensions below
58+
```
59+
60+
Or explicit (see available extensions below):
61+
```java
62+
// will work faster!
5863
codeView.setCode(getString(R.string.listing_py), "py");
5964
```
6065

@@ -70,16 +75,16 @@ codeView.setOptions(Options.Default.get(this)
7075
.withTheme(ColorTheme.MONOKAI));
7176
```
7277

73-
Or using adapter (see <b>Adapter customization<b/> or example for more details):
78+
Or using adapter (see <b>Adapter</b> or example for more details):
7479
```java
7580
final CustomAdapter myAdapter = new CustomAdapter(this, getString(R.string.listing_md));
7681
codeView.setAdapter(myAdapter);
7782
```
7883

7984
### Options
80-
<b>Options</b> helps to easily set necessary params, such as code & language, color theme, shortcut params & line click listener. Some params are unnecessary.
85+
Options helps to easily set necessary params, such as code & language, color theme, shortcut params & code line click listener. Some params are unnecessary.
8186

82-
When view initialized (options or adapter set) you can manipulate options in various ways:
87+
When view initialized (options or adapter are set) you can manipulate options in various ways:
8388
```java
8489
codeView.getOptions()
8590
.withCode(R.string.listing_java)
@@ -93,7 +98,7 @@ There are some default themes (see full list below):
9398
codeView.getOptions().setTheme(ColorTheme.SOLARIZED_LIGHT);
9499
```
95100

96-
But you can build your own from existing:
101+
But you can build your own from existing one:
97102
```java
98103
ColorThemeData myTheme = ColorTheme.SOLARIZED_LIGHT.theme()
99104
.withBgContent(android.R.color.black)

0 commit comments

Comments
 (0)