Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/nativescript-image-cache-it/nativescript.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NativeScriptConfig } from '@nativescript/core';

export default {
ios: {
SPMPackages: [
{
name: 'SDWebImage',
libs: ['SDWebImage'],
repositoryURL: 'https://github.com/SDWebImage/SDWebImage.git',
version: '5.21.2',
},
],
},
} as NativeScriptConfig;
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ android {

dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.0-rc01'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
implementation 'com.github.bumptech.glide:glide:5.0.0-rc01'
annotationProcessor 'com.github.bumptech.glide:compiler:5.0.0-rc01'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.5'
implementation 'com.github.triniwiz:glide-transformations:0b20ecf81a'
implementation 'com.github.triniwiz:android-gpuimage:9a33c87c1f'
implementation 'com.github.bumptech.glide:glide:5.0.5'
annotationProcessor 'com.github.bumptech.glide:compiler:5.0.5'
annotationProcessor 'androidx.annotation:annotation:1.9.1'
implementation "androidx.core:core-ktx:1.13.1"
}

}
1 change: 0 additions & 1 deletion packages/nativescript-image-cache-it/platforms/ios/Podfile

This file was deleted.

1 change: 1 addition & 0 deletions packages/nativescript-image-cache-it/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"assets": [
"packages/nativescript-image-cache-it/*.md",
"packages/nativescript-image-cache-it/index.d.ts",
"packages/nativescript-image-cache-it/nativescript.config.ts",
"LICENSE",
{
"glob": "**/*",
Expand Down

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdk 34
compileSdk 35
defaultConfig {
applicationId "com.github.triniwiz.imagedemo"
minSdkVersion 21
targetSdk 34
targetSdk 35
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -41,15 +41,15 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.0-rc01'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.5'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
implementation 'com.github.bumptech.glide:glide:5.0.0-rc01'
kapt 'com.github.bumptech.glide:compiler:5.0.0-rc01'
implementation 'com.github.triniwiz:android-gpuimage:9a33c87c1f'
implementation 'com.github.bumptech.glide:glide:5.0.5'
kapt 'com.github.bumptech.glide:compiler:5.0.5'
kapt 'androidx.annotation:annotation:1.9.1'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation project(path: ':imagecacheit')
implementation "androidx.core:core-ktx:1.13.1"
implementation "androidx.core:core-ktx:1.13.0"
}
repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
}

android {
compileSdk 33
compileSdk 35

defaultConfig {
minSdkVersion 17
targetSdkVersion 33
minSdkVersion 21
targetSdkVersion 35

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
Expand All @@ -34,6 +34,7 @@ android {
repositories {
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}

dependencies {
Expand All @@ -44,11 +45,11 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.0-rc01'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
implementation 'com.github.bumptech.glide:glide:5.0.0-rc01'
kapt 'com.github.bumptech.glide:compiler:5.0.0-rc01'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.5'
implementation 'com.github.triniwiz:glide-transformations:8c057db924'
implementation 'com.github.triniwiz:android-gpuimage:9a33c87c1f'
implementation 'com.github.bumptech.glide:glide:5.0.5'
kapt 'com.github.bumptech.glide:compiler:5.0.5'
kapt 'androidx.annotation:annotation:1.9.1'
implementation "androidx.core:core-ktx:1.13.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.Target
import java.io.File
import java.lang.ref.WeakReference
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors

Expand All @@ -29,11 +30,11 @@ class ImageCache {
private var executorService: ExecutorService? = null

@JvmStatic
private var mContext: Context? = null
private var mContext: WeakReference<Context>? = null

@JvmStatic
fun init(context: Context?) {
if (context != mContext) {
if (context != mContext?.get()) {
manager = null
}
if (manager == null) {
Expand All @@ -46,7 +47,7 @@ class ImageCache {
if (executorService == null) {
executorService = Executors.newCachedThreadPool()
}
mContext = context
mContext = WeakReference(context)
}

@SuppressLint("CheckResult")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import kotlin.math.floor
import kotlin.math.max
import kotlin.math.min
import kotlin.math.roundToInt
import androidx.core.graphics.drawable.toDrawable

/**
* Created by triniwiz on 4/6/20
Expand Down Expand Up @@ -951,7 +952,7 @@ class ImageView : AppCompatImageView, ImageViewProgressListener {
}

override fun onResourceReady(
resource: Drawable,
resource: Drawable?,
model: Any,
target: Target<Drawable?>?,
dataSource: DataSource,
Expand Down Expand Up @@ -988,7 +989,7 @@ class ImageView : AppCompatImageView, ImageViewProgressListener {
if (resource is BitmapDrawable) {
if (overlayColor != 0) {
val bitmapResource = drawOverlay(resource.bitmap)
res = BitmapDrawable(resources, bitmapResource)
res = bitmapResource.toDrawable(resources)
}
}
res?.let {
Expand All @@ -1004,8 +1005,8 @@ class ImageView : AppCompatImageView, ImageViewProgressListener {
var bmWidth: Int
var bmHeight: Int
try {
bmWidth = resource.intrinsicWidth
bmHeight = resource.intrinsicHeight
bmWidth = resource?.intrinsicWidth ?: 0
bmHeight = resource?.intrinsicHeight ?: 0
if (bmWidth <= 0) {
bmWidth = width
}
Expand All @@ -1017,7 +1018,7 @@ class ImageView : AppCompatImageView, ImageViewProgressListener {
} else {
bitmap = pool[bmWidth, bmHeight, Bitmap.Config.ARGB_8888]
val canvas = Canvas(bitmap)
resource.draw(canvas)
resource?.draw(canvas)
}
handleImageFilters(gpuImage)
} catch (outOfMemoryError: OutOfMemoryError) {
Expand All @@ -1034,10 +1035,10 @@ class ImageView : AppCompatImageView, ImageViewProgressListener {
val handler = Handler(Looper.getMainLooper())
try {
val filteredImage = gpuImage.getBitmapWithFilterApplied(bitmap)
var res = BitmapDrawable(resources, filteredImage)
var res = filteredImage.toDrawable(resources)
if (overlayColor != 0) {
val bitmapResource = drawOverlay(filteredImage)
res = BitmapDrawable(resources, bitmapResource)
res = bitmapResource.toDrawable(resources)
}
thumbConfig.createThumb(res)
sendLoadEvent(res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class MyAppGlideModule : AppGlideModule() {

}

private class OkHttpProgressResponseBody internal constructor(
private class OkHttpProgressResponseBody(
private val key: String,
private val responseBody: ResponseBody?,
private val progressListener: ResponseProgressListener
Expand All @@ -125,7 +125,7 @@ class MyAppGlideModule : AppGlideModule() {

override fun source(): BufferedSource {
if (bufferedSource == null) {
bufferedSource = responseBody!!.source().buffer
bufferedSource = source(responseBody!!.source()).buffer()
}
return bufferedSource!!
}
Expand Down
14 changes: 7 additions & 7 deletions packages/nativescript-image-zoom/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ export class ImageZoom extends ImageZoomBase {
}

public createNativeView() {
return new com.github.chrisbanes.photoview.PhotoView(this._context);
return new com.otaliastudios.zoom.ZoomImageView(this._context);
}

[minZoomScaleProperty.setNative](scale: number) {
if (this.nativeView && isNumber(scale)) {
this.nativeView.setMinimumScale(scale);
this.nativeView.setScaleLevels(Number(scale), Number(0.5833333333333334 * this.maxZoom), Number(this.maxZoom));
const nativeView = this.nativeView as com.otaliastudios.zoom.ZoomImageView;
if (nativeView && isNumber(scale)) {
nativeView.setMinZoom(scale);
}
}

[maxZoomScaleProperty.setNative](scale: number) {
if (this.nativeView && isNumber(scale)) {
this.nativeView.setScaleLevels(Number(this.minZoom), Number(0.5833333333333334 * scale), Number(scale));
const nativeView = this.nativeView as com.otaliastudios.zoom.ZoomImageView;
if (nativeView && isNumber(scale)) {
nativeView.setMaxZoom(scale);
}
}

Expand All @@ -44,7 +45,6 @@ export class ImageZoom extends ImageZoomBase {
}

public initNativeView() {
this.nativeView.setScaleLevels(Number(this.minZoom), Number(0.5833333333333334 * this.maxZoom), Number(this.maxZoom));
this.manager = com.bumptech.glide.Glide.with(this._context);

if (this.src) {
Expand Down
16 changes: 5 additions & 11 deletions packages/nativescript-image-zoom/platforms/android/include.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}

repositories {
mavenCentral()
google()
}

dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.otaliastudios:zoomlayout:1.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.0-rc01'
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'com.github.bumptech.glide:glide:5.0.0-rc01'
annotationProcessor 'com.github.bumptech.glide:compiler:5.0.0-rc01'
implementation 'com.github.bumptech.glide:okhttp3-integration:5.0.5'
implementation 'com.github.triniwiz:glide-transformations:8c057db924'
implementation 'com.github.bumptech.glide:glide:5.0.5'
annotationProcessor 'com.github.bumptech.glide:compiler:5.0.5'
annotationProcessor 'androidx.annotation:annotation:1.9.1'
}
Loading