当前位置: 首页>>代码示例>>Java>>正文


Java SparseArray.append方法代码示例

本文整理汇总了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;
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:23,代码来源:CoordinatorLayout.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:CoordinatorLayout.java

示例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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:AndroidPermissionRequester.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ParcelableSparseIntArray.java

示例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);
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:13,代码来源:SkinCompatDrawableManager.java

示例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);
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:6,代码来源:DatabaseModule.java

示例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;
}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:7,代码来源:ParcelableSparseIntArray.java


注:本文中的android.util.SparseArray.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。