Example #1
0
        internal static void CustomSelectListCtrlPostfix(CustomSelectListCtrl __instance, GameObject obj)
        {
            if (null == obj)
            {
                return;
            }
            CustomSelectInfoComponent component = obj.GetComponent <CustomSelectInfoComponent>();

            if (null == component)
            {
                return;
            }
            if (!component.tgl.interactable)
            {
                return;
            }

            if (__instance.onChangeItemFunc != null)
            {
                if (component.info.index >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo Info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)component.info.category, component.info.index);
                    if (Info != null)
                    {
                        BepInEx.Logging.Logger.LogWarning($"[CustomSelectListCtrlPostfix][{Info.GUID}][{(int) Info.CategoryNo}][{Info.CategoryNo}][{Info.Slot}][{Info.LocalSlot}]");
                    }
                }
                else
                {
                    BepInEx.Logging.Logger.LogWarning($"[CustomSelectListCtrlPostfix][hardmod][{(ChaListDefine.CategoryNo) component.info.category}][{component.info.category}][{component.info.index}]");
                }
            }
        }
            public override View GetView(int position, View convertView, ViewGroup parent)
            {
                CheckableLayout l;
                ImageView       i;

                if (convertView == null)
                {
                    i = new ImageView(self);
                    i.SetScaleType(ImageView.ScaleType.FitCenter);
                    i.LayoutParameters = new ViewGroup.LayoutParams(50, 50);
                    l = new CheckableLayout(self);
                    l.LayoutParameters = new GridView.LayoutParams(GridView.LayoutParams.WrapContent,
                                                                   GridView.LayoutParams.WrapContent);
                    l.AddView(i);
                }
                else
                {
                    l = (CheckableLayout)convertView;
                    i = (ImageView)l.GetChildAt(0);
                }

                ResolveInfo info = ((Grid3)self).mApps[position];

                i.SetImageDrawable(info.ActivityInfo.LoadIcon(self.PackageManager));

                return(l);
            }
Example #3
0
            public CustomSelectListCtrlEventArgs(GameObject _gameObject)
            {
                CustomSelectInfoComponent _cmp = _gameObject.GetComponent <CustomSelectInfoComponent>();

                if (_cmp == null || !_cmp.tgl.interactable)
                {
                    return;
                }

                if (_cmp.info.index >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo _info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)_cmp.info.category, _cmp.info.index);
                    if (_info != null)
                    {
                        CategoryNo  = (int)_info.CategoryNo;
                        GUID        = _info.GUID;
                        ItemID      = _info.LocalSlot;
                        LocalItemID = _info.Slot;
                    }
                }
                else
                {
                    CategoryNo  = _cmp.info.category;
                    ItemID      = _cmp.info.index;
                    LocalItemID = -1;
                }
            }
Example #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            _numInput = FindViewById <EditText>(Resource.Id.numInput);

            _btnSetBadge        = FindViewById <Button>(Resource.Id.btnSetBadge);
            _btnSetBadge.Click += Button_Click;

            _removeBadgeBtn        = FindViewById <Button>(Resource.Id.btnRemoveBadge);
            _removeBadgeBtn.Click += RemoveBadgeBtn_Click;

            //find the home launcher Package
            var intent = new Intent(Intent.ActionMain);

            intent.AddCategory(Intent.CategoryHome);
            ResolveInfo resolveInfo        = PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);
            var         currentHomePackage = resolveInfo.ActivityInfo.PackageName;

            TextView textViewHomePackage = FindViewById <TextView>(Resource.Id.textViewHomePackage);

            textViewHomePackage.Text = "launcher:" + currentHomePackage;
        }
