Skip to content

Commit b53bdcd

Browse files
committed
Merge pull request androidannotations#1170 from WonderCsabo/1039_updateAndroidOnApi
Update to Android 2.3.1
2 parents 52263e7 + 9063c6f commit b53bdcd

10 files changed

Lines changed: 14 additions & 184 deletions

File tree

‎AndroidAnnotations/androidannotations-api/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>com.google.android</groupId>
4040
<artifactId>android</artifactId>
41-
<version>1.6_r2</version>
41+
<version>2.3.1</version>
4242
<scope>provided</scope>
4343
</dependency>
4444
<dependency>

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/api/SdkVersionHelper.java‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/holder/EActivityHolder.java‎

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,9 @@
2828
import java.util.ArrayList;
2929
import java.util.List;
3030

31-
import javax.lang.model.element.Element;
32-
import javax.lang.model.element.ExecutableElement;
33-
import javax.lang.model.element.Modifier;
3431
import javax.lang.model.element.TypeElement;
35-
import javax.lang.model.type.TypeKind;
3632
import javax.lang.model.type.TypeMirror;
37-
import javax.lang.model.util.ElementFilter;
3833

39-
import org.androidannotations.api.SdkVersionHelper;
4034
import org.androidannotations.helper.ActivityIntentBuilder;
4135
import org.androidannotations.helper.AndroidManifest;
4236
import org.androidannotations.helper.AnnotationHelper;
@@ -107,7 +101,6 @@ public EActivityHolder(ProcessHolder processHolder, TypeElement annotatedElement
107101
setSetContentView();
108102
intentBuilder = new ActivityIntentBuilder(this, androidManifest);
109103
intentBuilder.build();
110-
handleBackPressed();
111104
}
112105

113106
@Override
@@ -341,63 +334,6 @@ public JVar getInitSavedInstanceParam() {
341334
return initSavedInstanceParam;
342335
}
343336

344-
private void handleBackPressed() {
345-
Element declaredOnBackPressedMethod = getOnBackPressedMethod(annotatedElement);
346-
if (declaredOnBackPressedMethod != null) {
347-
348-
JMethod onKeyDownMethod = generatedClass.method(PUBLIC, codeModel().BOOLEAN, "onKeyDown");
349-
onKeyDownMethod.annotate(Override.class);
350-
JVar keyCodeParam = onKeyDownMethod.param(codeModel().INT, "keyCode");
351-
JClass keyEventClass = classes().KEY_EVENT;
352-
JVar eventParam = onKeyDownMethod.param(keyEventClass, "event");
353-
354-
JClass versionHelperClass = refClass(SdkVersionHelper.class);
355-
356-
JInvocation sdkInt = versionHelperClass.staticInvoke("getSdkInt");
357-
358-
JBlock onKeyDownBody = onKeyDownMethod.body();
359-
360-
onKeyDownBody._if( //
361-
sdkInt.lt(JExpr.lit(5)) //
362-
.cand(keyCodeParam.eq(keyEventClass.staticRef("KEYCODE_BACK"))) //
363-
.cand(eventParam.invoke("getRepeatCount").eq(JExpr.lit(0)))) //
364-
._then() //
365-
.invoke("onBackPressed");
366-
367-
onKeyDownBody._return( //
368-
JExpr._super().invoke(onKeyDownMethod) //
369-
.arg(keyCodeParam) //
370-
.arg(eventParam));
371-
}
372-
}
373-
374-
private ExecutableElement getOnBackPressedMethod(TypeElement activityElement) {
375-
376-
AnnotationHelper annotationHelper = new AnnotationHelper(processingEnvironment());
377-
378-
List<? extends Element> allMembers = annotationHelper.getElementUtils().getAllMembers(activityElement);
379-
380-
List<ExecutableElement> activityInheritedMethods = ElementFilter.methodsIn(allMembers);
381-
382-
for (ExecutableElement activityInheritedMethod : activityInheritedMethods) {
383-
if (isCustomOnBackPressedMethod(activityInheritedMethod)) {
384-
return activityInheritedMethod;
385-
}
386-
}
387-
return null;
388-
}
389-
390-
private boolean isCustomOnBackPressedMethod(ExecutableElement method) {
391-
TypeElement methodClass = (TypeElement) method.getEnclosingElement();
392-
boolean methodBelongsToActivityClass = methodClass.getQualifiedName().toString().equals(CanonicalNameConstants.ACTIVITY);
393-
return !methodBelongsToActivityClass //
394-
&& method.getSimpleName().toString().equals("onBackPressed") //
395-
&& method.getThrownTypes().size() == 0 //
396-
&& method.getModifiers().contains(Modifier.PUBLIC) //
397-
&& method.getReturnType().getKind().equals(TypeKind.VOID) //
398-
&& method.getParameters().size() == 0;
399-
}
400-
401337
@Override
402338
public IntentBuilder getIntentBuilder() {
403339
return intentBuilder;

‎AndroidAnnotations/eclipse-dependencies/.classpath‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
44
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
55
<classpathentry exported="true" kind="lib" path="codemodel-2.6.jar"/>
6-
<classpathentry exported="true" kind="lib" path="android-1.6_r2.jar"/>
6+
<classpathentry exported="true" kind="lib" path="android-2.3.1.jar"/>
77
<classpathentry kind="output" path="bin"/>
88
</classpath>

‎AndroidAnnotations/eclipse-dependencies/META-INF/MANIFEST.MF‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ Bundle-Name: androidannotations-dependencies
44
Bundle-SymbolicName: androidannotations-dependencies
55
Bundle-Version: 1.0.0
66
Bundle-ClassPath: codemodel-2.6.jar,
7-
android-1.6_r2.jar
7+
android-2.3.1.jar
88
Export-Package: android,
99
android.accessibilityservice,
10+
android.accounts,
1011
android.app,
12+
android.app.admin,
13+
android.app.backup,
1114
android.appwidget,
15+
android.bluetooth,
1216
android.content,
1317
android.content.pm,
1418
android.content.res,
@@ -22,17 +26,23 @@ Export-Package: android,
2226
android.inputmethodservice,
2327
android.location,
2428
android.media,
29+
android.media.audiofx,
2530
android.net,
2631
android.net.http,
32+
android.net.sip,
2733
android.net.wifi,
34+
android.nfc,
2835
android.opengl,
2936
android.os,
37+
android.os.storage,
3038
android.preference,
3139
android.provider,
3240
android.sax,
41+
android.service.wallpaper,
3342
android.speech,
3443
android.speech.tts,
3544
android.telephony,
45+
android.telephony.cdma,
3646
android.telephony.gsm,
3747
android.text,
3848
android.text.format,
-2.29 MB
Binary file not shown.
5.51 MB
Binary file not shown.

‎AndroidAnnotations/eclipse-dependencies/build.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
bin.includes = META-INF/,\
1818
codemodel-2.6.jar,\
19-
android-1.6_r2.jar
19+
android-2.3.1.jar

‎AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/BackpressedActivity.java‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎AndroidAnnotations/functional-test-1-5/src/test/java/org/androidannotations/test15/BackpressedActivityTest.java‎

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)