예제 #1
0
        public bool OnPreferenceChange(Preference preference, Object newValue)
        {
            var stringValue = newValue.ToString();
            var listPreference = preference as ListPreference;

            // for list preferences
            if (listPreference != null)
            {
                int prefIndex = listPreference.FindIndexOfValue(stringValue);
                if (prefIndex >= 0)
                {
                    preference.Summary = listPreference.GetEntries()[prefIndex];
                }
            }
            // any other preference just set the summary
            else
            {
                preference.Summary = stringValue;
            }

            return true;
        }
예제 #2
0
 public virtual unsafe Model.ModelLoaderLoadData BuildLoadData(Java.Lang.Object model, int width, int height, Load.Options options)
 {
     return(BuildLoadData(model?.ToString(), width, height, options));
 }
예제 #3
0
 public void OnReceiveValue(Java.Lang.Object value)
 {
     _source.SetResult(value?.ToString());
 }
예제 #4
0
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(Glide.With(ActivityContext).Load(p0.ToString()).Apply(new RequestOptions().CenterCrop()));
 }
예제 #5
0
        static void CreateJLO()
        {
            var jlo = new Java.Lang.Object();

            Console.WriteLine($"binding? {jlo.ToString ()}");
        }
예제 #6
0
            public void OnReceiveValue(Java.Lang.Object value)
            {
                string decodedValue = DecodeJsonString(value.ToString());

                _taskCompletion.SetResult(decodedValue);
            }
예제 #7
0
 public void OnSuccess(Java.Lang.Object result)
 {
     System.Console.WriteLine(result.ToString());
 }
 public bool SetViewValue(View view, Object data, string textRepresentation)
 {
     if (!(view is CheckedTextView)) return false;
     var checkedView = view as CheckedTextView;
     checkedView.Text = data.ToString();
     return true;
 }
