public void OnClick(View v)
            {
                int position = v_mTabsContainer.IndexOfChild(v);

                if (position != -1)
                {
                    if (v_mViewPager.CurrentItem != position)
                    {
                        if (v_mSnapOnTabClick)
                        {
                            v_mViewPager.SetCurrentItem(position, false);
                        }
                        else
                        {
                            v_mViewPager.CurrentItem = position;// (position);
                        }

                        if (v_mListener != null)
                        {
                            v_mListener.OnTabSelect(position);
                        }
                    }
                    else
                    {
                        if (v_mListener != null)
                        {
                            v_mListener.OnTabReselect(position);
                        }
                    }
                }
            }
Beispiel #2
0
        private void AddTimeToOutputList(Time t)
        {
            LayoutInflater inflater     = (LayoutInflater)BaseContext.GetSystemService(Context.LayoutInflaterService);
            View           timeView     = inflater.Inflate(Resource.Layout.single_output_layout, null);
            TextView       textOutput   = timeView.FindViewById <TextView>(Resource.Id.outText);
            Button         removeButton = timeView.FindViewById <Button>(Resource.Id.removeButton);

            outputContainer.AddView(timeView, outputContainer.IndexOfChild(listButtonsGrid));

            textOutput.Text = string.Format("{0}\n{1}", t.SavedTime.ToLongDateString(), t.SavedTime.ToShortTimeString());

            removeButton.Click += delegate
            {
                var alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Confirmation");
                alert.SetMessage("Do you really want to permanently delete this recorded time ?");

                alert.SetPositiveButton("YES", delegate
                {
                    outputContainer.RemoveView(timeView);
                    //await client.GetTable<RegisteredTime>().DeleteAsync(t);
                    registeredTimesDB.Delete <Time>(t.Id);
                    Toast.MakeText(this, $"The {t.SavedTime.ToLongTimeString()} of {t.SavedTime.ToShortDateString()} has been deleted.", ToastLength.Long).Show();
                });
                alert.SetNegativeButton("NO", delegate { return; });
                alert.Create().Show();
            };
            UpdateGraphicsLayout();
        }
        public void OnClick(View v)
        {
            if (v.Id == Resource.Id.imageButtonAddTable)
            {
                controller.NewTableAdded();
            }
            else
            if (v.Id == Resource.Id.layoutSelectionButton)
            {
                if (currentSelettedTableViewButton == v)
                {
                    tableView.LaunchSchemaEdit(mainColor.ToArgb());
                }
                else
                {
                    if (currentSelettedTableViewButton != null)
                    {
                        currentSelettedTableViewButton.SetBackgroundColor(Android.Graphics.Color.White);
                        currentSelettedTableViewButton.FindViewById <TextView>(Resource.Id.tableButtonTextView).SetTextColor(Color.Black);
                        (currentSelettedTableViewButton.FindViewById <ImageView>(Resource.Id.imageViewCanEditDetector).Visibility) = ViewStates.Invisible;
                        (currentSelettedTableViewButton.FindViewById <ImageView>(Resource.Id.imageViewCanEditDetector).Visibility) = ViewStates.Gone;
                        (currentSelettedTableViewButton.FindViewById <ImageView>(Resource.Id.imageViewCanEditDetector).Visibility) = ViewStates.Gone;
                    }
                    currentSelettedTableViewButton = v;
                    currentSelettedTableViewButton.SetBackgroundColor(mainColor);
                    currentSelettedTableViewButton.FindViewById <TextView>(Resource.Id.tableButtonTextView).SetTextColor(Color.White);
                    (currentSelettedTableViewButton.FindViewById <ImageView>(Resource.Id.imageViewCanEditDetector).Visibility) = ViewStates.Visible;

                    controller.TableSelected(tableNameList.IndexOfChild(currentSelettedTableViewButton));
                }
            }
        }
Beispiel #4
0
        void View_Drag(object sender, View.DragEventArgs e)
        {
            // React on different dragging events
            var evt = e.Event;

            switch (evt.Action)
            {
            case DragAction.Started:
                e.Handled = true;
                break;

            case DragAction.Drop:
                e.Handled = true;

                // Try to get clip data
                var data = e.Event.ClipData;
                if (data != null)
                {
                    var taskLetters   = GetCurrentIteration <AbcRankIteration>().TaskItems;
                    var position      = llTaskItems.IndexOfChild(sender as View);
                    var draggedLetter = data.GetItemAt(0).Text;
                    var draggedItem   = GetCurrentIteration <AbcRankIteration>().Options.FirstOrDefault(o => o.Name.Equals(draggedLetter));

                    taskLetters[position]         = new TaskItem(new TaskLetter(draggedItem.Name), draggedItem.Media, true);
                    taskLetters[position].IsDirty = true;

                    var isReady = taskLetters.All(l => l != null ? l.IsDirty : false);
                    FireUserInteracted(isReady);
                    BuildTaskElements(taskLetters);
                }

                break;
            }
        }
 public override void OnClick(View v)
 {
     if (v.Id == 6667)
     {
         CallOptionEditDialog(options.IndexOfChild(v));
     }
     else if (v.Id == Resource.Id.imageButtonAddOption)
     {
         AddNewOption();
     }
     else
     {
         base.OnClick(v);
     }
 }
