/// <summary>
		/// Add and show a card
		/// </summary>
		/// <param name="card">The card to add</param>
		/// <param name="show">If set to <c>true</c> show.</param>
		public void AddCard(Card card, bool show)
		{
			AddCard (card);
			if (show) {
				ShowCard (card.Tag);
			}
		}
		public CardStreamState(Card[] visible, Card[] hidden, HashSet<String> dismissible, String shownTag)
		{
			visibleCards = visible;
			hiddenCards = hidden;
			dismissibleCards = dismissible;
			this.shownTag = shownTag;
		}
		/// <summary>
		/// Add a visible, dismissible card to the card stream.
		/// </summary>
		/// <param name="card">The card to add</param>
		public void AddCard(Card card)
		{
			String tag = card.Tag;

			if (!mVisibleCards.ContainsKey (tag) && !mHiddenCards.ContainsKey (tag)) {
				View view = card.View;
				view.Tag = tag;
				mHiddenCards.Add (tag, card);
			}
		}
		private Card[] CloneCards(ICollection<Card> cards) {
			Card[] cardArray = new Card[cards.Count];
			int i = 0;
			foreach (Card c in cards) {
				cardArray [i++] = c.CreateShallowClone ();
			}
			return cardArray;
		}
Beispiel #5
0
			/// <summary>
			/// Initialize data from the given card
			/// </summary>
			/// <returns></returns>
			/// <param name="card"></param>
			public Builder CloneFromCard(Card card)
			{
				mCard = card.CreateShallowClone ();
				return this;
			}
Beispiel #6
0
			public Builder(OnCardClickListener listener, String tag)
			{
				mCard = new Card();
				mCard.mTag = tag;
				mCard.mClickListener = listener;
			}
Beispiel #7
0
			/// <summary>
			/// Instantiate the builder with data from a shallow clone.
			/// </summary>
			/// <param name="listener"></param>
			/// <param name="card"></param>
			public Builder(OnCardClickListener listener, Card card)
			{
				mCard = card;
				mCard.mClickListener = listener;
			}
Beispiel #8
0
		/// <summary>
		/// Creates a shallow clone of the card. Shallow means that all values are present, but now views.
		/// This is useful for saving/restoring in the case of configuration changes, like screen rotation
		/// </summary>
		/// <returns>A shallow clone of the card instance</returns>
		public Card CreateShallowClone()
		{
			Card cloneCard = new Card ();

			// Outer card values
			cloneCard.mTitle = mTitle;
			cloneCard.mDescription = mDescription;
			cloneCard.mTag = mTag;
			cloneCard.mLayoutId = mLayoutId;
			cloneCard.mCardState = mCardState;

			// Progress
			if (mCardProgress != null) {
				cloneCard.mCardProgress = mCardProgress.CreateShallowClone ();
			}

			// Actions
			foreach (CardAction action in mCardActions) {
				cloneCard.mCardActions.Add (action.CreateShallowClone ());
			}

			return cloneCard;
		}