Skip to content

Commit

Permalink
version 0.1.8.39
Browse files Browse the repository at this point in the history
prerelease
  • Loading branch information
gonojuarez committed Sep 13, 2021
1 parent 4e8bcd5 commit 926897a
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .idea/misc.xml

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 @@ -21,6 +21,7 @@
import com.bumptech.glide.request.Request;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.signature.ObjectKey;
import com.stonefacesoft.pictogramslibrary.Interfaces.GlideModelTypes;
import com.stonefacesoft.pictogramslibrary.R;

Expand Down Expand Up @@ -68,7 +69,7 @@ public GlideAttatcher useDecodeFormatRGB565(){
* clean the glide memory if you need
*/
public void clearMemory() {
if(getAvailableMemory().lowMemory)
if(!isValidContextFromGlide(mContext))
glide.clearMemory();
}

Expand Down Expand Up @@ -140,7 +141,7 @@ public Object loadDrawable(@Nullable String string, ImageView imageView) {
@Override
public Object loadDrawable(@Nullable Uri uri, ImageView imageView) {
if (isValidContextFromGlide(mContext)) {
glideScaleItem(cornerRadious(useDecodeFormat(useDiskCacheStrategic(getGlide().getRequestManagerRetriever().get(mContext).load(uri).fallback(R.drawable.ic_baseline_cloud_download_24).error(R.drawable.ic_baseline_cloud_download_24).override(width, height))))).into(imageView);
glideScaleItem(cornerRadious(useDecodeFormat(useDiskCacheStrategic(getGlide().getRequestManagerRetriever().get(mContext).load(uri).fallback(R.drawable.ic_baseline_cloud_download_24).override(width, height))))).into(imageView);
clearMemory();
}
return this;
Expand Down Expand Up @@ -169,7 +170,7 @@ public Object loadDrawable(@Nullable Integer resourceId, ImageView imageView) {
@Override
public Object loadDrawable(@Nullable URL url, ImageView imageView) {
if (isValidContextFromGlide(mContext)){
glideScaleItem(cornerRadious(useDecodeFormat(useDiskCacheStrategic(getGlide().getRequestManagerRetriever().get(mContext).load(url).fallback(R.drawable.ic_baseline_cloud_download_24).error(R.drawable.ic_baseline_cloud_download_24).override(width, height))))).into(imageView);
glideScaleItem(cornerRadious(useDecodeFormat(useDiskCacheStrategic(getGlide().getRequestManagerRetriever().get(mContext).load(url).signature(new ObjectKey(url)).error(R.drawable.ic_baseline_cloud_download_24).override(width, height))))).into(imageView);
clearMemory();
}
return this;
Expand Down Expand Up @@ -256,4 +257,6 @@ private ActivityManager.MemoryInfo getAvailableMemory(){





}
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ private void setData() {
glideAttatcher.setHeight(icon.getHeight()).setWidth(icon.getWidth()).useDiskCacheStrategy().loadDrawable(mContext.getResources().getDrawable(mContext.getResources().getIdentifier(pictogramsLibraryGameGroup.getPictogram(),
"drawable", mContext.getPackageName())), this.icon);
} else {
File picto = new File(pictogramsLibraryGameGroup.getEditedPictogram());
if (picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto, this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryGameGroup.getUrl()), this.icon);
selectIcon();
}
}
public void setCustom_Texto(String t) {
Expand All @@ -113,5 +109,12 @@ public void setDrawableScore(Drawable drawable){
this.tagScore.setImageDrawable(drawable);
}


@Override
public void selectIcon() {
File picto = new File(pictogramsLibraryGameGroup.getEditedPictogram());
if (picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto, this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryGameGroup.getUrl()), this.icon);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ private void setData() {
glideAttatcher.setHeight(icon.getHeight()).setWidth(icon.getWidth()).useDiskCacheStrategy().loadDrawable(mContext.getResources().getDrawable(mContext.getResources().getIdentifier(pictogramsLibraryGroup.getPictogram(),
"drawable", mContext.getPackageName())), this.icon);
} else {
File picto = new File(pictogramsLibraryGroup.getEditedPictogram());
if (picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto, this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryGroup.getUrl()), this.icon);
}
selectIcon();
}
}



public void loadHourIcon(boolean value) {
tagHora.setImageResource(value ? R.drawable.ic_timer_black_24dp : R.drawable.ic_timer_off_black_24dp);
}
Expand All @@ -128,4 +126,12 @@ public void setCustom_Texto(String t) {
requestLayout();
}

@Override
public void selectIcon() {
File picto = new File(pictogramsLibraryGroup.getEditedPictogram());
if (picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto, this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryGroup.getUrl()), this.icon);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class PictoView extends TarjetView{
private int Custom_Color;
private Pictogram pictogramsLibraryPictogram;
private boolean useDiskCacheStrategy,useDecodeFormata355;
private boolean useGlideAttatcher;

public PictoView(@NonNull Context context) {
super(context);
Expand Down Expand Up @@ -155,19 +156,24 @@ private void setData(){
this.setCustom_Texto(pictogramsLibraryPictogram.getObjectName());
this.icon.setScaleType(ImageView.ScaleType.FIT_CENTER);
cargarColor(pictogramsLibraryPictogram.getType());

if(pictogramsLibraryPictogram.getEditedPictogram().isEmpty()){
glideAttatcher.setWidth(icon.getWidth()).setHeight(icon.getHeight()).useDiskCacheStrategy().loadDrawable(mContext.getResources().getDrawable(mContext.getResources().getIdentifier(pictogramsLibraryPictogram.getPictogram(),
"drawable", mContext.getPackageName())),this.icon);
}else{
File picto=new File(pictogramsLibraryPictogram.getEditedPictogram());
if(picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto,this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getUrl()),this.icon);
selectIcon();
}
}

@Override
public void selectIcon(){
File picto=new File(pictogramsLibraryPictogram.getEditedPictogram());
if(picto.exists())
glideAttatcher.useDiskCacheStrategy().loadDrawable(picto,this.icon);
else
glideAttatcher.useDiskCacheStrategy().loadDrawable(Uri.parse(pictogramsLibraryPictogram.getUrl()),this.icon);

}



private void cargarColor(int color) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@ public void changeKindOfPictogramVisibility(){
kind_of_pictogram.setVisibility(VISIBLE);
}

public void selectIcon(){

}

}
4 changes: 1 addition & 3 deletions app/pictogramslibrary/src/main/res/layout-sw600dp/group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background_shape"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
Expand All @@ -12,9 +13,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/background_shape"

>
<ImageView
android:id="@+id/grid_image"
Expand Down
4 changes: 1 addition & 3 deletions app/pictogramslibrary/src/main/res/layout/group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_shape"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
Expand All @@ -11,9 +12,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/background_shape"

>
<ImageView
android:id="@+id/grid_image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* You can find additional examples on GitHub: https://github.com/androidthings
*/
public class MainActivity extends AppCompatActivity {

private GroupView groupView;

@Override
Expand All @@ -44,7 +43,6 @@ protected void onCreate(Bundle savedInstanceState) {
groupView.setPictogramsLibraryGroup(group1);
PictoView pictogramsView=findViewById(R.id.pictogram1);
pictogramsView.setPictogramsLibraryPictogram(pictogram);

}


Expand Down

0 comments on commit 926897a

Please sign in to comment.