Skip to content

Commit

Permalink
GlideAttatcher changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gonojuarez committed Feb 22, 2023
1 parent 44add7d commit 6dc20c1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ android {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(path: ':app:pictogramslibrary')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'


}
8 changes: 4 additions & 4 deletions app/pictogramslibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ android {

dependencies {

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation platform('com.google.firebase:firebase-bom:30.5.0')

// Add the dependency for the Cloud Storage library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.stonefacesoft.pictogramslibrary.R;
import com.stonefacesoft.pictogramslibrary.utils.GlideAttatcher;
import com.stonefacesoft.pictogramslibrary.utils.MemoryUtils;
import com.stonefacesoft.pictogramslibrary.utils.ValidateContext;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -169,15 +170,17 @@ protected void setData(){
this.setCustom_Texto(pictogramsLibraryPictogram.getObjectName());
this.icon.setScaleType(ImageView.ScaleType.FIT_CENTER);
cargarColor(pictogramsLibraryPictogram.getType());
if(pictogramsLibraryPictogram.getEditedPictogram().isEmpty()){
if(!pictogramsLibraryPictogram.getPictogram().startsWith("https://")){
Drawable drawable = findResource(pictogramsLibraryPictogram.getPictogram());
glideAttatcher.setWidth(IconWidth).setHeight(IconHeight).useDiskCacheStrategy().loadDrawable(drawable,this.icon);
if(ValidateContext.isValidContext(mContext)){
if(pictogramsLibraryPictogram.getEditedPictogram().isEmpty()){
if(!pictogramsLibraryPictogram.getPictogram().startsWith("https://")){
Drawable drawable = findResource(pictogramsLibraryPictogram.getPictogram());
glideAttatcher.setWidth(IconWidth).setHeight(IconHeight).useDiskCacheStrategy().loadDrawable(drawable,this.icon);
}else{
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getPictogram()),this.icon);
}
}else{
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getPictogram()),this.icon);
selectIcon(pictogramsLibraryPictogram,this.icon,glideAttatcher);
}
}else{
selectIcon(pictogramsLibraryPictogram,this.icon,glideAttatcher);
}
}

Expand All @@ -192,13 +195,15 @@ public void selectIcon(){
try{
String path = pictogramsLibraryPictogram.getEditedPictogram();
File picto=new File(path);
if(picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto,this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getUrl()),this.icon);
if(ValidateContext.isValidContext(mContext)) {
if (picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto, this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getUrl()), this.icon);
}
}catch (Exception ex){

glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getUrl()),this.icon);
if(ValidateContext.isValidContext(mContext))
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getUrl()),this.icon);
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.4.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
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-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

0 comments on commit 6dc20c1

Please sign in to comment.