本文整理汇总了Java中android.util.SparseArray.append方法的典型用法代码示例。如果您正苦于以下问题:Java SparseArray.append方法的具体用法?Java SparseArray.append怎么用?Java SparseArray.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.SparseArray
的用法示例。
在下文中一共展示了SparseArray.append方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSaveInstanceState
import android.util.SparseArray; //导入方法依赖的package包/类
@Override
protected Parcelable onSaveInstanceState() {
final SavedState ss = new SavedState(super.onSaveInstanceState());
final SparseArray<Parcelable> behaviorStates = new SparseArray<>();
for (int i = 0, count = getChildCount(); i < count; i++) {
final View child = getChildAt(i);
final int childId = child.getId();
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final Behavior b = lp.getBehavior();
if (childId != NO_ID && b != null) {
// If the child has an ID and a Behavior, let it save some state...
Parcelable state = b.onSaveInstanceState(this, child);
if (state != null) {
behaviorStates.append(childId, state);
}
}
}
ss.behaviorStates = behaviorStates;
return ss;
}
示例2: onSaveInstanceState
import android.util.SparseArray; //导入方法依赖的package包/类
protected Parcelable onSaveInstanceState() {
SavedState ss = new SavedState(super.onSaveInstanceState());
SparseArray<Parcelable> behaviorStates = new SparseArray();
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int childId = child.getId();
Behavior b = ((LayoutParams) child.getLayoutParams()).getBehavior();
if (!(childId == -1 || b == null)) {
Parcelable state = b.onSaveInstanceState(this, child);
if (state != null) {
behaviorStates.append(childId, state);
}
}
}
ss.behaviorStates = behaviorStates;
return ss;
}
示例3: generatePermissionsMapping
import android.util.SparseArray; //导入方法依赖的package包/类
private static SparseArray<String> generatePermissionsMapping(
WindowAndroid windowAndroid, int[] contentSettingsTypes) {
SparseArray<String> permissionsToRequest = new SparseArray<String>();
for (int i = 0; i < contentSettingsTypes.length; i++) {
String permission = PrefServiceBridge.getAndroidPermissionForContentSetting(
contentSettingsTypes[i]);
if (permission != null && !windowAndroid.hasPermission(permission)) {
permissionsToRequest.append(contentSettingsTypes[i], permission);
}
}
return permissionsToRequest;
}
示例4: toSparseArray
import android.util.SparseArray; //导入方法依赖的package包/类
private SparseArray<Object> toSparseArray() {
SparseArray<Object> sparseArray = new SparseArray();
int size = size();
for (int i = 0; i < size; i++) {
sparseArray.append(keyAt(i), Integer.valueOf(valueAt(i)));
}
return sparseArray;
}
示例5: addTintListToCache
import android.util.SparseArray; //导入方法依赖的package包/类
private void addTintListToCache(@NonNull Context context, @DrawableRes int resId,
@NonNull ColorStateList tintList) {
if (mTintLists == null) {
mTintLists = new WeakHashMap<>();
}
SparseArray<ColorStateList> themeTints = mTintLists.get(context);
if (themeTints == null) {
themeTints = new SparseArray<>();
mTintLists.put(context, themeTints);
}
themeTints.append(resId, tintList);
}
示例6: getMigrator
import android.util.SparseArray; //导入方法依赖的package包/类
@Provides @Singleton public Migrator getMigrator() {
SparseArray<Class<? extends Migration>> migrations = new SparseArray<>();
migrations.append(2, AddAppLibraryPermissionMigration.class);
return new Migrator(migrations);
}
示例7: toSparseArray
import android.util.SparseArray; //导入方法依赖的package包/类
private SparseArray<Object> toSparseArray() {
SparseArray<Object> sparseArray = new SparseArray<Object>();
for (int i = 0, size = size(); i < size; i++)
sparseArray.append(keyAt(i), valueAt(i));
return sparseArray;
}