public bool OnTouch(View v, MotionEvent @event)
        {
            lock (this)
            {
                TouchEvent touchEvent = touchEventPool.newObject();
                switch (@event.GetAction())
                {
                    case MotionEvent.ACTION_DOWN:
                        touchEvent.type = TouchEvent.TOUCH_DOWN;
                        isTouched = true;
                        break;
                    case MotionEvent.ACTION_MOVE:
                        touchEvent.type = TouchEvent.TOUCH_DRAGGED;
                        isTouched = true;
                        break;
                    case MotionEvent.ACTION_CANCEL:
                    case MotionEvent.ACTION_UP:
                        touchEvent.type = TouchEvent.TOUCH_UP;
                        isTouched = false;
                        break;
                }

                touchEvent.x = touchX = (int) (@event.GetX()*scaleX);
                touchEvent.y = touchY = (int) (@event.GetY()*scaleY);
                touchEventsBuffer.Add(touchEvent);

                return true;
            }
        }
예제 #2
0
 public AndroidInput(Context context, View view, float scaleX, float scaleY)
 {
     if (int.Parse(Build.VERSION.SDK) < 5)
         touchHandler = new SingleTouchHandler(view, scaleX, scaleY);
     else
         touchHandler = new MultiTouchHandler(view, scaleX, scaleY);
 }
        private void Refresh(View view)
        {
            var counterTitle = view.FindViewById<TextView>(R.Ids.pilotListCounterTitle);
            counterTitle.Text = mTitle + ":" + mPilotList.Count;

            var listview = view.FindViewById<ListView>(R.Ids.pilotListCounterView);
            listview.Adapter = mPilotList;
        }
예제 #4
0
파일: ActionMode.cs 프로젝트: rfcclub/dot42
 public bool OnLongClick(View v)
 {
   if (actionMode != null)
     return false;
   else
     actionMode = mainActivity.StartActionMode(this);
   return true;
 }
예제 #5
0
        public MultiTouchHandler(View view, float scaleX, float scaleY)
        {
            touchEventPool = new Pool<TouchEvent>(new TouchEventFactory(), 100);
            view.SetOnTouchListener(this);

            this.scaleX = scaleX;
            this.scaleY = scaleY;
        }
예제 #6
0
    public bool OnLongClick(View view)
    {
      ClipData data = ClipData.NewPlainText("DragData", "");
      view.StartDrag(data, 
                     new Android.View.View.DragShadowBuilder(view), 
                     (Object)new MoveDragData{ draggedView=view, dragHandler=this}, 0);

      return true;
    }
                //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));
 }
예제 #9
0
 public void OnClick(View view)
 {
    switch (view.GetId())
    {
       case R.Ids.send_interactive_button:
          // Set sharing so that the share is started in onSignedIn.
          mSharing = true;
          mPlusClientFragment.SignIn(REQUEST_CODE_PLUS_CLIENT_FRAGMENT);
          break;
    }
 }
예제 #10
0
파일: SortTask.cs 프로젝트: rfcclub/dot42
    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;
    }
예제 #11
0
 public bool OnTouch(View view, MotionEvent ev)
 {
   //if (inDrag == false)
   //{
     inDrag = true;
     ClipData data = ClipData.NewPlainText("SpeechDragData", "");
     view.StartDrag(data,
                    new Android.View.View.DragShadowBuilder(view),
                    (Object)new SpeechDragData { draggedView = view, dragHandler = this }, 0);
   //}
   return true;
 }
예제 #12
0
 public bool OnTouch(View view, MotionEvent ev)
 {
   //if (ev.GetAction() == MotionEvent.ACTION_MOVE)
   {
     ClipData data = ClipData.NewPlainText("DragData", "");
     view.StartDrag(data,
                    new Android.View.View.DragShadowBuilder(view),
                    (Object)new MoveDragData { draggedView = view, dragHandler = this }, 0);
     
   }
   return true;
 }
예제 #13
0
        private void CapacitorDetails(View view, Item details)
        {
            Capacitor cap = details as Capacitor;
            if (cap == null)
                return;

            EquipDetails(view, cap);
            var efficiency = view.FindViewById<TextView>(R.Ids.txtItemDetailEfficiency);
            efficiency.Text = cap.Efficiency.ToString();
            var capacity = view.FindViewById<TextView>(R.Ids.txtItemDetailCapacity);
            capacity.Text = (cap.Capacity / 1000.0).ToString("N1") + " K";
        }
