Example #1
0
		public virtual void saveActionViewStates(android.os.Bundle outStates)
		{
			android.util.SparseArray<android.os.Parcelable> viewStates = null;
			int itemCount = size();
			{
				for (int i = 0; i < itemCount; i++)
				{
					android.view.MenuItem item = getItem(i);
					android.view.View v = item.getActionView();
					if (v != null && v.getId() != android.view.View.NO_ID)
					{
						if (viewStates == null)
						{
							viewStates = new android.util.SparseArray<android.os.Parcelable>();
						}
						v.saveHierarchyState(viewStates);
						if (item.isActionViewExpanded())
						{
							outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
						}
					}
					if (item.hasSubMenu())
					{
						[email protected] subMenu = ([email protected]
							)item.getSubMenu();
						subMenu.saveActionViewStates(outStates);
					}
				}
			}
			if (viewStates != null)
			{
				outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates);
			}
		}
Example #2
0
		private void dispatchSaveInstanceState(android.os.Bundle outState)
		{
			if (mPresenters.isEmpty())
			{
				return;
			}
			android.util.SparseArray<android.os.Parcelable> presenterStates = new android.util.SparseArray
				<android.os.Parcelable>();
			foreach ([email protected]<[email protected]> 
				@ref in Sharpen.IterableProxy.Create(mPresenters))
			{
				and[email protected] presenter = @ref.get();
				if (presenter == null)
				{
					mPresenters.remove(@ref);
				}
				else
				{
					int id = presenter.getId();
					if (id > 0)
					{
						android.os.Parcelable state = presenter.onSaveInstanceState();
						if (state != null)
						{
							presenterStates.put(id, state);
						}
					}
				}
			}
			outState.putSparseParcelableArray(PRESENTER_KEY, presenterStates);
		}