Skip to content

Commit

Permalink
fix: improve/update build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
friederbluemle authored and DylanVann committed Sep 15, 2021
1 parent df37c4f commit 1f04c55
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 44 deletions.
82 changes: 40 additions & 42 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,70 +1,68 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.0"
}
}

apply plugin: "com.android.library"

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def _excludeAppGlideModule = safeExtGet("excludeAppGlideModule", false)
def _buildToolsVersion = safeExtGet("buildToolsVersion", "28.0.3")
def _compileSdkVersion = safeExtGet("compileSdkVersion", 28)
def _glideVersion = safeExtGet("glideVersion", "4.11.0")
def _minSdkVersion = safeExtGet("minSdkVersion", 16)
def _reactNativeVersion = safeExtGet("reactNative", "+")
def _targetSdkVersion = safeExtGet("targetSdkVersion", 28)
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion _compileSdkVersion
buildToolsVersion _buildToolsVersion

compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
}
sourceSets {
main {
java {
if (_excludeAppGlideModule) {
if (safeExtGet('excludeAppGlideModule', false)) {
srcDir "src"
exclude "**/FastImageGlideModule.java"
}
}
}
}

defaultConfig {
minSdkVersion _minSdkVersion
targetSdkVersion _targetSdkVersion
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}

repositories {
mavenCentral()
google()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
// Android JSC is installed from npm
url "$rootDir/../node_modules/jsc-android/dist"
}
google()
jcenter()
}

def glideVersion = safeExtGet('glideVersion', '4.11.0')

dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:${_reactNativeVersion}"
implementation "androidx.core:core:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.annotation:annotation:1.0.0"
implementation("com.github.bumptech.glide:glide:${_glideVersion}")
implementation("com.github.bumptech.glide:annotations:${_glideVersion}")
annotationProcessor 'com.android.support:support-annotations:28.0.0-alpha3'
annotationProcessor "com.github.bumptech.glide:compiler:${_glideVersion}"
implementation("com.github.bumptech.glide:okhttp3-integration:${_glideVersion}")
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation "com.github.bumptech.glide:glide:${glideVersion}"
implementation "com.github.bumptech.glide:okhttp3-integration:${glideVersion}"
annotationProcessor "com.github.bumptech.glide:compiler:${glideVersion}"
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.dylanvann.fastimage;

import android.content.Context;
import android.widget.ImageView;

import androidx.appcompat.widget.AppCompatImageView;

import com.bumptech.glide.load.model.GlideUrl;

class FastImageViewWithUrl extends ImageView {
class FastImageViewWithUrl extends AppCompatImageView {
public GlideUrl glideUrl;

public FastImageViewWithUrl(Context context) {
Expand Down

0 comments on commit 1f04c55

Please sign in to comment.