예제 #14
0
파일: SortTask.cs 프로젝트: rfcclub/dot42
    private void CreateTask(View v, SortGameObjects s)
    {
      s.ResultChecker.OnTaskFinished += TaskFinishedHandler;
      var v_tasktext = v.FindViewById<TextView>(R.Ids.TaskText);
      if (v_tasktext == null)
      {
        throw new NullReferenceException("No task text view");
      }
      var v_earImage = v.FindViewById<ImageView>(R.Ids.earImage);
      if (v_earImage == null)
      {
        throw new NullReferenceException("No ear image view");
      }

      var v_task = v.FindViewById<ViewGroup>(R.Ids.Task);
      if (v_task == null)
      {
        throw new NullReferenceException("No container for sort objects");
      }

      var v_dropzones = v.FindViewById<ViewGroup>(R.Ids.DropZones);
      if (v_dropzones == null)
      {
        throw new NullReferenceException("No container for sort containers");
      }

      v_dropzones.RemoveAllViews();

      v_tasktext.SetText(s.TaskText);
      var h = new SpeechDragHandler();
      v_earImage.SetOnDragListener(h);
      v_earImage.SetOnTouchListener(h);
      foreach (var o in s.SortObjects)
      {
        v_task.AddView(o);
      }
      foreach (var o in s.SortContainers)
      {
        v_dropzones.AddView(o);
      }

      //(s.SortContainers[0] as HorizontalFlowLayout).AddView(s.SortObjects[0]);
      //s.SortObjects.RemoveAt(0);
      //foreach (var o in s.SortObjects)
      //{
      //  v_task.AddView(o);
      //  //(s.SortContainers[0] as HorizontalFlowLayout).AddView(o);

      //}

    }
예제 #15
0
    public bool OnDrag(View view, DragEvent dragEvent)
    {
      if (dragEvent.GetLocalState() is SpeechDragData)
      {
        if (((SpeechDragData)dragEvent.GetLocalState()).dragHandler != this)
        {
          // Not this object
          return false;
        }
      }
      else
      {
        if (Successor != null)
        {
          if (Successor is View.IOnDragListener)
          {
            return (Successor as View.IOnDragListener).OnDrag(view, dragEvent);
          }
        }
      }

      bool result = true;

      switch (dragEvent.GetAction())
      {
        case DragEvent.ACTION_DRAG_STARTED:
          //view.SetAlpha(0.3f);
          inDrag = true;
          break;
        case DragEvent.ACTION_DRAG_ENDED:
          //view.SetAlpha(1.00f);
          inDrag = false;
          break;
        case DragEvent.ACTION_DRAG_EXITED:
          inDrag = false;
          break;
        case DragEvent.ACTION_DROP:
          break;
        case DragEvent.ACTION_DRAG_LOCATION:
          break;
        default:
          break;
      }

      return result;
    }
예제 #16
0
 public void OnClick(View view)
 {
    switch (view.GetId())
    {
       case R.Ids.sign_out_button:
          resetAccountState();
          mSignInFragment.SignOut();
          break;
       case R.Ids.sign_in_button:
          mSignInFragment.SignIn(REQUEST_CODE_PLUS_CLIENT_FRAGMENT);
          break;
       case R.Ids.revoke_access_button:
          resetAccountState();
          mSignInFragment.RevokeAccessAndDisconnect();
          break;
    }
 }
예제 #17
0
        public void OnShareFileClick(View v) {
            try {
                // This file will be accessed by the target of the share through
                // the ContentProvider SharingSupportProvider.
                FileWriter fw = new FileWriter(GetFilesDir() + "/foo.txt");
                fw.Write("This is a file share");
                fw.Close();

                ShareCompat.IntentBuilder.From(this)
                        .SetType("text/plain")
                        .SetStream(Uri.Parse(SharingSupportProvider.CONTENT_URI + "/foo.txt"))
                        .StartChooser();
            } catch (FileNotFoundException e) {
                e.PrintStackTrace();
            } catch (IOException e) {
                e.PrintStackTrace();
            }
        }
예제 #18
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;
    }
 public override void OnListItemClick(ListView l, View v, int position, long id) {
     Log.I("FragmentList", "Item clicked: " + id);
 }
