فهرست منبع

0.0.49.beta4 ready
- 修复部分系统下 BlurRelativeLayout 或 BlurRelativeLayout 在执行回收时触发的“Calling RS with no Context active.”异常;
- ActivityScreenShotImageView 截图方案更新;

0.0.49.beta4 ready
- 修复在部分设备上由 DialogXBaseRelativeLayout 引发的 StackOverflowError,此问题猜测跟特定版本系统固件存在问题有关;

0.0.49.beta3
- 修复 ActivityScreenShotImageView 可能引发的“Software rendering doesn’t support hardware bitmaps” 异常;
- 修复 BottomDialog/FullScreenDialog 的滑动事件在内部存在 ScrollController 时,若触摸位置处于 ScrollController 布局外无法滑动对话框的问题;

0.0.49.beta2
- InputInfo新增方法:`getInputFilters()`、`setInputFilters(InputFilter[] inputFilters)`、`addInputFilter(InputFilter inputFilter)` 和 `removeInputFilter(InputFilter inputFilter)`(issues:332);
- 尝试性修复 DialogFragment 模式实现下的 WaitDialog 内存泄漏问题(issues:334);
- 修复关于DialogFragmentImpl引发的空指针问题此问题(issues:335);

0.0.49.beta1
- 修复 BlurRelativeLayout 和 BlurLinearLayout 在 iOS 主题下使用 DialogFragment 模式时存在的渲染宽度和高度 <=0 导致的异常(issues:324);
- 修复 IOS 主题下可能存在的 `RSInvalidStateException: Calling RS with no Context active` 异常问题(issues:327);
- 修复可能存在的高频启关对话框过程中,因UI未完成构建被关闭引发的空指针异常(issues:331);

Kongzue 2 سال پیش
والد
کامیت
dcb35ff7a7

+ 4 - 3
DialogX/src/main/java/com/kongzue/dialogx/interfaces/OnBindView.java

@@ -30,6 +30,7 @@ public abstract class OnBindView<D> {
 
     int layoutResId;
     View customView;
+    private final int PARENT_FLAG = -109;
 
     public OnBindView(int layoutResId) {
         if (BaseDialog.getTopActivity() == null) {
@@ -163,10 +164,10 @@ public abstract class OnBindView<D> {
             waitBind(parentView, null);
             return;
         }
+        if (getCustomView().getParent() == parentView || parentView.getTag(PARENT_FLAG) == getCustomView().toString()) {
+            return;
+        }
         if (getCustomView().getParent() != null) {
-            if (getCustomView().getParent() == parentView) {
-                return;
-            }
             ((ViewGroup) getCustomView().getParent()).removeView(getCustomView());
         }
         ViewGroup.LayoutParams lp = getCustomView().getLayoutParams();

+ 10 - 13
DialogX/src/main/java/com/kongzue/dialogx/util/views/ActivityScreenShotImageView.java

@@ -152,20 +152,17 @@ public class ActivityScreenShotImageView extends ImageView {
         if (view.getWidth() == 0 || view.getHeight() == 0) return;
         dialog.getDialogView().setVisibility(GONE);
         setContentViewVisibility(true);
-        try {
-            view.buildDrawingCache();
-        }catch (Exception ignored){
-        }
-        try {
-            Rect rect = new Rect();
-            view.getWindowVisibleDisplayFrame(rect);
-            view.setDrawingCacheEnabled(true);
-            setImageBitmap(Bitmap.createBitmap(view.getDrawingCache(), 0, 0, view.getWidth(), view.getHeight()));
-            view.destroyDrawingCache();
-            isScreenshotSuccess = true;
-        }catch (Exception e){
-            isScreenshotSuccess = false;
+        if (view.getWidth() + view.getHeight() == 0) {
+            view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
+            view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
         }
+        int viewWidth = view.getWidth();
+        int viewHeight = view.getHeight();
+        Bitmap bitmap = Bitmap.createBitmap(viewWidth, viewHeight, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(bitmap);
+        view.draw(canvas);
+        setImageBitmap(Bitmap.createBitmap(bitmap, 0, 0, view.getWidth(), view.getHeight()));
+        isScreenshotSuccess = true;
         setContentViewVisibility(false);
         dialog.getDialogView().setVisibility(VISIBLE);
         dialog.getDialogView().requestFocus();

+ 6 - 2
DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/views/BlurLinearLayout.java

@@ -198,11 +198,15 @@ public class BlurLinearLayout extends MaxLinearLayout implements BlurViewType {
 
     private void releaseScript() {
         if (mRenderScript != null) {
-            mRenderScript.destroy();
+            try {
+                mRenderScript.destroy();
+            }catch (Exception e){}
             mRenderScript = null;
         }
         if (mBlurScript != null) {
-            mBlurScript.destroy();
+            try {
+                mBlurScript.destroy();
+            }catch (Exception e){}
             mBlurScript = null;
         }
     }

+ 6 - 2
DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/views/BlurRelativeLayout.java

@@ -198,11 +198,15 @@ public class BlurRelativeLayout extends MaxRelativeLayout implements BlurViewTyp
 
     private void releaseScript() {
         if (mRenderScript != null) {
-            mRenderScript.destroy();
+            try {
+                mRenderScript.destroy();
+            }catch (Exception e){}
             mRenderScript = null;
         }
         if (mBlurScript != null) {
-            mBlurScript.destroy();
+            try {
+                mBlurScript.destroy();
+            }catch (Exception e){}
             mBlurScript = null;
         }
     }

+ 1 - 1
gradle.properties

@@ -19,7 +19,7 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.49.beta3
+BUILD_VERSION=0.0.49.beta4
 BUILD_VERSION_INT=48
 DIALOGX_STYLE_VERSION=5
 android.nonTransitiveRClass=true