1+ /*
2+ * Copyright 2010-2011 Pierre-Yves Ricau (py.ricau at gmail.com)
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 .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+ import android .app .Activity ;
24+ import android .os .Bundle ;
25+
26+ import com .googlecode .androidannotations .annotations .res .StringRes ;
27+
28+ /**
29+ * Methods annotated with @{@link BeforeViews} will be called before
30+ * {@link Activity#setContentView(int)} is called by the generated activity.
31+ *
32+ * When the onCreate() method of your activity is called,
33+ * {@link Activity#setContentView(int)} has already been called, the views have
34+ * been injected and the listeners are bound. Sometimes, you might want to
35+ * execute code before {@link Activity#setContentView(int)} is called. For
36+ * instance, if you need to call {@link Activity#requestWindowFeature(int)}.
37+ *
38+ * When methods annotated with @{@link BeforeViews} are called,
39+ * {@link SystemService}s, Resources (e.g. {@link StringRes}) and {@link Extra}s
40+ * are already injected. However views are not injected yet, so beware of
41+ * {@link NullPointerException}s.
42+ *
43+ * The method may have zero or one parameter, that must be a {@link Bundle}.
44+ *
45+ * There may be several methods annotated with @{@link BeforeViews} in the same
46+ * activity.
47+ *
48+ */
49+ @ Retention (RetentionPolicy .SOURCE )
50+ @ Target (ElementType .METHOD )
51+ public @interface BeforeViews {
52+ }
0 commit comments