예제 #9
0
        public FormCamera(Context contxt, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus reportStatus,
                          string typeFlag, string type, List <ReportElement> elementList)
            : base(contxt)
        {
            imageDownloadArray = new List <string>();
            if (cameraPreviewView == null)
            {
                cameraPreviewView = new List <GridView>();
            }
            else
            {
                for (int i = 0; i < cameraPreviewView.Count; i++)
                {
                    if (IMAGE_PREVIEW_Header_ID + element.Id == cameraPreviewView[i].Id || IMAGE_PREVIEW_Info_ID + element.Id == cameraPreviewView[i].Id)
                    {
                        cameraPreviewView.RemoveAt(i);
                    }
                }
            }

            if (cameraIndicatorView == null)
            {
                cameraIndicatorView = new List <ImageView>();
            }
            else
            {
                for (int i = 0; i < cameraIndicatorView.Count; i++)
                {
                    if (IMAGE_INDICATOR_ID + element.Id == cameraIndicatorView[i].Id)
                    {
                        cameraIndicatorView.RemoveAt(i);
                    }
                }
            }

            imageJPGFile = new ImageFile();

            context  = contxt;
            resource = context.Resources;

            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();

            InitImageLoader();

            LinearLayout imageLay = new LinearLayout(context);

            imageLay.Orientation = Orientation.Vertical;

            var addImageButton = new ImageButton(context);

            addImageButton.Id = element.Id;
            addImageButton.SetPadding(20, 5, 5, 5);

            RelativeLayout.LayoutParams paramsForImageButton = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForImageButton.AddRule(LayoutRules.AlignParentLeft);
            addImageButton.LayoutParameters = paramsForImageButton;

            GridView gridGallery = new ExpandingGrid(context);

            RelativeLayout.LayoutParams paramsForgridGallery = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            paramsForgridGallery.AddRule(LayoutRules.Above, addImageButton.Id);
            gridGallery.LayoutParameters = paramsForgridGallery;
            gridGallery.SetNumColumns(6);

            List <CustomGallery> dataT = new List <CustomGallery>();
            string sdCardPath2         = Environment.ExternalStorageDirectory.AbsolutePath;

            foreach (var VARIABLE in element.Values)
            {
                CustomGallery item = new CustomGallery();
                item.SdCardPath = "/storage/emulated/0/Checkd/" + VARIABLE.Value;
                dataT.Add(item);

                String fileExist = Path.Combine(sdCardPath2, "Checkd/" + VARIABLE.Value);
                File   existFile = new File(fileExist);
                if (!existFile.Exists())
                {
                    imageDownloadArray.Add(VARIABLE.Value);
                }
            }

            MultipleImageDownloader(imageDownloadArray);

            MiniGallerAdapter adapter = new MiniGallerAdapter(Application.Context, imageLoader);

            if (dataT.Count != 0)
            {
                adapter.AddAll(dataT);
            }
            gridGallery.Adapter = adapter;

            if (typeFlag == "Info")
            {
                int artificial_Preview_ID = IMAGE_PREVIEW_Info_ID + element.Id;
                gridGallery.Id = artificial_Preview_ID;
                cameraPreviewView.Add(gridGallery);
            }
            else
            {
                int artificial_header_Preview_ID = IMAGE_PREVIEW_Header_ID + element.Id;
                gridGallery.Id = artificial_header_Preview_ID;
                cameraPreviewView.Add(gridGallery);
            }

            gridGallery.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                List <CustomGallery> items    = new List <CustomGallery>();
                MiniGallerAdapter    adapter3 = (MiniGallerAdapter)gridGallery.Adapter;
                items = adapter3.getList();
                Object obj   = items[args.Position].SdCardPath;
                String value = obj.ToString().Substring(obj.ToString().LastIndexOf('/') + 1);
                GalleryImagePreview(value);
            };

            imageLay.AddView(gridGallery);
            imageLay.AddView(addImageButton);

            RelativeLayout theme    = new FormTheme(context, element.Title);
            LinearLayout   btnLayer = new LinearLayout(context);

            btnLayer.Orientation = Orientation.Vertical;

            String img = element.Value;

            String sdCardPath = Environment.ExternalStorageDirectory.AbsolutePath;
            String filePath   = Path.Combine(sdCardPath, "Checkd/" + img);
            File   file       = new File(filePath);

            addImageButton.SetImageResource(Resource.Drawable.android_camera_grey);
            addImageButton.SetBackgroundResource(0);

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            activateElementInfo(element, theme);
            int artificial_ID = IMAGE_INDICATOR_ID + element.Id;

            indicatorImage.Id = artificial_ID;
            cameraIndicatorView.Add(indicatorImage);

            addImageButton.Click += (sender2, e) => ImageSelectionChoiceDialog(sender2, e, element.Id + "", type);

            if (!element.Value.Equals(""))
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }

            if (ownerID == 0 || ownerID == userID)
            {
                if (verifiedID != 0)
                {
                    addImageButton.Enabled   = false;
                    addImageButton.Clickable = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        addImageButton.Enabled   = true;
                        addImageButton.Clickable = true;
                    }
                }

                else
                {
                    addImageButton.Enabled   = true;
                    addImageButton.Clickable = true;
                }
            }
            else
            {
                addImageButton.Enabled   = false;
                addImageButton.Clickable = false;
            }

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            if (isArcheived)
            {
                addImageButton.Clickable = false;
                addImageButton.Enabled   = false;
                addImageButton.Click    += null;
            }

            btnLayer.AddView(theme);
            btnLayer.AddView(imageLay);
            btnLayer.SetPadding(45, 10, 45, 20);
            AddView(btnLayer);
        }
예제 #10
0
 public static string toString(this Java.Lang.Object value)
 {
     return(value.ToString());
 }
예제 #11
0
 public ModelLoaderLoadData BuildLoadData(Java.Lang.Object model, int width, int height, Options options) =>
 new ModelLoaderLoadData(new ObjectKey(model.ToString()), new DataFetcher(model));
예제 #12
0
 protected override void EntryRemoved(bool evicted, Java.Lang.Object key, Java.Lang.Object oldValue, Java.Lang.Object newValue)
 {
     base.EntryRemoved(evicted, key, oldValue, newValue);
     OnEntryRemoved?.Invoke(this, new EntryRemovedEventArgs <Java.Lang.Object>(key.ToString(), oldValue, evicted));
 }
예제 #13
0
 protected override void OnSetInitialValue(bool restorePersistedValue, Java.Lang.Object defaultValue)
 {
     GroupName = restorePersistedValue ? GetPersistedString(GroupName) : defaultValue.ToString();
 }
예제 #14
0
 protected override int SizeOf(Java.Lang.Object key, Java.Lang.Object value)
 {
     return(GetSizeOf(key.ToString(), (Bitmap[])value));
 }
