コード例 #1
0
        public override void Start()
        {
            base.Start();


            var texts = new String[1000];
            var numbers = new String[texts.Length];
            for (int i = 0; i < texts.Length; i++)
            {
                texts[i] = "Ivan Ivanov" + i;
                numbers[i] = "+375(55)1112222 " + i.ToString(CultureInfo.InvariantCulture);
            }



            data = new List<IDictionary<String, Object>>(texts.Length);
            for (int i = 0; i < texts.Length; i++)
            {
                var m = new JavaDictionary<String, Object>();
                m[ATTRIBUTE_NAME_NAME] = texts[i];
                m[ATTRIBUTE_NAME_PHONE] = numbers[i];
                m[ATTRIBUTE_NAME_IMAGE] = i % 2 == 0 ? Resource.Drawable.xamarin : Resource.Drawable.ic_launcher;
                data.Add(m);




            }


            RaisePropertyChanged(() => Data);

            String[] from = { ATTRIBUTE_NAME_NAME, ATTRIBUTE_NAME_PHONE, ATTRIBUTE_NAME_IMAGE };
            int[] to = { Resource.Id.tvName, Resource.Id.tvNumber, Resource.Id.tvImage };
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
 IDictionary<string, object> ToDictionaryItem(GoogleMusicSong song)
 {
     var d = new JavaDictionary<string,object> ();
     d ["title"] = song.Title;
     d ["artist"] = song.Artist;
     d ["time"] = TimeSpan.FromMilliseconds (song.Duration);
     return d;
 }
コード例 #4
0
		protected JavaList<IDictionary<String, Object>> GetData (String prefix)
		{
			var myData = new List<IDictionary<String, Object>> ();

			Intent mainIntent = new Intent (Intent.ActionMain, null);
			mainIntent.AddCategory (SampleCategory);

			PackageManager pm = PackageManager;
			IList<ResolveInfo> list = (IList<ResolveInfo>) pm.QueryIntentActivities (mainIntent, PackageInfoFlags.Activities);

			if (null == list)
				return new JavaList<IDictionary<String, Object>> (myData);

			String[] prefixPath;
			String prefixWithSlash = prefix;

			if (prefix.Equals ("")) {
				prefixPath = null;
			} else {
				prefixPath = prefix.Split ('/');
				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];
				var labelSeq = info.LoadLabel (pm);
				String label = labelSeq != null
					? labelSeq.ToString ()
						: info.ActivityInfo.Name;

				if (prefixWithSlash.Length  == 0 || label.StartsWith (prefixWithSlash)) {

					String[] labelPath = label.Split ('/');

					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] == null) {
							AddItem (myData, nextLabel, BrowseIntent (prefix.Equals ("") ? nextLabel : prefix + "/" + nextLabel));
							entries [nextLabel] = true;
						}
					}
				}
			}

			myData.Sort (sDisplayNameComparator);

			return new JavaList<IDictionary<String, Object>> (myData);
		}
コード例 #5
0
		public static IntPtr ToLocalJniHandle (IDictionary dictionary)
		{
			if (dictionary == null)
				return IntPtr.Zero;

			var d = dictionary as JavaDictionary;
			if (d != null)
				return JNIEnv.ToLocalJniHandle (d);

			using (d = new JavaDictionary (dictionary))
				return JNIEnv.ToLocalJniHandle (d);
		}
コード例 #6
0
 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;
 }
コード例 #7
0
		public static IDictionary FromJniHandle (IntPtr handle, JniHandleOwnership transfer)
		{
			if (handle == IntPtr.Zero)
				return null;

			IJavaObject inst = (IJavaObject) Java.Lang.Object.PeekObject (handle);
			if (inst == null)
				inst = new JavaDictionary (handle, transfer);
			else
				JNIEnv.DeleteRef (handle, transfer);

			return (IDictionary) inst;
		}
コード例 #8
0
        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;   
        
        }
コード例 #9
0
        public static IDictionary FromJniHandle(IntPtr handle, JniHandleOwnership transfer)
        {
            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            IJavaObject inst = Java.Lang.Object.PeekObject(handle);

            if (inst == null)
            {
                inst = new JavaDictionary(handle, transfer);
            }
            else
            {
                JNIEnv.DeleteRef(handle, transfer);
            }

            return((IDictionary)inst);
        }
コード例 #10
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Main);

			var texts = new String[1000];
            var numbers = new String[texts.Length];
			for (int i = 0; i < texts.Length; i++)
            {
                texts[i] = "Ivan Ivanov" + i;
                numbers[i] = "+375(55)1112222 " + i.ToString(CultureInfo.InvariantCulture);
            }

            var data = new List<IDictionary<String, Object>>(texts.Length);
		    for (int i = 0; i < texts.Length; i++)
            {
                var m = new JavaDictionary<String, Object>();
                m[ATTRIBUTE_NAME_NAME] = texts[i];
                m[ATTRIBUTE_NAME_PHONE] = numbers[i];
                m[ATTRIBUTE_NAME_IMAGE] = i % 2 == 0 ? Resource.Drawable.xamarin : Resource.Drawable.ic_launcher;
                data.Add(m);
            }

            String[] from = { ATTRIBUTE_NAME_NAME, ATTRIBUTE_NAME_PHONE, ATTRIBUTE_NAME_IMAGE };
            int[] to = { Resource.Id.tvName, Resource.Id.tvNumber, Resource.Id.tvImage };

            var adapter = new SimpleAdapter(this, data, Resource.Layout.item_row, from, to);
            var list = (ListView)FindViewById(Resource.Id.list);
            list.Adapter = adapter;

            //subscribing from axml directly doesn't work ;(
            FindViewById<Button>(Resource.Id.test1).Click += Test1;
            FindViewById<Button>(Resource.Id.test2).Click += Test2;
            FindViewById<Button>(Resource.Id.test4).Click += Test3;
		}
