public static void ResetHeight(this DroidListView listView) { if (listView == null || listView.Adapter == null) { return; } try { var row = 0; int totalHeight = listView.PaddingTop + listView.PaddingBottom; for (int i = 0; i < listView.Count; i++) { var listItem = listView.Adapter.GetView(i, null, listView); var p = listItem.LayoutParameters; var v = ((ViewGroup)listItem); if (listItem.GetType() == typeof(ViewGroup)) { listItem.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); } listItem.Measure(0, 0); row = listItem.MeasuredHeight; } listView.LayoutParameters.Height = (row * listView.Count) + (listView.DividerHeight * (listView.Count - 1)); listView.RequestLayout(); } catch (System.Exception ex) { #if DEBUG Console.WriteLine(ex.Message); #endif } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // to return adapter view for this Fragment View view = inflater.Inflate(Resource.Layout.home_fragment, container, false); /** * refer the parent tag */ // homeLayout = view.FindViewById<LinearLayout>(Resource.Id.home_layout); LinearLayout ll_iv_1 = view.FindViewById <LinearLayout>(Resource.Id.ll_iv_1); LinearLayout ll_iv_2 = view.FindViewById <LinearLayout>(Resource.Id.ll_iv_2); LinearLayout ll_iv_3 = view.FindViewById <LinearLayout>(Resource.Id.ll_iv_3); LinearLayout ll_iv_4 = view.FindViewById <LinearLayout>(Resource.Id.ll_iv_4); listView = (ListView)view.FindViewById(Resource.Id.childList); Android.Graphics.Color backgroundColor = new Android.Graphics.Color(ThemeUtill.OnActivityCreateSetTheme((Activity)mContext)); /** * set back ground color dynamicly here */ ll_iv_1.SetBackgroundColor(backgroundColor); ll_iv_2.SetBackgroundColor(backgroundColor); ll_iv_3.SetBackgroundColor(backgroundColor); ll_iv_4.SetBackgroundColor(backgroundColor); listView.SetBackgroundColor(backgroundColor); return(view); }
private void InitializeOutChart() { OutCalculator outCalculator = new OutCalculator(InOutRule.Double); List <string> allOutsList = new List <string>(); Dictionary <int, List <Dart> > allOuts = outCalculator.GetAllOuts(); // iterate through the dictionary to get all the outs foreach (KeyValuePair <int, List <Dart> > entry in allOuts) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(entry.Key.ToString()); stringBuilder.Append(": "); for (int j = 0; j < entry.Value.Count; j++) { stringBuilder.Append(entry.Value[j].Abbreviation); if (j != entry.Value.Count - 1) { stringBuilder.Append(", "); } } string outItemText = stringBuilder.ToString(); allOutsList.Add(outItemText); } Android.Widget.ListView lstMyList = (Android.Widget.ListView)FindViewById <Android.Widget.ListView>(Resource.Id.MyList); lstMyList.Adapter = new OutChartAdapter(this, allOutsList); }
public ListViewAdapter(Context context, AListView realListView, ListView listView) : base(context) { _context = context; _realListView = realListView; _listView = listView; if (listView.SelectedItem != null) { SelectItem(listView.SelectedItem); } var templatedItems = ((ITemplatedItemsView <Cell>)listView).TemplatedItems; templatedItems.CollectionChanged += OnCollectionChanged; templatedItems.GroupedCollectionChanged += OnGroupedCollectionChanged; listView.ItemSelected += OnItemSelected; realListView.OnItemClickListener = this; realListView.OnItemLongClickListener = this; var platform = _listView.Platform; if (platform.GetType() == typeof(AppCompat.Platform)) { MessagingCenter.Subscribe <AppCompat.Platform>(this, AppCompat.Platform.CloseContextActionsSignalName, p => CloseContextAction()); } else { MessagingCenter.Subscribe <Platform>(this, Platform.CloseContextActionsSignalName, p => CloseContextAction()); } }
/// <summary> /// Dispose the specified disposing. /// </summary> /// <returns>The dispose.</returns> /// <param name="disposing">If set to <c>true</c> disposing.</param> protected override void Dispose(bool disposing) { if (disposing) { // Dialog.Dispose() does not close an open dialog view so explicitly dismiss it before disposing _dialog?.Dismiss(); _dialog?.Dispose(); _dialog = null; _listView?.Dispose(); _listView = null; _adapter?.Dispose(); _adapter = null; _context = null; if (_notifyCollection != null) { _notifyCollection.CollectionChanged -= ItemsSourceCollectionChanged; _notifyCollection = null; } if (_selectedCollection != null) { _selectedCollection.CollectionChanged -= SelectedItems_CollectionChanged; _selectedCollection = null; } _indicatorView?.RemoveFromParent(); _indicatorView?.SetImageDrawable(null); _indicatorView?.SetImageBitmap(null); _indicatorView?.Dispose(); _indicatorView = null; } base.Dispose(disposing); }
public ListViewAdapter(Context context, AListView realListView, ListView listView) : base(context) { _context = context; _realListView = realListView; _listView = listView; _prototypicalCellByTypeOrDataTemplate = new Dictionary <object, Cell>(); if (listView.SelectedItem != null) { SelectItem(listView.SelectedItem); } var templatedItems = ((ITemplatedItemsView <Cell>)listView).TemplatedItems; templatedItems.CollectionChanged += OnCollectionChanged; templatedItems.GroupedCollectionChanged += OnGroupedCollectionChanged; listView.ItemSelected += OnItemSelected; realListView.OnItemClickListener = this; realListView.OnItemLongClickListener = this; MessagingCenter.Subscribe <ListViewAdapter>(this, Platform.CloseContextActionsSignalName, lva => CloseContextActions()); InvalidateCount(); }
/// <summary> /// OverrayするViewの初期設定 /// </summary> public void ViewCreate() { WindowManager = context.GetSystemService(WindowService).JavaCast <IWindowManager>(); // Viewからインフレータを作成する var layoutInflater = LayoutInflater.From(context); // レイアウトファイルから重ね合わせするViewを作成する view = layoutInflater.Inflate(Resource.Layout.listlayout, null); // 各要素を変数に格納,イベントのあるものはイベント登録 var closeButton = view.FindViewById <Button>(Resource.Id.closeButton); closeButton.Click += CloseButton_Click; var toSettingButtoun = view.FindViewById <Button>(Resource.Id.toSettingButton); toSettingButtoun.Click += ToSettingButtoun_Click; var addButton = view.FindViewById <Button>(Resource.Id.addButton); addButton.Click += AddButton_Click; listView = view.FindViewById <ListView>(Resource.Id.list_view); listView.ItemClick += ListView_ItemClick; editText = view.FindViewById <EditText>(Resource.Id.editText); // カスタムViewにアダプターをセット customMemoAdapter = new CustomMemoAdapter(this, customViewItem, getFontSize()); listView.Adapter = customMemoAdapter; // DBの値をアダプターにセットし反映 DepictionMemoListInit(); }
public DragListAdapter(Android.Widget.ListView listView, Xamarin.Forms.ListView element) { _listView = listView; // NOTE: careful, the listAdapter might not always be an IWrapperListAdapter _listAdapter = ((Android.Widget.IWrapperListAdapter)_listView.Adapter).WrappedAdapter; _element = element; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); _listView = FindViewById <Android.Widget.ListView>(Resource.Id.customListView); _liste = new List <Kisi> { new Kisi { Ad = "Murat", Soyad = "ÖNER", Yas = 25, Cinsiyet = "E" }, new Kisi { Ad = "Sakine", Soyad = "SALMANLI", Yas = 22, Cinsiyet = "K" }, new Kisi { Ad = "Hüseyin", Soyad = "TURAK", Yas = 24, Cinsiyet = "E" }, new Kisi { Ad = "Mustafa", Soyad = "ÖNER", Yas = 25, Cinsiyet = "E" } }; MyListViewAdapter adapter = new MyListViewAdapter(this, _liste); _listView.Adapter = adapter; _listView.ItemClick += _listView_ItemClick; _listView.ItemLongClick += _listView_ItemLongClick; }
/// <summary> /// Dispose the specified disposing. /// </summary> /// <returns>The dispose.</returns> /// <param name="disposing">If set to <c>true</c> disposing.</param> protected override void Dispose(bool disposing) { if (disposing) { _dialog?.Dispose(); _dialog = null; _listView?.Dispose(); _listView = null; _adapter?.Dispose(); _adapter = null; _context = null; if (_notifyCollection != null) { _notifyCollection.CollectionChanged -= ItemsSourceCollectionChanged; _notifyCollection = null; } if (_selectedCollection != null) { _selectedCollection.CollectionChanged -= SelectedItems_CollectionChanged; _selectedCollection = null; } _indicatorView?.RemoveFromParent(); _indicatorView?.SetImageDrawable(null); _indicatorView?.SetImageBitmap(null); _indicatorView?.Dispose(); _indicatorView = null; } base.Dispose(disposing); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.parsing_recepie); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar2); SetActionBar(toolbar); titleTextView = (EditText)FindViewById(Resource.Id.titleEdit); //imageView = (ImageView)FindViewById(Resource.Id.recipeImageView); ingredientsListView = (ListView)FindViewById(Resource.Id.ingredientsView); ingredients = new List <Ingredient>(); arrayAdapter = new ArrayAdapter <Ingredient>(this, Android.Resource.Layout.SimpleListItem1, ingredients); ingredientsListView.Adapter = arrayAdapter; ingredientsListView.ChoiceMode = ChoiceMode.Single; ingredientsListView.ItemClick += EditIngredientsButtonOnClick; //editIngredientsButton = (Button)FindViewById(Resource.Id.editIngerientsButton); //editIngredientsButton.Click += EditIngredientsButtonOnClick; methodTextWebView = (Xamarin.Forms.WebView)FindViewById(Resource.Id.recepiePreview); string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); documentsPath = Path.Combine(documentsPath, "recipes"); if (!Directory.Exists(documentsPath)) { Directory.CreateDirectory(documentsPath); } }
protected override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id) { var t = COUNTRIES[position]; Android.Widget.Toast.MakeText(this, t, Android.Widget.ToastLength.Short).Show(); Console.WriteLine("Clicked on " + t); }
protected override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id) { var t = l.Adapter.GetItem(position); Android.Widget.Toast.MakeText(this, t.ToString(), Android.Widget.ToastLength.Short).Show(); Console.WriteLine("Clicked on " + t); }
public DragListAdapter(AWidget.ListView listView, XListView element) { this.listView = listView; // NOTE: careful, the listAdapter might not always be an IWrapperListAdapter this.listAdapter = (listView.Adapter as IWrapperListAdapter)?.WrappedAdapter; this.element = element; }
protected override void OnCreate(Bundle savedInstanceState) { //Inicializacion de variables base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Datos); lista = FindViewById <Android.Widget.ListView>(Resource.Id.lista); nombres = new List <string>(); ruta = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/CameraScanner"; directorio = new File(ruta); archivos = directorio.ListFiles(); //Boton volver Android.Widget.Button volver = FindViewById <Android.Widget.Button>(Resource.Id.btn_volver); //Evento del boton volver volver.Click += Volver; //Boton flotante para borrado (No funcional/En pruebas) FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += PreguntaBorradoCompleto; //Ignora la URI de los archivos StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); CrearListado(); //Eventos del ListView lista.ItemClick += AbrirArchivo; lista.ItemLongClick += PreguntaBorradoSimple; }
public bool StartLeScan(Activity activity, Android.Widget.ListView textout) { if (isConnected) { return(binder.service.StartLeScan(activity, textout)); //return binder?.StartLeScan(activity, textout); } return(false); }
protected override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id) { var intent = new Intent(this, typeof(GameActivity)); intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop); intent.PutExtra("Type", sampleTypes[position].AssemblyQualifiedName); StartActivity(intent); }
public ListActionHelper(BookingsListAdapter listAdapter, ListView listView, Context ctx, bool isWorkshop) { this.listAdapter = listAdapter; this.listView = listView; this.ctx = ctx; this.isWorkshop = isWorkshop; InitOptions(); }
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.ListView> e) { base.OnElementChanged(e); nativeListView = this.Control; formsListView =(GemsListView) this.Element; nativeListView.Scroll += nativeListView_Scroll; }
public bool StartLeScan(Activity activity, Android.Widget.ListView textout) { if (blu != null) { return(blu.StartLeScan(activity, textout)); } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="T:AiForms.Renderers.Droid.SettingsViewAdapter"/> class. /// </summary> /// <param name="context">Context.</param> /// <param name="settingsView">Settings view.</param> /// <param name="listView">List view.</param> public SettingsViewAdapter(Context context, SettingsView settingsView, AListView listView) { _context = context; _settingsView = settingsView; _listView = listView; _listView.OnItemClickListener = this; _settingsView.ModelChanged += _settingsView_ModelChanged; }
void CreateDialog() { _listView = new AListView(_context); _listView.Focusable = false; _listView.DescendantFocusability = Android.Views.DescendantFocusability.AfterDescendants; _listView.SetPadding( (int)_context.ToPixels(_PickerCell.Padding.Left), (int)_context.ToPixels(_PickerCell.Padding.Top), (int)_context.ToPixels(_PickerCell.Padding.Right), (int)_context.ToPixels(_PickerCell.Padding.Bottom) ); _listView.SetDrawSelectorOnTop(true); _listView.ChoiceMode = _PickerCell.MaxSelectedNumber == 1 ? Android.Widget.ChoiceMode.Single : Android.Widget.ChoiceMode.Multiple; _adapter = new PickerAdapter(_context, _PickerCell, _listView); _listView.OnItemClickListener = _adapter; _listView.Adapter = _adapter; _adapter.CloseAction = () => { _dialog.GetButton((int)DialogButtonType.Positive).PerformClick(); }; if (_dialog == null) { using (var builder = new AlertDialog.Builder(_context)) { builder.SetTitle(_PickerCell.PageTitle); builder.SetView(_listView); builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { ClearFocus(); }); builder.SetPositiveButton(global::Android.Resource.String.Ok, (o, args) => { _adapter.DoneSelect(); UpdateSelectedItems(); _PickerCell.InvokeCommand(); ClearFocus(); }); _dialog = builder.Create(); } _dialog.SetCanceledOnTouchOutside(true); _dialog.SetOnDismissListener(this); _dialog.SetOnShowListener(this); _dialog.Show(); // Pending //var buttonTextColor = _PickerCell.AccentColor.IsDefault ? Xamarin.Forms.Color.Accent.ToAndroid() : _PickerCell.AccentColor.ToAndroid(); //_dialog.GetButton((int)DialogButtonType.Positive).SetTextColor(buttonTextColor); //_dialog.GetButton((int)DialogButtonType.Negative).SetTextColor(buttonTextColor); } }
public TableViewModelRenderer(Context context, AListView listView, TableView view) : base(context) { _view = view; Context = context; Controller.ModelChanged += (sender, args) => NotifyDataSetChanged(); listView.OnItemClickListener = this; listView.OnItemLongClickListener = this; }
public TableViewModelRenderer(Context context, AListView listView, TableView view) : base(context) { _view = view; Context = context; Controller.ModelChanged += OnModelChanged; listView.OnItemClickListener = this; listView.OnItemLongClickListener = this; }
public WifiReceiver(WifiManager wifiManager, Android.Widget.ListView wifiDeviceList, Context context, EditText pass, Button connectButton) { _wifiManager = wifiManager; _wifiDeviceListView = wifiDeviceList; _context = context; _password = pass; _connectButton = connectButton; AttachCallbacks(); ShowButtonConnectState(true, true); }
public ActionClickListener(BookingsListAdapter listAdapter, ListView listView, List <WorkshopPreview> list, ListActionHelper actionHelper, bool sorting, bool isWorkshop, Android.Views.View dialogView = null) : base() { this.listAdapter = listAdapter; this.listView = listView; this.list = list; this.actionHelper = actionHelper; this.sorting = sorting; this.isWorkshop = isWorkshop; this.dialogView = dialogView; }
public TableViewModelRenderer(Context context, AListView listView, TableView view) : base(context) { _view = view; Context = context; view.ModelChanged += (sender, args) => NotifyDataSetChanged(); listView.OnItemClickListener = this; listView.OnItemLongClickListener = this; }
// IDiscoveryEventHandler discoveryEventHandler = null; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.FindPrinters); printerListView = FindViewById <Android.Widget.ListView>(Resource.Id.printerListView); printerListView.ItemClick += PrinterListView_ItemClick;; // set up file utility for saving/loading settings fileUtility = new FileUtilImplementation(); SearchForPrinters(); }
public override Android.Views.View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.SpeakerDetailPage, container, false); _name = view.FindViewById <TextView>(Resource.Id.speakerdetail_name); _description = view.FindViewById <TextView>(Resource.Id.speakerdetail_description); _photo = view.FindViewById <ImageView>(Resource.Id.speakerdetail_photo); _sessions = view.FindViewById <Android.Widget.ListView>(Resource.Id.speakerdetail_sessions); return(view); }
public override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id) { // Launch viewer for specific vendor. ICursor cursor = (ICursor)mAdapter.GetItem(position); String vendorId = cursor.GetString(VendorsQuery.VENDOR_ID); Uri vendorUri = ScheduleContract.Vendors.BuildVendorUri(vendorId); ((BaseActivity)Activity).OpenActivityOrFragment(new Intent(Intent.ActionView, vendorUri)); ListView.SetItemChecked(position, true); mCheckedPosition = position; }
/// <summary> /// Ons the dismiss. /// </summary> /// <param name="dialog">Dialog.</param> public void OnDismiss(IDialogInterface dialog) { _dialog?.SetOnShowListener(null); _dialog?.SetOnDismissListener(null); _dialog?.Dispose(); _dialog = null; _adapter?.Dispose(); _adapter = null; _listView?.Dispose(); _listView = null; this.Selected = false; }
public bool OnDrag(Android.Views.View v, Android.Views.DragEvent e) { switch (e.Action) { case Android.Views.DragAction.Started: break; case Android.Views.DragAction.Entered: //v.SetBackgroundColor(Android.Graphics.Color.Blue); break; case Android.Views.DragAction.Exited: //v.SetBackgroundColor(Android.Graphics.Color.Transparent); break; case Android.Views.DragAction.Drop: //v.SetBackgroundColor(Android.Graphics.Color.Transparent); TemporalObject passObj = (TemporalObject)e.LocalState; Android.Views.View view = passObj.View; object passedItem = passObj.Item; Android.Widget.ListView oldParent = (Android.Widget.ListView)view.Parent; BaseAdapter sourceAdapter = (oldParent.Adapter is IWrapperListAdapter)?((IWrapperListAdapter)oldParent.Adapter).WrappedAdapter as BaseAdapter:((BaseAdapter)oldParent.Adapter); Android.Widget.ListView newParent = Control; BaseAdapter destinationAdapter = (oldParent.Adapter is IWrapperListAdapter)?((IWrapperListAdapter)newParent.Adapter).WrappedAdapter as BaseAdapter:((BaseAdapter)oldParent.Adapter); if (DragAndDropListViewRenderer.ListMap.ContainsKey(oldParent.Id.ToString()) && DragAndDropListViewRenderer.ListMap.ContainsKey(newParent.Id.ToString())) { var sourceList = (IList)DragAndDropListViewRenderer.ListMap [oldParent.Id.ToString()]; var destinationList = (IList)DragAndDropListViewRenderer.ListMap [newParent.Id.ToString()]; if (sourceList.Contains(passedItem)) { sourceList.Remove(passedItem); destinationList.Add(passedItem); } destinationAdapter.NotifyDataSetChanged(); sourceAdapter.NotifyDataSetChanged(); } break; case Android.Views.DragAction.Ended: break; } return(true); }
public ListViewAdapter(Context context, AListView realListView, ListView listView) : base(context) { _context = context; _realListView = realListView; _listView = listView; if (listView.SelectedItem != null) SelectItem(listView.SelectedItem); listView.TemplatedItems.CollectionChanged += OnCollectionChanged; listView.TemplatedItems.GroupedCollectionChanged += OnGroupedCollectionChanged; listView.ItemSelected += OnItemSelected; realListView.OnItemClickListener = this; realListView.OnItemLongClickListener = this; MessagingCenter.Subscribe<Platform>(this, Platform.CloseContextActionsSignalName, p => CloseContextAction()); }
public ActionClickListener(BookingsListAdapter listAdapter, ListView listView, List<WorkshopPreview> list, ListActionHelper actionHelper, bool sorting, bool isWorkshop, Android.Views.View dialogView = null) : base() { this.listAdapter = listAdapter; this.listView = listView; this.list = list; this.actionHelper = actionHelper; this.sorting = sorting; this.isWorkshop = isWorkshop; this.dialogView = dialogView; }
private void setupWidgets() { mBuyButton = (Button)FindViewById(Resource.Id.buy_button); mBuyButton.Enabled = false; mBuyButton.Click += delegate { BillingController.requestPurchase(this, mSku, true /* confirm */); }; mSelectItemSpinner = (Spinner)FindViewById(Resource.Id.item_choices); mCatalogAdapter = new CatalogAdapter(this, CatalogEntry.CATALOG); mSelectItemSpinner.Adapter = mCatalogAdapter; mSelectItemSpinner.ItemSelected += delegate(object sender, ItemEventArgs e) { mSku = CatalogEntry.CATALOG[e.Position].sku; }; mOwnedItemsTable = (ListView)FindViewById(Resource.Id.owned_items); }
public BaseTableViewModelRenderer(Context context, ListView listView, Xamarin.Forms.TableView view) : base(context, listView, view) { }