public DragAnDropItemTouchHelperCallback(CollectionView.RenderedViews.CollectionView collection, RecycleViewAdapter recycleViewAdapter, ICommand onDragAndDropStart = null, ICommand onDragAndDropdEnded = null) { _collection = collection; _recycleViewAdapter = recycleViewAdapter; _onDragAndDropStart = onDragAndDropStart; _onDragAndDropdEnded = onDragAndDropdEnded; }
private void UpdateItemsSource() { Control.GetAdapter()?.Dispose(); var adapter = new RecycleViewAdapter(Element, Context); Control.SetAdapter(adapter); if (Element.EnableDragAndDrop) { var dragHelper = new ItemTouchHelper(new DragAnDropItemTouchHelperCallback(Element, adapter, Element.DragAndDropEndedCommand)); dragHelper.AttachToRecyclerView(Control); } }
private void UpdateItemsSource() { InternalLogger.Info($"UpdateItemsSource()"); var oldAdapter = Control.GetAdapter(); var adapter = new RecycleViewAdapter(Element, Control, Context); Control.SetAdapter(adapter); oldAdapter?.Dispose(); if (Element.EnableDragAndDrop) { _dragHelper?.AttachToRecyclerView(null); _dragHelper = new ItemTouchHelper( new DragAnDropItemTouchHelperCallback(Element, adapter, Element.DragAndDropEndedCommand)); _dragHelper.AttachToRecyclerView(Control); } }
private void FindViews() { toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.courseDetailToolBar); courseDetailBanner = FindViewById <ImageView>(Resource.Id.courseDetailBanner); courseDetailBannerDescription = FindViewById <EditText>(Resource.Id.courseDetailDescription); courseDetailBannerUsage = FindViewById <EditText>(Resource.Id.courseDetailUsage); recyclerView = FindViewById <RecyclerView>(Resource.Id.courseDetailsListChapters); recyclerView.HasFixedSize = true; layoutManager = new LinearLayoutManager(this); recyclerView.SetLayoutManager(layoutManager); recycleAdapter1 = new RecycleViewAdapter(listData, this); recyclerView.SetAdapter(recycleAdapter1); lables1 = FindViewById <TextView>(Resource.Id.label1); lables2 = FindViewById <TextView>(Resource.Id.label2); lables3 = FindViewById <TextView>(Resource.Id.label3); Typeface tf = Typeface.CreateFromAsset(Assets, "CerebriSans-Regular.otf"); lables1.SetTypeface(tf, TypefaceStyle.Bold); lables2.SetTypeface(tf, TypefaceStyle.Bold); lables3.SetTypeface(tf, TypefaceStyle.Bold); courseDetailBannerDescription.SetTypeface(tf, TypefaceStyle.Normal); courseDetailBannerUsage.SetTypeface(tf, TypefaceStyle.Normal); //Sets the Banner and Title of Course details var imageBitmap = GetImageBitmapFromUrl(language_image); courseDetailBanner.SetImageBitmap(imageBitmap); toolbar.Title = language_name; courseDetailBannerDescription.Text = language_description; courseDetailBannerUsage.Text = language_usage; //If adding anything in this block, add after these 3 lines SetSupportActionBar(toolbar); if (SupportActionBar != null) { SupportActionBar.SetDisplayHomeAsUpEnabled(true); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); addUserContacts = new AddUserContacts(); lstContacts = addUserContacts.AddContacts(10); recycler = FindViewById <RecyclerView>(Resource.Id.recyclerView); layoutManager = new LinearLayoutManager(this); recycler.SetLayoutManager(layoutManager); adapter = new RecycleViewAdapter(lstContacts.getContacts()); recycler.SetAdapter(adapter); var addItem = FindViewById <ImageView>(Resource.Id.addNewContact); addItem.Click += (sender, e) => { openAddDialog(); }; }
private void UpdateItemsSource() { InternalLogger.Info($"UpdateItemsSource()"); if (Control.IsNullOrDisposed()) { return; } var oldAdapter = Control.GetAdapter(); if (_itemsSource is INotifyCollectionChanged oldNotifyCollection) { oldNotifyCollection.CollectionChanged -= OnCollectionChanged; } _itemsSource = Element.ItemsSource; Control.GetRecycledViewPool().Clear(); var adapter = new RecycleViewAdapter(Element, this, Control, Context); Control.SetAdapter(adapter); if (!oldAdapter.IsNullOrDisposed()) { oldAdapter.Dispose(); } if (_itemsSource is INotifyCollectionChanged newNotifyCollection) { newNotifyCollection.CollectionChanged += OnCollectionChanged; } UpdateEnableDragAndDrop(); ScrollToCurrentItem(); }
private void UpdateItemsSource() { InternalLogger.Info($"UpdateItemsSource()"); var oldAdapter = Control.GetAdapter(); if (_itemsSource is INotifyCollectionChanged oldNotifyCollection) { oldNotifyCollection.CollectionChanged -= OnCollectionChanged; } _itemsSource = Element.ItemsSource; Control.GetRecycledViewPool().Clear(); var adapter = new RecycleViewAdapter(Element, Control, Context); Control.SetAdapter(adapter); oldAdapter?.Dispose(); if (_itemsSource is INotifyCollectionChanged newNotifyCollection) { newNotifyCollection.CollectionChanged += OnCollectionChanged; } if (Element.EnableDragAndDrop) { _dragHelper?.AttachToRecyclerView(null); _dragHelper = new ItemTouchHelper( new DragAnDropItemTouchHelperCallback(Element, adapter, Element.DragAndDropEndedCommand)); _dragHelper.AttachToRecyclerView(Control); } ScrollToCurrentItem(); }
public DragAnDropItemTouchHelperCallback(HorizontalListView horizontalList, RecycleViewAdapter recycleViewAdapter, ICommand onDragAndDropdEnded = null) { _horizontalList = horizontalList; _recycleViewAdapter = recycleViewAdapter; _onDragAndDropdEnded = onDragAndDropdEnded; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.checkOutScreen); // All the Intent Data for the logged in user's account. userName = Intent.GetStringExtra("userName") ?? "Data not available"; userEmail = Intent.GetStringExtra("userEmail") ?? "Data not available"; customerID = Intent.GetStringExtra("customerID") ?? "Data not available"; userPhoto = Intent.GetStringExtra("userPhoto") ?? "Data not available"; userPhoneNumber = Intent.GetStringExtra("userPhoneNumber") ?? "Data not available"; accountEnabled = Intent.GetStringExtra("accountEnabled") ?? "Data not available"; accountAmount = Intent.GetStringExtra("accountAmount") ?? "Data not available"; wId = Intent.GetStringExtra("wId") ?? "Data not available"; walletAmount = Intent.GetStringExtra("walletAmount") ?? "Data not available"; userRewardPoints = Intent.GetStringExtra("userRewardPoints") ?? "Data not available"; cId = Intent.GetStringExtra("cId") ?? "Data not available"; userId = Intent.GetStringExtra("userId") ?? "Data not available"; debitCardHolderName = Intent.GetStringExtra("debitCardHolderName") ?? "Data not available"; debitCardNumber = Intent.GetStringExtra("debitCardNumber") ?? "Data not available"; debitExpiryDate = Intent.GetStringExtra("debitExpiryDate") ?? "Data not available"; debitStartDate = Intent.GetStringExtra("debitStartDate") ?? "Data not available"; creditCardHolderName = Intent.GetStringExtra("creditCardHolderName") ?? "Data not available"; creditCardNumber = Intent.GetStringExtra("creditCardNumber") ?? "Data not available"; creditExpiryDate = Intent.GetStringExtra("creditExpiryDate") ?? "Data not available"; creditStartDate = Intent.GetStringExtra("creditStartDate") ?? "Data not available"; totalAmount = Intent.GetStringExtra("totalAmount") ?? "Data not available"; storeName = Intent.GetStringExtra("storeName") ?? "Data not available"; itemPriceListString = Intent.GetStringExtra("itemPriceList") ?? "Data not available"; itemNameListString = Intent.GetStringExtra("itemNameList") ?? "Data not available"; //Console.WriteLine("itemNameListString : " + itemNameListString); //Console.WriteLine("itemPriceListString : " + itemPriceListString); // Convert the string to the list to later make a dictionary. itemNameListConverted = itemNameListString.Split(',').ToList(); itemPriceListConverted = itemPriceListString.Split(',').ToList(); for (int i = 0; i < itemNameListConverted.Count; i++) { itemListJSONRep = itemListJSONRep + "\"" + itemNameListConverted[i] + "\"" + ":" + "\"" + itemPriceListConverted[i] + "\","; } // Final cleaning the last , and adding } to make a perfect json! itemListJSONRep = itemListJSONRep.TrimEnd(','); itemListJSONRep = itemListJSONRep + "}"; FindViews(); ClickEvents(); valueSetter(); InitData(); recycleView = FindViewById <RecyclerView>(Resource.Id.recyclerScreen); recycleView.HasFixedSize = true; layoutManager = new LinearLayoutManager(this); recycleView.SetLayoutManager(layoutManager); recycleAdapter = new RecycleViewAdapter(listData); recycleView.SetAdapter(recycleAdapter); // Empty the cart, because the transaction has been made! ValueCleaner(); //Add this here // await Task.Run(() => PaymentProcessor(userId, totalAmount, wId, storeName, itemListJSONRep, customerID, "000000000000")); }