Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovicroland committed Mar 6, 2018
2 parents c413d22 + 5985532 commit dea2d81
Show file tree
Hide file tree
Showing 14 changed files with 2,291 additions and 14 deletions.
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: "maven-publish"

ext
{
appCompatVersion="27.0.2"
appCompatVersion = "27.0.2"
}

android
Expand All @@ -17,8 +17,8 @@ android
minSdkVersion 14
targetSdkVersion 27

versionCode 22
versionName "2.7.0"
versionCode 23
versionName "2.8.0"
}

buildTypes
Expand Down Expand Up @@ -143,7 +143,7 @@ bintray
{
name = android.defaultConfig.versionName
desc = "droid4me is a framework library dedicated to the development of Android applications"
released = new Date()
released = new Date()
vcsTag = "droid4me-" + android.defaultConfig.versionName
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.smartnsoft.droid4me.download.DownloadContracts.Bitmapable;
import com.smartnsoft.droid4me.download.DownloadContracts.Handlerable;
import com.smartnsoft.droid4me.download.DownloadContracts.Viewable;
import com.smartnsoft.droid4me.download.DownloadInstructions.BitmapableGif;

/**
* An implementation of the {@link CoreBitmapDownloader} class, which is independent from the Android platform.
Expand Down Expand Up @@ -404,6 +405,7 @@ public final void get(boolean isPreBlocking, boolean isDownloadBlocking, ViewCla
}
}


public synchronized void clear()
{
if (log.isInfoEnabled())
Expand Down Expand Up @@ -1081,7 +1083,7 @@ public final void onDownloaded(InputStream inputStream)
}

// We attempt to convert the input stream into a bitmap
final BitmapClass bitmap = fromInputStreamToBitmap(inputStream);
final BitmapClass bitmap = fromInputStreamToBitmapable(inputStream);
if (bitmap == null)
{
onBitmapReady(false, null);
Expand Down Expand Up @@ -1319,10 +1321,10 @@ protected InputStream onInputStreamDownloaded(InputStream inputStream)
/**
* This method assumes that the provided <code>inputStream</code> is not {@code null}.
*
* @param inputStream an input stream corresponding to a bitmap
* @param inputStream an input stream corresponding to a bitmap or a gif
* @return {@code null} if the input stream could not be properly converted ; a valid bitmap otherwise
*/
protected BitmapClass fromInputStreamToBitmap(InputStream inputStream)
protected BitmapClass fromInputStreamToBitmapable(InputStream inputStream)
{
try
{
Expand Down Expand Up @@ -1384,7 +1386,7 @@ private final BitmapClass retrieveBitmap()
}
try
{
final BitmapClass bitmap = fromInputStreamToBitmap(inputStream);
final BitmapClass bitmap = fromInputStreamToBitmapable(inputStream);
if (downloadStartTimestamp >= 0)
{
final long stop = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class BasisDownloadInstructions
public interface Instructions<BitmapClass extends Bitmapable, ViewClass extends Viewable>
{

/**s
/**
* The method will be invoked, so as to known whether the bitmap could not be extracted locally, i.e. from the application .apk, or a static local
* resource.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

import com.smartnsoft.droid4me.download.BasisDownloadInstructions.Instructions;
import com.smartnsoft.droid4me.download.DownloadInstructions.BitmapableBitmap;
import com.smartnsoft.droid4me.download.DownloadInstructions.HandlerableHander;
import com.smartnsoft.droid4me.download.DownloadInstructions.ViewableView;
Expand Down Expand Up @@ -195,12 +196,12 @@ public void unplug()
/**
* Indicates the default upper limit of memory that each cache is allowed to reach.
*/
public static final long DEFAULT_HIGH_LEVEL_MEMORY_WATER_MARK_IN_BYTES = 3l * 1024l * 1024l;
public static final long DEFAULT_HIGH_LEVEL_MEMORY_WATER_MARK_IN_BYTES = 5L * 1024L * 1024L;

/**
* Indicates the default lower limit of memory that each cache is allowed to reach.
*/
public static final long DEFAULT_LOW_LEVEL_MEMORY_WATER_MARK_IN_BYTES = 1l * 1024l * 1024l;
public static final long DEFAULT_LOW_LEVEL_MEMORY_WATER_MARK_IN_BYTES = 1L * 1024L * 1024L;

/**
* The number of instances of {@link BitmapDownloader} that will be created. Defaults to {@code 1}.
Expand Down Expand Up @@ -339,7 +340,7 @@ protected BitmapDownloader(int instanceIndex, String name, long maxMemoryInBytes
}

public final void get(View view, String bitmapUid, Object imageSpecs, Handler handler,
DownloadInstructions.Instructions instructions)
Instructions instructions)
{
get(view != null ? new ViewableView(view) : null, bitmapUid, imageSpecs, handler != null ? new HandlerableHander(handler) : null, instructions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.smartnsoft.droid4me.download.DownloadContracts.Bitmapable;
import com.smartnsoft.droid4me.download.DownloadContracts.Handlerable;
import com.smartnsoft.droid4me.download.DownloadContracts.Viewable;
import com.smartnsoft.droid4me.download.DownloadInstructions.BitmapableGif;
import com.smartnsoft.droid4me.log.Logger;
import com.smartnsoft.droid4me.log.LoggerFactory;

Expand Down Expand Up @@ -612,6 +613,11 @@ public void rememberBinding(ViewClass view)
@SuppressWarnings("unchecked") final UsedBitmap otherUsedBitmap = (UsedBitmap) view.getTag();
if (otherUsedBitmap != null)
{
if (otherUsedBitmap.getBitmap() instanceof BitmapableGif)
{
((BitmapableGif) otherUsedBitmap.getBitmap()).getGif().endAnimation();
}

otherUsedBitmap.bindingCount--;
if (IS_DEBUG_TRACE && log.isDebugEnabled())
{
Expand Down
Loading

0 comments on commit dea2d81

Please sign in to comment.