-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
358 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="lib.lhh.fiv.library" | ||
android:versionCode="1210" | ||
android:versionName="1.2.1" > | ||
<application> | ||
</application> | ||
android:versionCode="1300" | ||
android:versionName="1.3.0" > | ||
</manifest> |
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
lib.lhh.fiv.library/src/lib.lhh.fiv/library/BaseFrescoImageView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package lib.lhh.fiv.library; | ||
|
||
import com.facebook.drawee.controller.ControllerListener; | ||
import com.facebook.drawee.generic.RoundingParams; | ||
import com.facebook.drawee.interfaces.DraweeController; | ||
import com.facebook.imagepipeline.request.ImageRequest; | ||
import com.facebook.imagepipeline.request.Postprocessor; | ||
|
||
/** | ||
* Created by Linhh on 16/3/2. | ||
*/ | ||
public interface BaseFrescoImageView { | ||
|
||
/** | ||
* 获得当前监听 | ||
* @return | ||
*/ | ||
public ControllerListener getControllerListener(); | ||
|
||
/** | ||
* 获得当前使用的DraweeController | ||
* @return | ||
*/ | ||
public DraweeController getDraweeController(); | ||
|
||
/** | ||
* 获得低级别ImageRequest | ||
* @return | ||
*/ | ||
public ImageRequest getLowImageRequest(); | ||
|
||
/** | ||
* 获得当前使用的ImageRequest | ||
* @return | ||
*/ | ||
public ImageRequest getImageRequest(); | ||
|
||
/** | ||
* 获得当前使用的RoundingParams | ||
*/ | ||
public RoundingParams getRoundingParams(); | ||
|
||
/** | ||
* 是否开启动画 | ||
* @return | ||
*/ | ||
public boolean isAnim(); | ||
|
||
/** | ||
* 获得当前后处理 | ||
* @return | ||
*/ | ||
public Postprocessor getPostProcessor(); | ||
|
||
/** | ||
* 获得当前使用的默认图 | ||
* @return | ||
*/ | ||
public int getDefaultResID(); | ||
|
||
/** | ||
* 获得当前加载的图片 | ||
* @return | ||
*/ | ||
public String getThumbnailUrl(); | ||
|
||
/** | ||
* 获得当前低分辨率图片 | ||
* @return | ||
*/ | ||
public String getLowThumbnailUrl(); | ||
|
||
/** | ||
* 获得加载的本地图片 | ||
* @return | ||
*/ | ||
public String getThumbnailPath(); | ||
|
||
/** | ||
* 是否可以点击重试,默认false | ||
* @return | ||
*/ | ||
public boolean getTapToRetryEnabled(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
lib.lhh.fiv.library/src/lib.lhh.fiv/library/FrescoFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package lib.lhh.fiv.library; | ||
|
||
import android.net.Uri; | ||
import android.text.TextUtils; | ||
|
||
import com.facebook.drawee.backends.pipeline.Fresco; | ||
import com.facebook.drawee.interfaces.DraweeController; | ||
import com.facebook.imagepipeline.request.ImageRequest; | ||
import com.facebook.imagepipeline.request.ImageRequestBuilder; | ||
|
||
/** | ||
* Created by Linhh on 16/3/2. | ||
*/ | ||
public class FrescoFactory { | ||
|
||
public static DraweeController buildDraweeController(BaseFrescoImageView fresco){ | ||
return Fresco.newDraweeControllerBuilder() | ||
.setImageRequest(fresco.getImageRequest()) | ||
.setAutoPlayAnimations(fresco.isAnim()) | ||
.setTapToRetryEnabled(fresco.getTapToRetryEnabled()) | ||
.setLowResImageRequest(fresco.getLowImageRequest()) | ||
.setControllerListener(fresco.getControllerListener()) | ||
.setOldController(fresco.getDraweeController()) | ||
.build(); | ||
} | ||
|
||
public static ImageRequest buildImageRequestWithResource(BaseFrescoImageView fresco){ | ||
return ImageRequestBuilder.newBuilderWithResourceId(fresco.getDefaultResID()) | ||
.setPostprocessor(fresco.getPostProcessor()) | ||
.setLocalThumbnailPreviewsEnabled(true) | ||
.build(); | ||
} | ||
|
||
public static ImageRequest buildImageRequestWithSource(BaseFrescoImageView fresco){ | ||
String thumbnail = null; | ||
if(TextUtils.isEmpty(fresco.getThumbnailUrl())){ | ||
thumbnail = fresco.getThumbnailPath(); | ||
}else{ | ||
thumbnail = fresco.getThumbnailUrl(); | ||
} | ||
Uri uri = Uri.parse(thumbnail); | ||
return ImageRequestBuilder.newBuilderWithSource(uri) | ||
.setPostprocessor(fresco.getPostProcessor()) | ||
.setLocalThumbnailPreviewsEnabled(true) | ||
.build(); | ||
} | ||
|
||
public static ImageRequest buildLowImageRequest(BaseFrescoImageView fresco){ | ||
String lowThumbnail = null; | ||
if(TextUtils.isEmpty(fresco.getLowThumbnailUrl())){ | ||
return null; | ||
} | ||
lowThumbnail = fresco.getLowThumbnailUrl(); | ||
Uri uri = Uri.parse(lowThumbnail); | ||
return ImageRequest.fromUri(uri); | ||
} | ||
} |
Oops, something went wrong.