X Tutup
Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
* activity classes to inject a menu item.
* </p>
* <p>
* The field MUST be of type {@link android.view.MenuItem} or
* com.actionbarsherlock.view.MenuItem.
* The field MUST be of type {@link android.view.MenuItem}
* </p>
* <p>
* The annotation value should be one or several of R.id.* fields. If not set,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void validate(Element element, AnnotationElements validatedElements, IsVa

validatorHelper.returnTypeIsVoidOrBoolean(executableElement, valid);

validatorHelper.param.anyOfTypes(CanonicalNameConstants.MENU_ITEM, CanonicalNameConstants.SHERLOCK_MENU_ITEM).optional().validate(executableElement, valid);
validatorHelper.param.type(CanonicalNameConstants.MENU_ITEM).optional().validate(executableElement, valid);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ public final class CanonicalNameConstants {
public static final String INTERNET_PERMISSION = "android.permission.INTERNET";
public static final String WAKELOCK_PERMISSION = "android.permission.WAKE_LOCK";

/*
* Sherlock
*/
public static final String SHERLOCK_MENU = "com.actionbarsherlock.view.Menu";
public static final String SHERLOCK_MENU_ITEM = "com.actionbarsherlock.view.MenuItem";
public static final String SHERLOCK_MENU_INFLATER = "com.actionbarsherlock.view.MenuInflater";

/*
* SpringFramework
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,9 @@ public class ValidatorHelper {

public final ValidatorParameterHelper param;

private final ActionBarSherlockHelper thirdPartyLibHelper;

public ValidatorHelper(TargetAnnotationHelper targetAnnotationHelper) {
annotationHelper = targetAnnotationHelper;
param = new ValidatorParameterHelper(annotationHelper);
thirdPartyLibHelper = new ActionBarSherlockHelper(annotationHelper);
}

public void isNotFinal(Element element, IsValid valid) {
Expand Down Expand Up @@ -531,11 +528,7 @@ public void extendsMenuItem(Element element, IsValid valid) {
TypeElement enclosingTypeElement = annotationHelper.typeElementFromQualifiedName(enclosingQualifiedName);

if (enclosingTypeElement != null) {
if (thirdPartyLibHelper.usesActionBarSherlock(enclosingTypeElement)) {
extendsType(element, CanonicalNameConstants.SHERLOCK_MENU_ITEM, valid);
} else {
extendsType(element, CanonicalNameConstants.MENU_ITEM, valid);
}
extendsType(element, CanonicalNameConstants.MENU_ITEM, valid);
}
}

Expand Down Expand Up @@ -1533,6 +1526,7 @@ public void isPreferenceFragmentClassPresent(Element element, IsValid valid) {
annotationHelper.printAnnotationError(element, "The class " + CanonicalNameConstants.PREFERENCE_FRAGMENT + " cannot be found. You have to use at least API 11");
}
}

public void usesEnqueueIfHasId(Element element, IsValid valid) {
UiThread annotation = element.getAnnotation(UiThread.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import javax.lang.model.util.ElementFilter;

import org.androidannotations.api.SdkVersionHelper;
import org.androidannotations.helper.ActionBarSherlockHelper;
import org.androidannotations.helper.ActivityIntentBuilder;
import org.androidannotations.helper.AndroidManifest;
import org.androidannotations.helper.AnnotationHelper;
Expand Down Expand Up @@ -247,44 +246,26 @@ protected void setOnContentChanged() {
}

private void setOnCreateOptionsMenu() {
JClass menuClass = classes().MENU;
JClass menuInflaterClass = classes().MENU_INFLATER;
String getMenuInflaterMethodName = "getMenuInflater";
if (usesActionBarSherlock()) {
menuClass = classes().SHERLOCK_MENU;
menuInflaterClass = classes().SHERLOCK_MENU_INFLATER;
getMenuInflaterMethodName = "getSupportMenuInflater";
}

JMethod method = generatedClass.method(PUBLIC, codeModel().BOOLEAN, "onCreateOptionsMenu");
method.annotate(Override.class);
JBlock methodBody = method.body();
onCreateOptionsMenuMenuParam = method.param(menuClass, "menu");
onCreateOptionsMenuMenuInflaterVar = methodBody.decl(menuInflaterClass, "menuInflater", invoke(getMenuInflaterMethodName));
onCreateOptionsMenuMenuParam = method.param(classes().MENU, "menu");
onCreateOptionsMenuMenuInflaterVar = methodBody.decl(classes().MENU_INFLATER, "menuInflater", invoke("getMenuInflater"));
onCreateOptionsMenuMethodBody = methodBody.block();
methodBody._return(_super().invoke(method).arg(onCreateOptionsMenuMenuParam));
}

private void setOnOptionsItemSelected() {
JClass menuItemClass = classes().MENU_ITEM;
if (usesActionBarSherlock()) {
menuItemClass = classes().SHERLOCK_MENU_ITEM;
}

JMethod method = generatedClass.method(JMod.PUBLIC, codeModel().BOOLEAN, "onOptionsItemSelected");
method.annotate(Override.class);
JBlock methodBody = method.body();
onOptionsItemSelectedItem = method.param(menuItemClass, "item");
onOptionsItemSelectedItem = method.param(classes().MENU_ITEM, "item");
onOptionsItemSelectedItemId = methodBody.decl(codeModel().INT, "itemId_", onOptionsItemSelectedItem.invoke("getItemId"));
onOptionsItemSelectedMiddleBlock = methodBody.block();

methodBody._return(invoke(_super(), method).arg(onOptionsItemSelectedItem));
}

private boolean usesActionBarSherlock() {
return new ActionBarSherlockHelper(new AnnotationHelper(processingEnvironment())).usesActionBarSherlock(this);
}

@Override
protected void setFindNativeFragmentById() {
JMethod method = generatedClass.method(PRIVATE, classes().FRAGMENT, "findNativeFragmentById");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.Receiver.RegisterAt;
import org.androidannotations.helper.ActionBarSherlockHelper;
import org.androidannotations.helper.AnnotationHelper;
import org.androidannotations.helper.OrmLiteHelper;
import org.androidannotations.holder.ReceiverRegistrationHolder.IntentFilterData;
import org.androidannotations.process.ProcessHolder;
Expand Down Expand Up @@ -183,44 +181,28 @@ private void generify(JGenerifiable generifiable) {
}

private void setOnCreateOptionsMenu() {
JClass menuClass = classes().MENU;
JClass menuInflaterClass = classes().MENU_INFLATER;
if (usesActionBarSherlock()) {
menuClass = classes().SHERLOCK_MENU;
menuInflaterClass = classes().SHERLOCK_MENU_INFLATER;
}

JMethod method = generatedClass.method(PUBLIC, codeModel().VOID, "onCreateOptionsMenu");
method.annotate(Override.class);
JBlock methodBody = method.body();
onCreateOptionsMenuMenuParam = method.param(menuClass, "menu");
onCreateOptionsMenuMenuInflaterVar = method.param(menuInflaterClass, "inflater");
onCreateOptionsMenuMenuParam = method.param(classes().MENU, "menu");
onCreateOptionsMenuMenuInflaterVar = method.param(classes().MENU_INFLATER, "inflater");
onCreateOptionsMenuMethodBody = methodBody.block();
methodBody.invoke(_super(), method).arg(onCreateOptionsMenuMenuParam).arg(onCreateOptionsMenuMenuInflaterVar);

getInitBody().invoke("setHasOptionsMenu").arg(JExpr.TRUE);
}

private void setOnOptionsItemSelected() {
JClass menuItemClass = classes().MENU_ITEM;
if (usesActionBarSherlock()) {
menuItemClass = classes().SHERLOCK_MENU_ITEM;
}

JMethod method = generatedClass.method(JMod.PUBLIC, codeModel().BOOLEAN, "onOptionsItemSelected");
method.annotate(Override.class);
JBlock methodBody = method.body();
onOptionsItemSelectedItem = method.param(menuItemClass, "item");
onOptionsItemSelectedItem = method.param(classes().MENU_ITEM, "item");
onOptionsItemSelectedItemId = methodBody.decl(codeModel().INT, "itemId_", onOptionsItemSelectedItem.invoke("getItemId"));
onOptionsItemSelectedMiddleBlock = methodBody.block();

methodBody._return(invoke(_super(), method).arg(onOptionsItemSelectedItem));
}

private boolean usesActionBarSherlock() {
return new ActionBarSherlockHelper(new AnnotationHelper(processingEnvironment())).usesActionBarSherlock(this);
}

@Override
protected void setContextRef() {
contextRef = JExpr.invoke("getActivity");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ public class Classes {
public final JClass PREFERENCE_CLICK_LISTENER = refClass(CanonicalNameConstants.PREFERENCE_CLICK_LISTENER);
public final JClass PREFERENCE_ACTIVITY_HEADER = refClass(CanonicalNameConstants.PREFERENCE_ACTIVITY_HEADER);

/*
* Sherlock
*/
public final JClass SHERLOCK_MENU = refClass(CanonicalNameConstants.SHERLOCK_MENU);
public final JClass SHERLOCK_MENU_ITEM = refClass(CanonicalNameConstants.SHERLOCK_MENU_ITEM);
public final JClass SHERLOCK_MENU_INFLATER = refClass(CanonicalNameConstants.SHERLOCK_MENU_INFLATER);

/*
* RoboGuice
*/
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
X Tutup