Example #5
0
        /// <summary>
        /// 在Android5.0及以上系统中需要显式声明Intent才能启动Service
        /// </summary>
        /// <param name="context"></param>
        /// <param name="implicitIntent"></param>
        /// <returns></returns>
        private Intent CreateExplicitFromImplicitIntent(Context context, Intent implicitIntent)
        {
            PackageManager pm = context.PackageManager;

            //查出所有的能匹配这个隐式意图的服务列表
            var resolveInfo = pm.QueryIntentServices(implicitIntent, 0);

            if (resolveInfo == null || resolveInfo.Count != 1)
            {
                return(null);
            }

            ResolveInfo serviceInfo = resolveInfo[0];

            //取出包名
            string packageName = serviceInfo.ServiceInfo.PackageName;

            //取出服务名
            string className = serviceInfo.ServiceInfo.Name;

            //用包名和服务名来创建一个ComponentName对象
            ComponentName component = new ComponentName(packageName, className);

            //拿隐式意图对象implicitIntent作为构造参数,来创建一个新的显示的意图
            Intent explicitIntent = new Intent(implicitIntent);

            //设置显示意图的组件名对象
            explicitIntent.SetComponent(component);

            return(explicitIntent);
        }
Example #6
0
        private void TryNewMiuiBadge(Context context, int badgeCount)
        {
            if (_resolveInfo == null)
            {
                var intent = new Intent(Intent.ActionMain);
                intent.AddCategory(Intent.CategoryHome);
                _resolveInfo = context.PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);
            }

            if (_resolveInfo != null)
            {
                NotificationManager mNotificationManager =
                    (NotificationManager)context.GetSystemService(Context.NotificationService);
                Notification.Builder builder = new Notification.Builder(context)
                                               .SetContentTitle("")
                                               .SetContentText("")
                                               .SetSmallIcon(_resolveInfo.IconResource);
                Notification notification = builder.Build();
                try
                {
                    Field  field             = notification.Class.GetDeclaredField("extraNotification");
                    Object extraNotification = field.Get(notification);
                    Method method            = extraNotification.Class.GetDeclaredMethod("setMessageCount");
                    method.Invoke(extraNotification, badgeCount);
                    mNotificationManager.Notify(0, notification);
                }
                catch (Exception e)
                {
                    throw new ShortcutBadgeException($"not able to set badge {e.Message}");
                }
            }
        }
Example #7
0
        public override ResolveResponseInfo Resolve(ResolveInfo resolveInfo)
        {
            ResolveResponseInfo rri = new ResolveResponseInfo();

            if (ControlShape)
            {
                lock (mesh_lock)
                {
                    if (nodes_count == 0)
                    {
                        rri.Addresses = new PeerNodeAddress [0];
                    }
                    else if (unique_node != null)
                    {
                        Node n = unique_node;
                        rri.Addresses = new PeerNodeAddress [] { n.Address };
                    }

                    Console.WriteLine("Resolve: {0}", resolveInfo.MeshId);
                }
            }
            else
            {
                rri = base.Resolve(resolveInfo);
            }

            return(rri);
        }
            internal static bool CheckItemIDHook(int category, int id, ref byte __result)
            {
                if (id >= UniversalAutoResolver.BaseSlotID)
                {
                    {
                        ResolveInfo Info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)category, id);

                        if (CheckItemList.TryGetValue(Info.GUID, out var x))
                        {
                            if (x.TryGetValue(category, out var y))
                            {
                                if (y.Contains(Info.Slot))
                                {
                                    __result = 2; //Not new
                                    return(false);
                                }
                            }
                        }

                        __result = 1; //New
                        return(false);
                    }
                }
                return(true);
            }
