Пример #1
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			SetContentView (Resource.Layout.activity_events);

			base.debugTextView = (EditText)FindViewById (Resource.Id.debug_output_field_events);
			selectEventButton = (Button)FindViewById (Resource.Id.select_event_button);
			sendEventButton = (Button)FindViewById (Resource.Id.send_event_button);

			EventHandler<DialogClickEventArgs> handler = (s, o) => {
				// save off selected event
				selectEventButton.Text = items [o.Which];
				lastSelectedEvent = items [o.Which];
				sendEventButton.Enabled = true;
			};

			selectEventButton.Click += (sender, e) => {
				AlertDialog.Builder builder = new AlertDialog.Builder (this);
				builder.SetTitle ("Select Event");
				builder.SetItems (items, handler);
				builder.Show();
			};
				

			// set up click listener for when event is sent
			sendEventButton.Click += (sender, e) => {
				tapjoyEvent = new TJEvent(this, lastSelectedEvent, null, eventCallback);
				tapjoyEvent.EnableAutoPresent(true);
				tapjoyEvent.Send();
			};

		}
Пример #2
0
		public virtual void OnClick (View v)
		{
			if (v is Button) {
				Button button = ((Button)v);
				int id = button.Id;
				// --------------------------------------------------------------------------------
				// Events
				// --------------------------------------------------------------------------------
				if (id == Resource.Id.EventsButton) {
					Intent intent = new Intent (ApplicationContext, typeof(EventsActivity));
					StartActivity (intent);
				} else if (id == Resource.Id.OffersButton) {
					// Disable button
					disableButton (button);
					if (isAppManaged ()) {
						log ("Method Called: showOffers");
						TapjoyConnect.TapjoyConnectInstance.ShowOffers (offersNotifier);
					} else {
						log ("Method Called: showOffersWithCurrencyID \nCurrency ID: " + getActiveCurrency ());
						TapjoyConnect.TapjoyConnectInstance.ShowOffersWithCurrencyID (getActiveCurrency (), false, offersNotifier);
					}
				} else if (id == Resource.Id.GetDirectPlayVideoAd) {
					// Disable button
					disableButton (button);

					// Shows a direct play video
					TJEvent directPlayEvent = new TJEvent (this, "video_unit", new CustomTJEventCallback (TAG, this));
				
					// By default, ad content will be shown automatically on a successful send. For finer control of when content should be shown, call:
					directPlayEvent.EnableAutoPresent (false);

					directPlayEvent.Send ();
				} else if (id == Resource.Id.VirtualCurrencyButton) {
					Intent intent = new Intent (ApplicationContext, typeof(VirtualCurrencyActivity));
					StartActivity (intent);
				} else {
					log (((Button)v).Text.ToString ());
				}
			}
		}
Пример #3
0
		public void ContentIsReady (TJEvent @event, int statusPreloadIncomplete)
		{
		
		}
Пример #4
0
		public void DidRequestAction (TJEvent @event, TJEventRequest request)
		{
			// Does nothing
		}
Пример #5
0
		public void ContentDidDisappear (TJEvent @event)
		{
			Log.Info (TAG, "Tapjoy direct play content did disappear");
		
			parent.update_text = true;
			parent.displayText = "Tapjoy direct play content did disappear";
		
			// We must use a handler since we cannot update UI elements from a different thread.
			parent.mHandler.Post (parent.mUpdateResults);
		}
Пример #6
0
		public void SendEventFail (TJEvent @event, TJError error)
		{
			Log.Info (TAG, "Tapjoy send event 'video_unit' failed with error: " + error.Message);
		
			parent.update_text = true;
			parent.displayText = "Tapjoy send event 'video_unit' failed with error: " + error.Message;
		
			// We must use a handler since we cannot update UI elements from a different thread.
			parent.mHandler.Post (parent.mUpdateResults);
		}
Пример #7
0
		public void SendEventCompleted (TJEvent @event, bool contentAvailable)
		{
			Log.Info (TAG, "Tapjoy send event 'video_unit' completed, contentAvailable: " + contentAvailable);
		
			parent.update_text = true;
			parent.displayText = "Tapjoy send event 'video_unit' completed, contentAvailable: " + contentAvailable;
		
			// We must use a handler since we cannot update UI elements from a different thread.
			parent.mHandler.Post (parent.mUpdateResults);
		
			if (contentAvailable) {
				// If enableAutoPresent is set to false for the event, we need to present the event's content ourselves
				@event.ShowContent ();
			}
		}
Пример #8
0
		public  void ContentDidDisappear (TJEvent @event)
		{
			displayText = "Content did disappear \neventName: " + @event.Name;
			update_text = true;
			mHandler.Post (mUpdateResults);
		}
Пример #9
0
		public  void SendEventFail (TJEvent @event, TJError error)
		{
			update_text = true;
			displayText = "Send event failed [eventId: " + @event.Name + "] error: " + string.Format (error.Code + ": " + error.Message);
			mHandler.Post (mUpdateResults);		
			Log.Info (TAG, displayText);
		}
Пример #10
0
		public void SendEventCompleted (TJEvent @event, bool contentAvailable)
		{
			displayText = "Send event completed \neventName: " + @event.Name + "\ncontentAvailable: " + contentAvailable;
			update_text = true;
			mHandler.Post (mUpdateResults);
		}
Пример #11
0
		public void DidRequestAction (TJEvent @event, TJEventRequest request)
		{
//			// Dismiss the event content
			Intent intent = new Intent(ApplicationContext,typeof(EventsActivity));
			intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
			StartActivity(intent);
			string message = "Type: " + request.Type + ", Identifier: " + request.Identifier + ", Quantity: " + request.Quantity;

			EventHandler<DialogClickEventArgs> handler = (s, o) => {
				Dialog d = (Dialog)s;
				d.Dismiss ();
			};
			var builder = new AlertDialog.Builder(this)
				.SetTitle("Got Action Callback")
				.SetMessage(message)
				.SetPositiveButton("Okay", handler);	
		}