Skip to content

Commit 311e6e9

Browse files
committed
Merge branch 'develop' into 264_sharedpref_string_set
Conflicts: AndroidAnnotations/functional-test-1-5-tests/src/test/java/org/androidannotations/test15/prefs/PrefsActivityTest.java
2 parents 4733416 + af58f98 commit 311e6e9

92 files changed

Lines changed: 978 additions & 1889 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
/**
2-
* Copyright (C) 2010-2014 eBusiness Information, Excilys Group
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5-
* use this file except in compliance with the License. You may obtain a copy of
6-
* the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed To in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13-
* License for the specific language governing permissions and limitations under
14-
* the License.
15-
*/
16-
package org.androidannotations.annotations;
17-
18-
import java.lang.annotation.ElementType;
19-
import java.lang.annotation.Retention;
20-
import java.lang.annotation.RetentionPolicy;
21-
import java.lang.annotation.Target;
22-
23-
/**
24-
* Use it on {@link EActivity} annotated classes to set a custom title layout.
25-
* <p/>
26-
* The annotation value is mandatory and should be one of R.layout.* fields.
27-
* <p/>
28-
* <blockquote>
29-
*
30-
* Example :
31-
*
32-
* <pre>
33-
* &#064;CustomTitle(R.layout.activityTitleLayout)
34-
* &#064;EActivity(R.layout.main)
35-
* public class MyActivity extends Activity {
36-
*
37-
* }
38-
* </pre>
39-
*
40-
* </blockquote>
41-
*/
42-
@Retention(RetentionPolicy.CLASS)
43-
@Target(ElementType.TYPE)
44-
public @interface CustomTitle {
45-
int value();
46-
}
1+
/**
2+
* Copyright (C) 2010-2014 eBusiness Information, Excilys Group
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed To in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package org.androidannotations.annotations;
17+
18+
import java.lang.annotation.ElementType;
19+
import java.lang.annotation.Retention;
20+
import java.lang.annotation.RetentionPolicy;
21+
import java.lang.annotation.Target;
22+
23+
/**
24+
* Use it on {@link EActivity} annotated classes to set a custom title layout.
25+
* <p/>
26+
* The annotation value is mandatory and should be one of R.layout.* fields.
27+
* <p/>
28+
* <blockquote>
29+
*
30+
* Example :
31+
*
32+
* <pre>
33+
* &#064;CustomTitle(R.layout.activityTitleLayout)
34+
* &#064;EActivity(R.layout.main)
35+
* public class MyActivity extends Activity {
36+
*
37+
* }
38+
* </pre>
39+
*
40+
* </blockquote>
41+
*/
42+
@Retention(RetentionPolicy.CLASS)
43+
@Target(ElementType.TYPE)
44+
public @interface CustomTitle {
45+
int value();
46+
}

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/api/rest/RestErrorHandler.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.androidannotations.api.rest;
1717

18-
import org.springframework.web.client.RestClientException;
18+
import org.springframework.core.NestedRuntimeException;
1919

2020
/**
2121
* This interface is used for handling rest client exceptions.
@@ -26,5 +26,5 @@ public interface RestErrorHandler {
2626
*
2727
* @param e
2828
*/
29-
void onRestClientExceptionThrown(RestClientException e);
29+
void onRestClientExceptionThrown(NestedRuntimeException e);
3030
}

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/AbstractListenerHandler.java‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
package org.androidannotations.handler;
1717

1818
import static com.sun.codemodel.JExpr._new;
19-
import static com.sun.codemodel.JExpr._null;
20-
import static com.sun.codemodel.JExpr.cast;
2119
import static com.sun.codemodel.JExpr.invoke;
2220

2321
import java.util.List;
@@ -45,8 +43,6 @@
4543
import com.sun.codemodel.JFieldRef;
4644
import com.sun.codemodel.JInvocation;
4745
import com.sun.codemodel.JMethod;
48-
import com.sun.codemodel.JType;
49-
import com.sun.codemodel.JVar;
5046

