Skip to content

Commit 8848a85

Browse files
Merge pull request #1 from Omega-R/feature/base_extensions
Base extensions have been added
2 parents e2e8c66 + ac0d716 commit 8848a85

37 files changed

Lines changed: 882 additions & 11 deletions

.idea/modules.xml

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

app/build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
apply plugin: 'com.android.application'
2-
32
apply plugin: 'kotlin-android'
4-
53
apply plugin: 'kotlin-android-extensions'
64

75
android {
86
compileSdkVersion 28
97
defaultConfig {
10-
applicationId "omega_r.com.extensions"
8+
applicationId "omega_r.com.extensions.simple"
119
minSdkVersion 14
1210
targetSdkVersion 28
1311
versionCode 1
@@ -25,10 +23,11 @@ android {
2523
dependencies {
2624
implementation fileTree(dir: 'libs', include: ['*.jar'])
2725
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28-
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
29-
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
26+
implementation "androidx.appcompat:appcompat:$appcompat"
3027
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
28+
implementation project(":lib")
29+
3130
testImplementation 'junit:junit:4.12'
32-
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
33-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
31+
androidTestImplementation 'androidx.test:runner:1.2.0-alpha03'
32+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha03'
3433
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="omega_r.com.extensions">
3+
package="omega_r.com.extensions.simple">
44

55
<application
66
android:allowBackup="true"

app/src/main/java/omega_r/com/extensions/MainActivity.kt renamed to app/src/main/java/omega_r/com/extensions/simple/MainActivity.kt

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

33
import androidx.appcompat.app.AppCompatActivity
44
import android.os.Bundle

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
buildscript {
44
ext.kotlin_version = '1.3.30'
5+
ext.appcompat = '1.1.0-alpha04'
6+
57
repositories {
68
google()
79
jcenter()
@@ -10,6 +12,7 @@ buildscript {
1012
dependencies {
1113
classpath 'com.android.tools.build:gradle:3.3.2'
1214
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15+
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1316
// NOTE: Do not place your application dependencies here; they belong
1417
// in the individual module build.gradle files
1518
}
@@ -19,7 +22,7 @@ allprojects {
1922
repositories {
2023
google()
2124
jcenter()
22-
25+
2326
}
2427
}
2528

lib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

lib/build.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'com.github.dcendents.android-maven'
4+
5+
android {
6+
compileSdkVersion 28
7+
8+
defaultConfig {
9+
minSdkVersion 14
10+
targetSdkVersion 28
11+
versionCode 1
12+
versionName "1.0"
13+
14+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15+
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
25+
packagingOptions {
26+
exclude 'META-INF/lib_release.kotlin_module'
27+
}
28+
29+
}
30+
31+
dependencies {
32+
implementation fileTree(dir: 'libs', include: ['*.jar'])
33+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
34+
implementation "androidx.appcompat:appcompat:$appcompat"
35+
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha04'
36+
37+
testImplementation 'junit:junit:4.12'
38+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
39+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
40+
}
41+
repositories {
42+
mavenCentral()
43+
}

lib/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

lib/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="omega_r.com.extensions"/>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package omega_r.com.extensions.bitmap
2+
3+
import android.graphics.Bitmap
4+
import java.io.ByteArrayInputStream
5+
import java.io.ByteArrayOutputStream
6+
import java.io.InputStream
7+
import java.io.OutputStream
8+
9+
fun Bitmap.toOutputStream(
10+
compressFormat: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG,
11+
quality: Int = 100
12+
): OutputStream {
13+
val stream = ByteArrayOutputStream()
14+
compress(compressFormat, quality, stream)
15+
return stream
16+
}
17+
18+
fun Bitmap.toInputStream(
19+
compressFormat: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG,
20+
quality: Int = 100
21+
): InputStream {
22+
val stream = ByteArrayOutputStream()
23+
compress(compressFormat, quality, stream)
24+
val byteArray = stream.toByteArray()
25+
return ByteArrayInputStream(byteArray)
26+
}

0 commit comments

Comments
 (0)