mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-07 12:54:35 -05:00
android support! thanks to TachiWeb devs.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an anim resource reference (e.g. {@code android.R.anim.fade_in}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface AnimRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an animator resource reference (e.g. {@code android.R.animator.fade_in}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface AnimatorRes {
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a resource reference of any type. If the specific type is known, use
|
||||
* one of the more specific annotations instead, such as {@link StringRes} or
|
||||
* {@link DrawableRes}.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface AnyRes {
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated method can be called from any thread (e.g. it is "thread safe".)
|
||||
* If the annotated element is a class, then all methods in the class can be called
|
||||
* from any thread.
|
||||
* <p>
|
||||
* The main purpose of this method is to indicate that you believe a method can be called
|
||||
* from any thread; static tools can then check that nothing you call from within this method
|
||||
* or class have more strict threading requirements.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @AnyThread
|
||||
* public void deliverResult(D data) { ... }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,CONSTRUCTOR,TYPE})
|
||||
public @interface AnyThread {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an array resource reference (e.g. {@code android.R.array.phoneTypes}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface ArrayRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an attribute reference (e.g. {@code android.R.attr.action}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface AttrRes {
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated method should only be called on the binder thread.
|
||||
* If the annotated element is a class, then all methods in the class should be called
|
||||
* on the binder thread.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @BinderThread
|
||||
* public BeamShareData createBeamShareData() { ... }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,CONSTRUCTOR,TYPE})
|
||||
public @interface BinderThread {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a boolean resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface BoolRes {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that any overriding methods should invoke this method as well.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @CallSuper
|
||||
* public abstract void onFocusLost();
|
||||
* </code></pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD})
|
||||
public @interface CallSuper {
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated method returns a result that it typically is
|
||||
* an error to ignore. This is usually used for methods that have no side effect,
|
||||
* so calling it without actually looking at the result usually means the developer
|
||||
* has misunderstood what the method does.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>{@code
|
||||
* public @CheckResult String trim(String s) { return s.trim(); }
|
||||
* ...
|
||||
* s.trim(); // this is probably an error
|
||||
* s = s.trim(); // ok
|
||||
* }</pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD})
|
||||
public @interface CheckResult {
|
||||
/** Defines the name of the suggested method to use instead, if applicable (using
|
||||
* the same signature format as javadoc.) If there is more than one possibility,
|
||||
* list them all separated by commas.
|
||||
* <p>
|
||||
* For example, ProcessBuilder has a method named {@code redirectErrorStream()}
|
||||
* which sounds like it might redirect the error stream. It does not. It's just
|
||||
* a getter which returns whether the process builder will redirect the error stream,
|
||||
* and to actually set it, you must call {@code redirectErrorStream(boolean)}.
|
||||
* In that case, the method should be defined like this:
|
||||
* <pre>
|
||||
* @CheckResult(suggest="#redirectErrorStream(boolean)")
|
||||
* public boolean redirectErrorStream() { ... }
|
||||
* </pre>
|
||||
*/
|
||||
String suggest() default "";
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element represents a packed color
|
||||
* int, {@code AARRGGBB}. If applied to an int array, every element
|
||||
* in the array represents a color integer.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>{@code
|
||||
* public abstract void setTextColor(@ColorInt int color);
|
||||
* }</pre>
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({PARAMETER,METHOD,LOCAL_VARIABLE,FIELD})
|
||||
public @interface ColorInt {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a color resource reference (e.g. {@code android.R.color.black}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface ColorRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a dimension resource reference (e.g. {@code android.R.dimen.app_icon_size}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface DimenRes {
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to represent a dimension.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE,ANNOTATION_TYPE})
|
||||
public @interface Dimension {
|
||||
@Unit
|
||||
int unit() default PX;
|
||||
|
||||
int DP = 0;
|
||||
int PX = 1;
|
||||
int SP = 2;
|
||||
|
||||
@IntDef({PX, DP, SP})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@interface Unit {}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a drawable resource reference (e.g. {@code android.R.attr.alertDialogIcon}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface DrawableRes {
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element should be a float or double in the given range
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @FloatRange(from=0.0,to=1.0)
|
||||
* public float getAlpha() {
|
||||
* ...
|
||||
* }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE,ANNOTATION_TYPE})
|
||||
public @interface FloatRange {
|
||||
/** Smallest value. Whether it is inclusive or not is determined
|
||||
* by {@link #fromInclusive} */
|
||||
double from() default Double.NEGATIVE_INFINITY;
|
||||
/** Largest value. Whether it is inclusive or not is determined
|
||||
* by {@link #toInclusive} */
|
||||
double to() default Double.POSITIVE_INFINITY;
|
||||
|
||||
/** Whether the from value is included in the range */
|
||||
boolean fromInclusive() default true;
|
||||
|
||||
/** Whether the to value is included in the range */
|
||||
boolean toInclusive() default true;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a fraction resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface FractionRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an id resource reference (e.g. {@code android.R.id.copy}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface IdRes {
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element of integer type, represents
|
||||
* a logical type and that its value should be one of the explicitly
|
||||
* named constants. If the IntDef#flag() attribute is set to true,
|
||||
* multiple constants can be combined.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @Retention(SOURCE)
|
||||
* @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
|
||||
* public @interface NavigationMode {}
|
||||
* public static final int NAVIGATION_MODE_STANDARD = 0;
|
||||
* public static final int NAVIGATION_MODE_LIST = 1;
|
||||
* public static final int NAVIGATION_MODE_TABS = 2;
|
||||
* ...
|
||||
* public abstract void setNavigationMode(@NavigationMode int mode);
|
||||
* @NavigationMode
|
||||
* public abstract int getNavigationMode();
|
||||
* </code></pre>
|
||||
* For a flag, set the flag attribute:
|
||||
* <pre><code>
|
||||
* @IntDef(
|
||||
* flag = true
|
||||
* value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
|
||||
* </code></pre>
|
||||
*/
|
||||
@Retention(SOURCE)
|
||||
@Target({ANNOTATION_TYPE})
|
||||
public @interface IntDef {
|
||||
/** Defines the allowed constants for this element */
|
||||
long[] value() default {};
|
||||
|
||||
/** Defines whether the constants can be used as a flag, or just as an enum (the default) */
|
||||
boolean flag() default false;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element should be an int or long in the given range
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @IntRange(from=0,to=255)
|
||||
* public int getAlpha() {
|
||||
* ...
|
||||
* }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE,ANNOTATION_TYPE})
|
||||
public @interface IntRange {
|
||||
/** Smallest value, inclusive */
|
||||
long from() default Long.MIN_VALUE;
|
||||
/** Largest value, inclusive */
|
||||
long to() default Long.MAX_VALUE;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an integer resource reference (e.g. {@code android.R.integer.config_shortAnimTime}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface IntegerRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an interpolator resource reference (e.g. {@code android.R.interpolator.cycle}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface InterpolatorRes {
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element should not be removed when
|
||||
* the code is minified at build time. This is typically used
|
||||
* on methods and classes that are accessed only via reflection
|
||||
* so a compiler may think that the code is unused.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @Keep
|
||||
* public void foo() {
|
||||
* ...
|
||||
* }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({PACKAGE,TYPE,ANNOTATION_TYPE,CONSTRUCTOR,METHOD,FIELD})
|
||||
public @interface Keep {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a layout resource reference (e.g. {@code android.R.layout.list_content}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface LayoutRes {
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated method should only be called on the main thread.
|
||||
* If the annotated element is a class, then all methods in the class should be called
|
||||
* on the main thread.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @MainThread
|
||||
* public void deliverResult(D data) { ... }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,CONSTRUCTOR,TYPE})
|
||||
public @interface MainThread {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a menu resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface MenuRes {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that a parameter, field or method return value can never be null.
|
||||
* <p>
|
||||
* This is a marker annotation and it has no specific attributes.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD})
|
||||
public @interface NonNull {
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that a parameter, field or method return value can be null.
|
||||
* <p>
|
||||
* When decorating a method call parameter, this denotes that the parameter can
|
||||
* legitimately be null and the method will gracefully deal with it. Typically
|
||||
* used on optional parameters.
|
||||
* <p>
|
||||
* When decorating a method, this denotes the method might legitimately return
|
||||
* null.
|
||||
* <p>
|
||||
* This is a marker annotation and it has no specific attributes.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD})
|
||||
public @interface Nullable {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a plurals resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface PluralsRes {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to represent a pixel dimension.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
@Dimension(unit = Dimension.PX)
|
||||
public @interface Px {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a raw resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface RawRes {
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element should only be called on the given API level
|
||||
* or higher.
|
||||
* <p>
|
||||
* This is similar in purpose to the older {@code @TargetApi} annotation, but more
|
||||
* clearly expresses that this is a requirement on the caller, rather than being
|
||||
* used to "suppress" warnings within the method that exceed the {@code minSdkVersion}.
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({TYPE,METHOD,CONSTRUCTOR,FIELD})
|
||||
public @interface RequiresApi {
|
||||
/**
|
||||
* The API level to require. Alias for {@link #api} which allows you to leave out the
|
||||
* {@code api=} part.
|
||||
*/
|
||||
@IntRange(from=1)
|
||||
int value() default 1;
|
||||
|
||||
/** The API level to require */
|
||||
@IntRange(from=1)
|
||||
int api() default 1;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element requires (or may require) one or more permissions.
|
||||
* <p>
|
||||
* Example of requiring a single permission:
|
||||
* <pre><code>
|
||||
* @RequiresPermission(Manifest.permission.SET_WALLPAPER)
|
||||
* public abstract void setWallpaper(Bitmap bitmap) throws IOException;
|
||||
*
|
||||
* @RequiresPermission(ACCESS_COARSE_LOCATION)
|
||||
* public abstract Location getLastKnownLocation(String provider);
|
||||
* </code></pre>
|
||||
* Example of requiring at least one permission from a set:
|
||||
* <pre><code>
|
||||
* @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
|
||||
* public abstract Location getLastKnownLocation(String provider);
|
||||
* </code></pre>
|
||||
* Example of requiring multiple permissions:
|
||||
* <pre><code>
|
||||
* @RequiresPermission(allOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
|
||||
* public abstract Location getLastKnownLocation(String provider);
|
||||
* </code></pre>
|
||||
* Example of requiring separate read and write permissions for a content provider:
|
||||
* <pre><code>
|
||||
* @RequiresPermission.Read(@RequiresPermission(READ_HISTORY_BOOKMARKS))
|
||||
* @RequiresPermission.Write(@RequiresPermission(WRITE_HISTORY_BOOKMARKS))
|
||||
* public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
|
||||
* </code></pre>
|
||||
* <p>
|
||||
* When specified on a parameter, the annotation indicates that the method requires
|
||||
* a permission which depends on the value of the parameter. For example, consider
|
||||
* {@code android.app.Activity.startActivity(android.content.Intent)}:
|
||||
* <pre>{@code
|
||||
* public void startActivity(@RequiresPermission Intent intent) { ... }
|
||||
* }</pre>
|
||||
* Notice how there are no actual permission names listed in the annotation. The actual
|
||||
* permissions required will depend on the particular intent passed in. For example,
|
||||
* the code may look like this:
|
||||
* <pre>{@code
|
||||
* Intent intent = new Intent(Intent.ACTION_CALL);
|
||||
* startActivity(intent);
|
||||
* }</pre>
|
||||
* and the actual permission requirement for this particular intent is described on
|
||||
* the Intent name itself:
|
||||
* <pre><code>
|
||||
* @RequiresPermission(Manifest.permission.CALL_PHONE)
|
||||
* public static final String ACTION_CALL = "android.intent.action.CALL";
|
||||
* </code></pre>
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({ANNOTATION_TYPE,METHOD,CONSTRUCTOR,FIELD,PARAMETER})
|
||||
public @interface RequiresPermission {
|
||||
/**
|
||||
* The name of the permission that is required, if precisely one permission
|
||||
* is required. If more than one permission is required, specify either
|
||||
* {@link #allOf()} or {@link #anyOf()} instead.
|
||||
* <p>
|
||||
* If specified, {@link #anyOf()} and {@link #allOf()} must both be null.
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* Specifies a list of permission names that are all required.
|
||||
* <p>
|
||||
* If specified, {@link #anyOf()} and {@link #value()} must both be null.
|
||||
*/
|
||||
String[] allOf() default {};
|
||||
|
||||
/**
|
||||
* Specifies a list of permission names where at least one is required
|
||||
* <p>
|
||||
* If specified, {@link #allOf()} and {@link #value()} must both be null.
|
||||
*/
|
||||
String[] anyOf() default {};
|
||||
|
||||
/**
|
||||
* If true, the permission may not be required in all cases (e.g. it may only be
|
||||
* enforced on certain platforms, or for certain call parameters, etc.
|
||||
*/
|
||||
boolean conditional() default false;
|
||||
|
||||
/**
|
||||
* Specifies that the given permission is required for read operations.
|
||||
* <p>
|
||||
* When specified on a parameter, the annotation indicates that the method requires
|
||||
* a permission which depends on the value of the parameter (and typically
|
||||
* the corresponding field passed in will be one of a set of constants which have
|
||||
* been annotated with a {@code @RequiresPermission} annotation.)
|
||||
*/
|
||||
@Target({FIELD, METHOD, PARAMETER})
|
||||
@interface Read {
|
||||
RequiresPermission value() default @RequiresPermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies that the given permission is required for write operations.
|
||||
* <p>
|
||||
* When specified on a parameter, the annotation indicates that the method requires
|
||||
* a permission which depends on the value of the parameter (and typically
|
||||
* the corresponding field passed in will be one of a set of constants which have
|
||||
* been annotated with a {@code @RequiresPermission} annotation.)
|
||||
*/
|
||||
@Target({FIELD, METHOD, PARAMETER})
|
||||
@interface Write {
|
||||
RequiresPermission value() default @RequiresPermission;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated element should have a given size or length.
|
||||
* Note that "-1" means "unset". Typically used with a parameter or
|
||||
* return value of type array or collection.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>{@code
|
||||
* public void getLocationInWindow(@Size(2) int[] location) {
|
||||
* ...
|
||||
* }
|
||||
* }</pre>
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
@Target({PARAMETER,LOCAL_VARIABLE,METHOD,FIELD,ANNOTATION_TYPE})
|
||||
public @interface Size {
|
||||
/** An exact size (or -1 if not specified) */
|
||||
long value() default -1;
|
||||
/** A minimum size, inclusive */
|
||||
long min() default Long.MIN_VALUE;
|
||||
/** A maximum size, inclusive */
|
||||
long max() default Long.MAX_VALUE;
|
||||
/** The size must be a multiple of this factor */
|
||||
long multiple() default 1;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated String element, represents a logical
|
||||
* type and that its value should be one of the explicitly named constants.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @Retention(SOURCE)
|
||||
* @StringDef({
|
||||
* POWER_SERVICE,
|
||||
* WINDOW_SERVICE,
|
||||
* LAYOUT_INFLATER_SERVICE
|
||||
* })
|
||||
* public @interface ServiceName {}
|
||||
* public static final String POWER_SERVICE = "power";
|
||||
* public static final String WINDOW_SERVICE = "window";
|
||||
* public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater";
|
||||
* ...
|
||||
* public abstract Object getSystemService(@ServiceName String name);
|
||||
* </code></pre>
|
||||
*/
|
||||
@Retention(SOURCE)
|
||||
@Target({ANNOTATION_TYPE})
|
||||
public @interface StringDef {
|
||||
/** Defines the allowed constants for this element */
|
||||
String[] value() default {};
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a String resource reference (e.g. {@code android.R.string.ok}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface StringRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a style resource reference (e.g. {@code android.R.style.TextAppearance}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface StyleRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a styleable resource reference (e.g. {@code android.R.styleable.TextView_text}).
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface StyleableRes {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be a transition resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(SOURCE)
|
||||
@Target({METHOD, PARAMETER, FIELD})
|
||||
public @interface TransitionRes {
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated method or constructor should only be called on the UI thread.
|
||||
* If the annotated element is a class, then all methods in the class should be called
|
||||
* on the UI thread.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @UiThread
|
||||
*
|
||||
* public abstract void setText(@NonNull String text) { ... }
|
||||
* </code></pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,CONSTRUCTOR,TYPE})
|
||||
public @interface UiThread {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the class, method or field has its visibility relaxed, so that it is more widely
|
||||
* visible than otherwise necessary to make code testable.
|
||||
*/
|
||||
@Retention(CLASS)
|
||||
public @interface VisibleForTesting {
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that the annotated method should only be called on a worker thread.
|
||||
* If the annotated element is a class, then all methods in the class should be called
|
||||
* on a worker thread.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre><code>
|
||||
* @WorkerThread
|
||||
* protected abstract FilterResults performFiltering(CharSequence constraint);
|
||||
* </code></pre>
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD,CONSTRUCTOR,TYPE})
|
||||
public @interface WorkerThread {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
/**
|
||||
* Denotes that an integer parameter, field or method return value is expected
|
||||
* to be an XML resource reference.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(CLASS)
|
||||
@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
|
||||
public @interface XmlRes {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* All of the files in this package were copied unchanged from the Android Open Source Project (AOSP)
|
||||
*/
|
||||
package android.support.annotation;
|
||||
@@ -0,0 +1,16 @@
|
||||
package android.support.multidex;
|
||||
|
||||
import android.content.Context;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* MultiDex that does nothing.
|
||||
*/
|
||||
public class MultiDex {
|
||||
private static Logger logger = LoggerFactory.getLogger(MultiDex.class);
|
||||
|
||||
public static void install(Context context) {
|
||||
logger.debug("Ignoring MultiDex installation attempt for app: {}", context.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.v4.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.StatFs;
|
||||
import android.support.v4.os.EnvironmentCompat;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Helper for accessing features in {@link android.content.Context}
|
||||
* introduced after API level 4 in a backwards compatible fashion.
|
||||
*/
|
||||
public class ContextCompat {
|
||||
/**
|
||||
* Start a set of activities as a synthesized task stack, if able.
|
||||
*
|
||||
* <p>In API level 11 (Android 3.0/Honeycomb) the recommended conventions for
|
||||
* app navigation using the back key changed. The back key's behavior is local
|
||||
* to the current task and does not capture navigation across different tasks.
|
||||
* Navigating across tasks and easily reaching the previous task is accomplished
|
||||
* through the "recents" UI, accessible through the software-provided Recents key
|
||||
* on the navigation or system bar. On devices with the older hardware button configuration
|
||||
* the recents UI can be accessed with a long press on the Home key.</p>
|
||||
*
|
||||
* <p>When crossing from one task stack to another post-Android 3.0,
|
||||
* the application should synthesize a back stack/history for the new task so that
|
||||
* the user may navigate out of the new task and back to the Launcher by repeated
|
||||
* presses of the back key. Back key presses should not navigate across task stacks.</p>
|
||||
*
|
||||
* <p>startActivities provides a mechanism for constructing a synthetic task stack of
|
||||
* multiple activities. If the underlying API is not available on the system this method
|
||||
* will return false.</p>
|
||||
*
|
||||
* @param context Start activities using this activity as the starting context
|
||||
* @param intents Array of intents defining the activities that will be started. The element
|
||||
* length-1 will correspond to the top activity on the resulting task stack.
|
||||
* @return true if the underlying API was available and the call was successful, false otherwise
|
||||
*/
|
||||
public static boolean startActivities(Context context, Intent[] intents) {
|
||||
return startActivities(context, intents, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a set of activities as a synthesized task stack, if able.
|
||||
*
|
||||
* <p>In API level 11 (Android 3.0/Honeycomb) the recommended conventions for
|
||||
* app navigation using the back key changed. The back key's behavior is local
|
||||
* to the current task and does not capture navigation across different tasks.
|
||||
* Navigating across tasks and easily reaching the previous task is accomplished
|
||||
* through the "recents" UI, accessible through the software-provided Recents key
|
||||
* on the navigation or system bar. On devices with the older hardware button configuration
|
||||
* the recents UI can be accessed with a long press on the Home key.</p>
|
||||
*
|
||||
* <p>When crossing from one task stack to another post-Android 3.0,
|
||||
* the application should synthesize a back stack/history for the new task so that
|
||||
* the user may navigate out of the new task and back to the Launcher by repeated
|
||||
* presses of the back key. Back key presses should not navigate across task stacks.</p>
|
||||
*
|
||||
* <p>startActivities provides a mechanism for constructing a synthetic task stack of
|
||||
* multiple activities. If the underlying API is not available on the system this method
|
||||
* will return false.</p>
|
||||
*
|
||||
* @param context Start activities using this activity as the starting context
|
||||
* @param intents Array of intents defining the activities that will be started. The element
|
||||
* length-1 will correspond to the top activity on the resulting task stack.
|
||||
* @param options Additional options for how the Activity should be started.
|
||||
* See {@link android.content.Context#startActivity(Intent, Bundle)
|
||||
* @return true if the underlying API was available and the call was successful, false otherwise
|
||||
*/
|
||||
public static boolean startActivities(Context context, Intent[] intents,
|
||||
Bundle options) {
|
||||
context.startActivities(intents, options);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns absolute paths to application-specific directories on all
|
||||
* external storage devices where the application's OBB files (if there are
|
||||
* any) can be found. Note if the application does not have any OBB files,
|
||||
* these directories may not exist.
|
||||
* <p>
|
||||
* This is like {@link Context#getFilesDir()} in that these files will be
|
||||
* deleted when the application is uninstalled, however there are some
|
||||
* important differences:
|
||||
* <ul>
|
||||
* <li>External files are not always available: they will disappear if the
|
||||
* user mounts the external storage on a computer or removes it.
|
||||
* <li>There is no security enforced with these files.
|
||||
* </ul>
|
||||
* <p>
|
||||
* External storage devices returned here are considered a permanent part of
|
||||
* the device, including both emulated external storage and physical media
|
||||
* slots, such as SD cards in a battery compartment. The returned paths do
|
||||
* not include transient devices, such as USB flash drives.
|
||||
* <p>
|
||||
* An application may store data on any or all of the returned devices. For
|
||||
* example, an app may choose to store large files on the device with the
|
||||
* most available space, as measured by {@link StatFs}.
|
||||
* <p>
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#KITKAT}, no permissions
|
||||
* are required to write to the returned paths; they're always accessible to
|
||||
* the calling app. Before then,
|
||||
* {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} is required to
|
||||
* write. Write access outside of these paths on secondary external storage
|
||||
* devices is not available. To request external storage access in a
|
||||
* backwards compatible way, consider using {@code android:maxSdkVersion}
|
||||
* like this:
|
||||
*
|
||||
* <pre class="prettyprint"><uses-permission
|
||||
* android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
* android:maxSdkVersion="18" /></pre>
|
||||
* <p>
|
||||
* The first path returned is the same as {@link Context#getObbDir()}.
|
||||
* Returned paths may be {@code null} if a storage device is unavailable.
|
||||
*
|
||||
* @see Context#getObbDir()
|
||||
* @see EnvironmentCompat#getStorageState(File)
|
||||
*/
|
||||
public static File[] getObbDirs(Context context) {
|
||||
return context.getObbDirs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns absolute paths to application-specific directories on all
|
||||
* external storage devices where the application can place persistent files
|
||||
* it owns. These files are internal to the application, and not typically
|
||||
* visible to the user as media.
|
||||
* <p>
|
||||
* This is like {@link Context#getFilesDir()} in that these files will be
|
||||
* deleted when the application is uninstalled, however there are some
|
||||
* important differences:
|
||||
* <ul>
|
||||
* <li>External files are not always available: they will disappear if the
|
||||
* user mounts the external storage on a computer or removes it.
|
||||
* <li>There is no security enforced with these files.
|
||||
* </ul>
|
||||
* <p>
|
||||
* External storage devices returned here are considered a permanent part of
|
||||
* the device, including both emulated external storage and physical media
|
||||
* slots, such as SD cards in a battery compartment. The returned paths do
|
||||
* not include transient devices, such as USB flash drives.
|
||||
* <p>
|
||||
* An application may store data on any or all of the returned devices. For
|
||||
* example, an app may choose to store large files on the device with the
|
||||
* most available space, as measured by {@link StatFs}.
|
||||
* <p>
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#KITKAT}, no permissions
|
||||
* are required to write to the returned paths; they're always accessible to
|
||||
* the calling app. Before then,
|
||||
* {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} is required to
|
||||
* write. Write access outside of these paths on secondary external storage
|
||||
* devices is not available. To request external storage access in a
|
||||
* backwards compatible way, consider using {@code android:maxSdkVersion}
|
||||
* like this:
|
||||
*
|
||||
* <pre class="prettyprint"><uses-permission
|
||||
* android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
* android:maxSdkVersion="18" /></pre>
|
||||
* <p>
|
||||
* The first path returned is the same as
|
||||
* {@link Context#getExternalFilesDir(String)}. Returned paths may be
|
||||
* {@code null} if a storage device is unavailable.
|
||||
*
|
||||
* @see Context#getExternalFilesDir(String)
|
||||
* @see EnvironmentCompat#getStorageState(File)
|
||||
*/
|
||||
public static File[] getExternalFilesDirs(Context context, String type) {
|
||||
return context.getExternalFilesDirs(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns absolute paths to application-specific directories on all
|
||||
* external storage devices where the application can place cache files it
|
||||
* owns. These files are internal to the application, and not typically
|
||||
* visible to the user as media.
|
||||
* <p>
|
||||
* This is like {@link Context#getCacheDir()} in that these files will be
|
||||
* deleted when the application is uninstalled, however there are some
|
||||
* important differences:
|
||||
* <ul>
|
||||
* <li>External files are not always available: they will disappear if the
|
||||
* user mounts the external storage on a computer or removes it.
|
||||
* <li>There is no security enforced with these files.
|
||||
* </ul>
|
||||
* <p>
|
||||
* External storage devices returned here are considered a permanent part of
|
||||
* the device, including both emulated external storage and physical media
|
||||
* slots, such as SD cards in a battery compartment. The returned paths do
|
||||
* not include transient devices, such as USB flash drives.
|
||||
* <p>
|
||||
* An application may store data on any or all of the returned devices. For
|
||||
* example, an app may choose to store large files on the device with the
|
||||
* most available space, as measured by {@link StatFs}.
|
||||
* <p>
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#KITKAT}, no permissions
|
||||
* are required to write to the returned paths; they're always accessible to
|
||||
* the calling app. Before then,
|
||||
* {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} is required to
|
||||
* write. Write access outside of these paths on secondary external storage
|
||||
* devices is not available. To request external storage access in a
|
||||
* backwards compatible way, consider using {@code android:maxSdkVersion}
|
||||
* like this:
|
||||
*
|
||||
* <pre class="prettyprint"><uses-permission
|
||||
* android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
* android:maxSdkVersion="18" /></pre>
|
||||
* <p>
|
||||
* The first path returned is the same as
|
||||
* {@link Context#getExternalCacheDir()}. Returned paths may be {@code null}
|
||||
* if a storage device is unavailable.
|
||||
*
|
||||
* @see Context#getExternalCacheDir()
|
||||
* @see EnvironmentCompat#getStorageState(File)
|
||||
*/
|
||||
public static File[] getExternalCacheDirs(Context context) {
|
||||
return context.getExternalCacheDirs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a drawable object associated with a particular resource ID.
|
||||
* <p>
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#LOLLIPOP}, the returned
|
||||
* drawable will be styled for the specified Context's theme.
|
||||
*
|
||||
* @param id The desired resource identifier, as generated by the aapt tool.
|
||||
* This integer encodes the package, type, and resource entry.
|
||||
* The value 0 is an invalid identifier.
|
||||
* @return Drawable An object that can be used to draw this resource.
|
||||
*/
|
||||
public static final Drawable getDrawable(Context context, int id) {
|
||||
return context.getDrawable(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute path to the directory on the filesystem similar to
|
||||
* {@link Context#getFilesDir()}. The difference is that files placed under this
|
||||
* directory will be excluded from automatic backup to remote storage on
|
||||
* devices running {@link android.os.Build.VERSION_CODES#LOLLIPOP} or later. See
|
||||
* {@link android.app.backup.BackupAgent BackupAgent} for a full discussion
|
||||
* of the automatic backup mechanism in Android.
|
||||
*
|
||||
* <p>No permissions are required to read or write to the returned path, since this
|
||||
* path is internal storage.
|
||||
*
|
||||
* @return The path of the directory holding application files that will not be
|
||||
* automatically backed up to remote storage.
|
||||
*
|
||||
* @see android.content.Context.getFilesDir
|
||||
*/
|
||||
public final File getNoBackupFilesDir(Context context) {
|
||||
return context.getNoBackupFilesDir();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute path to the application specific cache directory on
|
||||
* the filesystem designed for storing cached code. On devices running
|
||||
* {@link android.os.Build.VERSION_CODES#LOLLIPOP} or later, the system will delete
|
||||
* any files stored in this location both when your specific application is
|
||||
* upgraded, and when the entire platform is upgraded.
|
||||
* <p>
|
||||
* This location is optimal for storing compiled or optimized code generated
|
||||
* by your application at runtime.
|
||||
* <p>
|
||||
* Apps require no extra permissions to read or write to the returned path,
|
||||
* since this path lives in their private storage.
|
||||
*
|
||||
* @return The path of the directory holding application code cache files.
|
||||
*/
|
||||
public final File getCodeCacheDir(Context context) {
|
||||
return context.getCodeCacheDir();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.v4.os;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Helper for accessing features in {@link Environment} introduced after API
|
||||
* level 4 in a backwards compatible fashion.
|
||||
*/
|
||||
public class EnvironmentCompat {
|
||||
/**
|
||||
* Unknown storage state, such as when a path isn't backed by known storage
|
||||
* media.
|
||||
*
|
||||
* @see #getStorageState(File)
|
||||
*/
|
||||
public static final String MEDIA_UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
* Returns the current state of the storage device that provides the given
|
||||
* path.
|
||||
*
|
||||
* @return one of {@link #MEDIA_UNKNOWN}, {@link Environment#MEDIA_REMOVED},
|
||||
* {@link Environment#MEDIA_UNMOUNTED},
|
||||
* {@link Environment#MEDIA_CHECKING},
|
||||
* {@link Environment#MEDIA_NOFS},
|
||||
* {@link Environment#MEDIA_MOUNTED},
|
||||
* {@link Environment#MEDIA_MOUNTED_READ_ONLY},
|
||||
* {@link Environment#MEDIA_SHARED},
|
||||
* {@link Environment#MEDIA_BAD_REMOVAL}, or
|
||||
* {@link Environment#MEDIA_UNMOUNTABLE}.
|
||||
*/
|
||||
public static String getStorageState(File path) {
|
||||
return Environment.getStorageState(path);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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 android.support.v7.preference;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A data store interface to be implemented and provided to the Preferences framework. This can be
|
||||
* used to replace the default {@link android.content.SharedPreferences}, if needed.
|
||||
*
|
||||
* <p>In most cases you want to use {@link android.content.SharedPreferences} as it is automatically
|
||||
* backed up and migrated to new devices. However, providing custom data store to preferences can be
|
||||
* useful if your app stores its preferences in a local db, cloud or they are device specific like
|
||||
* "Developer settings". It might be also useful when you want to use the preferences UI but
|
||||
* the data are not supposed to be stored at all because they are valid per session only.
|
||||
*
|
||||
* <p>Once a put method is called it is full responsibility of the data store implementation to
|
||||
* safely store the given values. Time expensive operations need to be done in the background to
|
||||
* prevent from blocking the UI. You also need to have a plan on how to serialize the data in case
|
||||
* the activity holding this object gets destroyed.
|
||||
*
|
||||
* <p>By default, all "put" methods throw {@link UnsupportedOperationException}.
|
||||
*/
|
||||
public abstract class PreferenceDataStore {
|
||||
|
||||
/**
|
||||
* Sets a {@link String} value to the data store.
|
||||
*
|
||||
* <p>Once the value is set the data store is responsible for holding it.
|
||||
*
|
||||
* @param key the name of the preference to modify
|
||||
* @param value the new value for the preference
|
||||
* @see #getString(String, String)
|
||||
*/
|
||||
public void putString(String key, @Nullable String value) {
|
||||
throw new UnsupportedOperationException("Not implemented on this data store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a set of Strings to the data store.
|
||||
*
|
||||
* <p>Once the value is set the data store is responsible for holding it.
|
||||
*
|
||||
* @param key the name of the preference to modify
|
||||
* @param values the set of new values for the preference
|
||||
* @see #getStringSet(String, Set<String>)
|
||||
*/
|
||||
public void putStringSet(String key, @Nullable Set<String> values) {
|
||||
throw new UnsupportedOperationException("Not implemented on this data store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an {@link Integer} value to the data store.
|
||||
*
|
||||
* <p>Once the value is set the data store is responsible for holding it.
|
||||
*
|
||||
* @param key the name of the preference to modify
|
||||
* @param value the new value for the preference
|
||||
* @see #getInt(String, int)
|
||||
*/
|
||||
public void putInt(String key, int value) {
|
||||
throw new UnsupportedOperationException("Not implemented on this data store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link Long} value to the data store.
|
||||
*
|
||||
* <p>Once the value is set the data store is responsible for holding it.
|
||||
*
|
||||
* @param key the name of the preference to modify
|
||||
* @param value the new value for the preference
|
||||
* @see #getLong(String, long)
|
||||
*/
|
||||
public void putLong(String key, long value) {
|
||||
throw new UnsupportedOperationException("Not implemented on this data store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link Float} value to the data store.
|
||||
*
|
||||
* <p>Once the value is set the data store is responsible for holding it.
|
||||
*
|
||||
* @param key the name of the preference to modify
|
||||
* @param value the new value for the preference
|
||||
* @see #getFloat(String, float)
|
||||
*/
|
||||
public void putFloat(String key, float value) {
|
||||
throw new UnsupportedOperationException("Not implemented on this data store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link Boolean} value to the data store.
|
||||
*
|
||||
* <p>Once the value is set the data store is responsible for holding it.
|
||||
*
|
||||
* @param key the name of the preference to modify
|
||||
* @param value the new value for the preference
|
||||
* @see #getBoolean(String, boolean)
|
||||
*/
|
||||
public void putBoolean(String key, boolean value) {
|
||||
throw new UnsupportedOperationException("Not implemented on this data store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a {@link String} value from the data store.
|
||||
*
|
||||
* @param key the name of the preference to retrieve
|
||||
* @param defValue value to return if this preference does not exist in the storage
|
||||
* @return the value from the data store or the default return value
|
||||
* @see #putString(String, String)
|
||||
*/
|
||||
@Nullable
|
||||
public String getString(String key, @Nullable String defValue) {
|
||||
return defValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a set of Strings from the data store.
|
||||
*
|
||||
* @param key the name of the preference to retrieve
|
||||
* @param defValues values to return if this preference does not exist in the storage
|
||||
* @return the values from the data store or the default return values
|
||||
* @see #putStringSet(String, Set<String>)
|
||||
*/
|
||||
@Nullable
|
||||
public Set<String> getStringSet(String key, @Nullable Set<String> defValues) {
|
||||
return defValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an {@link Integer} value from the data store.
|
||||
*
|
||||
* @param key the name of the preference to retrieve
|
||||
* @param defValue value to return if this preference does not exist in the storage
|
||||
* @return the value from the data store or the default return value
|
||||
* @see #putInt(String, int)
|
||||
*/
|
||||
public int getInt(String key, int defValue) {
|
||||
return defValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Long} value from the data store.
|
||||
*
|
||||
* @param key the name of the preference to retrieve
|
||||
* @param defValue value to return if this preference does not exist in the storage
|
||||
* @return the value from the data store or the default return value
|
||||
* @see #putLong(String, long)
|
||||
*/
|
||||
public long getLong(String key, long defValue) {
|
||||
return defValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Float} value from the data store.
|
||||
*
|
||||
* @param key the name of the preference to retrieve
|
||||
* @param defValue value to return if this preference does not exist in the storage
|
||||
* @return the value from the data store or the default return value
|
||||
* @see #putFloat(String, float)
|
||||
*/
|
||||
public float getFloat(String key, float defValue) {
|
||||
return defValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Boolean} value from the data store.
|
||||
*
|
||||
* @param key the name of the preference to retrieve
|
||||
* @param defValue value to return if this preference does not exist in the storage
|
||||
* @return the value from the data store or the default return value
|
||||
* @see #getBoolean(String, boolean)
|
||||
*/
|
||||
public boolean getBoolean(String key, boolean defValue) {
|
||||
return defValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package android.support.v7.preference;
|
||||
|
||||
public class PreferenceScreen {
|
||||
}
|
||||
Reference in New Issue
Block a user