Skip to content

Commit

Permalink
Merge pull request #42 from BugsBunnyBR/master
Browse files Browse the repository at this point in the history
 Fixed AndroidX migration, updated libraries and small nits.
  • Loading branch information
ko2ic authored Sep 10, 2019
2 parents a821a96 + aa6f894 commit 907d344
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
example/ios/Flutter/flutter_export_environment.sh
.DS_Store
.atom/
.idea/
Expand Down
7 changes: 3 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ group 'com.ko2ic.imagedownloader'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.41'
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.support:support-compat:28.0.0'
}
}

Expand All @@ -33,7 +32,7 @@ android {
}
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Downloader(private val context: Context, private val request: Request) {
receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
intent ?: return
if (ACTION_DOWNLOAD_COMPLETE.equals(intent.action)) {
if (ACTION_DOWNLOAD_COMPLETE == intent.action) {
val id = intent.getLongExtra(EXTRA_DOWNLOAD_ID, -1)
resolveDownloadStatus(id, onNext, onError, onComplete)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import io.flutter.plugin.common.PluginRegistry

class ImageDownloderPermissionListener(private val activity: Activity) :
class ImageDownloaderPermissionListener(private val activity: Activity) :
PluginRegistry.RequestPermissionsResultListener {

private val permissionRequestId: Int = 2578166
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ import java.util.*
class ImageDownloaderPlugin(
private val registrar: Registrar,
private val channel: MethodChannel,
private val permissionListener: ImageDownloderPermissionListener
private val permissionListener: ImageDownloaderPermissionListener
) : MethodCallHandler {
companion object {
@JvmStatic
fun registerWith(registrar: Registrar) {
val channel = MethodChannel(registrar.messenger(), "plugins.ko2ic.com/image_downloader")

val listener = ImageDownloderPermissionListener(registrar.activity())
val listener = ImageDownloaderPermissionListener(registrar.activity())
registrar.addRequestPermissionsResultListener(listener)

channel.setMethodCallHandler(ImageDownloaderPlugin(registrar, channel, listener))
Expand Down Expand Up @@ -167,7 +167,7 @@ class ImageDownloaderPlugin(
arrayOf(imageId),
null
).use {
if (it == null) throw IllegalStateException("$imageId is an imageId that does not exist.")
checkNotNull(it) { "$imageId is an imageId that does not exist." }
it.moveToFirst()
val path = it.getString(it.getColumnIndex(MediaStore.Images.Media.DATA))
val name = it.getString(it.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME))
Expand Down Expand Up @@ -204,7 +204,7 @@ class ImageDownloaderPlugin(
private val channel: MethodChannel,
private val context: Context
) :
ImageDownloderPermissionListener.Callback {
ImageDownloaderPermissionListener.Callback {

var downloader: Downloader? = null

Expand Down Expand Up @@ -344,7 +344,7 @@ class ImageDownloaderPlugin(
arrayOf(file.absolutePath),
null
).use {
if (it == null) throw java.lang.IllegalStateException("${file.absolutePath} is not found.")
checkNotNull(it) { "${file.absolutePath} is not found." }
it.moveToFirst()
it.getString(it.getColumnIndex(MediaStore.Images.Media._ID))
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.41'
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Apr 18 16:54:42 JST 2019
#Fri Aug 30 11:33:54 BRT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

0 comments on commit 907d344

Please sign in to comment.