예제 #20
0
        public bool OnTouch(View v, MotionEvent @event)
        {
            lock (this)
            {
                int action = @event.GetAction() & MotionEvent.ACTION_MASK;
                int pointerIndex = (@event.GetAction() & MotionEvent.ACTION_POINTER_ID_MASK) >>
                                   MotionEvent.ACTION_POINTER_ID_SHIFT;
                int pointerCount = @event.GetPointerCount();
                TouchEvent touchEvent;
                for (int i = 0; i < MAX_TOUCHPOINTS; i++)
                {
                    if (i >= pointerCount)
                    {
                        isTouched[i] = false;
                        id[i] = -1;
                        continue;
                    }
                    int pointerId = @event.GetPointerId(i);
                    if (@event.GetAction() != MotionEvent.ACTION_MOVE && i != pointerIndex)
                    {
                        // if it's an up/down/cancel/out event, mask the id to see if we should process it for this touch
                        // point
                        continue;
                    }
                    switch (action)
                    {
                        case MotionEvent.ACTION_DOWN:
                        case MotionEvent.ACTION_POINTER_DOWN:
                            touchEvent = touchEventPool.newObject();
                            touchEvent.type = TouchEvent.TOUCH_DOWN;
                            touchEvent.pointer = pointerId;
                            touchEvent.x = touchX[i] = (int) (@event.GetX(i)*scaleX);
                            touchEvent.y = touchY[i] = (int) (@event.GetY(i)*scaleY);
                            isTouched[i] = true;
                            id[i] = pointerId;
                            touchEventsBuffer.Add(touchEvent);
                            break;

                        case MotionEvent.ACTION_UP:
                        case MotionEvent.ACTION_POINTER_UP:
                        case MotionEvent.ACTION_CANCEL:
                            touchEvent = touchEventPool.newObject();
                            touchEvent.type = TouchEvent.TOUCH_UP;
                            touchEvent.pointer = pointerId;
                            touchEvent.x = touchX[i] = (int) (@event.GetX(i)*scaleX);
                            touchEvent.y = touchY[i] = (int) (@event.GetY(i)*scaleY);
                            isTouched[i] = false;
                            id[i] = -1;
                            touchEventsBuffer.Add(touchEvent);
                            break;

                        case MotionEvent.ACTION_MOVE:
                            touchEvent = touchEventPool.newObject();
                            touchEvent.type = TouchEvent.TOUCH_DRAGGED;
                            touchEvent.pointer = pointerId;
                            touchEvent.x = touchX[i] = (int) (@event.GetX(i)*scaleX);
                            touchEvent.y = touchY[i] = (int) (@event.GetY(i)*scaleY);
                            isTouched[i] = true;
                            id[i] = pointerId;
                            touchEventsBuffer.Add(touchEvent);
                            break;
                    }
                }
                return true;
            }
        }
예제 #21
0
 public void OnStartSecond(View sender)
 {
     var intent = new Intent(this, typeof (SecondActivity));
     StartActivity(intent);
 }
예제 #22
0
 override protected void OnListItemClick(ListView listView, View view, int position, long id)
 {
    IMap<String, Object> map = (IMap<String, Object>)listView.GetItemAtPosition(position);
    Intent intent = (Intent)map.Get(INTENT_KEY);
    StartActivity(intent);
 }
예제 #23
0
 public void OnShareTextClick(View v) {
     ShareCompat.IntentBuilder.From(this)
             .SetType("text/plain")
             .SetText("I'm sharing!")
             .StartChooser();
 }
예제 #24
0
 public bool OnGroupClick(ExpandableListView parent, View.View v, int groupPosition, long id)
 {
     var args = new GroupClickEventArgs(v, groupPosition, id);
     GroupClick.Invoke(parent, args);
     return args.IsHandled;
 }
 public override void OnListItemClick(ListView l, View v, int position, long id) {
     ShowDetails(position);
 }
예제 #26
0
 public void OnClick(View view)
 {
    if (view.GetId() == R.Ids.sign_in_button)
    {
    }
 }
 private void Refresh(View view)
 {
     var producers = view.FindViewById<ListView>(R.Ids.itemDetailProducersListView);
     producers.Adapter = new ItemProducersAdapter(this.Activity, details.Producers);
 }
 private void Refresh(View view)
 {
     var stations = view.FindViewById<ListView>(R.Ids.itemDetailInventoryListView);
     stations.Adapter = new ItemStationStockAdapter(this.Activity, details.StationStocks);
 }
예제 #29
0
파일: Simple.cs 프로젝트: rfcclub/dot42
	    public void OnClick(View obj0)
	    {
            SetContentView(R.Layouts.main);
        }
예제 #30
0
 public void OnClick(View sender)
 {
     
 }