From 49655c6eb38e4354e368a5fbc387bc7981f1d9bd Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 18 Apr 2018 18:13:12 -0700 Subject: [PATCH] Fix BadtokenException thrown when opening Android Catalyst app Reviewed By: achen1 Differential Revision: D7676053 fbshipit-source-id: e0cf9541de131b7c21de9a2647e4270f78b0a107 --- .../devsupport/DevLoadingViewController.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java index 7641b25a3..bc6e6c3b7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java @@ -7,6 +7,7 @@ package com.facebook.react.devsupport; +import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.graphics.Color; @@ -33,6 +34,7 @@ import javax.annotation.Nullable; /** * Controller to display loading messages on top of the screen. All methods are thread safe. */ +@TargetApi(Build.VERSION_CODES.CUPCAKE) public class DevLoadingViewController { private static final int COLOR_DARK_GREEN = Color.parseColor("#035900"); @@ -158,18 +160,16 @@ public class DevLoadingViewController { topOffset = rectangle.top; } - mDevLoadingPopup = new PopupWindow( - mDevLoadingView, - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT); + mDevLoadingPopup = new PopupWindow(currentActivity); mDevLoadingPopup.setTouchable(false); + mDevLoadingPopup.setWidth(ViewGroup.LayoutParams.MATCH_PARENT); + mDevLoadingPopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); mDevLoadingPopup.showAtLocation( - currentActivity.getWindow().getDecorView(), - Gravity.NO_GRAVITY, - - 0, - topOffset); + currentActivity.getWindow().getDecorView(), + Gravity.NO_GRAVITY, + 0, + topOffset); } private void hideInternal() {