Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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 @@ -7,6 +7,7 @@ Export-Package: org.androidannotations.annotations,
org.androidannotations.annotations.res,
org.androidannotations.annotations.rest,
org.androidannotations.annotations.sharedpreferences,
org.androidannotations.api,
org.androidannotations.api.rest,
org.androidannotations.api.sharedpreferences,
org.androidannotations.api.view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import org.androidannotations.annotations.Background;
import org.androidannotations.api.BackgroundExecutor;
import org.androidannotations.api.BackgroundExecutor.Task;
import org.androidannotations.helper.APTCodeModelHelper;
import org.androidannotations.holder.EComponentHolder;

Expand All @@ -51,13 +50,11 @@ public BackgroundHandler(ProcessingEnvironment processingEnvironment) {
public void process(Element element, EComponentHolder holder) throws Exception {
ExecutableElement executableElement = (ExecutableElement) element;

generateApiClass(element, BackgroundExecutor.class);

JMethod delegatingMethod = codeModelHelper.overrideAnnotatedMethod(executableElement, holder);

JBlock previousMethodBody = codeModelHelper.removeBody(delegatingMethod);

JDefinedClass anonymousTaskClass = codeModel().anonymousClass(Task.class);
JDefinedClass anonymousTaskClass = codeModel().anonymousClass(BackgroundExecutor.Task.class);

JMethod executeMethod = anonymousTaskClass.method(JMod.PUBLIC, codeModel().VOID, "execute");
executeMethod.annotate(Override.class);
Expand All @@ -67,10 +64,10 @@ public void process(Element element, EComponentHolder holder) throws Exception {
tryBlock.body().add(previousMethodBody);
JCatchBlock catchBlock = tryBlock._catch(holder.classes().THROWABLE);
JVar caughtException = catchBlock.param("e");
JStatement uncaughtExceptionCall = holder.classes().THREAD
.staticInvoke("getDefaultUncaughtExceptionHandler")
.invoke("uncaughtException")
.arg(holder.classes().THREAD.staticInvoke("currentThread"))
JStatement uncaughtExceptionCall = holder.classes().THREAD //
.staticInvoke("getDefaultUncaughtExceptionHandler") //
.invoke("uncaughtException") //
.arg(holder.classes().THREAD.staticInvoke("currentThread")) //
.arg(caughtException);
catchBlock.body().add(uncaughtExceptionCall);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import javax.lang.model.element.Element;

import org.androidannotations.annotations.HierarchyViewerSupport;
import org.androidannotations.api.ViewServer;
import org.androidannotations.holder.EActivityHolder;
import org.androidannotations.model.AnnotationElements;
import org.androidannotations.process.IsValid;
Expand All @@ -45,8 +44,6 @@ public void validate(Element element, AnnotationElements validatedElements, IsVa

@Override
public void process(Element element, EActivityHolder holder) throws Exception {
generateApiClass(element, ViewServer.class);

JInvocation viewServerInvocation = classes().VIEW_SERVER.staticInvoke("get").arg(_this());

holder.getOnViewChangedBody().invoke(viewServerInvocation, "addWindow").arg(_this());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
public class EActivityHolder extends EComponentWithViewSupportHolder implements HasIntentBuilder, HasExtras, HasInstanceState, HasOptionsMenu, HasOnActivityResult {

private GreenDroidHelper greenDroidHelper;
private ActivityIntentBuilder intentBuilder;
private ActivityIntentBuilder intentBuilder;
private JMethod onCreate;
private JMethod setIntent;
private JMethod setContentViewLayout;
Expand Down Expand Up @@ -95,8 +95,8 @@ public EActivityHolder(ProcessHolder processHolder, TypeElement annotatedElement
instanceStateHolder = new InstanceStateHolder(this);
onActivityResultHolder = new OnActivityResultHolder(this);
setSetContentView();
intentBuilder = new ActivityIntentBuilder(this, androidManifest);
intentBuilder.build();
intentBuilder = new ActivityIntentBuilder(this, androidManifest);
intentBuilder.build();
handleBackPressed();
}

Expand Down Expand Up @@ -196,7 +196,7 @@ protected void setOnStop() {
method.annotate(Override.class);
JBlock body = method.body();
body.invoke(_super(), method);
getRoboGuiceHolder().onStop = method;
getRoboGuiceHolder().onStop = method;
}

protected void setOnDestroy() {
Expand Down Expand Up @@ -361,8 +361,6 @@ private void handleBackPressed() {
Element declaredOnBackPressedMethod = getOnBackPressedMethod(annotatedElement);
if (declaredOnBackPressedMethod != null) {

processHolder.generateApiClass(declaredOnBackPressedMethod, SdkVersionHelper.class);

JMethod onKeyDownMethod = generatedClass.method(PUBLIC, codeModel().BOOLEAN, "onKeyDown");
onKeyDownMethod.annotate(Override.class);
JVar keyCodeParam = onKeyDownMethod.param(codeModel().INT, "keyCode");
Expand Down Expand Up @@ -418,12 +416,12 @@ private boolean isCustomOnBackPressedMethod(ExecutableElement method) {
;
}

@Override
public IntentBuilder getIntentBuilder() {
return intentBuilder;
}
@Override
public IntentBuilder getIntentBuilder() {
return intentBuilder;
}

@Override
@Override
public void setIntentBuilderClass(JDefinedClass intentBuilderClass) {
this.intentBuilderClass = intentBuilderClass;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.io.IOException;

import org.androidannotations.AndroidAnnotationProcessor;
import org.androidannotations.api.SdkVersionHelper;
import org.androidannotations.utils.AAProcessorTestHelper;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -35,14 +34,12 @@ public void setup() {
@Test
public void activity_with_on_back_pressed_generate_api_dependency() throws IOException {
CompileResult result = compileFiles(ActivityWithOnBackPressedMethod.class);
assertClassSourcesGeneratedToOutput(SdkVersionHelper.class);
assertCompilationSuccessful(result);
}

@Test
public void activity_without_on_back_pressed_do_not_generate_api_dependency() throws IOException {
CompileResult result = compileFiles(ActivityWithBackgroundMethod.class);
assertClassSourcesNotGeneratedToOutput(SdkVersionHelper.class);
assertCompilationSuccessful(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.io.IOException;

import org.androidannotations.AndroidAnnotationProcessor;
import org.androidannotations.api.BackgroundExecutor;
import org.androidannotations.utils.AAProcessorTestHelper;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -35,14 +34,12 @@ public void setup() {
@Test
public void activity_with_background_annotated_method_generate_api_dependency() throws IOException {
CompileResult result = compileFiles(ActivityWithBackgroundMethod.class);
assertClassSourcesGeneratedToOutput(BackgroundExecutor.class);
assertCompilationSuccessful(result);
}

@Test
public void activity_without_background_annotated_method_generate_api_dependency() throws IOException {
CompileResult result = compileFiles(ActivityWithOnBackPressedMethod.class);
assertClassSourcesNotGeneratedToOutput(BackgroundExecutor.class);
assertCompilationSuccessful(result);
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.