find activity even if wrapped in context wrapper. fixes #3396
This commit is contained in:
parent
f406631512
commit
875f0b9943
|
@ -9,6 +9,7 @@ import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.ContextWrapper;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentSender.SendIntentException;
|
import android.content.IntentSender.SendIntentException;
|
||||||
|
@ -1000,9 +1001,12 @@ public abstract class XmppActivity extends ActionBarActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmppActivity find(@NonNull final View view) {
|
public static XmppActivity find(@NonNull final View view) {
|
||||||
final Context context = view.getContext();
|
Context context = view.getContext();
|
||||||
if (context instanceof XmppActivity) {
|
while (context instanceof ContextWrapper) {
|
||||||
return (XmppActivity) context;
|
if (context instanceof XmppActivity) {
|
||||||
|
return (XmppActivity) context;
|
||||||
|
}
|
||||||
|
context = ((ContextWrapper)context).getBaseContext();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue