Skip to content

Commit 3104610

Browse files
Merge pull request #10 from Omega-R/develop
Develop
2 parents 1726e7a + 57aa708 commit 3104610

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2033
-271
lines changed

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,31 @@ android {
2525
pickFirst 'META-INF/atomicfu.kotlin_module'
2626
pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
2727
}
28+
29+
30+
compileOptions {
31+
sourceCompatibility JavaVersion.VERSION_1_8
32+
targetCompatibility JavaVersion.VERSION_1_8
33+
}
34+
2835
}
2936

3037
dependencies {
3138
implementation fileTree(include: ['*.jar'], dir: 'libs')
32-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
33-
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
34-
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
35-
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
36-
testImplementation 'junit:junit:4.12'
37-
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
38-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
39+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
40+
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
41+
implementation 'androidx.core:core-ktx:1.1.0-beta01'
42+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlinCorutines_version}"
43+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${kotlinCorutines_version}"
44+
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha5'
45+
testImplementation 'junit:junit:4.13-beta-3'
46+
androidTestImplementation 'androidx.test:runner:1.2.0-beta01'
47+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-beta01'
3948
implementation project(':lib')
40-
implementation 'com.github.Omega-R:OmegaRecyclerView:1.9.4'
49+
implementation "com.github.Omega-R:OmegaRecyclerView:${omegaRecyclerView}"
4150
implementation 'com.github.Omega-R.OmegaMoxy:moxy:1.5.7'
4251
implementation 'com.github.Omega-R.OmegaMoxy:moxy-androidx:1.5.7'
4352
kapt 'com.github.Omega-R.OmegaMoxy:moxy-compiler:1.5.7'
44-
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:0.2.0'
53+
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:ae42598df9'
4554

4655
}

app/src/main/java/com/omega_r/base/simple/MainActivity.kt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
package com.omega_r.base.simple
22

33
import android.view.View
4+
import androidx.recyclerview.widget.RecyclerView
45
import com.omega_r.base.adapters.OmegaAutoAdapter
56
import com.omega_r.base.annotations.OmegaContentView
67
import com.omega_r.base.binders.IdHolder
78
import com.omega_r.base.components.OmegaActivity
8-
import com.omega_r.libs.omegarecyclerview.OmegaRecyclerView
99
import com.omega_r.libs.omegatypes.Text
10+
import com.omegar.mvp.presenter.InjectPresenter
1011

1112
@OmegaContentView(R.layout.activity_main)
12-
class MainActivity : OmegaActivity(), OmegaAutoAdapter.Callback<MainActivity.Item> {
13+
class MainActivity : OmegaActivity(), MainView {
1314

14-
private val adapter = OmegaAutoAdapter.create(R.layout.item_test, this) {
15+
@InjectPresenter
16+
override lateinit var presenter: MainPresenter
17+
18+
private val adapter = OmegaAutoAdapter.create(R.layout.item_test, R.layout.item_test2, ::onClickItem) {
1519
bind(R.id.textview_test, Item::text)
20+
bindClick(R.id.textview_test1) {
21+
showToast(Text.from("MENU!"))
22+
}
1623
bindRecycler(R.id.recyclerview, R.layout.item_test, Item::list) {
1724
bind(R.id.textview_test, SubItem::text)
1825
}
26+
}.apply {
27+
list = listOf(Item(), Item())
1928
}
2029

21-
private val recyclerView: OmegaRecyclerView by bind(R.id.recyclerview) {
22-
this@MainActivity.adapter.list = listOf(Item(), Item())
23-
adapter = this@MainActivity.adapter
24-
}
30+
private val recyclerView: RecyclerView by bind(R.id.recyclerview, adapter)
2531

2632
private val maps: Map<Field, View> by bind(Field.values()) {
2733
showToast(Text.from(it.id.toString()))
2834
}
2935

30-
override fun onClickItem(item: Item, position: Int) {
31-
showToast(Text.from("Click $position"))
36+
private fun onClickItem(item: Item) {
37+
showToast(Text.from("Click $item"))
3238
}
3339

3440
data class Item (val text: String = "123", val list: List<SubItem> = listOf(SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem()))
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.omega_r.base.simple
2+
3+
import com.omega_r.base.mvp.OmegaPresenter
4+
import com.omega_r.base.mvp.model.Action
5+
import com.omega_r.libs.omegatypes.Text
6+
import com.omegar.mvp.InjectViewState
7+
8+
/**
9+
* Created by Anton Knyazev on 06.05.19.
10+
*/
11+
@InjectViewState
12+
class MainPresenter : OmegaPresenter<MainView>() {
13+
14+
init {
15+
viewState.showMessage(Text.from("test"), Action(Text.from("Test")){
16+
viewState.showToast(Text.from("test"))
17+
})
18+
19+
viewState.showQuery(Text.from("message"), Text.from("title"), positiveAction = Action("Yes") {
20+
21+
}, negativeAction = Action("No", {
22+
23+
}))
24+
25+
}
26+
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.omega_r.base.simple
2+
3+
import com.omega_r.base.mvp.OmegaView
4+
5+
interface MainView: OmegaView {
6+
7+
8+
9+
}

app/src/main/res/layout/item_test.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/text"
34
android:orientation="vertical"
45
android:layout_width="match_parent"
56
android:layout_height="wrap_content"
@@ -9,7 +10,8 @@
910
<TextView
1011
android:id="@+id/textview_test"
1112
android:layout_width="wrap_content"
12-
android:layout_height="wrap_content"/>
13+
android:layout_height="wrap_content"
14+
/>
1315

1416
<com.omega_r.libs.omegarecyclerview.OmegaRecyclerView
1517
android:id="@+id/recyclerview"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical"
4+
android:layout_width="wrap_content"
5+
android:layout_height="wrap_content"
6+
android:background="?selectableItemBackground">
7+
8+
<TextView
9+
android:id="@+id/textview_test1"
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:padding="32dp"
13+
android:textSize="14sp"
14+
android:background="@color/colorAccent"
15+
android:textColor="#fff"
16+
android:text="123"
17+
/>
18+
19+
20+
</LinearLayout>

app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
4+
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1+
ext {
2+
omegaRecyclerView = '1.9.6'
3+
kotlinCorutines_version = '1.2.1'
4+
5+
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
26

37
buildscript {
4-
ext.kotlin_version = '1.3.21'
8+
ext.kotlin_version = '1.3.31'
59
repositories {
610
google()
711
jcenter()
812

913
}
1014
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.3.2'
15+
classpath 'com.android.tools.build:gradle:3.4.0'
1216
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1317
// NOTE: Do not place your application dependencies here; they belong
1418
// in the individual module build.gradle files

0 commit comments

Comments
 (0)