Java Code Examples for android.content.Context#equals()
The following examples show how to use
android.content.Context#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogUtils.java From AndroidRipper with GNU Affero General Public License v3.0 | 6 votes |
/** * Checks that the specified DecorView and the Activity DecorView are not equal. * * @param activity the activity which DecorView is to be compared * @param decorView the DecorView to compare * @return true if not equal */ private boolean isDialog(Activity activity, View decorView){ if(decorView == null || !decorView.isShown() || activity == null){ return false; } 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()); }