From 875f0b994317ffcdded3d808e733bd5f1f9d27c2 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 3 Mar 2019 08:31:46 +0100 Subject: [PATCH] find activity even if wrapped in context wrapper. fixes #3396 --- .../java/eu/siacs/conversations/ui/XmppActivity.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 5006e7f44..50adb41d8 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -9,6 +9,7 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.ComponentName; import android.content.Context; +import android.content.ContextWrapper; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender.SendIntentException; @@ -1000,9 +1001,12 @@ public abstract class XmppActivity extends ActionBarActivity { } public static XmppActivity find(@NonNull final View view) { - final Context context = view.getContext(); - if (context instanceof XmppActivity) { - return (XmppActivity) context; + Context context = view.getContext(); + while (context instanceof ContextWrapper) { + if (context instanceof XmppActivity) { + return (XmppActivity) context; + } + context = ((ContextWrapper)context).getBaseContext(); } return null; }