Skip to content

Commit

Permalink
updated deps, tested shared anim switch
Browse files Browse the repository at this point in the history
  • Loading branch information
luca committed Sep 20, 2020
1 parent 68496a2 commit 1b265ff
Show file tree
Hide file tree
Showing 16 changed files with 289 additions and 172 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
buildscript {

ext {
android_gradle_ver = '4.0.0'
android_gradle_ver = '4.0.1'

kotlin_ver = '1.3.72'
ktlint_ver = '0.36.0'
ktx_ver = '1.3.0'
compile_sdk_ver = 30
build_tools_ver = "30.0.2"

min_sdk_ver = 21
target_sdk_ver = 30

jvm_ver = JavaVersion.VERSION_1_8

kotlin_ver = '1.4.10'
ktlint_ver = '0.39.0'
ktx_ver = '1.3.1'
ssiv_ver = '3.11.2'
glide_ver = '4.11.0'
coil_ver = '0.11.0'
constr_ver = '2.0.0-beta6'
mdc_ver = '1.1.0'
leakcanary_ver = '2.3'
constr_ver = '2.0.1'
mdc_ver = '1.2.1'
leakcanary_ver = '2.4'
test_ver = '1.2.0'
espresso_ver = '3.2.0'
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
20 changes: 14 additions & 6 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,42 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion compile_sdk_ver
buildToolsVersion build_tools_ver

defaultConfig {
minSdkVersion 19
targetSdkVersion 29
minSdkVersion min_sdk_ver
targetSdkVersion target_sdk_ver

versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility jvm_ver
targetCompatibility jvm_ver
}

kotlinOptions {
jvmTarget = '1.8'
noReflect = true
}
}

kotlin {
explicitApi()
explicitApiWarning()
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.kirkbushman.largeimageview
import android.content.Context
import android.net.Uri
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
Expand Down Expand Up @@ -187,6 +188,8 @@ class LargeImageView @JvmOverloads constructor(context: Context, attrs: Attribut
sourceView?.visibility = View.GONE
}

Log.i("LargeImageView", "Showing thumb view")

viewsShownListener?.onThumbnailViewShown(it)
}
}
Expand Down Expand Up @@ -241,6 +244,8 @@ class LargeImageView @JvmOverloads constructor(context: Context, attrs: Attribut
errorView?.visibility = View.GONE
}

Log.i("LargeImageView", "Showing source view")

viewsShownListener?.onImageViewShown(it)
}
}
Expand Down
12 changes: 6 additions & 6 deletions sampleapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion compile_sdk_ver
buildToolsVersion build_tools_ver

defaultConfig {
applicationId "com.kirkbushman.largeimageview.sampleapp"

minSdkVersion 19
targetSdkVersion 29
minSdkVersion min_sdk_ver
targetSdkVersion target_sdk_ver

versionCode 1
versionName "1.0"
Expand All @@ -27,8 +27,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility jvm_ver
targetCompatibility jvm_ver
}

kotlinOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,28 @@ class LargeImageViewTest {

var file: File? = null

doAsync(doWork = {

try {

file = glide.downloadOnly()
.load(URL_SOURCE)
.submit()
.get()
} catch (ex: Exception) {
ex.printStackTrace()
}
}, onPost = {

if (file != null) {
callback.onImageReady(file!!)
} else {
callback.onImageErrored()
doAsync(
doWork = {

try {

file = glide.downloadOnly()
.load(URL_SOURCE)
.submit()
.get()
} catch (ex: Exception) {
ex.printStackTrace()
}
},
onPost = {

if (file != null) {
callback.onImageReady(file!!)
} else {
callback.onImageErrored()
}
}
})
)
}
})

Expand Down Expand Up @@ -170,25 +173,28 @@ class LargeImageViewTest {

var file: File? = null

doAsync(doWork = {

try {

file = glide.downloadOnly()
.load(ERR_SOURCE)
.submit()
.get()
} catch (ex: Exception) {
ex.printStackTrace()
}
}, onPost = {

if (file != null) {
callback.onImageReady(file!!)
} else {
callback.onImageErrored()
doAsync(
doWork = {

try {

file = glide.downloadOnly()
.load(ERR_SOURCE)
.submit()
.get()
} catch (ex: Exception) {
ex.printStackTrace()
}
},
onPost = {

if (file != null) {
callback.onImageReady(file!!)
} else {
callback.onImageErrored()
}
}
})
)
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ class GlideModule : AppGlideModule() {
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val options = RequestOptions()
.disallowHardwareConfig()
.format(if (activityManager.isLowRamDevice)
DecodeFormat.PREFER_RGB_565
else
DecodeFormat.PREFER_ARGB_8888)
.format(
if (activityManager.isLowRamDevice)
DecodeFormat.PREFER_RGB_565
else
DecodeFormat.PREFER_ARGB_8888
)

builder.setLogLevel(Log.VERBOSE)
builder
.setLogLevel(Log.VERBOSE)
.setDefaultRequestOptions(options)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class AnimFirstActivity : AppCompatActivity() {
private const val THUMB_URL = "https://preview.redd.it/kgwb58shlp441.jpg?width=320&crop=smart&auto=webp&s=592da75578ac15f59ed762057138d62add0a18d7"
private const val SOURCE_URL = "https://preview.redd.it/kgwb58shlp441.jpg?auto=webp&s=391b7b139416a8a0d11b5528b13b8e49b124a341"

// private const val THUMB_URL = "https://preview.redd.it/9qcfzckaib531.jpg?width=216&crop=smart&auto=webp&s=63d71098f774fcc0dffe793e563fc7c5139671e4"
// private const val SOURCE_URL = "https://i.redd.it/9qcfzckaib531.jpg"

private const val FLAG_USE_COIL = "intent_extra_flag_use_coil"

fun start(context: Context, useCoil: Boolean = false) {
Expand Down
Loading

0 comments on commit 1b265ff

Please sign in to comment.