5147
public abstract class AbstractListenerHandler extends BaseAnnotationHandler<EComponentWithViewSupportHolder> {
5248

@@ -103,7 +99,7 @@ public void process(Element element, EComponentWithViewSupportHolder holder) {
10399

104100
makeCall(listenerMethodBody, call, returnType);
105101

106-
processParameters(listenerMethod, call, parameters);
102+
processParameters(holder, listenerMethod, call, parameters);
107103

108104
for (JFieldRef idRef : idsRefs) {
109105
FoundViewHolder foundViewHolder = holder.getFoundViewHolder(idRef, getViewClass());
@@ -113,7 +109,7 @@ public void process(Element element, EComponentWithViewSupportHolder holder) {
113109

114110
protected abstract void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror returnType);
115111

116-
protected abstract void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> userParameters);
112+
protected abstract void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> userParameters);
117113

118114
protected abstract JMethod createListenerMethod(JDefinedClass listenerAnonymousClass);
119115

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/CheckedChangeHandler.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
package org.androidannotations.handler;
1717

1818
import com.sun.codemodel.*;
19+
1920
import org.androidannotations.annotations.CheckedChange;
21+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
2022
import org.androidannotations.model.AnnotationElements;
2123
import org.androidannotations.process.IsValid;
2224

@@ -25,6 +27,7 @@
2527
import javax.lang.model.element.ExecutableElement;
2628
import javax.lang.model.element.VariableElement;
2729
import javax.lang.model.type.TypeMirror;
30+
2831
import java.util.List;
2932

3033
public class CheckedChangeHandler extends AbstractListenerHandler {
@@ -49,7 +52,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
4952
}
5053

5154
@Override
52-
protected void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
55+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
5356
JVar btnParam = listenerMethod.param(classes().COMPOUND_BUTTON, "buttonView");
5457
JVar isCheckedParam = listenerMethod.param(codeModel().BOOLEAN, "isChecked");
5558
boolean isCheckedParamExists = parameters.size() == 2;

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/ClickHandler.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import javax.lang.model.type.TypeMirror;
2525

2626
import org.androidannotations.annotations.Click;
27+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
2728
import org.androidannotations.model.AnnotationElements;
2829
import org.androidannotations.process.IsValid;
2930

@@ -58,7 +59,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
5859
}
5960

6061
@Override
61-
protected void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
62+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
6263
boolean hasItemParameter = parameters.size() == 1;
6364

6465
JVar viewParam = listenerMethod.param(classes().VIEW, "view");

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/EditorActionHandler.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
package org.androidannotations.handler;
1717

1818
import com.sun.codemodel.*;
19+
1920
import org.androidannotations.annotations.EditorAction;
2021
import org.androidannotations.helper.CanonicalNameConstants;
22+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
2123
import org.androidannotations.model.AnnotationElements;
2224
import org.androidannotations.process.IsValid;
2325

@@ -27,6 +29,7 @@
2729
import javax.lang.model.element.VariableElement;
2830
import javax.lang.model.type.TypeKind;
2931
import javax.lang.model.type.TypeMirror;
32+
3033
import java.util.List;
3134

3235
public class EditorActionHandler extends AbstractListenerHandler {
@@ -65,7 +68,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
6568
}
6669

6770
@Override
68-
protected void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> userParameters) {
71+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> userParameters) {
6972
JVar textView = listenerMethod.param(classes().TEXT_VIEW, "textView");
7073
JVar actionId = listenerMethod.param(codeModel().INT, "actionId");
7174
JVar event = listenerMethod.param(classes().KEY_EVENT, "event");

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/FocusChangeHandler.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import javax.lang.model.type.TypeMirror;
2525

2626
import org.androidannotations.annotations.FocusChange;
27+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
2728
import org.androidannotations.model.AnnotationElements;
2829
import org.androidannotations.process.IsValid;
2930

@@ -58,7 +59,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
5859
}
5960

6061
@Override
61-
protected void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
62+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
6263
JVar viewParam = listenerMethod.param(classes().VIEW, "view");
6364
JVar hasFocusParam = listenerMethod.param(codeModel().BOOLEAN, "hasFocus");
6465
boolean hasFocusParamExists = parameters.size() == 2;

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/ItemClickHandler.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import org.androidannotations.annotations.ItemClick;
3131
import org.androidannotations.helper.APTCodeModelHelper;
32+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
3233
import org.androidannotations.model.AnnotationElements;
3334
import org.androidannotations.process.IsValid;
3435

