/** Checks whether the Activity extends one of the ActionBarSherlock Activity types */ public boolean usesActionBarSherlock(TypeElement typeElement) { TypeMirror superType; while (!((superType = typeElement.getSuperclass()) instanceof NoType)) { typeElement = (TypeElement) ((DeclaredType) superType).asElement(); String qName = typeElement.getQualifiedName().toString(); if (qName.startsWith("com.actionbarsherlock.app")) { return true; } if (qName.startsWith("org.holoeverywhere")) { // Since 2.0.0, HoloEverywhere no longer depends on ABS so we // had to find a way to to detect the version in classpath. // Since org.holoeverywhere.addon.AddonSherlock has been removed // during ABS to ABC migration, we're checking if this class is // in the classpath. If so, we're using HEW < 2.0 // See issue #776 return annotationHelper.typeElementFromQualifiedName( "org.holoeverywhere.addon.AddonSherlock") != null; } } return false; }
/** Checks whether the Activity extends one of the ActionBarSherlock Activity types */ public boolean usesActionBarSherlock(EComponentHolder holder) { TypeElement typeElement = annotationHelper.typeElementFromQualifiedName( holder.getGeneratedClass()._extends().fullName()); return usesActionBarSherlock(typeElement); }