title: Xamarin Android EggsToGo (swipe gesture) listener in view doesnt work with ListView
body: <p>I have a problem with EggsToGo (swipe left/right effect) listener in a ListView control. I had problem <a href="https://stackoverflow.com/questions/46049130/xamarin-android-scrollview-doesnt-work-in-listview">HERE</a> and found the problem with EggsToGo exactly with a ListView listener... when I have a listener on my ListView so the ScrollView doesnt work there.... Is there some solution how I can make EggsToGo listener on view that will work on ListView?</p>
  
  <p>My test project is <a href="https://github.com/pinkysek/XabluDemoApp" rel="nofollow noreferrer">HERE</a> - the problem is in the FirstFragment (First view). When I have a listener on listview, the scrollview doesnt work. But when I don't have a listener, the swipe doesn't work....</p>
  
  <p><strong>Here is code my view:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:local="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
      &lt;include
          layout="@layout/toolbar_back_layout" /&gt;
  &lt;!-- Test Top Layout --&gt;
      &lt;include
          layout="@layout/view_shopname_lastupdate_ribbon" /&gt;
  &lt;!-- Layout Date and Picker--&gt;
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:background="@android:color/white"
          android:layout_height="50dp"
          android:paddingRight="20dp"
          android:paddingLeft="20dp"
          android:gravity="center_vertical"&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:text="Období:"
              local:MvxLang="Text Period"
              android:textSize="16dp"
              android:textStyle="normal"
              android:textColor="@color/main_dark_gray"
              android:ellipsize="marquee"
              android:maxLines="1"
              android:gravity="center"
              android:layout_marginRight="10dp" /&gt;
          &lt;MvxSpinner
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:id="@+id/periodSpinner"
              local:MvxBind="ItemsSource PeriodList; SelectedItem SelectedPeriod"
              android:spinnerMode="dropdown" /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"
              android:layout_weight="1"&gt;
               &lt;oxyplot.xamarin.android.PlotView
                 android:id="@+id/dailySalesModel"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout_weight="1"
                 android:background="@android:color/white" /&gt;
               &lt;MvxListView
                android:id="@+id/dailySalesListView"
                android:layout_weight="1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                local:MvxBind="ItemsSource DailySales"
                local:MvxItemTemplate="@layout/view_dailysalesitem"
                android:divider="@color/main_gray"
                android:dividerHeight="1dp"
                android:choiceMode="none"
                android:layout_gravity="start"
                android:background="@android:color/white"
                android:listSelector="@android:color/transparent"
                android:paddingTop="15dp" /&gt;
          &lt;/LinearLayout&gt;
          &lt;include
              layout="@layout/view_bottomribbon" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>Here is code my fragment:</strong> </p>
  
  <pre><code>   [MvxFragment(typeof(MainViewModel), Resource.Id.content_frame, true)]
      public class DailySalesFragment : BaseBackFragment&lt;DailySalesViewModel&gt;, View.IOnTouchListener
      {
          private Easter _easter;
          private View _view;
          protected override int FragmentId =&gt; Resource.Layout.fragment_dailysales;
  
          public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
          {
              var ignore = base.OnCreateView(inflater, container, savedInstanceState);
  
              _view = this.BindingInflate(FragmentId, null);
  
              var orientation = Resources.Configuration.Orientation;
  
              if (orientation == Orientation.Landscape)
              {
                  var metrics = Resources.DisplayMetrics;
  
                  var height = CoreHelper.ConvertPixelsToDp(metrics.HeightPixels, Resources);
  
                  if (height &lt;= 360)
                  {
                      var topLayout = _view.FindViewById&lt;LinearLayout&gt;(Resource.Id.topLayout);
                      if (topLayout != null)
                      {
                          topLayout.Visibility = ViewStates.Gone;
                      }
                  }
              }
  
              var plotView = _view.FindViewById&lt;PlotView&gt;(Resource.Id.dailySalesModel);
              var bindset = this.CreateBindingSet&lt;DailySalesFragment, DailySalesViewModel&gt;();
              bindset.Bind(plotView).For(q =&gt; q.Model).To(vm =&gt; vm.Model);
              bindset.Apply();
  
              _easter = new Easter(new KonamiCode());
  
              var easyEgg = new CustomEgg("Easy")
                  .WatchForSequence(Command.SwipeLeft(), Command.SwipeRight());
  
              _easter = new Easter(easyEgg);
              _easter.CommandDetected += cmd =&gt; DoSwipe(cmd.Value);
  
              var model = _view.FindViewById&lt;PlotView&gt;(Resource.Id.dailySalesModel);
              var listView = _view.FindViewById&lt;MvxListView&gt;(Resource.Id.dailySalesListView);
              model?.SetOnTouchListener(this);
              listView?.SetOnTouchListener(this);
  
              InitializeSwipeButtons();
              InitializeShopPicker();
  
              return _view;
          }
  
          public override void OnConfigurationChanged(Configuration newConfig)
          {
              base.OnConfigurationChanged(newConfig);
              ViewModel.RefreshView();
          }
  
          private void InitializeShopPicker()
          {
              var shopLayout = _view.FindViewById&lt;LinearLayout&gt;(Resource.Id.shopLayout);
              if (shopLayout != null)
              {
                  shopLayout.Click += delegate
                  {
                      ShowShopPickerDialog();
                  };
              }
          }
  
          private void ShowShopPickerDialog()
          {
              var dialog = new ShopPickerDialogFragment(ViewModel.ShopId);
              dialog.DialogClosed += OnDialogClosed;
              dialog.Show(this.Activity.FragmentManager, null);
          }
  
          private async void OnDialogClosed(object sender, Helpers.ShopPickerDialogEventArgs e)
          {
              if (e.IsChanged)
              {
                  var shop = e.Shop;
                  await ViewModel.ChangeShop(shop);
              }
          }
  
          private void InitializeSwipeButtons()
          {
              var leftButton = _view.FindViewById&lt;ImageButton&gt;(Resource.Id.leftButton);
              if (leftButton != null)
              {
                  leftButton.Click += delegate
                  {
                      DoSwipe("RIGHT");
                  };
              }
  
              var rightButton = _view.FindViewById&lt;ImageButton&gt;(Resource.Id.rightButton);
              if (rightButton != null)
              {
                  rightButton.Click += delegate
                  {
                      DoSwipe("LEFT");
                  };
              }
          }
  
          private void DoSwipe(string swipeText)
          {
              if (swipeText.Equals("LEFT"))
              {
                  FragmentManager.BeginTransaction()
                      .SetCustomAnimations(Resource.Animation.slide_from_right, Resource.Animation.slide_to_left)
                      .Replace(Resource.Id.content_frame, GroupSalesFragment.NewInstance(null))
                      .Commit();
              }
  
              if (swipeText.Equals("RIGHT"))
              {
                  FragmentManager.BeginTransaction()
                      .SetCustomAnimations(Resource.Animation.slide_from_left, Resource.Animation.slide_to_right)
                      .Replace(Resource.Id.content_frame, ReportsFragment.NewInstance(null))
                      .Commit();
              }
  
              ViewModel.SwipeView(swipeText);
          }
  
          private int ConvertDpToPixels(int dp)
          {
              var pixels = dp * Resources.DisplayMetrics.Density;
              return (int)pixels;
          }
  
          private void RefreshLayout(object sender, EventArgs e)
          {
              BackgroundWorker worker = new BackgroundWorker();
              worker.DoWork += WorkerDoWork;
              worker.RunWorkerCompleted += WorkerCompleted;
              worker.RunWorkerAsync();
          }
  
          private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
          {
              _dailySalesSwipeRefreshLayout.Refreshing = false;
          }
  
          private void WorkerDoWork(object sender, DoWorkEventArgs e)
          {
              Task.Run(ViewModel.ExecuteRefreshAsync);
          }
  
          public bool OnTouch(View v, MotionEvent e)
          {
              _easter.OnTouchEvent(e);
              return true;
          }
      }
  </code></pre>