Example #9
0
        private static Intent CreateExplicitFromImplicitIntent(Context context, Intent implicitIntent)
        {
            // Retrieve all services that can match the given intent
            PackageManager      pm          = context.PackageManager;
            IList <ResolveInfo> resolveInfo = pm.QueryIntentServices(implicitIntent, 0);

            // Make sure only one match was found
            if (resolveInfo == null || resolveInfo.Count != 1)
            {
                return(null);
            }

            // Get component info and create ComponentName
            ResolveInfo   serviceInfo = resolveInfo[0];
            string        packageName = serviceInfo.ServiceInfo.PackageName;
            string        className   = serviceInfo.ServiceInfo.Name;
            ComponentName component   = new ComponentName(packageName, className);

            // Create a new intent. Use the old one for extras and such reuse
            Intent explicitIntent = new Intent(implicitIntent);

            // Set the component to be explicit
            explicitIntent.SetComponent(component);

            return(explicitIntent);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.main);
            mEditText        = FindViewById <EditText>(Resource.Id.edit);
            mConnectButton   = FindViewById <Button>(Resource.Id.connect_button);
            mWarmupButton    = FindViewById <Button>(Resource.Id.warmup_button);
            mMayLaunchButton = FindViewById <Button>(Resource.Id.may_launch_button);
            mLaunchButton    = FindViewById <Button>(Resource.Id.launch_button);
            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner);

            mEditText.RequestFocus();
            mConnectButton.SetOnClickListener(this);
            mWarmupButton.SetOnClickListener(this);
            mMayLaunchButton.SetOnClickListener(this);
            mLaunchButton.SetOnClickListener(this);
            mMediaPlayer = MediaPlayer.Create(this, Resource.Raw.amazing_grace);

            packagesSupportingCustomTabs =
                new List <KeyValuePair <string, string> >()
                //PackageManagerHelper.GetPackageNameToUse.PackagesSupportingCustomTabs.ToList()
            ;

            Intent activityIntent = new Intent
                                    (
                //
                Intent.ActionView,
                Android.Net.Uri.Parse("https://holisticware.net")
                                    );

            PackageManager      pm = PackageManager;
            IList <ResolveInfo> resolvedActivityList = null;

            resolvedActivityList = pm.QueryIntentActivities
                                   (
                activityIntent,
                Android.Content.PM.PackageInfoFlags.MatchAll
                                   );
            foreach (ResolveInfo info in resolvedActivityList)
            {
                Intent serviceIntent = new Intent();
                serviceIntent.SetAction("android.support.customtabs.action.CustomTabsService");
                serviceIntent.SetPackage(info.ActivityInfo.PackageName);
                ResolveInfo ri = pm.ResolveService(serviceIntent, 0);
                if (ri != null)
                {
                    string k = info.LoadLabel(pm).ToString();
                    string v = info.ActivityInfo.PackageName;
                    packagesSupportingCustomTabs.Add(new KeyValuePair <string, string>(k, v));
                }
            }

            SetupSpinnerAdapterJavaStyle(spinner);

            mLogImportance.Run();

            return;
        }
Example #11
0
 public void StopResolve()
 {
     if (Session != null)
     {
         resolveInfo = null;
         resolveOn   = false;
     }
 }
 public void StopResolve()
 {
     if (Session != null)
     {
         resolveInfo          = null;
         Session.FrameChange -= AutoResolve;
     }
 }
 public void StartAutoResolve(float resolveRate)
 {
     if (Session != null && resolveInfo == null)
     {
         autoResolveRate      = resolveRate;
         resolveInfo          = new ResolveInfo();
         Session.FrameChange += AutoResolve;
     }
 }