예제 #15
0
            public void OnSuccess(Java.Lang.Object responseObject)
            {
                Log.I(outerInstance.TAG, "initializeSDK - onSuccess", "", "");

//				// Retrieving data from existing table
//				IDictionary<string,SyncUtils.CLASSTYPE> colums = new Dictionary<string,SyncUtils.CLASSTYPE>();
//				colums.Add ("username", SyncUtils.CLASSTYPE.String);
//				colums.Add ("password",SyncUtils.CLASSTYPE.String);
//				colums.Add ("login_attempt",SyncUtils.CLASSTYPE.Int);
//
//				GenericDBManager gb = new GenericDBManager (outerInstance, "UserStorageDB", colums,new TjHandler(outerInstance));
//				gb.CreateTable ();
//				string query = "login_attempt=?";
//				string[] values = new string[] {
//					"1"
//				};
//
//				ContentValues Cv = new ContentValues ();
//				Cv.Put ("username", "brahmam");
//				Cv.Put ("password", "brahmam");
//				Cv.Put ("login_attempt", 1);
//
//				ContentValues Cobj = new ContentValues ();
//				Cobj.Put ("username", "record");
//				Cobj.Put ("password", "record");
//				Cobj.Put ("login_attempt", 2);
//				long count;
//
//
//				gb.InsertValues (Cv);
//
//
//
//				ContentValues Cvobj = new ContentValues ();
//				Cvobj.Put ("username", "test");
//				Cvobj.Put ("password", "test");
//				Cvobj.Put ("login_attempt", 1);
//
//				query = "login_attempt=?";
//				// string[] values = new string[] {
//				// "1"
//				// };
//				gb.UpdateValues(Cvobj,query,values);
//
//				//
//				gb.Select (null, null);
//				gb.DeleteValues (query, values);

                IDictionary <string, Java.Lang.Class> colums = new Dictionary <string, Java.Lang.Class>();

                colums.Add("username", Java.Lang.Class.FromType(typeof(Java.Lang.String)));
                colums.Add("password", Java.Lang.Class.FromType(typeof(Java.Lang.String)));
                colums.Add("login_attempt", Java.Lang.Class.FromType(typeof(Java.Lang.Integer)));

                GenericDBManager gb = new GenericDBManager(outerInstance, "UserStorageDB", colums);

                gb.CreateTable();
                string query = "login_attempt=?";

                string[] values = new string[] {
                    "1"
                };
                string strUserName;
                //Select is working in both following cases
                //select with query,values
//				IList<JSONObject> jsonObj = gb.Select(query, values);
//				string strUserName;
//				foreach (JSONObject obj in jsonObj) {
//					strUserName = obj.GetString ("username");
//				}
//				//Select with null,null
//				jsonObj = gb.Select (null, null);
//				foreach (JSONObject jsnObj in jsonObj) {
//					strUserName = jsnObj.GetString ("username");
//				}
                IList <JSONObject> jsonObj = null;
                ContentValues      Cv      = new ContentValues();

                Cv.Put("username", "brahmam");
                Cv.Put("password", "brahmam");
                Cv.Put("login_attempt", 1);

                ContentValues Cobj = new ContentValues();

                Cobj.Put("username", "record");
                Cobj.Put("password", "record");
                Cobj.Put("login_attempt", 2);
                long count;


                count = gb.InsertValues(Cv);

                count = gb.InsertValues(Cobj);

                jsonObj = gb.Select(query, values);
                foreach (JSONObject obj in jsonObj)
                {
                    strUserName = obj.GetString("username");
                }

                ContentValues Cvobj = new ContentValues();

                Cvobj.Put("username", "test");
                Cvobj.Put("password", "test");
                Cvobj.Put("login_attempt", 1);
                count = gb.UpdateValues(Cvobj, query, values);

                jsonObj = gb.Select(null, null);

                count = gb.DeleteValues(query, values);

                jsonObj = gb.Select(null, null);
                //count = 2;

                string responseStr = responseObject.ToString();

                Toast.MakeText(outerInstance, responseStr, ToastLength.Long).Show();

                outerInstance.startLoginProcess();
            }
예제 #16
0
 public void Call(Java.Lang.Object p0)
 {
     Console.WriteLine(p0.ToString());
 }
예제 #17
0
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(FullGlideRequestBuilder.Load(p0.ToString()));
 }