@@ -38,7 +39,6 @@
3839
import com.sun.codemodel.JInvocation;
3940
import com.sun.codemodel.JMethod;
4041
import com.sun.codemodel.JMod;
41-
import com.sun.codemodel.JType;
4242
import com.sun.codemodel.JVar;
4343

4444
public class ItemClickHandler extends AbstractListenerHandler {
@@ -66,7 +66,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
6666
}
6767

6868
@Override
69-
protected void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
69+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
7070
boolean hasItemParameter = parameters.size() == 1;
7171

7272
JClass narrowAdapterViewClass = classes().ADAPTER_VIEW.narrow(codeModel().wildcard());

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/ItemLongClickHandler.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
package org.androidannotations.handler;
1717

1818
import com.sun.codemodel.*;
19+
1920
import org.androidannotations.annotations.ItemLongClick;
21+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
2022
import org.androidannotations.model.AnnotationElements;
2123
import org.androidannotations.process.IsValid;
2224

@@ -26,6 +28,7 @@
2628
import javax.lang.model.element.VariableElement;
2729
import javax.lang.model.type.TypeKind;
2830
import javax.lang.model.type.TypeMirror;
31+
2932
import java.util.List;
3033

3134
import static com.sun.codemodel.JExpr.cast;
@@ -60,7 +63,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
6063
}
6164

6265
@Override
63-
protected void processParameters(JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
66+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> parameters) {
6467
boolean hasItemParameter = parameters.size() == 1;
6568

6669
JClass narrowAdapterViewClass = classes().ADAPTER_VIEW.narrow(codeModel().wildcard());

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/handler/ItemSelectHandler.java‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
package org.androidannotations.handler;
1717

1818
import com.sun.codemodel.*;
19+
1920
import org.androidannotations.annotations.ItemSelect;
21+
import org.androidannotations.holder.EComponentWithViewSupportHolder;
2022
import org.androidannotations.model.AnnotationElements;
2123
import org.androidannotations.process.IsValid;
2224

@@ -26,6 +28,7 @@
2628
import javax.lang.model.element.VariableElement;
2729
import javax.lang.model.type.TypeKind;
2830
import javax.lang.model.type.TypeMirror;
31+
2932
import java.util.List;
3033

3134
import static com.sun.codemodel.JExpr.*;
@@ -55,7 +58,7 @@ protected void makeCall(JBlock listenerMethodBody, JInvocation call, TypeMirror
5558
}
5659

5760
@Override
58-
protected void processParameters(JMethod listenerMethod, JInvocation itemSelectedCall, List<? extends VariableElement> parameters) {
61+
protected void processParameters(EComponentWithViewSupportHolder holder, JMethod listenerMethod, JInvocation itemSelectedCall, List<? extends VariableElement> parameters) {
5962
JClass narrowAdapterViewClass = classes().ADAPTER_VIEW.narrow(codeModel().wildcard());
6063
JVar onItemClickParentParam = listenerMethod.param(narrowAdapterViewClass, "parent");
6164
listenerMethod.param(classes().VIEW, "view");
@@ -83,7 +86,10 @@ protected void processParameters(JMethod listenerMethod, JInvocation itemSelecte
8386
}
8487

8588
onNothingSelectedMethod.param(narrowAdapterViewClass, "parent");
86-
JInvocation nothingSelectedCall = onNothingSelectedMethod.body().invoke(getMethodName());
89+
JExpression activityRef = holder.getGeneratedClass().staticRef("this");
90+
91+
JInvocation nothingSelectedCall = invoke(activityRef, getMethodName());
92+
onNothingSelectedMethod.body().add(nothingSelectedCall);
8793
nothingSelectedCall.arg(JExpr.FALSE);
8894
if (hasItemParameter) {
8995
if (secondParameterIsInt) {

0 commit comments

Comments
 (0)