Example #14
0
        private void UnblacklistMod(string guid)
        {
            List <CustomSelectInfo> lstSelectInfo = (List <CustomSelectInfo>)Traverse.Create(CustomSelectListCtrlInstance).Field("lstSelectInfo").GetValue();

            bool changeFilter = false;

            for (var i = 0; i < lstSelectInfo.Count; i++)
            {
                CustomSelectInfo customSelectInfo = lstSelectInfo[i];
                if (customSelectInfo.index >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)customSelectInfo.category, customSelectInfo.index);
                    if (info != null && info.GUID == guid)
                    {
                        if (!Blacklist.ContainsKey(info.GUID))
                        {
                            Blacklist[info.GUID] = new Dictionary <int, HashSet <int> >();
                        }
                        if (!Blacklist[info.GUID].ContainsKey(customSelectInfo.category))
                        {
                            Blacklist[info.GUID][customSelectInfo.category] = new HashSet <int>();
                        }
                        Blacklist[info.GUID][customSelectInfo.category].Remove(info.Slot);
                        SaveBlacklist();

                        var controls = CustomBase.Instance.GetComponentsInChildren <CustomSelectListCtrl>(true);
                        for (var j = 0; j < controls.Length; j++)
                        {
                            var customSelectListCtrl = controls[j];
                            if (customSelectListCtrl.GetSelectInfoFromIndex(customSelectInfo.index)?.category == customSelectInfo.category)
                            {
                                if (ListVisibility.TryGetValue(customSelectListCtrl, out var visibilityType))
                                {
                                    if (visibilityType == ListVisibilityType.Hidden)
                                    {
                                        customSelectListCtrl.DisvisibleItem(customSelectInfo.index, true);
                                    }
                                }

                                List <CustomSelectInfo> lstSelectInfo2 = (List <CustomSelectInfo>)Traverse.Create(customSelectListCtrl).Field("lstSelectInfo").GetValue();

                                if (lstSelectInfo2.All(x => x.disvisible))
                                {
                                    changeFilter = true;
                                }
                            }
                        }
                    }
                }
            }

            if (changeFilter)
            {
                ChangeListFilter(ListVisibilityType.Filtered);
            }
            SetMenuVisibility(false);
        }
Example #15
0
 public void StartAutoResolve(float resolveRate)
 {
     if (Session != null && resolveInfo == null)
     {
         autoResolveRate = resolveRate;
         resolveInfo     = new ResolveInfo();
         resolveOn       = true;
     }
 }
        public override void Finished()
        {
            SkipEndMarker endLoop = new SkipEndMarker();

            ActionSet.AddAction(endLoop);
            _playerNodeReachedBreak.SetEndMarker(endLoop);

            ResolveInfo.Pathfind(ActionSet, _player, PathmapObject, Builder.ParentArray.Get(), _destination);
        }
Example #17
0
        public Task <bool> ShareLink(string title, string extraText)
        {
            Intent sendIntent = new Intent(Intent.ActionSend);

            sendIntent.SetType("text/plain");
            sendIntent.PutExtra(Intent.ExtraText, extraText);

            Intent        receiver      = new Intent(_context, new InviteIntentReceiver().Class);
            PendingIntent pendingIntent = PendingIntent.GetBroadcast(_context, 0, receiver, PendingIntentFlags.UpdateCurrent);
            var           chooserIntent = Intent.CreateChooser(sendIntent, title ?? string.Empty, pendingIntent.IntentSender);

            IList <ResolveInfo>  resInfo    = _context.PackageManager.QueryIntentActivities(sendIntent, 0);
            List <LabeledIntent> intentList = new List <LabeledIntent>();

            for (int i = 0; i < resInfo.Count; i++)
            {
                ResolveInfo ri          = resInfo.ElementAt(i);
                string      packageName = ri.ActivityInfo.PackageName;
                if (packageName.Contains("com.google.android.apps.messaging"))
                {
                    Intent intent = new Intent();
                    intent.SetComponent(new ComponentName(packageName, ri.ActivityInfo.Name));
                    intent.SetAction(Intent.ActionSend);
                    intent.SetType("text/plain");
                    intent.PutExtra(Intent.ExtraText, extraText);
                    intentList.Add(new LabeledIntent(intent, packageName, ri.LoadLabel(_context.PackageManager), ri.Icon));
                }
                else if (packageName.Contains("com.whatsapp"))
                {
                    Intent intent = new Intent();
                    intent.SetComponent(new ComponentName(packageName, ri.ActivityInfo.Name));
                    intent.SetAction(Intent.ActionSend);
                    intent.SetType("text/plain");
                    intent.PutExtra(Intent.ExtraText, extraText);
                    intentList.Add(new LabeledIntent(intent, packageName, ri.LoadLabel(_context.PackageManager), ri.Icon));
                }
                else if (packageName.Contains("com.google.android.apps.docs"))
                {
                    Intent intent = new Intent();
                    intent.SetComponent(new ComponentName(packageName, ri.ActivityInfo.Name));
                    intent.SetAction(Intent.ActionSend);
                    intent.SetType("text/plain");
                    intent.PutExtra(Intent.ExtraText, extraText);
                    intentList.Add(new LabeledIntent(intent, packageName, ri.LoadLabel(_context.PackageManager), ri.Icon));
                }
            }
            LabeledIntent[] extraIntents = intentList.ToArray();


            chooserIntent.PutExtra(Intent.ExtraInitialIntents, extraIntents);
            chooserIntent.SetFlags(ActivityFlags.ClearTop);
            chooserIntent.SetFlags(ActivityFlags.NewTask);

            _context.StartActivity(chooserIntent);
            return(Task.FromResult(true));
        }
