/**
* Returns a new KeyPath with the key added.
* This is used during keypath resolution. Children normally don't know about all of their parent
* elements so this is used to keep track of the fully qualified keypath.
* This returns a key keypath because during resolution, the full keypath element tree is walked
* and if this modified the original copy, it would remain after popping back up the element tree.
*/
@CheckResult
@RestrictTo(RestrictTo.Scope.LIBRARY)
public KeyPath addKey(String key) {
KeyPath newKeyPath = new KeyPath(this);
newKeyPath.keys.add(key);
return newKeyPath;
}
java类android.support.annotation.RestrictTo的实例源码
KeyPath.java 文件源码
项目:lottie-android
阅读 35
收藏 0
点赞 0
评论 0
KeyPath.java 文件源码
项目:lottie-android
阅读 32
收藏 0
点赞 0
评论 0
/**
* Return a new KeyPath with the element resolved to the specified {@link KeyPathElement}.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public KeyPath resolve(KeyPathElement element) {
KeyPath keyPath = new KeyPath(this);
keyPath.resolvedElement = element;
return keyPath;
}
Preference.java 文件源码
项目:MaterialPreference
阅读 29
收藏 0
点赞 0
评论 0
/**
* Called from {@link PreferenceGroup} to pass in an ID for reuse
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
protected void onAttachedToHierarchy(PreferenceManager preferenceManager, long id) {
mId = id;
mHasId = true;
try {
onAttachedToHierarchy(preferenceManager);
} finally {
mHasId = false;
}
}
TwoStatePreference.java 文件源码
项目:MaterialPreference
阅读 21
收藏 0
点赞 0
评论 0
/**
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
protected void syncSummaryView(View view) {
if (!(view instanceof TextView)) {
return;
}
TextView summaryView = (TextView) view;
boolean useDefaultSummary = true;
if (mChecked && !TextUtils.isEmpty(mSummaryOn)) {
summaryView.setText(mSummaryOn);
useDefaultSummary = false;
} else if (!mChecked && !TextUtils.isEmpty(mSummaryOff)) {
summaryView.setText(mSummaryOff);
useDefaultSummary = false;
}
if (useDefaultSummary) {
final CharSequence summary = getSummary();
if (!TextUtils.isEmpty(summary)) {
summaryView.setText(summary);
useDefaultSummary = false;
}
}
int newVisibility = View.GONE;
if (!useDefaultSummary) {
// Someone has written to it
newVisibility = View.VISIBLE;
}
if (newVisibility != summaryView.getVisibility()) {
summaryView.setVisibility(newVisibility);
}
}
DropDownPreference.java 文件源码
项目:MaterialPreference
阅读 25
收藏 0
点赞 0
评论 0
/**
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
public int findSpinnerIndexOfValue(String value) {
CharSequence[] entryValues = getEntryValues();
if (value != null && entryValues != null) {
for (int i = entryValues.length - 1; i >= 0; i--) {
if (entryValues[i].equals(value)) {
return i;
}
}
}
return Spinner.INVALID_POSITION;
}
PreferenceManager.java 文件源码
项目:MaterialPreference
阅读 31
收藏 0
点赞 0
评论 0
/**
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
public PreferenceManager(Context context) {
mContext = context;
setSharedPreferencesName(getDefaultSharedPreferencesName(context));
}
Selector.java 文件源码
项目:Android-Orma
阅读 27
收藏 0
点赞 0
评论 0
@RestrictTo(RestrictTo.Scope.LIBRARY)
@SuppressWarnings("unchecked")
public S resetLimitClause() {
limit = -1;
offset = -1;
page = -1;
return (S) this;
}
Selector.java 文件源码
项目:Android-Orma
阅读 28
收藏 0
点赞 0
评论 0
@RestrictTo(RestrictTo.Scope.LIBRARY)
public long getOffset() {
assert hasOffset();
if (offset != -1) {
return offset;
} else {
return ((page - 1) * limit);
}
}
DatabaseConfiguration.java 文件源码
项目:AndroidLife
阅读 27
收藏 0
点赞 0
评论 0
/**
* Creates a database configuration with the given values.
*
* @param context The application context.
* @param name Name of the database, can be null if it is in memory.
* @param sqliteOpenHelperFactory The open helper factory to use.
* @param migrationContainer The migration container for migrations.
* @param allowMainThreadQueries Whether to allow main thread reads/writes or not.
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public DatabaseConfiguration(@NonNull Context context, @Nullable String name,
@NonNull SupportSQLiteOpenHelper.Factory sqliteOpenHelperFactory,
@NonNull RoomDatabase.MigrationContainer migrationContainer,
boolean allowMainThreadQueries) {
this.sqliteOpenHelperFactory = sqliteOpenHelperFactory;
this.context = context;
this.name = name;
this.migrationContainer = migrationContainer;
this.allowMainThreadQueries = allowMainThreadQueries;
}
RoomDatabase.java 文件源码
项目:AndroidLife
阅读 24
收藏 0
点赞 0
评论 0
/**
* Asserts that we are not on the main thread.
*
* @hide
*/
@SuppressLint("RestrictedApi")
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public void assertNotMainThread() {
if (mAllowMainThreadQueries) {
return;
}
if (AppToolkitTaskExecutor.getInstance().isMainThread()) {
throw new IllegalStateException("Cannot access database on the main thread since"
+ " it may potentially lock the UI for a long periods of time.");
}
}