Skip to content

Commit 17937a0

Browse files
Illia BershadskyiIllia Bershadskyi
authored andcommitted
CustomTitile fix
1 parent 65b7fb4 commit 17937a0

9 files changed

Lines changed: 164 additions & 15 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.googlecode.androidannotations.api;
2+
/**
3+
* Copyright (C) 2010-2012 eBusiness Information, Excilys Group
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
6+
* use this file except in compliance with the License. You may obtain a copy of
7+
* the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed To in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations under
15+
* the License.
16+
*/
17+
18+
19+
import org.eclipse.core.runtime.Plugin;
20+
import org.osgi.framework.BundleContext;
21+
22+
/**
23+
* The activator class controls the plug-in life cycle
24+
*/
25+
public class Activator extends Plugin {
26+
27+
// The plug-in ID
28+
public static final String PLUGIN_ID = "com.googlecode.androidannotations-api";
29+
30+
// The shared instance
31+
private static Activator plugin;
32+
33+
/**
34+
* The constructor
35+
*/
36+
public Activator() {
37+
}
38+
39+
/*
40+
* (non-Javadoc)
41+
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
42+
*/
43+
public void start(BundleContext context) throws Exception {
44+
super.start(context);
45+
plugin = this;
46+
}
47+
48+
/*
49+
* (non-Javadoc)
50+
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
51+
*/
52+
public void stop(BundleContext context) throws Exception {
53+
plugin = null;
54+
super.stop(context);
55+
}
56+
57+
/**
58+
* Returns the shared instance
59+
*
60+
* @return the shared instance
61+
*/
62+
public static Activator getDefault() {
63+
return plugin;
64+
}
65+
}

AndroidAnnotations/androidannotations/src/main/java/com/googlecode/androidannotations/annotations/CustomTitle.java renamed to AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/CustomTitle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* License for the specific language governing permissions and limitations under
1414
* the License.
1515
*/
16-
package com.googlecode.androidannotations.annotations;
16+
package org.androidannotations.annotations;
1717

1818

