Skip to content

Commit

Permalink
fix #114
Browse files Browse the repository at this point in the history
  • Loading branch information
bingoogolapple committed Nov 28, 2017
1 parent 64ea86e commit 30bf841
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
4 changes: 2 additions & 2 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ dependencies {
implementation 'pub.devrel:easypermissions:1.0.1'
// 以上几个库是演示案例所使用到的

// implementation project(':library')
implementation project(':library')

// -------------------- 以下4个库是必须依赖的 ----------------------------
implementation 'cn.bingoogolapple:bga-photopicker:1.2.5@aar'
// implementation 'cn.bingoogolapple:bga-photopicker:1.2.6@aar'
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:recyclerview-v7:27.0.1'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ ANDROID_BUILD_TARGET_SDK_VERSION=26
ANDROID_BUILD_SDK_VERSION=26
ANDROID_BUILD_TOOLS_VERSION=26.0.3

VERSION_NAME=1.2.5
VERSION_CODE=125
VERSION_NAME=1.2.6
VERSION_CODE=126
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class BGAPhotoPreviewActivity extends BGAPPToolbarActivity implements Pho
* 获取查看多张图片的intent
*
* @param context
* @param savePhotoDir 保存图片的目录,如果传null,则没有保存图片功能
* @param savePhotoDir 保存图片的目录,如果传null,则没有保存图片功能
* @param previewPhotos 当前预览的图片目录里的图片路径集合
* @param currentPosition 当前预览图片的位置
* @return
Expand Down Expand Up @@ -251,7 +251,9 @@ private synchronized void savePic() {
BGAImage.download(url, new BGAImageLoader.DownloadDelegate() {
@Override
public void onSuccess(String url, Bitmap bitmap) {
mSavePhotoTask.setBitmapAndPerform(bitmap);
if (mSavePhotoTask != null) {
mSavePhotoTask.setBitmapAndPerform(bitmap);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import android.app.Activity;
import android.support.annotation.DrawableRes;
import android.util.Log;
import android.widget.ImageView;

/**
Expand All @@ -25,6 +26,7 @@
* 描述:
*/
public class BGAImage {
private static final String TAG = BGAImage.class.getSimpleName();
private static BGAImageLoader sImageLoader;

private BGAImage() {
Expand Down Expand Up @@ -61,7 +63,11 @@ private static final boolean isClassExists(String classFullName) {
}

public static void display(ImageView imageView, @DrawableRes int loadingResId, @DrawableRes int failResId, String path, int width, int height, final BGAImageLoader.DisplayDelegate delegate) {
getImageLoader().display(imageView, path, loadingResId, failResId, width, height, delegate);
try {
getImageLoader().display(imageView, path, loadingResId, failResId, width, height, delegate);
} catch (Exception e) {
Log.d(TAG, "显示图片失败:" + e.getMessage());
}
}

public static void display(ImageView imageView, @DrawableRes int placeholderResId, String path, int width, int height, final BGAImageLoader.DisplayDelegate delegate) {
Expand All @@ -77,7 +83,11 @@ public static void display(ImageView imageView, @DrawableRes int placeholderResI
}

public static void download(String path, final BGAImageLoader.DownloadDelegate delegate) {
getImageLoader().download(path, delegate);
try {
getImageLoader().download(path, delegate);
} catch (Exception e) {
Log.d(TAG, "下载图片失败:" + e.getMessage());
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
Expand Down Expand Up @@ -79,15 +81,26 @@ protected void processLogic() {
/**
* 设置目录数据集合
*
* @param datas
* @param data
*/
public void setData(ArrayList<BGAPhotoFolderModel> datas) {
mFolderAdapter.setData(datas);
public void setData(ArrayList<BGAPhotoFolderModel> data) {
mFolderAdapter.setData(data);
}

@Override
public void show() {
showAsDropDown(mAnchorView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
int[] location = new int[2];
mAnchorView.getLocationInWindow(location);
int offsetY = location[1] + mAnchorView.getHeight();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
setHeight(BGAPhotoPickerUtil.getScreenHeight() - offsetY);
}
showAtLocation(mAnchorView, Gravity.NO_GRAVITY, 0, offsetY);
} else {
showAsDropDown(mAnchorView);
}

ViewCompat.animate(mContentRv).translationY(-mWindowRootView.getHeight()).setDuration(0).start();
ViewCompat.animate(mContentRv).translationY(0).setDuration(ANIM_DURATION).start();
ViewCompat.animate(mRootLl).alpha(0).setDuration(0).start();
Expand Down

0 comments on commit 30bf841

Please sign in to comment.