Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions library/src/main/java/com/lxj/xpopup/util/XPopupUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ public static void moveUpToKeyboard(int keyboardHeight, BasePopupView pv) {
if (focusEt != null && overflowHeight > 0) {
dy = overflowHeight;
}
}else if(isTopPartShadow(pv)){
} else if (isTopPartShadow(pv)) {
int overflowHeight = (focusBottom + keyboardHeight) - windowHeight;
if (focusEt != null && overflowHeight > 0) {
dy = overflowHeight;
}
if(dy!=0){
if (dy != 0) {
pv.getPopupImplView().animate().translationY(-dy)
.setDuration(200)
.setInterpolator(new OvershootInterpolator(0))
Expand Down Expand Up @@ -296,7 +296,7 @@ public static void moveDown(BasePopupView pv) {
pv.getPopupImplView().animate().translationY(0)
.setInterpolator(new OvershootInterpolator(0))
.setDuration(200).start();
}else {
} else {
pv.getPopupContentView().animate().translationY(0)
.setInterpolator(new OvershootInterpolator(0))
.setDuration(200).start();
Expand Down Expand Up @@ -346,22 +346,19 @@ public static void findAllEditText(ArrayList<EditText> list, ViewGroup group) {
}
}

private static Context mContext;

public static void saveBmpToAlbum(final Context context, final XPopupImageLoader imageLoader, final Object uri) {
final Handler mainHandler = new Handler(Looper.getMainLooper());
final ExecutorService executor = Executors.newSingleThreadExecutor();
mContext = context;
executor.execute(new Runnable() {
@Override
public void run() {
File source = imageLoader.getImageFile(mContext, uri);
File source = imageLoader.getImageFile(context, uri);
if (source == null) {
mainHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, "图片不存在!", Toast.LENGTH_SHORT).show();
mContext = null;
Toast.makeText(context, "图片不存在!", Toast.LENGTH_SHORT).show();
}
});
return;
Expand All @@ -379,15 +376,14 @@ public void run() {
//2. save
writeFileFromIS(target, new FileInputStream(source));
//3. notify
MediaScannerConnection.scanFile(mContext, new String[]{target.getAbsolutePath()},
MediaScannerConnection.scanFile(context, new String[]{target.getAbsolutePath()},
new String[]{"image/" + ext}, new MediaScannerConnection.OnScanCompletedListener() {
@Override
public void onScanCompleted(final String path, Uri uri) {
mainHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, "已保存到相册!", Toast.LENGTH_SHORT).show();
mContext = null;
Toast.makeText(context, "已保存到相册!", Toast.LENGTH_SHORT).show();
}
});
}
Expand All @@ -397,8 +393,7 @@ public void run() {
mainHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, "没有保存权限,保存功能无法使用!", Toast.LENGTH_SHORT).show();
mContext = null;
Toast.makeText(context, "没有保存权限,保存功能无法使用!", Toast.LENGTH_SHORT).show();
}
});
}
Expand Down