Skip to content

Commit d5894e6

Browse files
Merge pull request #29 from Omega-R/develop
Develop
2 parents 1fa81d3 + d733aba commit d5894e6

57 files changed

Lines changed: 2508 additions & 473 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
137 Bytes
Binary file not shown.

.idea/gradle.xml

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

.idea/misc.xml

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

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ android {
2323
dependencies {
2424
implementation fileTree(dir: 'libs', include: ['*.jar'])
2525
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
26+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlinCorutines_version}"
27+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${kotlinCorutines_version}"
28+
2629
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
2730

2831
api project(':omegatypes')

app/src/main/java/omega_r/com/omegatypesexample/MainActivity.kt

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
package omega_r.com.omegatypesexample
22

3+
34
import android.graphics.Bitmap
45
import android.graphics.BitmapFactory
6+
import android.graphics.drawable.BitmapDrawable
57
import android.os.Bundle
68
import android.widget.ImageView
79
import android.widget.TextView
810
import androidx.core.content.res.ResourcesCompat
9-
import com.omega_r.libs.omegatypes.*
11+
import com.omega_r.libs.omegatypes.Color
12+
import com.omega_r.libs.omegatypes.Text
13+
import com.omega_r.libs.omegatypes.TextStyle
14+
import com.omega_r.libs.omegatypes.file.File
15+
import com.omega_r.libs.omegatypes.file.from
16+
import com.omega_r.libs.omegatypes.image.*
17+
import com.omega_r.libs.omegatypes.join
18+
import kotlinx.coroutines.Dispatchers
19+
import kotlinx.coroutines.launch
20+
import kotlinx.coroutines.withContext
21+
import java.io.ByteArrayOutputStream
1022
import kotlin.concurrent.thread
1123

24+
1225
class MainActivity : BaseActivity() {
1326

1427
private val exampleTextView by bind<TextView>(R.id.textview)
1528
private val imageView by bind<ImageView>(R.id.imageview)
1629

1730
override fun onCreate(savedInstanceState: Bundle?) {
1831
super.onCreate(savedInstanceState)
32+
1933
setContentView(R.layout.activity_main)
2034
val text = Text.from("test ") +
2135
Text.from(
@@ -31,18 +45,47 @@ class MainActivity : BaseActivity() {
3145

3246
val list = listOf(Text.from("1", TextStyle.color(Color.fromAttribute(R.attr.colorAccent))), Text.from("2", TextStyle.color(Color.fromAttribute(R.attr.colorAccent))), Text.from("3"))
3347

34-
title = list.join(",", postfix = ".").getCharSequence(this)
48+
title = list.join(",", postfix = ".").getCharSequence(this)
49+
50+
51+
val image = Image.from("https://dejagerart.com/wp-content/uploads/2018/09/Test-Logo-Circle-black-transparent.png")
52+
53+
54+
// val image = intent.getSerializableExtra("test") as? Image ?: run {
55+
//
56+
// val image = Image.from("https://dejagerart.com/wp-content/uploads/2018/09/Test-Logo-Circle-black-transparent.png")
57+
//
58+
// ImageProcessors.current.launch {
59+
// val stream = image.getStream(this@MainActivity, Bitmap.CompressFormat.PNG)
60+
// val bitmap = BitmapFactory.decodeStream(stream)
61+
//
62+
// val bitmapImage = Image.from(BitmapDrawable(this@MainActivity.resources, bitmap))
63+
//
64+
// withContext(Dispatchers.Main) {
65+
// imageView.setImage(bitmapImage)
66+
//
67+
//
68+
//// intent.putExtra("test", bitmapImage)
69+
//// finish()
70+
//// startActivity(intent)
71+
//// imageView.setImageBitmap(bitmap)
72+
// }
73+
// }
74+
// image
75+
// }
76+
77+
imageView.setImage(image)
3578

36-
val image = Image.from("https://avatars1.githubusercontent.com/u/28600571")
3779

38-
thread {
39-
val stream = image.getStream(this, Bitmap.CompressFormat.PNG)
40-
val bitmap = BitmapFactory.decodeStream(stream)
41-
runOnUiThread {
42-
imageView.setImageBitmap(bitmap)
43-
}
4480

45-
}
81+
// thread {
82+
// val stream = image.getStream(this, Bitmap.CompressFormat.PNG)
83+
// val bitmap = BitmapFactory.decodeStream(stream)
84+
// runOnUiThread {
85+
// imageView.setImageBitmap(bitmap)
86+
// }
87+
//
88+
// }
4689

4790
}
4891

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@
2424
android:background="@color/colorAccent"
2525
tools:src="@mipmap/ic_launcher"/>
2626

27+
<Button
28+
android:layout_width="wrap_content"
29+
android:layout_height="wrap_content"
30+
android:text="Test"/>
31+
2732
</RelativeLayout>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
buildscript {
44
ext.kotlin_version = '1.3.41'
5-
ext.kotlin_version = '1.3.30'
5+
ext.kotlinCorutines_version = '1.2.1'
66
ext.supportVersion = '28.0.0'
77
ext.compileSdkVersion = 28
88
ext.targetSdkVersion = 28

glide/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232

3333
implementation fileTree(dir: 'libs', include: ['*.jar'])
3434

35-
implementation ("com.github.bumptech.glide:glide:4.9.0") {
35+
api ("com.github.bumptech.glide:glide:4.9.0") {
3636
exclude group: "com.android.support"
3737
}
3838

glide/src/main/java/com/omega_r/libs/omegatypes/UrlImageExtensions.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.

glide/src/main/java/com/omega_r/libs/omegatypes/glide/GlideImage.kt

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)