aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-03-06 21:53:23 +0100
committerChristian Schneppe <christian@pix-art.de>2019-03-06 21:53:23 +0100
commit0305d355627f880afddae247261c0c29457df6d4 (patch)
tree8e4b646df4a9080abef1fed2b1b7c60184df360f /src/main/java
parentfec6d7a90c443ef0ef86464bd2fb49cdc56d1587 (diff)
find activity even if wrapped in context wrapper
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index b254549af..afc319048 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -10,6 +10,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;
@@ -1275,9 +1276,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;
}