android.content.MutableContextWrapper

Here are the examples of the java api android.content.MutableContextWrapper taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

16 Source : FastWebViewPool.java
with MIT License
from Ryan-Shz

public static void release(FastWebView webView) {
    if (webView == null) {
        return;
    }
    webView.release();
    MutableContextWrapper wrapper = (MutableContextWrapper) webView.getContext();
    wrapper.setBaseContext(wrapper.getApplicationContext());
    sPool.release(webView);
    LogUtils.d("release webview instance to pool.");
}

16 Source : FastWebViewPool.java
with MIT License
from Ryan-Shz

public static FastWebView acquire(Context context) {
    FastWebView webView = sPool.acquire();
    if (webView == null) {
        MutableContextWrapper wrapper = new MutableContextWrapper(context);
        webView = new FastWebView(wrapper);
        LogUtils.d("create new webview instance.");
    } else {
        MutableContextWrapper wrapper = (MutableContextWrapper) webView.getContext();
        wrapper.setBaseContext(context);
        LogUtils.d("obtain webview instance from pool.");
    }
    return webView;
}

16 Source : MrReactActivity.java
with Apache License 2.0
from markzhai

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) {
        // Get permission to show redbox in dev builds.
        if (!Settings.canDrawOverlays(this)) {
            Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
            startActivity(serviceIntent);
            FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
            Toast.makeText(this, REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
        }
    }
    mReactRootView = ReactPreLoader.getRootView(getReactInfo());
    if (mReactRootView != null) {
        Log.i(TAG, "use pre-load view");
        MutableContextWrapper contextWrapper = (MutableContextWrapper) mReactRootView.getContext();
        contextWrapper.setBaseContext(this);
        try {
            ViewGroup viewGroup = (ViewGroup) mReactRootView.getParent();
            if (viewGroup != null) {
                viewGroup.removeView(mReactRootView);
            }
        } catch (Exception exception) {
            Log.e(TAG, "getParent error", exception);
        }
    } else {
        Log.i(TAG, "createRootView");
        mReactRootView = createRootView();
        if (mReactRootView != null) {
            mReactRootView.startReactApplication(getReactNativeHost().getReactInstanceManager(), getMainComponentName(), getLaunchOptions());
        }
    }
    setContentView(mReactRootView);
    mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}