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


Java Bundle.getSparseParcelableArray方法代码示例

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


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

示例1: dispatchRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
private void dispatchRestoreInstanceState(Bundle state) {
    SparseArray<Parcelable> presenterStates = state.getSparseParcelableArray(PRESENTER_KEY);

    if (presenterStates == null || mPresenters.isEmpty()) return;

    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) {
                Parcelable parcel = presenterStates.get(id);
                if (parcel != null) {
                    presenter.onRestoreInstanceState(parcel);
                }
            }
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:21,代码来源:MenuBuilder.java

示例2: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Parcelable state, ClassLoader loader)
{
	if(state != null)
	{
		Bundle bundle = (Bundle)state;
		bundle.setClassLoader(loader);
		SparseArray fss = bundle.getSparseParcelableArray("states");
		for(TabFragment fragment : tabFragments)
		{
			if(curTransaction == null)
				curTransaction = fragmentManager.beginTransaction();
			curTransaction.remove(fragment);
		}
		savedStates.clear();
		tabFragments.clear();
		if(fss != null)
		{
			for(int i = 0; i < fss.size(); i++)
				savedStates.put(fss.keyAt(i), (Fragment.SavedState)fss.valueAt(i));
		}
	}
}
 
开发者ID:mniip,项目名称:bananapeel,代码行数:24,代码来源:TabAdapter.java

示例3: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
    public void restoreState(Parcelable state, ClassLoader loader) {
        if (state != null) {
            Bundle bundle = (Bundle) state;
            bundle.setClassLoader(loader);
            mSavedState.clear();
            mFragments.clear();
            if (bundle.containsKey("states")) {
                mSavedState = bundle.getSparseParcelableArray("states");
            }
            Iterable<String> keys = bundle.keySet();
            for (String key : keys) {
                if (key.startsWith("f")) {
                    int index = Integer.parseInt(key.substring(1));
                    Fragment f = mFragmentManager.getFragment(bundle, key);
                    if (f != null) {
                        f.setMenuVisibility(false);
                        mFragments.put(index, f);
                    } else {
//						Log.w(TAG, "Bad fragment at key " + key);
                    }
                }
            }
        }
    }
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:26,代码来源:FragmentListPageAdapter.java

