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 @@ -22,10 +22,15 @@

/**
* Should be used on Activity classes that must have no title.
*
* <p/>
* The activity must be annotated with {@link EActivity}.
* <p/>
* Note: This annotation has been deprecated. Please use
* {@code WindowFeature(Window.FEATURE_NO_TITLE})} instead
*
* @see WindowFeature
*/
@Deprecated
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface NoTitle {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2010-2013 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Should be used on Activity classes that must have no title.
*
* The activity must be annotated with {@link EActivity}.
*
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface WindowFeature {

int[] value();

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import org.androidannotations.annotations.Transactional;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;
import org.androidannotations.annotations.WindowFeature;
import org.androidannotations.annotations.res.AnimationRes;
import org.androidannotations.annotations.res.BooleanRes;
import org.androidannotations.annotations.res.ColorRes;
Expand Down Expand Up @@ -187,6 +188,7 @@
import org.androidannotations.processing.TransactionalProcessor;
import org.androidannotations.processing.UiThreadProcessor;
import org.androidannotations.processing.ViewByIdProcessor;
import org.androidannotations.processing.WindowFeatureProcessor;
import org.androidannotations.processing.rest.DeleteProcessor;
import org.androidannotations.processing.rest.GetProcessor;
import org.androidannotations.processing.rest.HeadProcessor;
Expand Down Expand Up @@ -257,6 +259,7 @@
import org.androidannotations.validation.TraceValidator;
import org.androidannotations.validation.TransactionalValidator;
import org.androidannotations.validation.ViewByIdValidator;
import org.androidannotations.validation.WindowFeatureValidator;
import org.androidannotations.validation.rest.AcceptValidator;
import org.androidannotations.validation.rest.DeleteValidator;
import org.androidannotations.validation.rest.GetValidator;
Expand Down Expand Up @@ -426,6 +429,7 @@ private ModelValidator buildModelValidator(IRClass rClass, AndroidSystemServices
modelValidator.register(new OptionsMenuItemValidator(processingEnv, rClass));
modelValidator.register(new OptionsItemValidator(processingEnv, rClass));
modelValidator.register(new NoTitleValidator(processingEnv));
modelValidator.register(new WindowFeatureValidator(processingEnv));
modelValidator.register(new CustomTitleValidator(processingEnv, rClass));
modelValidator.register(new FullscreenValidator(processingEnv));
modelValidator.register(new RestServiceValidator(processingEnv));
Expand Down Expand Up @@ -522,6 +526,7 @@ private ModelProcessor buildModelProcessor(IRClass rClass, AndroidSystemServices
modelProcessor.register(new OptionsMenuItemProcessor(processingEnv, rClass));
modelProcessor.register(new OptionsItemProcessor(processingEnv, rClass));
modelProcessor.register(new NoTitleProcessor());
modelProcessor.register(new WindowFeatureProcessor());
modelProcessor.register(new CustomTitleProcessor(processingEnv, rClass));
modelProcessor.register(new FullscreenProcessor());
modelProcessor.register(new RestServiceProcessor());
Expand Down Expand Up @@ -642,6 +647,7 @@ public Set<String> getSupportedAnnotationTypes() {
OptionsItem.class, //
HtmlRes.class, //
NoTitle.class, //
WindowFeature.class, //
CustomTitle.class, //
Fullscreen.class, //
RestService.class, //
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright (C) 2010-2013 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.processing;

import javax.lang.model.element.Element;

import org.androidannotations.annotations.WindowFeature;

import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JExpr;

public class WindowFeatureProcessor implements DecoratingElementProcessor {

@Override
public String getTarget() {
return WindowFeature.class.getName();
}

@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
WindowFeature annotation = element.getAnnotation(WindowFeature.class);
int[] features = annotation.value();

for (int feature : features) {
holder.initBody.invoke("requestWindowFeature").arg(JExpr.lit(feature));
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (C) 2010-2013 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.validation;

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;

import org.androidannotations.annotations.WindowFeature;
import org.androidannotations.helper.TargetAnnotationHelper;
import org.androidannotations.helper.ValidatorHelper;
import org.androidannotations.model.AnnotationElements;

public class WindowFeatureValidator implements ElementValidator {

private ValidatorHelper validatorHelper;

public WindowFeatureValidator(ProcessingEnvironment processingEnv) {
TargetAnnotationHelper annotationHelper = new TargetAnnotationHelper(processingEnv, getTarget());
validatorHelper = new ValidatorHelper(annotationHelper);
}

@Override
public String getTarget() {
return WindowFeature.class.getName();
}

@Override
public boolean validate(Element element, AnnotationElements validatedElements) {
IsValid valid = new IsValid();

validatorHelper.hasEActivity(element, validatedElements, valid);

return valid.isValid();
}

}
1 change: 1 addition & 0 deletions 1 AndroidAnnotations/functional-test-1-5/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<activity android:name="org.androidannotations.test15.menu.OptionsMenuActivity_" />
<activity android:name="org.androidannotations.test15.menu.OptionsMenuSubActivity_" />
<activity android:name="org.androidannotations.test15.NoTitleFullscreenActivity_" />
<activity android:name="org.androidannotations.test15.WindowFeatureActivity_" />
<activity android:name="org.androidannotations.test15.ExtendingActivity_" />
<activity android:name="org.androidannotations.test15.ebean.BeanInjectedActivity_" />
<activity android:name="org.androidannotations.test15.rest.MyServiceActivity_" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (C) 2010-2013 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.test15;

import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Fullscreen;
import org.androidannotations.annotations.WindowFeature;

import android.app.Activity;
import android.view.Window;

@EActivity
@Fullscreen
@WindowFeature({ Window.FEATURE_NO_TITLE, Window.FEATURE_INDETERMINATE_PROGRESS })
public class WindowFeatureActivity extends Activity {

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