Skip to content
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
@@ -0,0 +1,64 @@
/**
* Copyright (C) 2010-2015 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;

/**
* <p>
* Methods annotated with {@link AfterPreferences} will be called after
* <code>addPreferenceFromResource</code> is called by the generated classs.
* </p>
* <p>
* This occurs AFTER <code>addPreferencesFromResource</code> which is called at
* the end of super.onCreate(). Any preference depending code should be done in
* an {@link AfterPreferences} annotated method.
* </p>
* <p>
* The method MUST have zero parameters.
* </p>
* <p>
* There MAY be several methods annotated with {@link AfterPreferences} in the
* same class.
* </p>
* <blockquote>
*
* Example :
*
* <pre>
* &#064;EActivity
* public class SettingsActivity extends PreferenceActivity {
*
* &#064;PreferenceByKey(R.string.checkBoxPref)
* CheckBoxPreference checkBoxPref;
*
* &#064;AfterPreferences
* void initPrefs() {
* checkBoxPref.setChecked(false);
* }
* }
* </pre>
*
* </blockquote>
*
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.METHOD)
public @interface AfterPreferences {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright (C) 2010-2015 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;

/**
* <p>
* Use it on a {@link android.preference.Preference Preference} or
* {@link android.preference.Preference Preference} subtype fields in a
* {@link org.androidannotations.annotations.EActivity EActivity} or
* {@link org.androidannotations.annotations.EFragment EFragment} annotated
* class, which is a subclass of {@link android.preference.PreferenceActivity
* PreferenceActivity} or <code>PreferenceFragment</code>, respectively.
* </p>
* <p>
* The annotation value should be an array of R.string.* fields.
* </p>
* <p>
* Your code related to injected views should go in an
* {@link org.androidannotations.annotations.AfterPreferences AfterPreferences}
* annotated method.
* </p>
* <blockquote>
*
* Example :
*
* <pre>
* &#064;EActivity
* public class SettingsActivity extends PreferenceActivity {
*
* &#064;PreferenceByKey(R.string.myPref1)
* Preference myPreference1;
*
* &#064;PreferenceByKey(R.string.checkBoxPref)
* CheckBoxPreference checkBoxPref;
*
* &#064;AfterPreferences
* void initPrefs() {
* checkBoxPref.setChecked(false);
* }
* }
* </pre>
*
* </blockquote>
*
* @see org.androidannotations.annotations.AfterPreferences AfterPreferences
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.FIELD)
public @interface PreferenceByKey {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Target and @Retention

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i do not know how could i forget that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you'd see that by yourself when writing the javadocs ;)


int value() default ResId.DEFAULT_VALUE;

String resName() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* Copyright (C) 2010-2015 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;

/**
* <p>
* This annotation is intended to be used on methods to receive events defined
* by
* {@link android.preference.Preference.OnPreferenceChangeListener#onPreferenceChange(android.preference.Preference, Object)
* OnPreferenceChangeListener#onPreferenceChange} when the value of a
* {@link android.preference.Preference Preference} has been changed by the user
* and is about to be set and/or persisted.
* </p>
* <p>
* The annotation value should be one or several R.string.* fields that refers
* to {@link android.preference.Preference Preference} or subclasses of
* {@link android.preference.Preference Preference}. If not set, the method name
* will be used as the R.string.* field name.
* </p>
* <p>
* The method MAY have multiple parameter:
* </p>
* <ul>
* <li>A {@link android.preference.Preference Preference} parameter to know
* which preference was targeted by this event</li>
* <li>An {@link Object} or {@link java.util.Set Set of strings} or
* {@link Boolean} or {@link String} to obtain the new value of the
* {@link android.preference.Preference Preference}</li>
* </ul>
* <blockquote>
*
* Example :
*
* <pre>
* &#064;PreferenceChange(<b>R.string.myPref</b>)
* void checkedChangedOnMyButton(boolean newValue, Preference preference) {
* // Something Here
* }
*
* &#064;PreferenceChange
* void <b>myPref</b>PreferenceChanged(Preference preference) {
* // Something Here
* }
*
* &#064;PreferenceChange(<b>{R.string.myPref1, R.string.myPref2}</b>)
* void preferenceChangeOnMultiplePrefs(Preference preference, String newValue) {
* // Something Here
* }
*
* &#064;PreferenceChange(<b>R.string.myPref</b>)
* void preferenceChangeOnMyPref() {
* // Something Here
* }
* </pre>
*
* </blockquote>
*
* @see PreferenceClick
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.METHOD)
public @interface PreferenceChange {

int[] value() default ResId.DEFAULT_VALUE;

String[] resName() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* Copyright (C) 2010-2015 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;

/**
* <p>
* This annotation is intended to be used on methods to receive events defined
* by
* {@link android.preference.Preference.OnPreferenceClickListener#onPreferenceClick(android.preference.Preference)
* OnPreferenceClickListener#onPreferenceClick} when the
* {@link android.preference.Preference Preference} has been clicked by the
* user.
* </p>
* <p>
* The annotation value should be one or several of R.string.* fields. If not
* set, the method name will be used as the R.string.* field name.
* </p>
* <p>
* The method MAY have one parameter:
* </p>
* <ul>
* <li>A {@link android.preference.Preference Preference} parameter to know
* which preference has been clicked</li>
* </ul>
* <blockquote>
*
* Example :
*
* <pre>
* &#064;PreferenceClick(<b>R.string.myPref</b>)
* void clickOnMyPref() {
* // Something Here
* }
*
* &#064;PreferenceClick
* void <b>myPref</b>PreferenceClicked(Preference preference) {
* // Something Here
* }
* </pre>
*
* </blockquote>
*
* @see PreferenceChange
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.METHOD)
public @interface PreferenceClick {

int[] value() default ResId.DEFAULT_VALUE;

String[] resName() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Copyright (C) 2010-2015 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;

/**
* <p>
* Should be used on a {@link org.androidannotations.annotations.EActivity
* EActivity} class which is a subclass of
* {@link android.preference.PreferenceActivity PreferenceActivity}, to inject
* the preference headers from resource.
* </p>
* <p>
* The annotation value should be one of R.xml.* fields.
* </p>
*
* <blockquote>
*
* Example :
*
* <pre>
* &#064;PreferenceHeaders(R.xml.preference_headers)
* &#064;EActivity
* public class SettingsActivity extends PreferenceActivity {
*
* &#064;PreferenceByKey(R.string.myPref1)
* Preference myPreference1;
*
* &#064;PreferenceByKey(R.string.checkBoxPref)
* CheckBoxPreference checkBoxPref;
*
* &#064;AfterPreferences
* void initPrefs() {
* checkBoxPref.setChecked(false);
* }
* }
* </pre>
*
* </blockquote>
*
* @see PreferenceScreen
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface PreferenceHeaders {

int value() default ResId.DEFAULT_VALUE;

String resName() default "";
}
Loading