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


Java Bundle.putSparseParcelableArray方法代码示例

本文整理汇总了Java中android.os.Bundle.putSparseParcelableArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putSparseParcelableArray方法的具体用法?Java Bundle.putSparseParcelableArray怎么用?Java Bundle.putSparseParcelableArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.putSparseParcelableArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveActionViewStates

import android.os.Bundle; //导入方法依赖的package包/类
public void saveActionViewStates(Bundle outStates) {
    SparseArray<Parcelable> viewStates = null;

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
        final MenuItem item = getItem(i);
        final View v = item.getActionView();
        if (v != null && v.getId() != View.NO_ID) {
            if (viewStates == null) {
                viewStates = new SparseArray<Parcelable>();
            }
            v.saveHierarchyState(viewStates);
            if (item.isActionViewExpanded()) {
                outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
            }
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.saveActionViewStates(outStates);
        }
    }

    if (viewStates != null) {
        outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:27,代码来源:MenuBuilder.java

示例2: dispatchSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
private void dispatchSaveInstanceState(Bundle outState) {
    if (mPresenters.isEmpty()) return;

    SparseArray<Parcelable> presenterStates = new SparseArray<Parcelable>();

    for (WeakReference<MenuPresenter> ref : mPresenters) {
        final MenuPresenter presenter = ref.get();
        if (presenter == null) {
            mPresenters.remove(ref);
        } else {
            final int id = presenter.getId();
            if (id > 0) {
                final Parcelable state = presenter.onSaveInstanceState();
                if (state != null) {
                    presenterStates.put(id, state);
                }
            }
        }
    }

    outState.putSparseParcelableArray(PRESENTER_KEY, presenterStates);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:MenuBuilder.java

示例3: saveViewState

import android.os.Bundle; //导入方法依赖的package包/类
private void saveViewState(@NonNull View view) {
  viewState = new Bundle(getClass().getClassLoader());

  SparseArray<Parcelable> hierarchyState = new SparseArray<>();
  view.saveHierarchyState(hierarchyState);
  viewState.putSparseParcelableArray(KEY_VIEW_STATE_HIERARCHY, hierarchyState);

  Bundle stateBundle = new Bundle(getClass().getClassLoader());
  onSaveViewState(view, stateBundle);
  viewState.putBundle(KEY_VIEW_STATE_BUNDLE, stateBundle);

  if (!lifecycleListeners.isEmpty()) {
    for (LifecycleListener listener : new ArrayList<>(lifecycleListeners)) {
      listener.onSaveViewState(this, viewState);
    }
  }
}
 
开发者ID:seven332,项目名称:Stage,代码行数:18,代码来源:Scene.java

示例4: dispatchSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
private void dispatchSaveInstanceState(Bundle outState) {
    if (!this.mPresenters.isEmpty()) {
        SparseArray<Parcelable> presenterStates = new SparseArray();
        Iterator i$ = this.mPresenters.iterator();
        while (i$.hasNext()) {
            WeakReference<MenuPresenter> ref = (WeakReference) i$.next();
            MenuPresenter presenter = (MenuPresenter) ref.get();
            if (presenter == null) {
                this.mPresenters.remove(ref);
            } else {
                int id = presenter.getId();
                if (id > 0) {
                    Parcelable state = presenter.onSaveInstanceState();
                    if (state != null) {
                        presenterStates.put(id, state);
                    }
                }
            }
        }
        outState.putSparseParcelableArray(PRESENTER_KEY, presenterStates);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:MenuBuilder.java

示例5: createInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
public Bundle createInstanceState() {
    Bundle state = new Bundle();
    if (this.mCheckedItem != null) {
        state.putInt(STATE_CHECKED_ITEM, this.mCheckedItem.getItemId());
    }
    SparseArray<ParcelableSparseArray> actionViewStates = new SparseArray();
    Iterator i$ = this.mItems.iterator();
    while (i$.hasNext()) {
        NavigationMenuItem navigationMenuItem = (NavigationMenuItem) i$.next();
        if (navigationMenuItem instanceof NavigationMenuTextItem) {
            MenuItemImpl item = ((NavigationMenuTextItem) navigationMenuItem).getMenuItem();
            View actionView = item != null ? item.getActionView() : null;
            if (actionView != null) {
                ParcelableSparseArray container = new ParcelableSparseArray();
                actionView.saveHierarchyState(container);
                actionViewStates.put(item.getItemId(), container);
            }
        }
    }
    state.putSparseParcelableArray(STATE_ACTION_VIEWS, actionViewStates);
    return state;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:NavigationMenuPresenter.java

示例6: saveState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Parcelable saveState() {
  if (savedStateMap != null) {
    Bundle state = new Bundle();
    state.putSparseParcelableArray(KEY_SAVED_STATE_MAP, savedStateMap);
    return state;
  } else {
    return null;
  }
}
 
开发者ID:seven332,项目名称:Stage,代码行数:11,代码来源:StagePagerAdapter.java

示例7: saveState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Parcelable saveState()
{
	for(TabFragment fragment : tabFragments)
		savedStates.put(fragment.getTabId(), fragment.isAdded() ? fragmentManager.saveFragmentInstanceState(fragment) : null);
	Bundle state = new Bundle();
	state.putSparseParcelableArray("states", savedStates);
	return state;
}
 
开发者ID:mniip,项目名称:bananapeel,代码行数:10,代码来源:TabAdapter.java

示例8: putSparseParcelableArray

import android.os.Bundle; //导入方法依赖的package包/类
public Bundler putSparseParcelableArray(@NonNull String key, SparseArray<? extends Parcelable> value) {
    Bundle safeBundle = new Bundle();
    safeBundle.putSparseParcelableArray(key, value);
    if (isValidBundleSize(safeBundle)) {
        bundle.putSparseParcelableArray(key, value);
    }
    clearBundle(safeBundle);
    return this;
}
 
开发者ID:alphater,项目名称:garras,代码行数:10,代码来源:Bundler.java

示例9: write

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException {
    Field propertyField = field.getField();
    propertyField.setAccessible(true);
    bundle.putSparseParcelableArray(field.getBundleKey(), (SparseArray<? extends Parcelable>) propertyField.get(to));

}
 
开发者ID:leobert-lan,项目名称:MagicBox,代码行数:8,代码来源:SparseParcelableArrayWriter.java

示例10: writeToParcel

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void writeToParcel(final Parcel parcel, final int arg1) {
    final Bundle b = new Bundle();
    b.putString("local_name_complete", mLocalNameComplete);
    b.putString("local_name_short", mLocalNameShort);
    b.putSparseParcelableArray("records_array", mAdRecords);

    parcel.writeBundle(b);
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:10,代码来源:AdRecordStore.java

示例11: save

import android.os.Bundle; //导入方法依赖的package包/类
final void save(Bundle outState) {
  saveViewState();
  if (viewState != null) {
    outState.putSparseParcelableArray(VIEW_STATE + hashCode(), viewState);
  }
  viewState = null;
}
 
开发者ID:wealthfront,项目名称:magellan,代码行数:8,代码来源:Screen.java

示例12: saveHierarchyState

import android.os.Bundle; //导入方法依赖的package包/类
public void saveHierarchyState(Bundle outState) {
    SparseArray<Parcelable> viewStates = new SparseArray();
    if (this.mMenuView != null) {
        this.mMenuView.saveHierarchyState(viewStates);
    }
    outState.putSparseParcelableArray(VIEWS_TAG, viewStates);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:ListMenuPresenter.java

示例13: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
public Parcelable onSaveInstanceState() {
    Bundle state = new Bundle();
    if (this.mMenuView != null) {
        SparseArray<Parcelable> hierarchy = new SparseArray();
        this.mMenuView.saveHierarchyState(hierarchy);
        state.putSparseParcelableArray("android:menu:list", hierarchy);
    }
    if (this.mAdapter != null) {
        state.putBundle(STATE_ADAPTER, this.mAdapter.createInstanceState());
    }
    return state;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:NavigationMenuPresenter.java

示例14: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
Parcelable onSaveInstanceState() {
    SparseArray<Parcelable> state = new SparseArray<>();
    itemView.saveHierarchyState(state);
    Bundle bundle = new Bundle();
    bundle.putSparseParcelableArray(STATE, state);
    return bundle;
}
 
开发者ID:achenglike,项目名称:imageviewer,代码行数:8,代码来源:ViewHolder.java

示例15: saveState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Parcelable saveState() {
    Bundle bundle = new Bundle();
    for (ViewHolder viewHolder : getAttachedViewHolders()) {
        mSavedStates.put(getItemId(viewHolder.mPosition), viewHolder.onSaveInstanceState());
    }
    bundle.putSparseParcelableArray(STATE, mSavedStates);
    return bundle;
}
 
开发者ID:achenglike,项目名称:imageviewer,代码行数:10,代码来源:RecyclingPagerAdapter.java


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