예제 #18
0
        private object ConvertProfileValue(Java.Lang.Object profileValue)
        {
            if (profileValue == null)
            {
                return(null);
            }

            switch (profileValue)
            {
            case Java.Lang.Boolean @boolean:
                return((bool)@boolean);

            case Java.Lang.Short @short:
                return((short)@short);

            case Java.Lang.Integer @integer:
                return((int)@integer);

            case Java.Lang.Long @long:
                return((long)@long);

            case Java.Lang.Float @float:
                return((float)@float);

            case Java.Lang.Double @double:
                return((double)@double);

            case Java.Lang.Number @number:
                return((double)@number);

            case Java.Lang.String @string:
                return(profileValue.ToString());

            case JavaList javaList:
            {
                var list = new List <object>();
                foreach (var data in javaList)
                {
                    var value = data;
                    if (value is Java.Lang.Object javaObject)
                    {
                        value = ConvertProfileValue(javaObject);
                    }
                    list.Add(value);
                }
                return(list);
            }

            case JavaDictionary javaDictionary:
            {
                var dict = new Dictionary <string, object>();
                foreach (var key in javaDictionary.Keys)
                {
                    var value = javaDictionary[key];
                    if (value is Java.Lang.Object javaObject)
                    {
                        value = ConvertProfileValue(javaObject);
                    }
                    dict[key.ToString()] = value;
                }
                return(dict);
            }

            case ArrayMap arrayMap:
            {
                var dict = new Dictionary <string, object>();
                foreach (var key in arrayMap.KeySet())
                {
                    dict[key.ToString()] = ConvertProfileValue(arrayMap.Get(new Java.Lang.String(key.ToString())));
                }
                return(dict);
            }

            default:
                if (profileValue.ToString() == "null")
                {
                    return(null);
                }
                return(profileValue);
            }
        }
 public RequestBuilder GetPreloadRequestBuilder(Object p0)
 {
     return(GlideImageLoader.GetPreLoadRequestBuilder(ActivityContext, p0.ToString(), ImageStyle.RoundedCrop));
 }
예제 #20
0
 public void OnReceiveValue(Java.Lang.Object value)
 {
     action(value.ToString());
 }
 public void OnReceiveValue(Java.Lang.Object value)
 {
     Value = value.ToString();
 }
예제 #22
0
 protected override void OnPostExecute(Java.Lang.Object result)
 {
     textViewVersions.Text = result.ToString();
 }
예제 #23
0
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(Glide.With(ActivityContext).Load(p0.ToString()));
 }
 public void Call(Java.Lang.Object sdkEvent)
 {
     callbackString = "AEP SDK event data: " + sdkEvent.ToString();
 }
예제 #25
0
 public RequestBuilder GetPreloadRequestBuilder(Object p0)
 {
     return(Glide.With(ActivityContext).Load(p0.ToString())
            .Apply(new RequestOptions().CircleCrop().SetDiskCacheStrategy(DiskCacheStrategy.All)));
 }
 public void Error(Java.Lang.Object error)
 {
     callbackString = "AEP SDK Error: " + error.ToString();
 }
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(GlideImageLoader.GetPreLoadRequestBuilder(ActivityContext, p0.ToString(), ImageStyle.CircleCrop));
 }
 public void Call(Java.Lang.Object sdkEvent)
 {
     Console.WriteLine("AEP SDK event data: " + sdkEvent.ToString());
 }
예제 #29
0
 public void OnReceiveValue(Java.Lang.Object value)
 {
     _setCallBackValue(value?.ToString() ?? string.Empty);
 }
 public void Error(Java.Lang.Object error)
 {
     Console.WriteLine("AEP SDK Error: " + error.ToString());
 }
예제 #31
0
 public virtual unsafe bool Handles(Java.Lang.Object model)
 {
     return(Handles(model?.ToString()));
 }