Example #18
0
    public static void Share(string body, string subject, string mimeType = "text/plain", string chooserTitle = "Choose application")
    {
#if UNITY_ANDROID
        //        Debug.LogWarning(Build.VERSION.SDK_INT + " => " + Build.VERSION.CODENAME);
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.SetType(mimeType)
        .PutExtra(Intent.EXTRA_SUBJECT, subject)
        .PutExtra(Intent.EXTRA_TEXT, body);

        var intentList = new List <Intent>();

        var activity = Internal.GetCurrentActivity();
        var pm       = activity.GetPackageManager();
        var resInfo  = pm.QueryIntentActivities(intent, 0);


        for (int i = 0; i < resInfo.Count; i++)
        {
            // Extract the label, append it, and repackage it in a LabeledIntent
            ResolveInfo ri = resInfo[i];

            string packageName = ri.ActivityInfo.PackageName;
            if (packageName.Contains("vkontakte") || packageName.Contains("instagram") || packageName.Contains("skype"))
            {
                Intent newIntent = new Intent(Intent.ACTION_SEND);
                newIntent.SetComponent(new ComponentName(packageName, ri.ActivityInfo.Name));
                newIntent.SetPackage(packageName)
                .PutExtra(Intent.EXTRA_SUBJECT, subject)
                .PutExtra(Intent.EXTRA_TEXT, body)
                .SetType(mimeType);

                intentList.Add(new LabeledIntent(newIntent, packageName, ri.LoadLabel(pm) + " [" + i + "]", ri.Icon));
            }
        }

        Intent intentt = intentList[0];
        intentList.RemoveAt(0);
        Parcelable[] extraIntents = new Parcelable[intentList.Count];

        for (int i = 0; i < intentList.Count; i++)
        {
            extraIntents[i] = intentList[i];
        }

        var chooser = Intent.CreateChooser(intentt, chooserTitle);
        chooser.PutExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents);
        activity.StartActivity(chooser);
#endif
    }
Example #19
0
        /// <summary>
        /// Get home package
        /// </summary>
        public string GetHomePackage(Context context)
        {
            var intent = new Intent(Intent.ActionMain);

            intent.AddCategory(Intent.CategoryHome);

            ResolveInfo resolveInfo = context.PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);

            if (resolveInfo != null && resolveInfo.ActivityInfo != null && resolveInfo.ActivityInfo.PackageName != null)
            {
                return(resolveInfo.ActivityInfo.PackageName);
            }

            return(context.PackageName);
        }
Example #20
0
            public override Android.Views.View GetView(int position, Android.Views.View convertView, ViewGroup parent)
            {
                Android.Views.View view  = base.GetView(position, convertView, parent);
                ResolveInfo        res   = ActivitiesInfo.ElementAt(position);
                ImageView          image = (ImageView)view.FindViewById(
                    BlazorWebViewService.GetResourceId("intent_listview_icon", AndroidResourceType.Identifier)
                    );

                image.SetImageDrawable(res.LoadIcon(BlazorWebViewService.GetCurrentActivity().PackageManager));
                TextView textview = (TextView)view.FindViewById(
                    BlazorWebViewService.GetResourceId("intent_listview_title", AndroidResourceType.Identifier)
                    );

                textview.Text = res.LoadLabel(BlazorWebViewService.GetCurrentActivity().PackageManager);
                return(view);
            }
