Beispiel #1
0
        private void BuildTaskLetters(List <TaskItem> taskItems, Case fontCase)
        {
            llTaskItems.RemoveAllViews();

            // Convert letters to font case
            foreach (var item in taskItems)
            {
                item.TaskLetter.Letter        = item.TaskLetter.Letter.ToCase(fontCase);
                item.TaskLetter.CorrectLetter = item.TaskLetter.CorrectLetter.ToCase(fontCase);
            }

            var taskItemAdapter = new TaskItemAdapter(Activity.BaseContext, 0, taskItems);

            for (var i = 0; i < taskItems.Count; i++)
            {
                var view = taskItemAdapter.GetView(i, null, null);

                // Define searched letters as drop zone
                if (taskItems.ElementAt(i).IsSearched)
                {
                    view.Drag += View_Drag;
                }

                // Add letter to view
                llTaskItems.AddView(view);
            }
        }
Beispiel #2
0
        private void BuildTaskLetters(List <SyllableAggregate> syllables)
        {
            llTaskItems.RemoveAllViews();
            for (var i = 0; i < syllables.Count(); i++)
            {
                var syllable = syllables.ElementAt(i);
                var adapter  = new TaskItemAdapter(Activity.BaseContext, 0, syllable.SyllableParts);

                for (int j = 0; j < syllable.SyllableParts.Count; j++)
                {
                    var view = adapter.GetView(j, null, null);
                    view.Drag += View_Drag;

                    view.FindViewById <TextView>(Resource.Id.letter).SetTextColor(Resources.GetColor(
                                                                                      (i % 2 == 0) ? Resource.Color.level1 : Resource.Color.green));

                    // Add letter to view
                    llTaskItems.AddView(view);
                }

                // Add + icon
                if (i != syllables.Count - 1)
                {
                    var divider = new TextView(Activity.BaseContext);
                    divider.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    divider.Gravity          = GravityFlags.Center;
                    divider.TextSize         = 36f;
                    divider.SetTextColor(Color.Black);
                    divider.Text = "+";
                    llTaskItems.AddView(divider);
                }
            }
        }
Beispiel #3
0
        private void BuildTaskElements(List <TaskItem> taskItems)
        {
            // Add task items to view and attach Drag and Drop handler
            llTaskItems.RemoveAllViews();
            var adapter = new TaskItemAdapter(Activity.BaseContext, 0, taskItems);

            for (var i = 0; i < taskItems.Count; i++)
            {
                var view = adapter.GetView(i, null, null);
                if (GetCurrentIteration <AbcRankIteration>().Options.FirstOrDefault().Media != null)
                {
                    // Workaround to resize drop zone space for picture cards
                    view.FindViewById <TextView>(Resource.Id.letter).SetTextSize(Android.Util.ComplexUnitType.Dip, 30);
                }
                view.Drag += View_Drag;
                llTaskItems.AddView(view);
            }
        }
        private void BuildTaskLetters(List <TaskItem> taskItems)
        {
            if (useAlternateView)
            {
                flTaskItems.RemoveAllViews();
                flTaskItems.HorizontalSpacing = (int)(8 * Resources.DisplayMetrics.Density);
            }
            else
            {
                llTaskItems.RemoveAllViews();
            }
            var taskItemAdapter = new TaskItemAdapter(Activity.BaseContext, 0, taskItems);

            for (var i = 0; i < taskItems.Count; i++)
            {
                var view = taskItemAdapter.GetView(i, null, null);

                // Use different text size
                var letter = view.FindViewById <TextView>(Resource.Id.letter);
                letterTextSize = letter.TextSize / Resources.DisplayMetrics.ScaledDensity;

                // Define searched letters as drop zone
                if (taskItems.ElementAt(i).IsSearched)
                {
                    view.Drag += View_Drag;
                }

                // Add letter to view
                if (useAlternateView)
                {
                    var llLayout = view.FindViewById <RelativeLayout>(Resource.Id.llLayout);
                    llLayout.SetMinimumWidth((int)(80 * Resources.DisplayMetrics.Density));
                    flTaskItems.AddView(view);
                }
                else
                {
                    llTaskItems.AddView(view);
                }
            }
        }