/// <summary> /// Gets the ListView items. /// </summary> /// <returns> /// The get items. /// </returns> private IList<IDictionary<string, object>> _GetItems() { var item1 = new JavaDictionary<string, object>(); item1.Add(TitleKey, "FileExplorer"); item1.Add(DetailsKey, "12312"); var item2 = new JavaDictionary<string, object>(); item2.Add(TitleKey, "Author"); item2.Add(DetailsKey, "Alexander Matsibarov (macasun)"); var item3 = new JavaDictionary<string, object>(); item3.Add(TitleKey, "Email"); item3.Add(DetailsKey, "*****@*****.**"); var item4 = new JavaDictionary<string, object>(); item4.Add(TitleKey, "Copyrights"); item4.Add(DetailsKey, "2013"); var item5 = new JavaDictionary<string, object>(); item5.Add(TitleKey, "Application description"); item5.Add(DetailsKey, "FileExplorer application for iOS and Android"); var coll = new JavaList<IDictionary<string, object>>(); coll.Add(item1); coll.Add(item2); coll.Add(item3); coll.Add(item4); coll.Add(item5); return coll; }
private IList<IDictionary<string, object>> GetListValues() { IList<IDictionary<string, object>> values = new List<IDictionary<string, object>>(); int length = mMenuText.Length; for (int i = 0; i < length; i++) { IDictionary<string, object> v = new JavaDictionary<string, object>(); v.Add("name", mMenuText[i]); v.Add("desc", mMenuSummary[i]); values.Add(v); } return values; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_autocomplete); // Highlight sample XuniAutoCompleteTextView highLightAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_highlight); //highLightAutoComplete.SetItemsSource(DropDownItem.country); highLightAutoComplete.DisplayMemberPath = "Name"; highLightAutoComplete.ItemsSource = DropDownItem.getList(); highLightAutoComplete.MatchType =MatchType.Contains; highLightAutoComplete.Threshold=1; // Delay sample XuniAutoCompleteTextView delayAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_delay); delayAutoComplete.DisplayMemberPath = "Name"; delayAutoComplete.ItemsSource=DropDownItem.getList(); delayAutoComplete.MatchType = MatchType.Contains; delayAutoComplete.Threshold = 1; delayAutoComplete.Delay = 1500; // Delay 1500 milliseconds. delayAutoComplete.SetWidth(20); // Custom sample System.Collections.Generic.IDictionary<Integer, string> viewToDataMap = new JavaDictionary<Integer, string>(); viewToDataMap.Add(Integer.ValueOf(Resource.Id.imageView1), "flag"); viewToDataMap.Add(Integer.ValueOf(Resource.Id.textView1), "Name"); XuniAutoCompleteTextView customAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_custom); customAutoComplete.SetDropDownItemLayoutId(Resource.Layout.custom_item); // Custom drop down item. customAutoComplete.SetDropDownItemTextViewId(Resource.Id.textView1); customAutoComplete.ViewDataBinderMap = viewToDataMap; IList<object> list = DropDownItem.getList(); customAutoComplete.ItemsSource = list; customAutoComplete.DisplayMemberPath = "Name"; customAutoComplete.MatchType = MatchType.Contains; customAutoComplete.Threshold = 1; // custom filter sample filterAutoComplete = (XuniAutoCompleteTextView)this.FindViewById(Resource.Id.autocomplete_filter); filterAutoComplete.ItemsSource = DropDownItem.getList(); filterAutoComplete.DisplayMemberPath = "Name"; filterAutoComplete.Threshold=1; filterAutoComplete.FilteringEvent += filterAutoComplete_FilteringEvent; }
public XmlVocabFileParser (Stream xmlStream) { // SimpleAdapter requires a list of JavaDictionary<string,object> objects vocabList = new List<IDictionary<string, object>>(); /* //for testing var item1 = new JavaDictionary<string, object> (); item1.Add (SPANISH, "mono"); item1.Add (ENGLISH, "monkey"); item1.Add ("partOfSpeech", "noun"); vocabList.Add(item1); var item2 = new JavaDictionary<string, object> (); item2.Add (SPANISH, "agua"); item2.Add (ENGLISH, "water"); item2.Add (ENGLISH, "noun"); vocabList.Add(item2); var item3 = new JavaDictionary<string, object> (); item3.Add (SPANISH, "saltar"); item3.Add (ENGLISH, "to jump"); item3.Add (ENGLISH, "verb"); vocabList.Add(item3); */ // Parse the xml file and fill the list of JavaDictionary objects with vocabulary data using (XmlReader reader = XmlReader.Create (xmlStream)) { JavaDictionary<string, object> word = null; while (reader.Read ()) { // Only detect start elements. if (reader.IsStartElement ()) { // Get element name and switch on it. switch (reader.Name) { case WORD: // New word word = new JavaDictionary<string, object> (); break; case SPANISH: // Add spanish word if (reader.Read () && word != null) { word.Add (SPANISH, reader.Value.Trim ()); } break; case ENGLISH: // Add english word if (reader.Read () && word != null) { word.Add (ENGLISH, reader.Value.Trim ()); } break; case POS: // Add part of speech if (reader.Read () && word != null) { word.Add (ENGLISH, reader.Value.Trim ()); } break; } } else if (reader.Name == WORD) { // reached </word> vocabList.Add(word); word = null; } } } }
protected void AddItem (List<IDictionary<String, Object>> data, String name, Intent intent) { IDictionary<String, Object> temp = new JavaDictionary<String, Object> (); temp.Add ("title", name); temp.Add ("intent", intent); data.Add (temp); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.SoundFontDetails); var sf = Intent.GetStringExtra ("soundfont"); var model = ApplicationModel.Instance; var mod = model.Database.Modules.First (m => m.Name == sf); var sfFile = model.Files.FirstOrDefault (p => p.Value == mod.Name).Key; if (!File.Exists (sfFile)) { Toast.MakeText (this, string.Format ("SoundFont file '{0}' was not found. Details not shown", sfFile), ToastLength.Long).Show (); } else { var sf2 = new SoundFont (new MemoryStream (File.ReadAllBytes (sfFile))); var infoList = new JavaList<IDictionary<string,object>> (); var map = mod.Instrument.Maps.First (); var labels = new string [] {"BankName", "FileName", "Author", "Copyright", "Comments", "Created", "SFVersion", "ROMVersion", "WaveTableEngine", "Tools", "TargetProduct", "DataROM"}; var values = new string [] { mod.Name, sfFile, sf2.FileInfo.Author, sf2.FileInfo.Copyright, sf2.FileInfo.Comments, sf2.FileInfo.SoundFontVersion == null ? null : string.Format ("{0}.{1}", sf2.FileInfo.SoundFontVersion.Major, sf2.FileInfo.SoundFontVersion.Minor), sf2.FileInfo.ROMVersion == null ? null : string.Format ("{0}.{1}", sf2.FileInfo.ROMVersion.Major, sf2.FileInfo.ROMVersion.Minor), sf2.FileInfo.CreationDate, sf2.FileInfo.WaveTableSoundEngine, sf2.FileInfo.Tools, sf2.FileInfo.TargetProduct, sf2.FileInfo.DataROM, }; for (int i = 0; i < labels.Length; i++) { var items = new JavaDictionary<string,object> (); items.Add ("text1", labels [i]); items.Add ("text2", values [i]); infoList.Add (items); } var bankList = new JavaList<IDictionary<string,object>> (); foreach (var p in map.Programs) { foreach (var b in p.Banks) { var items = new JavaDictionary<string,object> (); items.Add ("text1", string.Format ("{0:D03}.{1:D03}.{2:D03}", p.Index, b.Msb, b.Lsb)); items.Add ("text2", b.Name); bankList.Add (items); } } var fromKeys = new string [] {"text1", "text2"}; var toIds = new int [] { Resource.Id.soundFontDetailFileInfoLabel, Resource.Id.soundFontDetailFileInfoValue }; var lvfi = FindViewById<ListView> (Resource.Id.soundFontDetailsFileInfo); lvfi.Adapter = new SimpleAdapter (this, infoList, Resource.Layout.SoundFontFileInfoItem, fromKeys, toIds); var lvbanks = FindViewById<ListView> (Resource.Id.soundFontDetailsBankList); lvbanks.Adapter = new SimpleAdapter (this, bankList, Resource.Layout.SoundFontFileInfoItem, fromKeys, toIds); } }
//LOAD LISTA E PÁGINA public async void LoadContent() { aeho = await Get(); List<Models.Restaurante> list = JsonConvert.DeserializeObject<List<Models.Restaurante>>(aeho); IList<IDictionary<string, object>> dados = new List<IDictionary<string, object>>(); foreach (Models.Restaurante r in list) { IDictionary<string, object> dado = new JavaDictionary<string, object>(); dado.Add("Id", r.Id.ToString()); dado.Add("Descricao", r.Descricao); dados.Add(dado); } string[] from = new String[] { "Id", "Descricao" }; int[] to = new int[] { Resource.Id.idRest, Resource.Id.descRest }; int layout = Resource.Layout.ListItem; EditText txtid = FindViewById<EditText>(Resource.Id.txtId); EditText txtdesc = FindViewById<EditText>(Resource.Id.txtDescricao); // ArrayList for data row // SimpleAdapter mapping static data to views in xml file SimpleAdapter adapter = new SimpleAdapter(this, dados, layout, from, to); ListView.Adapter = adapter; }
protected IList<IDictionary<string, object>> getData(string prefix) { IList<IDictionary<string, object>> myData = new List<IDictionary<string, object>>(); Android.Content.Intent mainIntent = new Intent(Android.Content.Intent.ActionMain, null); mainIntent.AddCategory("com.jakewharton.android.viewpagerindicator.sample.SAMPLE"); Android.Content.PM.PackageManager pm = this.PackageManager; IList<ResolveInfo> list = pm.QueryIntentActivities(mainIntent, 0); if (null == list) return myData; string[] prefixPath; string prefixWithSlash = prefix; if (prefix.Equals("")) { prefixPath = null; } else { prefixPath = prefix.Split(new char[] { '/' }); prefixWithSlash = prefix + "/"; } int len = list.Count; IDictionary<string, bool> entries = new JavaDictionary<string, bool>(); for (int i = 0; i < len; i++) { ResolveInfo info = list[i]; string labelSeq = info.LoadLabel(pm); string label = labelSeq != null ? labelSeq.ToString() : info.ActivityInfo.Name; if (prefixWithSlash.Length == 0 || label.StartsWith(prefixWithSlash)) { string[] labelPath = label.Split(new char[] { '/' }); string nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.Length]; if ((prefixPath != null ? prefixPath.Length : 0) == labelPath.Length - 1) { addItem(myData, nextLabel, activityIntent( info.ActivityInfo.ApplicationInfo.PackageName, info.ActivityInfo.Name)); } else { if (entries[nextLabel] == false) { addItem(myData, nextLabel, browseIntent(prefix.Equals("") ? nextLabel : prefix + "/" + nextLabel)); entries.Add(nextLabel, true); } } } } //Collections.sort(myData, NAME_COMPARATOR); return myData; }