Example #21
0
        public static bool ItemMatchesSearch(CustomSelectInfo data, string searchStr)
        {
            var searchIn = "";

            switch (HS2_MakerSearch.searchBy.Value)
            {
            case SearchBy.Name:
                searchIn = data.name;

                if (HS2_MakerSearch.useTranslatedCache.Value)
                {
                    searchIn = searchNameStrings.TryGetValue(data, out var cachedTranslation) ? cachedTranslation : data.name;
                }

                break;

            case SearchBy.AssetBundle:
                searchIn = data.assetBundle;
                break;
            }

            if (data.id >= UniversalAutoResolver.BaseSlotID)
            {
                ResolveInfo info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)data.category, data.id);
                if (info != null)
                {
                    Manifest manifest = Sideloader.Sideloader.GetManifest(info.GUID);
                    if (manifest.Author != null)
                    {
                        searchIn = searchIn + " " + manifest.Author;
                    }
                }
            }

            var rule = StringComparison.Ordinal;

            if (!HS2_MakerSearch.caseSensitive.Value)
            {
                searchStr = searchStr.ToLowerInvariant();
                rule      = StringComparison.OrdinalIgnoreCase;
            }

            var splitSearchStr = searchStr.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

            return(splitSearchStr.All(s => searchIn.IndexOf(s, rule) >= 0));
        }
Example #22
0
        internal BaseBadge GetBadger(Context context)
        {
            if (mBadge != null)
            {
                return(mBadge);
            }
            Log.Debug(LOG_TAG, "Finding badger");

            try
            {
                Intent intent = new Intent(Intent.ActionMain);
                intent.AddCategory(Intent.CategoryHome);
                ResolveInfo resolveInfo        = context.PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);
                String      currentHomePackage = resolveInfo.ActivityInfo.PackageName.ToLower();

                /*if (Build.Manufacturer.ToLower() == "xiaomi") {
                 *                      mBadge = new XiaomiHomeBadger(context);
                 *                      return mBadge;
                 *              }*/

                foreach (string badgeclass in BADGERS)
                {
                    Type      t        = Type.GetType("Xam.Plugin.Badger.Droid.Implementation." + badgeclass);
                    BaseBadge myObject = (BaseBadge)Activator.CreateInstance(t, true);
                    if (myObject.GetSupportLaunchers().Contains(currentHomePackage))
                    {
                        myObject.SetContext(context);
                        mBadge = myObject;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(LOG_TAG, ex.Message.ToString());
            }

            if (mBadge == null)
            {
                mBadge = new DefaultBadger(context);
            }

            Log.Debug(LOG_TAG, "Returning badger:" + mBadge.ToString());
            return(mBadge);
        }
Example #23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            Log.Info("GlassPrompter", "boot");

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            scroller   = FindViewById <ScrollView>(Resource.Id.scroller);
            listLayout = FindViewById <LinearLayout>(Resource.Id.listLayout);
            layoutRoot = FindViewById <LinearLayout>(Resource.Id.layoutRoot);
            indicator  = FindViewById <GridView>(Resource.Id.gridView1);


            scriptLines = getLinesFromScript(fullScript);
            lineCount   = scriptLines.Count;
            scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add("");


            //figure out recognizer
            IList <ResolveInfo> services = this.ApplicationContext.PackageManager.QueryIntentServices(
                new Intent(RecognitionService.ServiceInterface), 0);

            if (services.Count == 0)
            {
                return;
            }
            ResolveInfo ri  = services[0];
            var         pkg = ri.ServiceInfo.PackageName;
            var         cls = ri.ServiceInfo.Name;

            speechComp = new ComponentName(pkg, cls);



            CreateLines();
            SetLines();

            mGestureDetector = createGestureDetector(this);

            SetupSpeechReco();
            startReco();
        }
