From 57c519895756d6566e39c6e1962c0301e990195b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E6=99=93=E8=B6=85?= Date: Wed, 15 Jan 2020 16:48:37 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E5=8D=95=E5=9B=BE?= =?UTF-8?q?=E5=A4=A7=E5=9B=BE=E6=B5=8F=E8=A7=88=E5=A4=9A=E6=AC=A1=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E7=82=B9=E5=87=BB=E4=BF=9D=E5=AD=98=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lxj/xpopup/util/XPopupUtils.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/library/src/main/java/com/lxj/xpopup/util/XPopupUtils.java b/library/src/main/java/com/lxj/xpopup/util/XPopupUtils.java index 524de489..7d743bfb 100644 --- a/library/src/main/java/com/lxj/xpopup/util/XPopupUtils.java +++ b/library/src/main/java/com/lxj/xpopup/util/XPopupUtils.java @@ -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)) @@ -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(); @@ -346,22 +346,19 @@ public static void findAllEditText(ArrayList 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; @@ -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(); } }); } @@ -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(); } }); }