コード例 #11
0
        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;
        }       
コード例 #12
0
 public DictionaryEnumerator(JavaDictionary owner)
 {
     simple_enumerator = (owner as IEnumerable).GetEnumerator ();
 }
コード例 #13
0
 public DictionaryEnumerator(JavaDictionary owner)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
		protected void AddItem (IList<IDictionary<String, Object>> data, string name, Intent intent)
		{
			var temp = new JavaDictionary<string, Object> ();
			temp ["title"] = name;
			temp ["intent"] = intent;
			data.Add (temp);
		}
コード例 #15
0
        /// <summary>
        /// Allows a session to tag a particular event as having occurred, and optionally attach a collection of attributes to it. For
        /// example, if a view has three buttons, it might make sense to tag each button with the name of the button which was clicked.
        /// For another example, in a game with many levels it might be valuable to create a new tag every time the user gets to a new
        /// level in order to determine how far the average user is progressing in the game. <br>
        /// <strong>Tagging Best Practices</strong>
        /// <ul>
        /// <li>DO NOT use tags to record personally identifiable information.</li>
        /// <li>The best way to use tags is to create all the tag strings as predefined constants and only use those. This is more
        /// efficient and removes the risk of collecting personal information.</li>
        /// <li>Do not set tags inside loops or any other place which gets called frequently. This can cause a lot of data to be stored
        /// and uploaded.</li>
        /// </ul>
        /// <br>
        /// </summary>
        /// <param name="event">The name of the event which occurred.</param>
        /// <param name="attributes">The collection of attributes for this particular event. If this parameter is null or empty, then calling
        ///            this method has the same effect as calling {@link #tagEvent(String)}. This parameter may not contain null or
        ///            empty keys or values.
        public void TagEvent(String @event, IDictionary<String, String> attributes)
        {
            if (!IsEnabled)
                return;

            if (String.IsNullOrWhiteSpace(@event))
                throw new ArgumentNullException("event");

            if (null == attributes)
                throw new ArgumentNullException("attributes");

            if (id_tagEvent_Ljava_lang_StringLjava_util_Map == IntPtr.Zero)
            {
                id_tagEvent_Ljava_lang_StringLjava_util_Map = JNIEnv.GetMethodID (class_ref, "tagEvent", "(Ljava/lang/String;Ljava/util/Map;)V");
            }

            var attributesJava = new JavaDictionary<String, String>(attributes);

            var ptrEvent = JNIEnv.NewString(@event);

            JNIEnv.CallVoidMethod (base.Handle, id_tagEvent_Ljava_lang_StringLjava_util_Map, new JValue(ptrEvent), new JValue(attributesJava));

            JNIEnv.DeleteLocalRef(ptrEvent);
        }
コード例 #16
0
		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;
					}
						
				}
			}
		
		}
コード例 #17
0
		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);
		}
コード例 #18
0
        //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;
        }
コード例 #19
0
 public DictionaryEnumerator(JavaDictionary owner)
 {
     simple_enumerator = (owner as IEnumerable).GetEnumerator();
 }
コード例 #20
0
        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);
            }
        }
コード例 #21
0
ファイル: FlurryClient.cs プロジェクト: khellang/Solvberget
 public void LogEvent(string eventName, Dictionary<string, string> parameters)
 {
     JavaDictionary<string, string> actualParams = new JavaDictionary<string, string>(parameters);
     ExceptionSafe(() => JNIEnv.CallStaticVoidMethod(_flurryClass, _flurryLogEventMap, new JValue(new Java.Lang.String(eventName)), new JValue(actualParams)));
 }
コード例 #22
0
        public static IDictionary FromJniHandle(IntPtr handle, JniHandleOwnership transfer)
        {
            if (handle == IntPtr.Zero)
                return null;

            IJavaObject inst = Java.Lang.Object.PeekObject (handle);
            if (inst == null)
                inst = new JavaDictionary (handle, transfer);
            else
                JNIEnv.DeleteRef (handle, transfer);

            return (IDictionary) inst;
        }
コード例 #23
0
        public static IntPtr ToLocalJniHandle(IDictionary dictionary)
        {
            if (dictionary == null)
                return IntPtr.Zero;

            var d = dictionary as JavaDictionary;
            if (d != null)
                return JNIEnv.ToLocalJniHandle (d);

            using (d = new JavaDictionary (dictionary))
                return JNIEnv.ToLocalJniHandle (d);
        }