示例4: dispatchRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
private void dispatchRestoreInstanceState(Bundle state) {
    SparseArray<Parcelable> presenterStates = state.getSparseParcelableArray(PRESENTER_KEY);
    if (presenterStates != null && !this.mPresenters.isEmpty()) {
        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 parcel = (Parcelable) presenterStates.get(id);
                    if (parcel != null) {
                        presenter.onRestoreInstanceState(parcel);
                    }
                }
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:MenuBuilder.java

示例5: restoreActionViewStates

import android.os.Bundle; //导入方法依赖的package包/类
public void restoreActionViewStates(Bundle states) {
    if (states != null) {
        SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(getActionViewStatesKey());
        int itemCount = size();
        for (int i = 0; i < itemCount; i++) {
            MenuItem item = getItem(i);
            View v = MenuItemCompat.getActionView(item);
            if (!(v == null || v.getId() == -1)) {
                v.restoreHierarchyState(viewStates);
            }
            if (item.hasSubMenu()) {
                ((SubMenuBuilder) item.getSubMenu()).restoreActionViewStates(states);
            }
        }
        int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
        if (expandedId > 0) {
            MenuItem itemToExpand = findItem(expandedId);
            if (itemToExpand != null) {
                MenuItemCompat.expandActionView(itemToExpand);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:MenuBuilder.java

示例6: restoreActionViewStates

import android.os.Bundle; //导入方法依赖的package包/类
public void restoreActionViewStates(Bundle states) {
    if (states == null) {
        return;
    }

    SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
            getActionViewStatesKey());

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) {
        //Fixes Issue #652 with sdk <= 2.3.6
        return;
    }

    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) {
            v.restoreHierarchyState(viewStates);
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.restoreActionViewStates(states);
        }
    }

    final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
    if (expandedId > 0) {
        MenuItem itemToExpand = findItem(expandedId);
        if (itemToExpand != null) {
            itemToExpand.expandActionView();
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:35,代码来源:MenuBuilder.java

示例7: restoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public final void restoreInstanceState(@Nullable final Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        savedInstanceStates =
                savedInstanceState.getSparseParcelableArray(SAVED_INSTANCE_STATES_EXTRA);
    }
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:8,代码来源:ChildRecyclerAdapter.java

示例8: restoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
public void restoreInstanceState(Bundle state) {
    Iterator i$;
    int checkedItem = state.getInt(STATE_CHECKED_ITEM, 0);
    if (checkedItem != 0) {
        this.mUpdateSuspended = true;
        i$ = this.mItems.iterator();
        while (i$.hasNext()) {
            NavigationMenuItem item = (NavigationMenuItem) i$.next();
            if (item instanceof NavigationMenuTextItem) {
                MenuItemImpl menuItem = ((NavigationMenuTextItem) item).getMenuItem();
                if (menuItem != null && menuItem.getItemId() == checkedItem) {
                    setCheckedItem(menuItem);
                    break;
                }
            }
        }
        this.mUpdateSuspended = false;
        prepareMenuItems();
    }
    SparseArray<ParcelableSparseArray> actionViewStates = state.getSparseParcelableArray(STATE_ACTION_VIEWS);
    i$ = this.mItems.iterator();
    while (i$.hasNext()) {
        NavigationMenuItem navigationMenuItem = (NavigationMenuItem) i$.next();
        if (navigationMenuItem instanceof NavigationMenuTextItem) {
            MenuItemImpl item2 = ((NavigationMenuTextItem) navigationMenuItem).getMenuItem();
            View actionView = item2 != null ? item2.getActionView() : null;
            if (actionView != null) {
                actionView.restoreHierarchyState((SparseArray) actionViewStates.get(item2.getItemId()));
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:33,代码来源:NavigationMenuPresenter.java

示例9: onRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
public void onRestoreInstanceState(Parcelable parcelable) {
    Bundle state = (Bundle) parcelable;
    SparseArray<Parcelable> hierarchy = state.getSparseParcelableArray("android:menu:list");
    if (hierarchy != null) {
        this.mMenuView.restoreHierarchyState(hierarchy);
    }
    Bundle adapterState = state.getBundle(STATE_ADAPTER);
    if (adapterState != null) {
        this.mAdapter.restoreInstanceState(adapterState);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:NavigationMenuPresenter.java

示例10: unbundle

import android.os.Bundle; //导入方法依赖的package包/类
public static TestClassBundled unbundle(Bundle bundle, Gson gson) {
    return new AutoValue_TestClassBundled(
            bundle,
            bundle.getByte("some_byte"),
            bundle.getBoolean("some_boolean"),
            bundle.getShort("some_short"),
            bundle.getInt("some_int"),
            bundle.getLong("some_long"),
            bundle.getChar("some_char"),
            bundle.getFloat("some_float"),
            bundle.getDouble("some_double"),
            bundle.getString("some_string"),
            bundle.getCharSequence("some_char_sequence"),
            bundle.getParcelable("some_parcelable"),
            bundle.getParcelableArrayList("some_parcelable_array_list"),
            bundle.getSparseParcelableArray("some_parcelable_sparse_array"),
            bundle.getSerializable("some_serializable"),
            bundle.getIntegerArrayList("some_integer_array_list"),
            bundle.getStringArrayList("some_string_array_list"),
            bundle.getCharSequenceArrayList("some_char_sequence_array_list"),
            bundle.getByteArray("some_byte_array"),
            bundle.getShortArray("some_short_array"),
            bundle.getCharArray("some_char_array"),
            bundle.getFloatArray("some_float_array"),
            gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
            gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
            gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
 
开发者ID:uber,项目名称:auto-value-bundle,代码行数:29,代码来源:AutoValue_TestClassBundled.java

示例11: onRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        SparseArray<Parcelable> ss = bundle.containsKey(STATE) ? bundle.getSparseParcelableArray(STATE) : null;
        if (ss != null) {
            itemView.restoreHierarchyState(ss);
        }
    }
}
 
开发者ID:achenglike,项目名称:imageviewer,代码行数:10,代码来源:ViewHolder.java

示例12: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        bundle.setClassLoader(loader);
        SparseArray<Parcelable> ss = bundle.containsKey(STATE) ? bundle.getSparseParcelableArray(STATE) : null;
        mSavedStates = ss != null ? ss : new SparseArray<Parcelable>();
    }
    super.restoreState(state, loader);
}
 
开发者ID:achenglike,项目名称:imageviewer,代码行数:11,代码来源:RecyclingPagerAdapter.java

示例13: getSparseParcelableArray

import android.os.Bundle; //导入方法依赖的package包/类
public <T extends Parcelable> SparseArray<T> getSparseParcelableArray(Bundle state, String key) {
    return state.getSparseParcelableArray(key + baseKey);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Injector.java

示例14: getSparseParcelableArray

import android.os.Bundle; //导入方法依赖的package包/类
public <T extends Parcelable> SparseArray<T> getSparseParcelableArray(Bundle state, String key) {
    return state.getSparseParcelableArray(key + mBaseKey);
}
 
开发者ID:evernote,项目名称:android-state,代码行数:4,代码来源:InjectionHelper.java

示例15: AdRecordStore

import android.os.Bundle; //导入方法依赖的package包/类
public AdRecordStore(final Parcel in) {
    final Bundle b = in.readBundle(getClass().getClassLoader());
    mAdRecords = b.getSparseParcelableArray("records_array");
    mLocalNameComplete = b.getString("local_name_complete");
    mLocalNameShort = b.getString("local_name_short");
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:7,代码来源:AdRecordStore.java


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