public static void Start (Activity activity, bool edit, ActivityOptions options) { var starter = new Intent (activity, typeof(SignInActivity)); starter.PutExtra (ExtraEdit, edit); if (options == null) { activity.StartActivity (starter); activity.OverridePendingTransition (Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); } else { activity.StartActivity (starter, options.ToBundle ()); } }
// Used for Swiping public bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { float diffY = e2.GetY() - e1.GetY(); float diffX = e2.GetX() - e1.GetX(); if (Math.Abs(diffX) > Math.Abs(diffY)) { if (Math.Abs(diffX) > SWIPE_THRESHOLD && Math.Abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { if (diffX > 0) { // Left Swipe - go back Intent slideIntent = new Intent(this, typeof(MainActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim3, Resource.Animation.Anim4).ToBundle(); StartActivity(slideIntent, slideAnim); Finish(); } else { // Right Swipe } } } else if (Math.Abs(diffY) > SWIPE_THRESHOLD && Math.Abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) { if (diffY > 0) { // Top swipe } else { // Bottom swipe } } return(true); }
void CheckIn(CardMenuPDVsModel item) { try { var isToOpenTarefas = false; CheckApp(); var batery = GetBatteryLevel(); var gpsLocation = GPS.lastLocation; var cordenadaEsperada = controller.GetCoordinates(item.listTypePdv); var gpsEsperado = new Android.Locations.Location("GpsEsperado") { Latitude = cordenadaEsperada[0], Longitude = cordenadaEsperada[1] }; if (gpsEsperado == null) { isToOpenTarefas = true; controller.CheckIn(item.listTypePdv, 0, 0, batery); } else { var distance = gpsEsperado.DistanceTo(gpsLocation); if (distance > 500 && (int)cordenadaEsperada[0] > 0 && (int)cordenadaEsperada[1] > 0) { AlertDialog.Builder dialogBuilder; dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme); dialogBuilder.SetTitle(Resources.GetString(Resource.String.PDV_Distante)); dialogBuilder.SetMessage(Resources.GetString(Resource.String.PDV_Distante_descricao)); dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.sim), delegate { try { controller.CheckIn(item.listTypePdv, gpsLocation.Latitude, gpsLocation.Longitude, batery); controller.RegistroDePontoEletronico(); MetricsManager.TrackEvent("CheckInLoja"); isToRunning = false; var i = new Intent(this, typeof(MenuTarefas)); i.PutExtra("lojaSelecionada", item.name); i.PutStringArrayListExtra("idUser", controller.PrepareIdsUserToIntent()); i.PutExtra("visitas", new ListTypePDV().ToIntentVar(item.listTypePdv)); var options = ActivityOptions.MakeSceneTransitionAnimation(this, Pair.Create(FindViewById(Resource.Id.profile_image_pdv), "profileImage"), Pair.Create(FindViewById(Resource.Id.profileBarLayout), "profileBar"), Pair.Create(FindViewById(Resource.Id.toolbar), "toolbar")); StartActivity(i, options.ToBundle()); } catch (NullReferenceException) { Toast.MakeText(this, Resources.GetString(Resource.String.erro_checkin), ToastLength.Long).Show(); } catch (Java.Lang.NullPointerException) { Toast.MakeText(this, Resources.GetString(Resource.String.erro_checkin), ToastLength.Long).Show(); } }); dialogBuilder.SetNegativeButton(Resources.GetString(Resource.String.nao), delegate { MetricsManager.TrackEvent("CancelCheckIn"); }); model.modelGeneric.dialog = dialogBuilder.Create(); RunOnUiThread(() => model.modelGeneric.dialog.Show()); } else { try { isToOpenTarefas = true; controller.CheckIn(item.listTypePdv, gpsLocation.Latitude, gpsLocation.Longitude, batery); } catch (NullReferenceException ex) { MetricsManager.TrackEvent("CheckInFail"); MetricsManager.TrackEvent(ex.Message); Toast.MakeText(this, Resources.GetString(Resource.String.erro_checkin), ToastLength.Long).Show(); } catch (Java.Lang.NullPointerException exPointer) { MetricsManager.TrackEvent("CheckInFail"); MetricsManager.TrackEvent(exPointer.Message); Toast.MakeText(this, Resources.GetString(Resource.String.erro_checkin), ToastLength.Long).Show(); } } } if (isToOpenTarefas) { controller.RegistroDePontoEletronico(); MetricsManager.TrackEvent("CheckInLoja"); var i = new Intent(this, typeof(MenuTarefas)); i.PutExtra("lojaSelecionada", item.name); i.PutStringArrayListExtra("idUser", controller.PrepareIdsUserToIntent()); i.PutExtra("visitas", new ListTypePDV().ToIntentVar(item.listTypePdv)); var options = ActivityOptions.MakeSceneTransitionAnimation(this, Pair.Create(FindViewById(Resource.Id.profile_image_pdv), "profileImage"), Pair.Create(FindViewById(Resource.Id.profileBarLayout), "profileBar"), Pair.Create(FindViewById(Resource.Id.toolbar), "toolbar")); StartActivity(i, options.ToBundle()); } } catch (NullReferenceException) { Toast.MakeText(this, Resources.GetString(Resource.String.erro_checkin), ToastLength.Long).Show(); } catch (Java.Lang.NullPointerException) { Toast.MakeText(this, Resources.GetString(Resource.String.erro_checkin), ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Button taketoDiceButton = FindViewById <Button> (Resource.Id.taketoDiceButton); Button taketoRegularDiceGameButton = FindViewById <Button> (Resource.Id.taketoRegularDiceGameButton); Button taketoHighLowDieGameButton = FindViewById <Button> (Resource.Id.taketoHighLowDieGameButton); Button taketoChuckALuckGameButton = FindViewById <Button> (Resource.Id.taketoChuckALuckGameButton); Button aboutButton = FindViewById <Button> (Resource.Id.aboutButton); Button statsButton = FindViewById <Button> (Resource.Id.statsButton); TextView dicemasterTitle = FindViewById <TextView> (Resource.Id.dicemasterTitle); dicemasterTitle.TextSize = 40; taketoRegularDiceGameButton.TextSize = 15; taketoDiceButton.TextSize = 15; taketoHighLowDieGameButton.TextSize = 15; taketoChuckALuckGameButton.TextSize = 15; aboutButton.TextSize = 15; statsButton.TextSize = 15; taketoDiceButton.Click += delegate { Intent slideIntent = new Intent(this, typeof(DiceCategoriesActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; taketoRegularDiceGameButton.Click += delegate { Intent slideIntent = new Intent(this, typeof(RegularDiceActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; taketoHighLowDieGameButton.Click += delegate { Intent slideIntent = new Intent(this, typeof(HighLowDiceActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; taketoChuckALuckGameButton.Click += delegate { Intent slideIntent = new Intent(this, typeof(ChuckALuckActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; aboutButton.Click += delegate { Intent slideIntent = new Intent(this, typeof(AboutActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; statsButton.Click += delegate { Intent slideIntent = new Intent(this, typeof(StatsActivity)); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; // Gesture Detection gestureDetector = new GestureDetector(this); }
/// <summary> /// Creates a normal (non-local) activity stub instance suitable for executing a non-local activity. /// </summary> /// <param name="client">The associated <see cref="CadenceClient"/>.</param> /// <param name="workflow">The parent workflow.</param>x /// <param name="activityTypeName">Specifies the activity type name.</param> /// <param name="options">Specifies the <see cref="ActivityOptions"/>.</param> /// <param name="activityInterface">Specifies the activity interface definition.</param> /// <returns>The activity stub as an <see cref="object"/>.</returns> public object Create(CadenceClient client, Workflow workflow, string activityTypeName, ActivityOptions options, System.Type activityInterface) { Covenant.Requires <ArgumentNullException>(client != null, nameof(client)); Covenant.Requires <ArgumentNullException>(workflow != null, nameof(workflow)); Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(activityTypeName), nameof(activityTypeName)); Covenant.Requires <ArgumentNullException>(options != null, nameof(options)); Covenant.Requires <ArgumentNullException>(activityInterface != null, nameof(activityInterface)); return(normalConstructor.Invoke(new object[] { client, client.DataConverter, workflow, activityTypeName, options, activityInterface })); }
public static void Start(Context context, Player player, ActivityOptions options) { var starter = new Intent(context, typeof(CategorySelectionActivity)); starter.PutExtra(ExtraPlayer, player); context.StartActivity(starter, options.ToBundle()); }
/// <summary> /// Inicios the app. /// </summary> public void InicioApp(Activity activity) { try { Task startupwork = new Task(() => { Task.Delay(TIME_SPLASH).Wait(); }); startupwork.ContinueWith(t => { activity.StartActivity(new Intent(activity, typeof(HomeActivity)), ActivityOptions.MakeSceneTransitionAnimation(activity).ToBundle()); }, TaskScheduler.FromCurrentSynchronizationContext()); startupwork.Start(); } catch (Exception ex) { Log.Info("start app ", ex.Message); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DiceCategoriesScreen); Button oneSix = FindViewById <Button>(Resource.Id.oneSix); Button oneTwelve = FindViewById <Button>(Resource.Id.oneTwelve); Button oneEighteen = FindViewById <Button>(Resource.Id.oneEighteen); Button oneTwentyfour = FindViewById <Button>(Resource.Id.oneTwentyfour); Button oneThirty = FindViewById <Button>(Resource.Id.oneThirty); Button oneThirtysix = FindViewById <Button>(Resource.Id.oneThirtysix); TextView chooseacategoryText = FindViewById <TextView> (Resource.Id.chooseacategoryText); chooseacategoryText.TextSize = 35; oneSix.TextSize = 15; oneTwelve.TextSize = 15; oneEighteen.TextSize = 15; oneTwentyfour.TextSize = 15; oneThirty.TextSize = 15; oneThirtysix.TextSize = 15; oneSix.Click += delegate { string categoryMax = "6"; Intent slideIntent = new Intent(this, typeof(DiceActivity)); slideIntent.PutExtra("catMax", categoryMax); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; oneTwelve.Click += delegate { string categoryMax = "12"; Intent slideIntent = new Intent(this, typeof(DiceActivity)); slideIntent.PutExtra("catMax", categoryMax); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; oneEighteen.Click += delegate { string categoryMax = "18"; Intent slideIntent = new Intent(this, typeof(DiceActivity)); slideIntent.PutExtra("catMax", categoryMax); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; oneTwentyfour.Click += delegate { string categoryMax = "24"; Intent slideIntent = new Intent(this, typeof(DiceActivity)); slideIntent.PutExtra("catMax", categoryMax); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; oneThirty.Click += delegate { string categoryMax = "30"; Intent slideIntent = new Intent(this, typeof(DiceActivity)); slideIntent.PutExtra("catMax", categoryMax); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; oneThirtysix.Click += delegate { string categoryMax = "36"; Intent slideIntent = new Intent(this, typeof(DiceActivity)); slideIntent.PutExtra("catMax", categoryMax); Bundle slideAnim = ActivityOptions.MakeCustomAnimation(Application.Context, Resource.Animation.Anim1, Resource.Animation.Anim2).ToBundle(); StartActivity(slideIntent, slideAnim); }; // Gesture Detection gestureDetector = new GestureDetector(this); }
/// <summary> /// Creates a normal (non-local) activity stub instance suitable for executing a non-local activity. /// </summary> /// <param name="client">The associated <see cref="CadenceClient"/>.</param> /// <param name="workflow">The parent workflow.</param> /// <param name="activityTypeName">Specifies the activity type name.</param> /// <param name="options">Specifies the <see cref="ActivityOptions"/>.</param> /// <param name="domain">Optionally specifies the target domain.</param> /// <returns>The activity stub as an <see cref="object"/>.</returns> public object Create(CadenceClient client, Workflow workflow, string activityTypeName, ActivityOptions options, string domain = null) { Covenant.Requires <ArgumentNullException>(client != null); Covenant.Requires <ArgumentNullException>(workflow != null); Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(activityTypeName)); Covenant.Requires <ArgumentNullException>(options != null); return(normalConstructor.Invoke(new object[] { client, client.DataConverter, workflow.Parent, activityTypeName, options, domain })); }
/// <summary> /// Raises the create event. /// </summary> /// <param name="savedInstanceState">Saved instance state.</param> protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var preferences = FindViewById <Button>(Resource.Id.toolbarButton); preferences.Click += (sender, e) => { ActivityOptions options = ActivityOptions.MakeSceneTransitionAnimation(this); var pendingIntent = new Intent(this, typeof(Popup)); StartActivity(pendingIntent, options.ToBundle()); }; UseGooglePlayLocations = true; // Set Typeface and Styles TypefaceStyle tfs = TypefaceStyle.Normal; Typeface HnBd = Typeface.CreateFromAsset(Assets, "fonts/HelveticaNeueLTCom-Bd.ttf"); Typeface HnLt = Typeface.CreateFromAsset(Assets, "fonts/HelveticaNeueLTCom-Lt.ttf"); Typeface HnMd = Typeface.CreateFromAsset(Assets, "fonts/HelveticaNeueLTCom-Roman.ttf"); var metrics = new DisplayMetrics(); WindowManager.DefaultDisplay.GetMetrics(metrics); int viewport = metrics.HeightPixels - GetStatusBarHeight(); mainLayout = FindViewById <RelativeLayout>(Resource.Id.mainLayout); mainLayout.SetMinimumHeight(viewport * 70 / 100); mainLayout.SetClipChildren(false); subLayout = FindViewById <RelativeLayout>(Resource.Id.subLayout); subLayout.SetMinimumHeight(viewport * 70 / 100); coordinatorView = FindViewById(Resource.Id.CoordinatorView); swipeLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeContainer); swipeLayout.SetOnRefreshListener(this); swipeLayout.SetColorSchemeResources(Resource.Color.red); int childCount = mainLayout.ChildCount; // Main app title and tagline for (var i = 0; i < childCount; i++) { switch (i) { case 1: var title = (TextView)mainLayout.GetChildAt(i); title.SetTypeface(HnBd, tfs); break; case 2: var tagLine = (TextView)mainLayout.GetChildAt(i); tagLine.SetTypeface(HnLt, tfs); break; } } scrollView = FindViewById <ScrollView>(Resource.Id.scrollView); scrollView.SetOnTouchListener(this); var allButtons = GetViewsByTag(scrollView, "button"); foreach (CircleView button in allButtons) { button.SetTypeface(HnLt, tfs); } swipeButton = FindViewById <ImageButton>(Resource.Id.swipeButton); swipeButton.SetMinimumHeight(viewport * 30 / 100); swipeButton.SetOnTouchListener(this); for (var i = 1; i < 3; i++) { var direction = (LinearLayout)mainLayout.GetChildAt(i + 2); var times = (TextView)direction.FindViewWithTag("time"); var label = (TextView)direction.FindViewWithTag("label"); times.SetTypeface(HnMd, tfs); label.SetTypeface(HnLt, tfs); var button = (CircleView)direction.FindViewWithTag("button"); SetTrainsNotice(button, times); } }
private void ActivityOptionChanged(int arg0) { var activityOptions = ActivityOptions.GetComponent <Dropdown>(); Debug.Log(string.Format("互动选择:{0}", activityOptions.captionText.text)); }
/// <summary> /// Sets the next trains. This only sets trains and never gets them. /// </summary> public void SetNextTrains(string origin) { if (trainLVM == null) { Report(origin + " TrainLVM not setup yet.", 0); return; } if (trainLVM.IsBusy) { Report(origin + " Still getting trains.", 0); } else { Report(origin + " Setting next trains.", 0); RunOnUiThread(() => { subLayout.Visibility = ViewStates.Invisible; swipeButton.Visibility = ViewStates.Invisible; int dir = 0; // Loop throuh south and north view groups foreach (var stops in trainLVM.stopList) { int idx = 0; foreach (var stop in stops) { //no more than 5, including the main if (idx > 4) { break; } LinearLayout path; if (idx < 1) { path = (LinearLayout)mainLayout.GetChildAt(dir + 3); } else { path = (LinearLayout)subLayout.GetChildAt(dir); subLayout.Visibility = ViewStates.Visible; swipeButton.Visibility = ViewStates.Visible; } var button = (CircleView)path.FindViewWithTag("button"); var buttons = GetViewsByTag(path, "button"); var time = (TextView)path.FindViewWithTag("time"); int subIdx = idx - 1; if (idx > 0 && buttons.Count > 0 && subIdx < buttons.Count) { button = (CircleView)buttons[subIdx]; } var nearestTrain = stop != null ? stop.next_train : null; if (nearestTrain != null) { /*if (nearestTrain.ExpiredUnder(15)) * { * Report("===>ExpiredUnder", 0); * // refresh these if the first time is stale * HandleConnections(); * return; * }*/ var trainColor = GetTrainColor(nearestTrain.route_id); button.Text = nearestTrain.route_id.Substring(0, 1); button.BackgroundColor = Color.ParseColor(Resources.GetString(trainColor)); button.EndAngle = 0; //reset angle button.SetBackgroundResource(GetTrainColorDrawable(nearestTrain.route_id)); button.SetTextColor(GetTrainTextColor(nearestTrain.route_id)); button.EnterReveal(); var timing = (int)nearestTrain.Time(); var duration = (timing <= 0 ? 1000 : timing) * 60 * 1000; var animation = new CircleView.CircleAngleAnimation(button, 359); animation.Duration = duration; button.StartAnimation(animation); button.Click -= stop.clickHandler; if (time != null) { time.Text = nearestTrain.TimeString(); } if (!button.HasOnClickListeners) { stop.clickHandler = delegate { ActivityOptions options = ActivityOptions.MakeScaleUpAnimation(button, 0, 0, 60, 60); var pendingIntent = new Intent(this, typeof(Detail)); Train nearest = nearestTrain; List <Train> next = stop.trains; var toJsonNearestTrain = Newtonsoft.Json.JsonConvert.SerializeObject(nearest); pendingIntent.PutExtra("nearestTrain", toJsonNearestTrain); pendingIntent.PutExtra("nearestTrainColor", trainColor); var toJsonFartherTrains = Newtonsoft.Json.JsonConvert.SerializeObject(next); pendingIntent.PutExtra("fartherTrains", toJsonFartherTrains); StartActivity(pendingIntent, options.ToBundle()); button.Click -= stop.clickHandler; }; // event needed to clear click handlers after update EventHandler <AfterTextChangedEventArgs> removeHandlers = null; removeHandlers = delegate { if (stop.clickHandler != null) { button.Click -= stop.clickHandler; button.AfterTextChanged -= removeHandlers; } }; button.AfterTextChanged += removeHandlers; button.Click += stop.clickHandler; } } else { SetTrainsNotice(button, time); Report("NearestTrain was null", 0); } idx++; } dir++; } }); swipeLayout.Refreshing = false; } }
private void HandleNativeNavigationMessage(HomePage sender, NativeNavigationArgs args) { Bundle translateBundle = ActivityOptions.MakeCustomAnimation(this, Resource.Animation.abc_fade_in, Resource.Animation.abc_fade_out).ToBundle(); this.StartActivity(new Intent(this, typeof(MyThirdActivity)), translateBundle); }
public void NavigateTo(Type viewModelType, IPayload parameter = null, Action <Guid> callback = null) { if (viewModelType == null) { return; } if (_viewMapperDictionary.TryGetValue(viewModelType, out Type concreteType) == false) { throw new System.Exception($"The viewmodel '{viewModelType.ToString()}' does not exist in view mapper!"); } if (concreteType.IsSubclassOf(typeof(FragmentBase))) { LoadFragment(concreteType, parameter, callback); return; } var concreteTypeJava = Class.FromType(concreteType); var intent = new Intent(Context, concreteTypeJava); if (parameter != null) { intent.SetPayload(parameter); } if (callback != null) { var currentActivity = Context as Activity; if (currentActivity == null) { System.Diagnostics.Debug.WriteLine("AppNavigation.NavigateTo: Context is null or not an activity!"); return; } intent.SetCallback(callback); if (CanUseActivityTrasitions) { currentActivity.StartActivityForResult(intent, CallbackActivityRequestCode, ActivityOptions.MakeSceneTransitionAnimation(Context as Activity).ToBundle()); } else { currentActivity.StartActivityForResult(intent, CallbackActivityRequestCode); } return; } if (CanUseActivityTrasitions) { Context.StartActivity(intent, ActivityOptions.MakeSceneTransitionAnimation(Context as Activity).ToBundle()); } else { Context.StartActivity(intent); } }
private void Boton_Click(object sender, System.EventArgs e) { Intent intentListaNotas = new Intent(this, typeof(ListaNotasActivity)); StartActivity(intentListaNotas, ActivityOptions.MakeSceneTransitionAnimation(this).ToBundle()); }
/** * Sets the start animations, * * @param context Application context. * @param enterResId Resource ID of the "enter" animation for the browser. * @param exitResId Resource ID of the "exit" animation for the application. */ public HostedUIBuilder SetStartAnimations(Context context, int enterResId, int exitResId) { startBundle = ActivityOptions.MakeCustomAnimation(context, enterResId, exitResId).ToBundle(); return(this); }