コード例 #1
0
        // This method is explicitly implemented as a member of an instantiated Com.Google.Android.Exoplayer.Metadata.IMetadataParser
        global::Java.Lang.Object global::Com.Google.Android.Exoplayer.Metadata.IMetadataParser.Parse(byte[] p0, int p1)
        {
            var frames = ParseId3Frame(p0, p1);
            var array  = new Java.Util.ArrayList(frames.Count);

            for (int i = 0; i < frames.Count; i++)
            {
                array.Add(frames[i]);
            }

            return(array);
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: nearit/Xamarin-SDK
        public void FromNativeToBridgeCustomJSON()
        {
            CustomJSON     customJSON = new CustomJSON();
            JavaDictionary jsonMap    = new JavaDictionary();

            jsonMap.Add("nome", "stefano");
            jsonMap.Add("numero", 4.6);
            Java.Util.ArrayList lista = new Java.Util.ArrayList();
            lista.Add(3.0);
            lista.Add(4.0);
            jsonMap.Add("lista", lista);

            JavaDictionary innerDict = new JavaDictionary();

            innerDict.Add("nome", "martin");
            innerDict.Add("cognome", "scorsese");
            jsonMap.Add("inner_object", innerDict);

            customJSON.Content             = jsonMap;
            customJSON.NotificationMessage = "messaggio";

            XCCustomJSONNotification jSONNotification = AdapterCustom.GetCommonType(customJSON);

            Assert.True(jSONNotification.Content is Dictionary <string, object>);

            jSONNotification.Content.TryGetValue("nome", out object stringValue);
            Assert.True(stringValue is string);
            Assert.True(stringValue.Equals("stefano"));

            jSONNotification.Content.TryGetValue("numero", out object doubleValue);
            Assert.True(doubleValue is double);
            Assert.True(doubleValue.Equals(4.6));

            jSONNotification.Content.TryGetValue("lista", out object listValue);
            Assert.True(listValue is List <object>);
            Assert.True((listValue as List <object>)[0] is double);
            Assert.True((double)(listValue as List <object>)[0] == 3.0);
            Assert.True((listValue as List <object>)[1] is double);
            Assert.True((double)(listValue as List <object>)[1] == 4.0);

            jSONNotification.Content.TryGetValue("inner_object", out object innerObj);
            Assert.True(innerObj is Dictionary <string, object>);
            Dictionary <string, object> castedDic = innerObj as Dictionary <string, object>;

            castedDic.TryGetValue("nome", out object name);
            Assert.True(name is string);
            Assert.True(((string)name).Equals("martin"));
            castedDic.TryGetValue("cognome", out object cognome);
            Assert.True(cognome is string);
            Assert.True(((string)cognome).Equals("scorsese"));
        }
コード例 #3
0
        private List <ARPlane> GetSortedPlanes(System.Collections.ICollection allPlanes, ARPose cameraPose)
        {
            // Planes must be sorted by the distance from the camera so that we can
            // first draw the closer planes, and have them block the further planes.
            Java.Util.ArrayList pairPlanes = new Java.Util.ArrayList();
            foreach (Java.Lang.Object item in allPlanes)
            {
                ARPlane plane = item.JavaCast <ARPlane>();
                if ((plane.Type == ARPlane.PlaneType.UnknownFacing) ||
                    plane.TrackingState != ARTrackableTrackingState.Tracking ||
                    plane.SubsumedBy != null)
                {
                    continue;
                }

                // Store the normal vector of the current plane.
                float[] planeNormalVector = new float[3];
                ARPose  planeCenterPose   = plane.CenterPose;
                planeCenterPose.GetTransformedAxis(1, 1.0f, planeNormalVector, 0);

                // Calculate the distance from the camera to the plane. If the value is negative,
                // it indicates that the camera is behind the plane (the normal vector distinguishes
                // the front side from the back side).
                float distanceBetweenPlaneAndCamera = (cameraPose.Tx() - planeCenterPose.Tx()) * planeNormalVector[0]
                                                      + (cameraPose.Ty() - planeCenterPose.Ty()) * planeNormalVector[1]
                                                      + (cameraPose.Tz() - planeCenterPose.Tz()) * planeNormalVector[2];
                pairPlanes.Add(new Pair(plane, distanceBetweenPlaneAndCamera));
            }
            //Get Pair object from ArrayList
            List <Pair> sortedList = new List <Pair>();
            IIterator   myit       = pairPlanes.Iterator();

            while (myit.HasNext)
            {
                sortedList.Add((Pair)(myit.Next()));
            }
            //Sort Pair objects by plane in list
            sortedList.Sort(new PlanCompare());

            //Obtain plane list.
            List <ARPlane> listOfPlane = new List <ARPlane>();

            foreach (Pair item in sortedList)
            {
                listOfPlane.Add((item.First).JavaCast <ARPlane>());
            }

            return(listOfPlane);
        }
コード例 #4
0
        private static void parse(JSONObject json, string key)
        {
            bool       success = false;
            JSONObject result  = json.OptJSONObject("result");

            if (result != null)
            {
                string license = result.OptString("license");
                if (!TextUtils.IsEmpty(license))
                {
                    string[] licenses = license.Split(',');
                    if (licenses != null && licenses.Length == 2)
                    {
                        PreferencesUtil.putString("activate_key", key);
                        Java.Util.ArrayList list = new Java.Util.ArrayList();
                        list.Add(licenses[0]);
                        list.Add(licenses[1]);
                        success = FileUitls.c(Contexts, FaceSDKManager.LICENSE_NAME, list);
                    }
                }
            }

            if (success)
            {
                toast("激活成功");
                if (activationCallback != null)
                {
                    activationCallback.callback(true);
                    activationDialog.Dismiss();
                }
            }
            else
            {
                toast("激活失败");
            }
        }