1919
import java.lang.annotation.ElementType;
@@ -30,5 +30,5 @@
3030
@Retention(RetentionPolicy.CLASS)
3131
@Target(ElementType.TYPE)
3232
public @interface CustomTitle {
33-
int value() default ResId.DEFAULT_VALUE;
33+
int value();
3434
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Copyright (C) 2010-2012 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 com.googlecode.androidannotations;
17+
18+
import org.eclipse.core.runtime.Plugin;
19+
import org.osgi.framework.BundleContext;
20+
21+
/**
22+
* The activator class controls the plug-in life cycle
23+
*/
24+
public class Activator extends Plugin {
25+
26+
// The plug-in ID
27+
public static final String PLUGIN_ID = "com.googlecode.androidannotations";
28+
29+
// The shared instance
30+
private static Activator plugin;
31+
32+
/**
33+
* The constructor
34+
*/
35+
public Activator() {
36+
}
37+
38+
/*
39+
* (non-Javadoc)
40+
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
41+
*/
42+
public void start(BundleContext context) throws Exception {
43+
super.start(context);
44+
plugin = this;
45+
}
46+
47+
/*
48+
* (non-Javadoc)
49+
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
50+
*/
51+
public void stop(BundleContext context) throws Exception {
52+
plugin = null;
53+
super.stop(context);
54+
}
55+
56+
/**
57+
* Returns the shared instance
58+
*
59+
* @return the shared instance
60+
*/
61+
public static Activator getDefault() {
62+
return plugin;
63+
}
64+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import org.androidannotations.annotations.ItemSelect;
6363
import org.androidannotations.annotations.LongClick;
6464
import org.androidannotations.annotations.NoTitle;
65+
import org.androidannotations.annotations.CustomTitle;
6566
import org.androidannotations.annotations.NonConfigurationInstance;
6667
import org.androidannotations.annotations.OnActivityResult;
6768
import org.androidannotations.annotations.OptionsItem;
@@ -148,6 +149,7 @@
148149
import org.androidannotations.processing.ModelProcessor;
149150
import org.androidannotations.processing.ModelProcessor.ProcessResult;
150151
import org.androidannotations.processing.NoTitleProcessor;
152+
import org.androidannotations.processing.CustomTitleProcessor;
151153
import org.androidannotations.processing.NonConfigurationInstanceProcessor;
152154
import org.androidannotations.processing.OnActivityResultProcessor;
153155
import org.androidannotations.processing.OptionsItemProcessor;
@@ -211,6 +213,7 @@
211213
import org.androidannotations.validation.LongClickValidator;
212214
import org.androidannotations.validation.ModelValidator;
213215
import org.androidannotations.validation.NoTitleValidator;
216+
import org.androidannotations.validation.CustomTitleValidator;
214217
import org.androidannotations.validation.NonConfigurationInstanceValidator;
215218
import org.androidannotations.validation.OnActivityResultValidator;
216219
import org.androidannotations.validation.OptionsItemValidator;
@@ -290,6 +293,7 @@
290293
OptionsItem.class, //
291294
HtmlRes.class, //
292295
NoTitle.class, //
296+
CustomTitle.class, //
293297
Fullscreen.class, //
294298
RestService.class, //
295299
EBean.class, //
@@ -462,6 +466,7 @@ private ModelValidator buildModelValidator(IRClass rClass, AndroidSystemServices
462466
modelValidator.register(new OptionsMenuValidator(processingEnv, rClass));
463467
modelValidator.register(new OptionsItemValidator(processingEnv, rClass));
464468
modelValidator.register(new NoTitleValidator(processingEnv));
469+
modelValidator.register(new CustomTitleValidator(processingEnv, rClass));
465470
modelValidator.register(new FullscreenValidator(processingEnv));
466471
modelValidator.register(new RestServiceValidator(processingEnv));
467472
modelValidator.register(new RootContextValidator(processingEnv));
@@ -550,6 +555,7 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
550555
modelProcessor.register(new OptionsMenuProcessor(processingEnv, rClass));
551556
modelProcessor.register(new OptionsItemProcessor(processingEnv, rClass));
552557
modelProcessor.register(new NoTitleProcessor());
558+
modelProcessor.register(new CustomTitleProcessor());
553559
modelProcessor.register(new FullscreenProcessor());
554560
modelProcessor.register(new RestServiceProcessor());
555561
modelProcessor.register(new OrmLiteDaoProcessor(processingEnv));

AndroidAnnotations/androidannotations/src/main/java/com/googlecode/androidannotations/processing/CustomTitleProcessor.java renamed to AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/CustomTitleProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
* License for the specific language governing permissions and limitations under
1414
* the License.
1515
*/
16-
package com.googlecode.androidannotations.processing;
16+
package org.androidannotations.processing;
1717

18-
import com.googlecode.androidannotations.annotations.CustomTitle;
18+
import org.androidannotations.annotations.CustomTitle;
1919
import com.sun.codemodel.JCodeModel;
2020
import com.sun.codemodel.JFieldRef;
2121

2222
import javax.lang.model.element.Element;
2323
import java.lang.annotation.Annotation;
2424

25+
import static com.sun.codemodel.JExpr.lit;
26+
2527

2628
public class CustomTitleProcessor implements DecoratingElementProcessor {
2729

@@ -36,7 +38,6 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
3638
JFieldRef customTitleFeature = holder.classes().WINDOW.staticRef("FEATURE_CUSTOM_TITLE");
3739

3840
holder.init.body().invoke("requestWindowFeature").arg(customTitleFeature);
39-
holder.afterSetContentView.body().directStatement("getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, " + annotation.value() + ");");
41+
holder.afterSetContentView.body().add(holder.contextRef.invoke("getWindow").invoke("setFeatureInt").arg(customTitleFeature).arg(lit(annotation.value())));
4042
}
41-
4243
}

AndroidAnnotations/androidannotations/src/main/java/com/googlecode/androidannotations/validation/CustomTitleValidator.java renamed to AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/validation/CustomTitleValidator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
* License for the specific language governing permissions and limitations under
1414
* the License.
1515
*/
16-
package com.googlecode.androidannotations.validation;
16+
package org.androidannotations.validation;
1717

18-
import com.googlecode.androidannotations.annotations.CustomTitle;
19-
import com.googlecode.androidannotations.helper.IdAnnotationHelper;
20-
import com.googlecode.androidannotations.helper.IdValidatorHelper;
21-
import com.googlecode.androidannotations.model.AnnotationElements;
22-
import com.googlecode.androidannotations.rclass.IRClass;
18+
import org.androidannotations.annotations.CustomTitle;
19+
import org.androidannotations.helper.IdAnnotationHelper;
20+
import org.androidannotations.helper.IdValidatorHelper;
21+
import org.androidannotations.model.AnnotationElements;
22+
import org.androidannotations.rclass.IRClass;
2323

2424
import javax.annotation.processing.ProcessingEnvironment;
2525
import javax.lang.model.element.Element;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.googlecode.androidannotations.ebean;
2+
3+
import com.googlecode.androidannotations.annotations.EBean;
4+
5+
@EBean
6+
public class SomeImplementation implements SomeInterface {
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.googlecode.androidannotations.ebean;
2+
3+
public interface SomeInterface {
4+
5+
}

AndroidAnnotations/functional-test-1-5/src/main/java/com/googlecode/androidannotations/test15/CustomTitleActivity.java renamed to AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/CustomTitleActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
* License for the specific language governing permissions and limitations under
1414
* the License.
1515
*/
16-
package com.googlecode.androidannotations.test15;
16+
package org.androidannotations.test15;
1717

1818
import android.app.Activity;
1919

20-
import com.googlecode.androidannotations.annotations.EActivity;
21-
import com.googlecode.androidannotations.annotations.CustomTitle;
20+
import org.androidannotations.annotations.EActivity;
21+
import org.androidannotations.annotations.CustomTitle;
2222

2323
@EActivity
2424
@CustomTitle(R.layout.component)

0 commit comments

Comments
 (0)