private void RegisterResources(Type layoutClassType, JavaDictionary <string, int> container) { foreach (var field in layoutClassType.GetFields()) { var name = CreateName(field.Name); if (container.ContainsKey(name)) { container.Remove(name); } container.Add(name, field.GetValue(null)); } }
public int ResolveMenu(Type type) { while (type != null) { var name = CreateName(type.Name); if (Menus.ContainsKey(name)) { return(Menus[name]); } type = type.BaseType; } return(-1); }
protected List <IDictionary <String, Object> > GetData(string prefix) { List <IDictionary <String, Object> > myData = new List <IDictionary <String, Object> > (); Intent mainIntent = new Intent(Intent.ActionMain, null); mainIntent.AddCategory("com.pynting.akvaapp.SUPPORT13_SAMPLE_CODE"); PackageManager pm = PackageManager; var list = pm.QueryIntentActivities(mainIntent, 0); if (null == list) { return(myData); } String[] prefixPath; String prefixWithSlash = prefix; if (prefix == "") { prefixPath = null; } else { prefixPath = prefix.Split('/'); prefixWithSlash = prefix + "/"; } int len = list.Count(); IDictionary <String, Boolean> entries = new JavaDictionary <String, Boolean> (); 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.ContainsKey(nextLabel)) { AddItem(myData, nextLabel, BrowseIntent(prefix == "" ? nextLabel : prefix + "/" + nextLabel)); entries [nextLabel] = true; } } } } myData.Sort(sDisplayNameComparator); return(myData); }