Skip to content

Commit c87d015

Browse files
Merge pull request #13 from Omega-R/develop
Develop
2 parents 3104610 + 18a6914 commit c87d015

Some content is hidden

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

41 files changed

+1508
-765
lines changed

app/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ android {
3232
targetCompatibility JavaVersion.VERSION_1_8
3333
}
3434

35+
kotlinOptions.jvmTarget = "1.8"
36+
3537
}
3638

3739
dependencies {
@@ -50,6 +52,9 @@ dependencies {
5052
implementation 'com.github.Omega-R.OmegaMoxy:moxy:1.5.7'
5153
implementation 'com.github.Omega-R.OmegaMoxy:moxy-androidx:1.5.7'
5254
kapt 'com.github.Omega-R.OmegaMoxy:moxy-compiler:1.5.7'
53-
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:ae42598df9'
55+
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:1.0.1'
56+
implementation 'com.github.Omega-R.OmegaTypes:glide:1.0.1'
57+
implementation 'com.github.Omega-R:OmegaLaunchers:1.0.1'
58+
5459

5560
}

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.omega_r.base.simple">
44

5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
58
<application
69
android:allowBackup="true"
710
android:icon="@mipmap/ic_launcher"

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

Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,107 @@
11
package com.omega_r.base.simple
22

3+
import android.os.Bundle
34
import android.view.View
45
import androidx.recyclerview.widget.RecyclerView
56
import com.omega_r.base.adapters.OmegaAutoAdapter
7+
import com.omega_r.base.adapters.OmegaListAdapter
68
import com.omega_r.base.annotations.OmegaContentView
79
import com.omega_r.base.binders.IdHolder
810
import com.omega_r.base.components.OmegaActivity
11+
import com.omega_r.libs.omegatypes.Image
912
import com.omega_r.libs.omegatypes.Text
13+
import com.omega_r.libs.omegatypes.from
14+
import com.omegar.libs.omegalaunchers.createActivityLauncher
15+
import com.omegar.libs.omegalaunchers.tools.put
1016
import com.omegar.mvp.presenter.InjectPresenter
1117

1218
@OmegaContentView(R.layout.activity_main)
1319
class MainActivity : OmegaActivity(), MainView {
1420

21+
companion object {
22+
23+
private const val EXTRA_TITLE = "title"
24+
25+
fun createLauncher(title: String) = createActivityLauncher(
26+
EXTRA_TITLE put title
27+
)
28+
29+
}
30+
1531
@InjectPresenter
1632
override lateinit var presenter: MainPresenter
1733

18-
private val adapter = OmegaAutoAdapter.create(R.layout.item_test, R.layout.item_test2, ::onClickItem) {
19-
bind(R.id.textview_test, Item::text)
20-
bindClick(R.id.textview_test1) {
21-
showToast(Text.from("MENU!"))
22-
}
23-
bindRecycler(R.id.recyclerview, R.layout.item_test, Item::list) {
24-
bind(R.id.textview_test, SubItem::text)
25-
}
34+
private val adapter = OmegaAutoAdapter.create(R.layout.item_test_3, ::onClickItem) {
35+
bindImage(R.id.imageview)
2636
}.apply {
27-
list = listOf(Item(), Item())
37+
watcher = OmegaListAdapter.ImagePreloadWatcher(this)
38+
list = listOf(
39+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?156"),
40+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?256"),
41+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?35"),
42+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?45"),
43+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?56"),
44+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?64"),
45+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?79"),
46+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?85"),
47+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?91"),
48+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?102"),
49+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?113"),
50+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?124"),
51+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?135"),
52+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?146"),
53+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?1578"),
54+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?169"),
55+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?174"),
56+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?185"),
57+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?1956"),
58+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?201"),
59+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?212"),
60+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?2212"),
61+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?231"),
62+
Image.from("https://i.pinimg.com/originals/d6/68/ab/d668abc72809303852c27275e6a56775.gif?242")
63+
)
2864
}
2965

30-
private val recyclerView: RecyclerView by bind(R.id.recyclerview, adapter)
66+
private val recyclerView: RecyclerView by bind(R.id.recyclerview, adapter) {
67+
recyclerView.setHasFixedSize(true)
68+
}
3169

3270
private val maps: Map<Field, View> by bind(Field.values()) {
3371
showToast(Text.from(it.id.toString()))
3472
}
3573

36-
private fun onClickItem(item: Item) {
74+
75+
override fun onCreate(savedInstanceState: Bundle?) {
76+
super.onCreate(savedInstanceState)
77+
title = intent.getStringExtra(EXTRA_TITLE)
78+
}
79+
80+
private fun onClickItem(item: Image) {
3781
showToast(Text.from("Click $item"))
82+
83+
// ActivityLauncher.launch(this, null, createLauncher("1"), createLauncher("2"))
84+
85+
createLauncher("1").launch(this, createLauncher("2"))
3886
}
3987

40-
data class Item (val text: String = "123", val list: List<SubItem> = listOf(SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem(), SubItem()))
88+
data class Item(
89+
val text: String = "123",
90+
val list: List<SubItem> = listOf(
91+
SubItem(),
92+
SubItem(),
93+
SubItem(),
94+
SubItem(),
95+
SubItem(),
96+
SubItem(),
97+
SubItem(),
98+
SubItem(),
99+
SubItem(),
100+
SubItem()
101+
)
102+
)
41103

42-
data class SubItem (val text: String = "123")
104+
data class SubItem(val text: String = "123")
43105

44106
enum class Field(override val id: Int) : IdHolder {
45107
ITEM1(R.id.recyclerview),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.omega_r.base.simple
22

3-
import com.omega_r.base.mvp.OmegaPresenter
3+
import com.omega_r.base.mvp.presenters.OmegaPresenter
44
import com.omega_r.base.mvp.model.Action
55
import com.omega_r.libs.omegatypes.Text
66
import com.omegar.mvp.InjectViewState

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.omega_r.base.simple
22

3-
import com.omega_r.base.mvp.OmegaView
3+
import com.omega_r.base.mvp.views.OmegaView
44

55
interface MainView: OmegaView {
66

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
6-
android:layout_height="match_parent"
6+
android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
77
tools:context=".MainActivity">
88

99
<com.omega_r.libs.omegarecyclerview.OmegaRecyclerView
1010
android:id="@+id/recyclerview"
1111
android:layout_width="match_parent"
12-
android:layout_height="match_parent"/>
12+
android:layout_height="match_parent"
13+
app:layoutManager="LinearLayoutManager"
14+
/>
1315

1416
</LinearLayout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="170dp">
5+
<ImageView
6+
android:id="@+id/imageview"
7+
android:layout_width="match_parent"
8+
android:layout_height="match_parent"/>
9+
</FrameLayout>
10+

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ext {
2-
omegaRecyclerView = '1.9.6'
2+
omegaRecyclerView = '1.9.7'
33
kotlinCorutines_version = '1.2.1'
44

55
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

lib/build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ dependencies {
5353
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${kotlinCorutines_version}"
5454
implementation "org.jetbrains.kotlin:kotlin-android-extensions-runtime:${kotlin_version}"
5555

56-
implementation 'com.github.Omega-R.OmegaMoxy:moxy:1.5.7'
57-
implementation 'com.github.Omega-R.OmegaMoxy:moxy-androidx:1.5.7'
58-
kapt 'com.github.Omega-R.OmegaMoxy:moxy-compiler:1.5.7'
56+
implementation 'com.github.Omega-R.OmegaMoxy:moxy:1.5.8'
57+
implementation 'com.github.Omega-R.OmegaMoxy:moxy-androidx:1.5.8'
58+
implementation 'com.github.Omega-R:OmegaLaunchers:1.0.1'
59+
60+
kapt 'com.github.Omega-R.OmegaMoxy:moxy-compiler:1.5.8'
5961

6062
implementation "com.github.Omega-R:OmegaRecyclerView:${omegaRecyclerView}@aar"
61-
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:0.3.0'
62-
implementation 'com.github.Omega-R.OmegaTypes:glide:0.3.0'
63+
implementation 'com.github.Omega-R.OmegaTypes:omegatypes:1.0.1'
64+
implementation 'com.github.Omega-R.OmegaTypes:glide:1.0.1'
6365

6466
implementation "com.squareup.retrofit2:retrofit:2.4.0"
6567
implementation "com.squareup.moshi:moshi-kotlin:1.8.0"

lib/src/main/java/com/omega_r/base/OmegaContext.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.omega_r.base
22

33
import android.content.Context
4+
import android.content.res.Resources
45

56
/**
67
* Created by Anton Knyazev on 04.04.2019.

0 commit comments

Comments
 (0)