Skip to content

Commit 9c1f6b7

Browse files
Update README.md
1 parent 70ab80a commit 9c1f6b7

1 file changed

Lines changed: 37 additions & 65 deletions

File tree

README.md

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,47 @@ Moxy has a few killer features in other ways:
1818
## Sample
1919

2020
View interface
21-
```java
22-
public interface HelloWorldView extends MvpView {
23-
void showMessage(int message);
21+
```kotlin
22+
interface HelloWorldView: MvpView {
23+
24+
var waiting: Boolean
25+
26+
@MoxyViewCommand(ONE_EXECUTION)
27+
fun showMessage(int message)
28+
2429
}
2530
```
2631
Presenter
27-
```java
28-
@InjectViewState
29-
public class HelloWorldPresenter extends MvpPresenter<HelloWorldView> {
30-
public HelloWorldPresenter() {
31-
getViewState().showMessage(R.string.hello_world);
32-
}
32+
```kotlin
33+
class HelloWorldPresenter: MvpPresenter<HelloWorldView> {
34+
35+
init {
36+
viewState.showMessage(R.string.hello_world)
37+
}
38+
3339
}
3440
```
3541
View implementation
36-
```java
37-
public class HelloWorldActivity extends MvpAppCompatActivity implements HelloWorldView {
42+
```kotlin
43+
class HelloWorldActivity: MvpAppCompatActivity, HelloWorldView {
3844

39-
@InjectPresenter
40-
HelloWorldPresenter mHelloWorldPresenter;
45+
private val helloWorldPresenter: HelloWorldPresenter by providePresenter {
46+
HelloWorldPresenter()
47+
}
4148

42-
private TextView mHelloWorldTextView;
49+
private lateinit var helloWorldTextView: TextView
4350

44-
@Override
45-
protected void onCreate(Bundle savedInstanceState) {
46-
super.onCreate(savedInstanceState);
47-
setContentView(R.layout.activity_hello_world);
51+
override fun onCreate(savedInstanceState: Bundle?) {
52+
super.onCreate(savedInstanceState)
53+
setContentView(R.layout.activity_hello_world)
4854

49-
mHelloWorldTextView = ((TextView) findViewById(R.id.activity_hello_world_text_view_message));
50-
}
55+
helloWorldTextView = findViewById<TextView>(R.id.activity_hello_world_text_view_message)
56+
}
5157

52-
@Override
53-
public void showMessage(int message) {
54-
mHelloWorldTextView.setText(message);
55-
}
58+
@Override
59+
override fun showMessage(message: Int) {
60+
helloWorldTextView.setText(message)
61+
}
5662
}
5763
```
5864

@@ -61,14 +67,7 @@ public class HelloWorldActivity extends MvpAppCompatActivity implements HelloWor
6167
## Wiki
6268
For all information check [Moxy Wiki](https://github.com/Arello-Mobile/Moxy/wiki)
6369

64-
## Android studio templates
65-
In order to avoid boilerplate code creating for binding activity, fragments and its presentation part, we propose to use Android Studio templates for Moxy.
66-
67-
Templates located in [/moxy-templates](https://github.com/Arello-Mobile/Moxy/tree/master/moxy-templates)
68-
6970
## Links
70-
[Telegram channel (en)](https://telegram.me/moxy_mvp_library)<br />
71-
[Telegram channel (ru)](https://telegram.me/moxy_ru)<br />
7271
[References](https://github.com/Arello-Mobile/Moxy/wiki#references)<br />
7372
[FAQ](https://github.com/Arello-Mobile/Moxy/wiki/FAQ)
7473

@@ -84,45 +83,18 @@ allprojects {
8483
}
8584
```
8685

87-
Base modules integration:
88-
```groovy
89-
dependencies {
90-
...
91-
implementation 'com.github.Omega-R.OmegaMoxy:moxy:1.5.7'
92-
annotationProcessor 'com.github.Omega-R.OmegaMoxy:moxy-compiler:1.5.7'
93-
}
94-
```
95-
For additional base view classes `MvpActivity` and `MvpFragment` add this:
86+
Add dependency:
9687
```groovy
97-
dependencies {
98-
...
99-
implementation 'com.github.Omega-R.OmegaMoxy:moxy-android:1.5.7'
100-
}
101-
```
10288
103-
If you are planning to use AndroidX, then you can use `MvpAppCompatActivity` and `MvpAppCompatFragment`. Then add this:
104-
```groovy
105-
dependencies {
106-
...
107-
implementation 'com.github.Omega-R.OmegaMoxy:moxy-androidx:1.5.7'
89+
plugins {
90+
id 'com.google.devtools.ksp' version '1.9.0-1.0.11' apply false
10891
}
109-
```
110-
If you are planning to use AppCompat, then you can use `MvpAppCompatActivity` and `MvpAppCompatFragment`. Then add this:
111-
```groovy
112-
dependencies {
113-
...
114-
implementation 'com.github.Omega-R.OmegaMoxy:moxy-app-compat:1.5.7'
115-
implementation 'com.android.support:appcompat-v7:$support_version'
116-
}
117-
```
118-
### Kotlin
119-
If you are using kotlin, use `kapt` instead of `provided`/`apt` dependency type:
120-
```groovy
121-
apply plugin: 'kotlin-kapt'
12292
12393
dependencies {
12494
...
125-
kapt 'com.github.Omega-R.OmegaMoxy:moxy-compiler:1.5.7'
95+
implementation 'com.github.Omega-R.OmegaMoxy:moxy:3.1.0'
96+
implementation 'com.github.Omega-R.OmegaMoxy:moxy-androidx:3.1.0'
97+
ksp 'com.github.Omega-R.OmegaMoxy:moxy-compiler:3.1.0'
12698
}
12799
```
128100

@@ -133,7 +105,7 @@ Moxy is completely without reflection! No special ProGuard rules required.
133105
```
134106
The MIT License (MIT)
135107
136-
Copyright (c) 2016 Arello Mobile
108+
Copyright (c) 2023 Omega
137109
138110
Permission is hereby granted, free of charge, to any person obtaining a copy
139111
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)