當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。