Example #24
0
        public static void Main()
        {
            BasicHttpBinding binding = new BasicHttpBinding();
            EndpointAddress  ea      = new EndpointAddress(
                new Uri("http://localhost:8080/ChatServer"));
            IPeerResolverContract proxy = ChannelFactory <IPeerResolverContract> .CreateChannel(binding, ea);

            try {
                Guid guid = Guid.NewGuid();
                Console.WriteLine(guid);
                ResolveInfo ri = new ResolveInfo(
                    guid, "net.p2p://chatMesh/ChatServer", 1);
                ResolveResponseInfo rri = proxy.Resolve(ri);
                Console.WriteLine("Response: {0}", rri);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }
Example #25
0
        public override void OnListItemClick(ListView l, View v, int position, long id)
        {
            base.OnListItemClick(l, v, position, id);

            ResolveInfo  resolveInfo  = (ResolveInfo)l.Adapter.GetItem(position);
            ActivityInfo activityInfo = resolveInfo.ActivityInfo;

            if (activityInfo == null)
            {
                return;
            }

            Intent i = new Intent(Intent.ActionMain);

            i.SetClassName(activityInfo.ApplicationInfo.PackageName, activityInfo.Name);
            i.AddFlags(ActivityFlags.NewTask);

            StartActivity(i);
        }
        private void BlacklistMod(string guid)
        {
            for (var i = 0; i < CustomSelectListCtrlInstance.lstSelectInfo.Count; i++)
            {
                CustomSelectInfo customSelectInfo = CustomSelectListCtrlInstance.lstSelectInfo[i];
                if (customSelectInfo.index >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)customSelectInfo.category, customSelectInfo.index);
                    if (info != null && info.GUID == guid)
                    {
                        if (!Blacklist.ContainsKey(info.GUID))
                        {
                            Blacklist[info.GUID] = new Dictionary <int, HashSet <int> >();
                        }
                        if (!Blacklist[info.GUID].ContainsKey(customSelectInfo.category))
                        {
                            Blacklist[info.GUID][customSelectInfo.category] = new HashSet <int>();
                        }
                        Blacklist[info.GUID][customSelectInfo.category].Add(info.Slot);
                        SaveBlacklist();

                        var controls = CustomBase.Instance.GetComponentsInChildren <CustomSelectListCtrl>(true);
                        for (var j = 0; j < controls.Length; j++)
                        {
                            var customSelectListCtrl = controls[j];
                            if (customSelectListCtrl.GetSelectInfoFromIndex(customSelectInfo.index)?.category == customSelectInfo.category)
                            {
                                if (ListVisibility.TryGetValue(customSelectListCtrl, out var visibilityType))
                                {
                                    if (visibilityType == ListVisibilityType.Filtered)
                                    {
                                        customSelectListCtrl.DisvisibleItem(customSelectInfo.index, true);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            SetMenuVisibility(false);
        }
Example #27
0
            public override View GetView(int position, View convertView, ViewGroup parent)
            {
                ImageView i;

                if (convertView == null)
                {
                    i = new ImageView(self);
                    i.SetScaleType(ImageView.ScaleType.FitCenter);
                    i.LayoutParameters = new GridView.LayoutParams(50, 50);
                }
                else
                {
                    i = (ImageView)convertView;
                }

                ResolveInfo info = ((Grid1)self).mApps[position];

                i.SetImageDrawable(info.ActivityInfo.LoadIcon(self.PackageManager));

                return(i);
            }
Example #28
0
        protected List <IDictionary <String, Object> > GetData()
        {
            var myData = new List <IDictionary <String, Object> > ();

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

            mainIntent.AddCategory(Intent.CategorySampleCode);

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

            if (null == list)
            {
                return(myData);
            }

            int len = list.Count;

            IDictionary <String, Boolean> entries = new Dictionary <String, Boolean> ();

            for (int i = 0; i < len; i++)
            {
                ResolveInfo info = list [i];

                var labelSeq = info.LoadLabel(pm);

                if ("com.example.monodroid.googleapis.maps" == info.ActivityInfo.ApplicationInfo.PackageName)
                {
                    AddItem(myData, labelSeq.ToString(), ActivityIntent(
                                info.ActivityInfo.ApplicationInfo.PackageName,
                                info.ActivityInfo.Name));
                }
            }

            myData.Sort(delegate(IDictionary <string, object> map1, IDictionary <string, object> map2) {
                return(String.Compare((string)map1 ["title"], (string)map2 ["title"], StringComparison.CurrentCulture));
            });

            return(myData);
        }
Example #29
0
        public static void ChangeListFilter(CustomSelectListCtrl customSelectListCtrl, ListVisibilityType visibilityType)
        {
            List <CustomSelectInfo> lstSelectInfo = (List <CustomSelectInfo>)Traverse.Create(customSelectListCtrl).Field("lstSelectInfo").GetValue();

            int count = 0;

            for (var i = 0; i < lstSelectInfo.Count; i++)
            {
                CustomSelectInfo customSelectInfo = lstSelectInfo[i];
                if (visibilityType == ListVisibilityType.All)
                {
                    customSelectListCtrl.DisvisibleItem(customSelectInfo.index, false);
                    continue;
                }

                bool hide = visibilityType != ListVisibilityType.Filtered;

                if (customSelectInfo.index >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo Info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)customSelectInfo.category, customSelectInfo.index);
                    if (Info != null)
                    {
                        if (CheckBlacklist(Info.GUID, (int)Info.CategoryNo, Info.Slot))
                        {
                            hide = visibilityType == ListVisibilityType.Filtered;
                            count++;
                        }
                    }
                }
                customSelectListCtrl.DisvisibleItem(customSelectInfo.index, hide);
            }
            ListVisibility[customSelectListCtrl] = visibilityType;

            if (count == 0 && visibilityType == ListVisibilityType.Hidden)
            {
                Logger.LogMessage("No items are hidden");
                ChangeListFilter(customSelectListCtrl, ListVisibilityType.Filtered);
            }
        }
            internal static bool AddItemIDHook(int category, int id)
            {
                if (id >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo Info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)category, id);
                    if (!CheckItemList.ContainsKey(Info.GUID))
                    {
                        CheckItemList[Info.GUID] = new Dictionary <int, HashSet <int> >();
                    }
                    if (!CheckItemList[Info.GUID].ContainsKey(category))
                    {
                        CheckItemList[Info.GUID][category] = new HashSet <int>();
                    }
                    if (!CheckItemList[Info.GUID][category].Contains(Info.Slot))
                    {
                        CheckItemList[Info.GUID][category].Add(Info.Slot);
                        SaveCheckItemList();
                    }

                    return(false);
                }
                return(true);
            }
Example #31
0
 public void SetResolveError(ResolveInfo resolveInfo)
 {
     this.resolveInfo = resolveInfo;
 }
Example #32
0
 public ResolveResult ResolveWithoutCache(out ResolveInfo resolveInfo)
 {
     // TODO check this code
     return ResolveUtil.ResolveQualifiableReference(this, this, out resolveInfo);
 }
Example #33
0
 public ResolveResult Resolve(ISymbolTable table, IAccessContext context, out ResolveInfo resolveInfo)
 {
     // TODO check this code
     if (table == EmptySymbolTable.INSTANCE)
     {
         resolveInfo = ResolveErrorType.NOT_RESOLVED;
         return ResolveResult.EMPTY;
     }
     return CheckedReferenceImplUtil.Resolve(this, table, out resolveInfo);
 }