void HandleItemLongClick(object sender, ItemLongClickEventArgs e) { // Long press is handeled in the OnLongPress method of the IOnGestureListener Interface // for some reason we have to wire this up to detect the long press, otherwise, the gesture gets ignored mTotalOffset = 0; // int position = PointToPosition (mDownX, mDownY); int position = e.Position; if (position < 0 || !LongClickable) { return; } int itemNum = position - FirstVisiblePosition; View selectedView = GetChildAt(itemNum); mMobileItemId = Adapter.GetItemId(position); // use this varable to keep track of which view is currently moving mHoverCell = GetAndAddHoverView(selectedView); selectedView.Visibility = ViewStates.Invisible; // set the visibility of the selected view to invisible mCellIsMobile = true; UpdateNeighborViewsForID(mMobileItemId); }
void Adapter_ItemSwipe(object sender, ItemLongClickEventArgs e) { if (_BoundryPolygons.Count() > 0) { var item = arrayAdapter.GetItem(e.Position); arrayAdapter.Remove(item); itemList.Remove(item); _BoundryPolygons.RemoveAt(e.Position); boundaryPolygonsText.Text = String.Format("Boundary Polygons {0}", itemList.Count); oldPosition = e.Position; bpListView.Adapter = arrayAdapter; bpListView.ItemLongClick += Adapter_ItemSwipe; } }
private void ItemOnLongClick(object sender, ItemLongClickEventArgs e) { var type = GetPackedPositionType(e.Id); long packedPos = ((ExpandableListView)e.Parent).GetExpandableListPosition(e.Position); int groupPosition = GetPackedPositionGroup(packedPos); int childPosition = GetPackedPositionChild(packedPos); if (type == PackedPositionType.Child) { ExecuteCommandOnItem(ItemLongClick, groupPosition, childPosition); } else if (type == PackedPositionType.Group) { ExecuteCommandOnGroup(GroupLongClick, groupPosition); } }
protected void Handle_LongPressEvent(object sender, ItemLongClickEventArgs e) { Console.Write("Long Press !"); if (!lvwNotifications.IsSelectionMode) { UIListViewItem <Notification> notification = lvwNotifications.GetItemByPosition(e.Position); notification.IsSelected = true; List <ToolbarItem> toolBarItems = new List <ToolbarItem>(); if (Device.RuntimePlatform == Device.Android) { //ToolbarItems.Add(new ToolbarItem("Delete", "ic_action_delete.png", DeletedNotifications, ToolbarItemOrder.Primary)); ToolbarItem item = new ToolbarItem("Delete", "ic_action_delete.png", DeletedNotifications, ToolbarItemOrder.Primary); item.Text = "Delete"; item.Order = 0; toolBarItems.Add(item); } if (Device.RuntimePlatform == Device.iOS) { ((NavigationPage)Application.Current.MainPage).ToolbarItems.Clear(); ToolbarItem item = new ToolbarItem("Back", "ic_back.png", DeletedNotifications, ToolbarItemOrder.Primary); item.Text = "Back"; item.Order = ToolbarItemOrder.Primary; toolBarItems.Add(item); item = new ToolbarItem("Delete", "ic_delete.png", DeletedNotifications, ToolbarItemOrder.Primary); item.Text = "Delete"; item.Order = ToolbarItemOrder.Primary; toolBarItems.Add(item); } toolBarItems.ForEach(x => ((NavigationPage)Application.Current.MainPage).ToolbarItems.Add(x)); //ToolbarItems.Add(item); //((NavigationPage)Application.Current.MainPage).ToolbarItems.Add(item); if (Device.RuntimePlatform == Device.Android) { //((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.DarkGray; } Title = $"{lvwNotifications.ItemsSelectedCount()} seleccionados"; } }
private void OnDateGridFragmentItemLongClicked(object sender, ItemLongClickEventArgs e) { var dateTime = _daysInMonths[e.Position]; if (_calendarListener != null) { if (!_isClickOnDisabledDatesEnabled) { if ((_minDateTime != null && dateTime.Date < _minDateTime.Value.Date) || (_maxDateTime != null && dateTime.Date > _maxDateTime.Value.Date) || (_disabledDates != null && _disabledDates.Contains(dateTime))) { return; } } _calendarListener.OnLongClickDate(dateTime, e.View); } }
private void ListViewItemLongClick(object sender, ItemLongClickEventArgs e) { if ((new FileInfo((listFile[e.Position])).Attributes & FileAttributes.Directory) != 0) { Android.Support.V7.App.AlertDialog alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this) .SetTitle("打包PAK") .SetMessage("你确定生成PAK包在本目录 ?") .SetPositiveButton("确定", (s, ItemClickEventArgs) => { progressdialog = new ProgressDialog(this); progressdialog.SetTitle("打包Pak中"); progressdialog.SetMessage("请稍等......"); progressdialog.SetCancelable(false); progressdialog.Show(); Task.Run(() => { try { new Pak(listFile[e.Position]); hander.Post(() => { progressdialog.Dismiss(); mainListView.UpThisDirectories(listFile[e.Position]); (new Android.Support.V7.App.AlertDialog.Builder(this).SetTitle("打包PAK成功").SetMessage("PAK打包成功,欢迎再次使用!").SetNegativeButton("确定", delegate { }).Create()).Show(); }); } catch (Exception exception) { hander.Post(() => { progressdialog.Dismiss(); mainListView.UpThisDirectories(listFile[e.Position]); (new Android.Support.V7.App.AlertDialog.Builder(this).SetTitle("打包PAK失败").SetMessage("PAK打包失败,请将错误信息交给作者!\n错误信息 :" + exception.Message).SetNegativeButton("确定", delegate { }).Create()).Show(); }); } }); }).SetNegativeButton("取消", (s, ItemClickEventArgs) => { Toast.MakeText(this, "你已经取消了操作", ToastLength.Short).Show(); }).Create(); alertDialog.Show(); mainListView.UpThisDirectories(listFile[e.Position]); } }
private void ItemOnLongClick(object sender, ItemLongClickEventArgs e) { ExecuteCommandOnItem(ItemLongClick, e.Position); }
void HandleItemLongClick(object sender, ItemLongClickEventArgs e) { // Long press is handeled in the OnLongPress method of the IOnGestureListener Interface // for some reason we have to wire this up to detect the long press, otherwise, the gesture gets ignored }
private void OnItemLongClick(object sender, ItemLongClickEventArgs e) { ExecuteCommandOnItem(ItemLongClick, e.Position); }
private void listView_onLongClickListener(object sender, ItemLongClickEventArgs e) { startRecording(); }