Skip to content

Commit 7bbac6c

Browse files
committed
Merge branch 'develop' of github.com:excilys/androidannotations into develop
Conflicts: AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/helper/ValidatorHelper.java AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/rest/MyService.java
2 parents a0986a2 + 77cbcea commit 7bbac6c

46 files changed

Lines changed: 1548 additions & 155 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.

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/Background.java‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,26 @@
2828
@Retention(RetentionPolicy.CLASS)
2929
@Target(ElementType.METHOD)
3030
public @interface Background {
31-
long delay() default 0;
31+
/**
32+
* Identifier for task cancellation.
33+
*
34+
* To cancel all tasks having a specified background id:
35+
*
36+
* <pre>
37+
* boolean mayInterruptIfRunning = true;
38+
* BackgroundExecutor.cancelAll(&quot;my_background_id&quot;, mayInterruptIfRunning);
39+
* </pre>
40+
**/
41+
String id() default "";
42+
43+
/** Minimum delay, in milliseconds, before the background task is executed. */
44+
int delay() default 0;
45+
46+
/**
47+
* Serial execution group.
48+
*
49+
* All background tasks having the same <code>serial</code> will be executed
50+
* sequentially.
51+
**/
52+
String serial() default "";
3253
}

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/NoTitle.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222

2323
/**
2424
* Should be used on Activity classes that must have no title.
25-
*
25+
* <p/>
2626
* The activity must be annotated with {@link EActivity}.
27+
* <p/>
28+
* Note: This annotation has been deprecated. Please use
29+
* {@code WindowFeature(Window.FEATURE_NO_TITLE})} instead
2730
*
31+
* @see WindowFeature
2832
*/
33+
@Deprecated
2934
@Retention(RetentionPolicy.CLASS)
3035
@Target(ElementType.TYPE)
3136
public @interface NoTitle {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright (C) 2010-2013 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+
* Should be used on option items fields in activity classes.
25+
*
26+
* The field MUST be of type {@link link android.view.MenuItem} or
27+
* {@link com.actionbarsherlock.view.MenuItem}.
28+
* <p/>
29+
* The annotation value should be one of R.id.* fields. If not set, the method
30+
* name will be used as the R.id.* field name. *
31+
*/
32+
@Retention(RetentionPolicy.CLASS)
33+
@Target(ElementType.FIELD)
34+
public @interface OptionsMenuItem {
35+
36+
int[] value() default ResId.DEFAULT_VALUE;
37+
38+
String[] resName() default "";
39+
40+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright (C) 2010-2013 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+
* Should be used on Activity classes that must have no title.
25+
*
26+
* The activity must be annotated with {@link EActivity}.
27+
*
28+
*/
29+
@Retention(RetentionPolicy.CLASS)
30+
@Target(ElementType.TYPE)
31+
public @interface WindowFeature {
32+
33+
int[] value();
34+
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright (C) 2010-2013 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.sharedpreferences;
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+
import org.androidannotations.annotations.ResId;
24+
25+
/**
26+
* Default value for a preference field
27+
*/
28+
@Retention(RetentionPolicy.CLASS)
29+
@Target(ElementType.METHOD)
30+
public @interface DefaultRes {
31+
32+
int value() default ResId.DEFAULT_VALUE;
33+
34+
String resName() default "";
35+
36+
}

‎AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/AndroidAnnotationProcessor.java‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.androidannotations.helper.CanonicalNameConstants.PRODUCE;
2020
import static org.androidannotations.helper.CanonicalNameConstants.SUBSCRIBE;
2121
import static org.androidannotations.helper.ModelConstants.TRACE_OPTION;
22+
import static org.androidannotations.rclass.ProjectRClassFinder.RESOURCE_PACKAGE_NAME_OPTION;
2223

2324
import java.io.IOException;
2425
import java.io.PrintWriter;
@@ -75,6 +76,7 @@
7576
import org.androidannotations.annotations.OnActivityResult;
7677
import org.androidannotations.annotations.OptionsItem;
7778
import org.androidannotations.annotations.OptionsMenu;
79+
import org.androidannotations.annotations.OptionsMenuItem;
7880
import org.androidannotations.annotations.OrmLiteDao;
7981
import org.androidannotations.annotations.RoboGuice;
8082
import org.androidannotations.annotations.RootContext;
@@ -88,6 +90,7 @@
8890
import org.androidannotations.annotations.Transactional;
8991
import org.androidannotations.annotations.UiThread;
9092
import org.androidannotations.annotations.ViewById;
93+
import org.androidannotations.annotations.WindowFeature;
9194
import org.androidannotations.annotations.res.AnimationRes;
9295
import org.androidannotations.annotations.res.BooleanRes;
9396
import org.androidannotations.annotations.res.ColorRes;
@@ -165,6 +168,7 @@
165168
import org.androidannotations.processing.NonConfigurationInstanceProcessor;
166169
import org.androidannotations.processing.OnActivityResultProcessor;
167170
import org.androidannotations.processing.OptionsItemProcessor;
171+
import org.androidannotations.processing.OptionsMenuItemProcessor;
168172
import org.androidannotations.processing.OptionsMenuProcessor;
169173
import org.androidannotations.processing.OrmLiteDaoProcessor;
170174
import org.androidannotations.processing.PrefProcessor;
@@ -185,6 +189,7 @@
185189
import org.androidannotations.processing.TransactionalProcessor;
186190
import org.androidannotations.processing.UiThreadProcessor;
187191
import org.androidannotations.processing.ViewByIdProcessor;
192+
import org.androidannotations.processing.WindowFeatureProcessor;
188193
import org.androidannotations.processing.rest.DeleteProcessor;
189194
import org.androidannotations.processing.rest.GetProcessor;
190195
import org.androidannotations.processing.rest.HeadProcessor;
@@ -234,6 +239,7 @@
234239
import org.androidannotations.validation.NonConfigurationInstanceValidator;
235240
import org.androidannotations.validation.OnActivityResultValidator;
236241
import org.androidannotations.validation.OptionsItemValidator;
242+
import org.androidannotations.validation.OptionsMenuItemValidator;
237243
import org.androidannotations.validation.OptionsMenuValidator;
238244
import org.androidannotations.validation.OrmLiteDaoValidator;
239245
import org.androidannotations.validation.PrefValidator;
@@ -254,6 +260,7 @@
254260
import org.androidannotations.validation.TraceValidator;
255261
import org.androidannotations.validation.TransactionalValidator;
256262
import org.androidannotations.validation.ViewByIdValidator;
263+
import org.androidannotations.validation.WindowFeatureValidator;
257264
import org.androidannotations.validation.rest.AcceptValidator;
258265
import org.androidannotations.validation.rest.DeleteValidator;
259266
import org.androidannotations.validation.rest.GetValidator;
@@ -264,7 +271,7 @@
264271
import org.androidannotations.validation.rest.RestValidator;
265272

266273
@SupportedSourceVersion(SourceVersion.RELEASE_6)
267-
@SupportedOptions({ TRACE_OPTION, ANDROID_MANIFEST_FILE_OPTION })
274+
@SupportedOptions({ TRACE_OPTION, ANDROID_MANIFEST_FILE_OPTION, RESOURCE_PACKAGE_NAME_OPTION })
268275
public class AndroidAnnotationProcessor extends AbstractProcessor {
269276

270277
private final TimeStats timeStats = new TimeStats();
@@ -420,8 +427,10 @@ private ModelValidator buildModelValidator(IRClass rClass, AndroidSystemServices
420427
modelValidator.register(new AcceptValidator(processingEnv));
421428
modelValidator.register(new AppValidator(processingEnv));
422429
modelValidator.register(new OptionsMenuValidator(processingEnv, rClass));
430+
modelValidator.register(new OptionsMenuItemValidator(processingEnv, rClass));
423431
modelValidator.register(new OptionsItemValidator(processingEnv, rClass));
424432
modelValidator.register(new NoTitleValidator(processingEnv));
433+
modelValidator.register(new WindowFeatureValidator(processingEnv));
425434
modelValidator.register(new CustomTitleValidator(processingEnv, rClass));
426435
modelValidator.register(new FullscreenValidator(processingEnv));
427436
modelValidator.register(new RestServiceValidator(processingEnv));
@@ -483,7 +492,7 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
483492
modelProcessor.register(new EViewGroupProcessor(processingEnv, rClass));
484493
modelProcessor.register(new EViewProcessor());
485494
modelProcessor.register(new EBeanProcessor());
486-
modelProcessor.register(new SharedPrefProcessor());
495+
modelProcessor.register(new SharedPrefProcessor(processingEnv, rClass));
487496
modelProcessor.register(new PrefProcessor(validatedModel));
488497
modelProcessor.register(new RoboGuiceProcessor());
489498
modelProcessor.register(new ViewByIdProcessor(processingEnv, rClass));
@@ -515,8 +524,10 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
515524
modelProcessor.register(new OptionsProcessor(processingEnv, restImplementationsHolder));
516525
modelProcessor.register(new AppProcessor());
517526
modelProcessor.register(new OptionsMenuProcessor(processingEnv, rClass));
527+
modelProcessor.register(new OptionsMenuItemProcessor(processingEnv, rClass));
518528
modelProcessor.register(new OptionsItemProcessor(processingEnv, rClass));
519529
modelProcessor.register(new NoTitleProcessor());
530+
modelProcessor.register(new WindowFeatureProcessor());
520531
modelProcessor.register(new CustomTitleProcessor(processingEnv, rClass));
521532
modelProcessor.register(new FullscreenProcessor());
522533
modelProcessor.register(new RestServiceProcessor());
@@ -633,9 +644,11 @@ public Set<String> getSupportedAnnotationTypes() {
633644
Accept.class, //
634645
FromHtml.class, //
635646
OptionsMenu.class, //
647+
OptionsMenuItem.class, //
636648
OptionsItem.class, //
637649
HtmlRes.class, //
638650
NoTitle.class, //
651+
WindowFeature.class, //
639652
CustomTitle.class, //
640653
Fullscreen.class, //
641654
RestService.class, //

0 commit comments

Comments
 (0)