Skip to content

Commit dd62061

Browse files
committed
Move image loader into independent library module
1 parent c3b3348 commit dd62061

19 files changed

+109
-1
lines changed

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ android {
3232
}
3333

3434
dependencies {
35+
implementation project(path: ':imageloader')
3536
implementation 'androidx.core:core-ktx:1.6.0'
3637
implementation 'androidx.appcompat:appcompat:1.3.1'
3738
implementation 'com.google.android.material:material:1.4.0'
3839
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
39-
implementation 'com.github.solkin:disk-lru-cache:1.4'
4040
testImplementation 'junit:junit:4.+'
4141
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
4242
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

imageloader/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

imageloader/build.gradle

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'kotlin-android'
4+
}
5+
6+
android {
7+
compileSdk 30
8+
9+
defaultConfig {
10+
minSdk 21
11+
targetSdk 30
12+
versionCode 1
13+
versionName "1.0"
14+
15+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16+
consumerProguardFiles "consumer-rules.pro"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
kotlinOptions {
30+
jvmTarget = '1.8'
31+
}
32+
}
33+
34+
dependencies {
35+
implementation 'com.github.solkin:disk-lru-cache:1.4'
36+
testImplementation 'junit:junit:4.13.2'
37+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
38+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
39+
}

imageloader/consumer-rules.pro

Whitespace-only changes.

imageloader/proguard-rules.pro

+21
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.tomclaw.imageloader
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.tomclaw.imageloader.test", appContext.packageName)
23+
}
24+
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.tomclaw.imageloader">
4+
5+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.tomclaw.imageloader
2+
3+
import org.junit.Test
4+
5+
import org.junit.Assert.*
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* See [testing documentation](http://d.android.com/tools/testing).
11+
*/
12+
class ExampleUnitTest {
13+
@Test
14+
fun addition_isCorrect() {
15+
assertEquals(4, 2 + 2)
16+
}
17+
}

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ dependencyResolutionManagement {
88
}
99
rootProject.name = "Simple Image Loader"
1010
include ':app'
11+
include ':imageloader'

0 commit comments

Comments
 (0)