Beispiel #1
0
    View ITask.CreateView(LayoutInflater inflater, ViewGroup container)
    {
      v = inflater.Inflate(layoutId, container, false);

      tts = new Text2Speech(v.GetContext());
      // Create all parts from, for instance, a xml file
      var s = factory.GetNextGameObjects(v.GetContext(), tts);
      CreateTask(v, s);

      return v;
    }
                //TODO: is host.GetContect what we want, or should be create an Additional field in this class?

                public override void OnPopulateAccessibilityEvent(View host, AccessibilityEvent @event)
                {
                    base.OnPopulateAccessibilityEvent(host, @event);
                    // Note that View.onPopulateAccessibilityEvent was introduced in
                    // ICS and we would like to tweak a bit the text that is reported to
                    // accessibility services via the AccessibilityEvent.
                    @event.GetText().Add(host.GetContext().GetString(
                            R.Strings.accessibility_delegate_custom_text_added));
                }
 public override void OnInitializeAccessibilityNodeInfo(View host,
         AccessibilityNodeInfoCompat info)
 {
     base.OnInitializeAccessibilityNodeInfo(host, info);
     // Note that View.onInitializeAccessibilityNodeInfo was introduced in
     // ICS and we would like to tweak a bit the text that is reported to
     // accessibility services via the AccessibilityNodeInfo.
     info.SetText(host.GetContext().GetString(
             R.Strings.accessibility_delegate_custom_text_added));
 }
Beispiel #4
0
    public bool OnDrag(View view, DragEvent dragEvent)
    {
      bool result = true;

      SpeechDragData dragData;
      if (dragEvent.GetLocalState() is SpeechDragData)
      {
        dragData = dragEvent.GetLocalState() as SpeechDragData;
      }
      else
      {
        if (Successor is View.IOnDragListener)
        {
          return (Successor as View.IOnDragListener).OnDrag(view, dragEvent);
        }
      }

      switch (dragEvent.GetAction())
      {
        case DragEvent.ACTION_DRAG_STARTED:
          break;
        case DragEvent.ACTION_DRAG_ENTERED:
          view.SetBackgroundColor(view.GetContext().GetResources().GetColor(R.Colors.accent_blue));
          //float[] single = { 1.0F, 0.5F };
          //anim = ObjectAnimator.OfFloat((Object)view, "alpha", single);
          //anim.SetInterpolator(new CycleInterpolator(40));
          //anim.SetDuration(30 * 1000); // 30 seconds
          //anim.Start();
          break;
        case DragEvent.ACTION_DRAG_ENDED:
        case DragEvent.ACTION_DRAG_EXITED:
          view.SetBackgroundColor(view.GetContext().GetResources().GetColor(R.Colors.light_blue));
          //if (anim != null)
          //{
          //  anim.End();
          //  anim = null;
          //}
          break;
        case DragEvent.ACTION_DROP:
          view.SetBackgroundColor(view.GetContext().GetResources().GetColor(R.Colors.light_blue));
          //if (anim != null)
          //{
          //  anim.End();
          //  anim = null;
          //}
          Tts.SpeakOut(Text);
          // Dropped, reassign View to ViewGroup
          //var dragedView = dragData.draggedView;
          //ViewGroup owner = (ViewGroup)dragedView.GetParent();
          //owner.RemoveView(dragedView);
          //HorizontalFlowLayout container = (HorizontalFlowLayout)view;
          //container.AddView(dragedView);
          //dragedView.SetVisibility(View.VISIBLE);

          // Inform all listeners
          //OnDropAccepted(dragData.dragHandler.CurrentContainer, Id, (dragData as MoveDragData).dragHandler.CheckerData);

          break;
        case DragEvent.ACTION_DRAG_LOCATION:
          break;
        default:
          break;
      }

      return result;
    }