예제 #32
0
        public static object ToFieldValue(this Java.Lang.Object fieldValue, Type type)
        {
            if (fieldValue == null)
            {
                return(null);
            }

            switch (fieldValue)
            {
            case Java.Lang.Boolean @bool:
                if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    type = type.GenericTypeArguments[0];
                }
                return(Convert.ChangeType((bool)@bool, type));

            case Java.Lang.Long @long:
                if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    type = type.GenericTypeArguments[0];
                }
                return(Convert.ChangeType((long)@long, type));

            case Java.Lang.Double @double:
                if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    type = type.GenericTypeArguments[0];
                }
                return(Convert.ChangeType((double)@double, type));

            case Java.Lang.String @string:
                return(fieldValue.ToString());

            case Firebase.Timestamp timestamp:
            {
                var time = new Timestamp(timestamp);
                if (type == typeof(DateTime) || type == typeof(DateTime?))
                {
                    return(time.ToDateTime());
                }
                if (type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?))
                {
                    return(time.ToDateTimeOffset());
                }
                return(time);
            }

            case Java.Util.Date date:
            {
                var time = new Timestamp(date);
                if (type == typeof(DateTime) || type == typeof(DateTime?))
                {
                    return(time.ToDateTime());
                }
                if (type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?))
                {
                    return(time.ToDateTimeOffset());
                }
                return(time);
            }

            case JavaList javaList:
            {
                IList list;
                if (type.GetInterfaces().Contains(typeof(IList)))
                {
                    list = (IList)Activator.CreateInstance(type);
                }
                else if (type.IsGenericType)
                {
                    var listType = typeof(List <>).MakeGenericType(type.GenericTypeArguments[0]);
                    list = (IList)Activator.CreateInstance(listType);
                }
                else
                {
                    list = new List <object>();
                }

                var genericType = typeof(object);
                if (type.IsGenericType)
                {
                    genericType = type.GenericTypeArguments[0];
                }

                foreach (var data in javaList)
                {
                    var value = data;
                    if (value is Java.Lang.Object javaObject)
                    {
                        value = javaObject.ToFieldValue(genericType);
                    }
                    else if (value != null && genericType != typeof(object))
                    {
                        if (genericType.IsGenericType && genericType.GetGenericTypeDefinition() == typeof(Nullable <>))
                        {
                            genericType = genericType.GenericTypeArguments[0];
                        }
                        value = Convert.ChangeType(value, genericType);
                    }
                    list.Add(value);
                }
                return(list);
            }

            case JavaDictionary dictionary:
            {
                object @object;
                if (type == typeof(object))
                {
                    @object = new Dictionary <string, object>();
                }
                else if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary <,>))
                {
                    var dictionaryType = typeof(Dictionary <,>).MakeGenericType(type.GenericTypeArguments[0], type.GenericTypeArguments[1]);
                    @object = Activator.CreateInstance(dictionaryType);
                }
                else
                {
                    @object = Activator.CreateInstance(type);
                }

                if (@object is IDictionary dict)
                {
                    var genericType = typeof(object);
                    if (type.IsGenericType)
                    {
                        genericType = type.GenericTypeArguments[1];
                    }

                    foreach (var key in dictionary.Keys)
                    {
                        var value = dictionary[key];
                        if (value is Java.Lang.Object javaObject)
                        {
                            value = javaObject.ToFieldValue(genericType);
                        }
                        else if (value != null && genericType != typeof(object))
                        {
                            if (genericType.IsGenericType && genericType.GetGenericTypeDefinition() == typeof(Nullable <>))
                            {
                                genericType = genericType.GenericTypeArguments[0];
                            }
                            value = Convert.ChangeType(value, genericType);
                        }
                        dict.Add(key.ToString(), value);
                    }
                }
                else
                {
                    var properties       = type.GetProperties();
                    var mappedProperties = properties.Select(p => (Property: p, Attribute: Attribute.GetCustomAttribute(p, typeof(MapToAttribute)) as MapToAttribute))
                                           .Where(t => t.Attribute != null)
                                           .ToDictionary(t => t.Attribute.Mapping, t => t.Property);
                    var igonoredProperties = properties.Where(p => Attribute.GetCustomAttribute(p, typeof(IgnoredAttribute)) != null);

                    foreach (var key in dictionary.Keys)
                    {
                        PropertyInfo property;
                        if (mappedProperties.ContainsKey(key.ToString()))
                        {
                            property = mappedProperties[key.ToString()];
                        }
                        else
                        {
                            property = type.GetProperty(key.ToString());
                        }

                        if (property != null && !igonoredProperties.Contains(property))
                        {
                            var value = dictionary[key];
                            if (value is Java.Lang.Object javaObject)
                            {
                                value = javaObject.ToFieldValue(property.PropertyType);
                            }
                            else if (value != null)
                            {
                                var propertyType = property.PropertyType;
                                if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                                {
                                    propertyType = propertyType.GenericTypeArguments[0];
                                }
                                value = Convert.ChangeType(value, propertyType);
                            }
                            property.SetValue(@object, value);
                        }
                    }
                }
                return(@object);
            }

            case Firebase.Firestore.Blob blob:
                if (type == typeof(byte[]))
                {
                    return(blob.ToBytes());
                }
                return(new MemoryStream(blob.ToBytes()));

            case Firebase.Firestore.GeoPoint geoPoint:
                return(new GeoPoint(geoPoint));

            case Firebase.Firestore.DocumentReference documentReference:
                return(new DocumentReferenceWrapper(documentReference));

            default:
                throw new ArgumentOutOfRangeException($"{fieldValue.GetType().FullName} is not supported");
            }
        }