Example usage for android.view ContextThemeWrapper getBaseContext

List of usage examples for android.view ContextThemeWrapper getBaseContext

Introduction

In this page you can find the example usage for android.view ContextThemeWrapper getBaseContext.

Prototype

public Context getBaseContext() 

Source Link

Usage

From source file:com.microsoft.office.integration.test.AbstractTest.java

private boolean isDialog(Activity activity, View decorView) {
    if (decorView == null || !decorView.isShown()) {
        return false;
    }//from   ww w . ja  v a 2  s  .  c  o m
    Context viewContext = null;
    if (decorView != null) {
        viewContext = decorView.getContext();
    }

    if (viewContext instanceof ContextThemeWrapper) {
        ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
        viewContext = ctw.getBaseContext();
    }
    Context activityContext = activity;
    Context activityBaseContext = activity.getBaseContext();
    return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext))
            && (decorView != activity.getWindow().getDecorView());
}