コード例 #1
0
        public void RestoreState(CardStreamState state, OnCardClickListener callback)
        {
            // Restore hidden cards
            foreach (Card c in state.HiddenCards)
            {
                Card card = new Card.Builder(callback, c).Build(Activity);
                if (!mHiddenCards.ContainsKey(card.Tag))
                {
                    mHiddenCards.Add(card.Tag, card);
                }
                else
                {
                    mHiddenCards [card.Tag] = card;
                }
            }

            // temprarily set up list of dismissible cards
            HashSet <String> dismissibleCards = state.DismissibleCards;

            // Restore shown cards

            foreach (Card c in state.VisibleCards)
            {
                Card card = new Card.Builder(callback, c).Build(Activity);
                AddCard(card);
                string tag = card.Tag;
                ShowCard(tag, dismissibleCards.Contains(tag));
            }

            mLayout.TriggerShowInitialAnimation();
        }
コード例 #2
0
		public void RestoreState(CardStreamState state, OnCardClickListener callback)
		{
			// Restore hidden cards
			foreach (Card c in state.HiddenCards) {
				Card card = new Card.Builder (callback, c).Build (Activity);
				if (!mHiddenCards.ContainsKey (card.Tag))
					mHiddenCards.Add (card.Tag, card);
				else
					mHiddenCards [card.Tag] = card;
			}

			// temprarily set up list of dismissible cards
			HashSet<String> dismissibleCards = state.DismissibleCards;

			// Restore shown cards

			foreach (Card c in state.VisibleCards) {
				Card card = new Card.Builder (callback, c).Build (Activity);
				AddCard (card);
				string tag = card.Tag;
				ShowCard (tag, dismissibleCards.Contains (tag));
			}

			mLayout.TriggerShowInitialAnimation ();
		}
コード例 #3
0
		/// <summary>
		/// Initializes the cards.
		/// </summary>
		private void InitializeCards()
		{
			// Step counting
			Card c = new Card.Builder (this, CARD_COUNTING)
				.SetTitle ("Steps")
				.SetDescription ("")
				.AddAction ("Unregister Listener", ACTION_UNREGISTER, Card.ACTION_NEGATIVE)
				.Build(Activity);
			CardStream.AddCard (c);

			// Register step detector listener
			c = new Card.Builder (this, CARD_REGISTER_DETECTOR)
				.SetTitle (GetString (Resource.String.register_detector_title))
				.SetDescription (GetString (Resource.String.register_detector_description))
				.AddAction (GetString (Resource.String.register_0), ACTION_REGISTER_DETECT_NOBATCHING, Card.ACTION_NEUTRAL)
				.AddAction (GetString (Resource.String.register_5), ACTION_REGISTER_DETECT_BATCHING_5s, Card.ACTION_NEUTRAL)
				.AddAction (GetString (Resource.String.register_10), ACTION_REGISTER_DETECT_BATCHING_10s, Card.ACTION_NEUTRAL)
				.Build (Activity);
			CardStream.AddCard (c);

			// Register step count listener
			c = new Card.Builder (this, CARD_REGISTER_COUNTER)
				.SetTitle (GetString (Resource.String.register_counter_title))
				.SetDescription (GetString (Resource.String.register_counter_description))
				.AddAction (GetString (Resource.String.register_0), ACTION_REGISTER_COUNT_NOBATCHING, Card.ACTION_NEUTRAL)
				.AddAction (GetString (Resource.String.register_5), ACTION_REGISTER_COUNT_BATCHING_5s, Card.ACTION_NEUTRAL)
				.AddAction (GetString (Resource.String.register_10), ACTION_REGISTER_COUNT_BATCHING_10s, Card.ACTION_NEUTRAL)
				.Build (Activity);
			CardStream.AddCard (c);

			// Batching description
			c = new Card.Builder (this, CARD_BATCHING_DESCRIPTION)
				.SetTitle (GetString (Resource.String.batching_queue_title))
				.SetDescription (GetString (Resource.String.batching_queue_description))
				.AddAction (GetString (Resource.String.action_notagain), ACTION_BATCHING_DESCRIPTION_DISMISS, Card.ACTION_POSITIVE)
				.Build (Activity);
			CardStream.AddCard (c);

			// Explanation
			c = new Card.Builder (this, CARD_EXPLANATION)
				.SetDescription (GetString (Resource.String.explanation_description))
				.AddAction (GetString (Resource.String.action_notagain), ACTION_EXPLANATION_DISMISS, Card.ACTION_POSITIVE)
				.Build (Activity);
			CardStream.AddCard (c);

			// Error
			c = new Card.Builder (this, CARD_NOBATCHSUPPORT)
				.SetTitle (GetString (Resource.String.error_title))
				.SetDescription (GetString (Resource.String.error_nosensor))
				.Build (Activity);
			CardStream.AddCard (c);
		}
コード例 #4
0
		/// <summary>
		/// Show the introduction card
		/// </summary>
		private void ShowIntroCard() 
		{
			Card c = new Card.Builder (this, CARD_INTRO)
				.SetTitle (GetString (Resource.String.intro_title))
				.SetDescription (GetString (Resource.String.intro_message))
				.Build (Activity);
			CardStream.AddCard (c, true);
		}