Beispiel #6
0
        private void ClickRemoveFile(object sender, EventArgs e)
        {
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Aviso");
            alert.SetMessage("¿Está seguro que desea quitar el Archivo?");
            alert.SetButton("Si", (c, ev) =>
            {
                ViewGroup fileRow = (ViewGroup)((View)sender).Parent;
                int filePosition  = filesContainer.IndexOfChild(fileRow);

                DeleteFile(attachedFiles[filePosition], filePosition);
            });

            alert.SetButton2("Cancelar", (c, ev) => { });

            alert.Show();
        }
Beispiel #7
0
        void View.IOnClickListener.OnClick(View view)
        {
            int result = -1;

            try
            {
                if (view != null)
                {
                    result = layout.IndexOfChild(view);
                }
            }
            catch (Exception ex)
            {
                arguments.Result.SetException(ex);
            }
            finally
            {
                Hide();
            }

            arguments.SetResult(result);
        }
Beispiel #8
0
        private void View_Drag(object sender, View.DragEventArgs e)
        {
            // React on different dragging events
            var evt = e.Event;

            switch (evt.Action)
            {
            case DragAction.Ended:
            case DragAction.Started:
                e.Handled = true;
                break;

            // Dragged element has been dropped at the drop zone
            case DragAction.Drop:
                e.Handled = true;

                // Try to get clip data
                var data = e.Event.ClipData;
                if (data != null)
                {
                    var taskItems     = GetCurrentIteration <FindMissingLetterIteration>().TaskItems;
                    var draggedLetter = data.GetItemAt(0).Text;
                    var position      = llTaskItems.IndexOfChild(sender as View);

                    if (taskItems[position].IsSearched)
                    {
                        taskItems[position].TaskLetter.Letter = draggedLetter;
                        taskItems[position].IsDirty           = true;
                    }

                    var isReady = taskItems.Count(t => t.IsSearched && !t.IsDirty) == 0;
                    FireUserInteracted(isReady);
                    BuildTaskLetters(taskItems, fontCase);
                }
                break;
            }
        }
        private void View_Drag(object sender, View.DragEventArgs e)
        {
            // React on different dragging events
            var evt = e.Event;

            switch (evt.Action)
            {
            case DragAction.Ended:
            case DragAction.Started:
                e.Handled = true;
                break;

            case DragAction.Drop:
                e.Handled = true;

                // Try to get clip data
                var data = e.Event.ClipData;
                if (data != null)
                {
                    var taskLetters   = GetCurrentIteration <LetterDropIteration>().TaskItems;
                    var draggedLetter = data.GetItemAt(0).Text;
                    var position      = (useAlternateView) ? flTaskItems.IndexOfChild(sender as View) : llTaskItems.IndexOfChild(sender as View);

                    // Get case of dragged letter
                    var fontCase = draggedLetter.GetCase();

                    // Check if selection is correct
                    if (taskLetters[position].IsSearched && taskLetters[position].TaskLetter.CorrectLetter.Equals(draggedLetter.ToNegativeCase(fontCase)))
                    {
                        taskLetters[position].TaskLetter.IsCorrect = true;
                    }

                    // Rebuild task letters
                    if (taskLetters[position].TaskLetter.Letter.Length > 1)
                    {
                        taskLetters[position].TaskLetter.Letter = taskLetters[position].TaskLetter.Letter.Remove(1);
                    }

                    taskLetters[position].TaskLetter.Letter += draggedLetter;
                    taskLetters[position].IsDirty            = true;

                    var isReady = taskLetters.Count(t => t.IsSearched && !t.IsDirty) == 0;
                    FireUserInteracted(isReady);
                    BuildTaskLetters(taskLetters);
                }

                break;
            }
        }
Beispiel #10
0
        void View_Drag(object sender, View.DragEventArgs e)
        {
            // React on different dragging events
            var evt = e.Event;

            switch (evt.Action)
            {
            case DragAction.Ended:
            case DragAction.Started:
                e.Handled = true;
                break;

            case DragAction.Drop:
                e.Handled = true;

                // Try to get clip data
                var data = e.Event.ClipData;
                if (data != null)
                {
                    var taskItems     = currentSyllablesToLearn.Syllables;
                    var draggedLetter = data.GetItemAt(0).Text;
                    var position      = llTaskItems.IndexOfChild(sender as View);

                    // Adjust position by consiering the "+" icons
                    var count = 0;
                    for (var i = 0; i < taskItems.Count; i++)
                    {
                        count += taskItems[i].SyllableParts.Count;
                        if (count <= position - 1)
                        {
                            position -= 1;
                        }
                    }

                    // Check if selection is correct
                    var index = position;
                    foreach (var taskLetter in taskItems)
                    {
                        if (taskLetter.SyllableParts.Count > index)
                        {
                            taskLetter.SyllableParts.ElementAt(index).TaskLetter.Letter    = draggedLetter;
                            taskLetter.SyllableParts.ElementAt(index).IsDirty              = true;
                            taskLetter.SyllableParts.ElementAt(index).TaskLetter.IsCorrect = taskLetter.SyllableParts.ElementAt(index).TaskLetter.CorrectLetter == draggedLetter;
                            break;
                        }
                        else
                        {
                            index -= taskLetter.SyllableParts.Count;
                        }
                    }

                    var isReady = true;
                    foreach (var taskLetter in taskItems)
                    {
                        foreach (var syllable in taskLetter.SyllableParts)
                        {
                            if (!syllable.IsDirty)
                            {
                                isReady = false;
                                break;
                            }
                        }
                    }

                    FireUserInteracted(isReady);
                    BuildTaskLetters(taskItems);
                }

                break;
            }
        }