From 411c92f0f0a759b9f77cf0abcb080b35920e9a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B6=9B?= Date: Wed, 24 Feb 2021 11:57:40 +0800 Subject: [PATCH] fix:android unwarp return activity --- .../doric/src/main/java/pub/doric/utils/DoricUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/utils/DoricUtils.java b/doric-android/doric/src/main/java/pub/doric/utils/DoricUtils.java index 43a16182..5a365ea9 100644 --- a/doric-android/doric/src/main/java/pub/doric/utils/DoricUtils.java +++ b/doric-android/doric/src/main/java/pub/doric/utils/DoricUtils.java @@ -15,6 +15,7 @@ */ package pub.doric.utils; +import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; import android.content.res.AssetManager; @@ -323,10 +324,9 @@ public class DoricUtils { } public static Context unwrap(Context context) { - while (context instanceof ContextWrapper) { + while (!(context instanceof Activity) && context instanceof ContextWrapper) { context = ((ContextWrapper) context).getBaseContext(); } - return context; } }