public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (view == null)
            {
                view = inflater.Inflate(Resource.Layout.ProfilFragment, container, false);

                NapuniLabele();

                //dugme sve menze.. Dodat click
                sveMenze        = view.FindViewById <Android.Widget.Button>(Resource.Id.sveMenzeDugme);
                sveMenze.Click += SveMenzeOnClick;

                //napunimo omiljenu menzu.. Po defaultu index 0
                var prefs = Context.GetSharedPreferences("Mensarium", FileCreationMode.Private);
                this.omiljenaMenza = prefs.GetInt("OmiljenaMezna", omiljenaMenza);
                SetujOmiljenuMenzu(omiljenaMenza);

                obrociLayout        = view.FindViewById <LinearLayout>(Resource.Id.profilObrociLayout);
                obrociLayout.Click += ObrociLayoutOnClick;

                swipe          = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeProfilPage);
                swipe.Refresh += Swipe_Refresh;

                SetujSliku();
            }
            return(view);
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.SetContentView(Resource.Layout.SearchLayout);

            SearchService rservice = new SearchService();

            searchERP          = this.FindViewById <EditText>(Resource.Id.textsearchERP);
            buttonCheck        = this.FindViewById <Button>(Resource.Id.buttonCheck);
            buttonShow         = this.FindViewById <Button>(Resource.Id.buttonShow);
            textBarcode        = this.FindViewById <TextView>(Resource.Id.textBarcode);
            textERP            = this.FindViewById <TextView>(Resource.Id.textERP);
            textBrand          = this.FindViewById <TextView>(Resource.Id.textBrand);
            textInspector      = this.FindViewById <TextView>(Resource.Id.textInspector);
            textInspectionDate = this.FindViewById <TextView>(Resource.Id.textInspectionDate);

            buttonCheck.Click += async(sender, e) =>
            {
                this.RunOnUiThread(() => { searchedERP = this.searchERP.Text; });

                await rservice.Retrieve(searchedERP);
            };
            buttonShow.Click += (sender, e) =>
            {
                this.textBarcode.Text        = "Unit Barcode: " + rservice.BarcodeScan;
                this.textERP.Text            = "Unit ERP: " + rservice.UnitERP;
                this.textBrand.Text          = "Unit Brand: " + rservice.UnitBrand;
                this.textInspector.Text      = "Inspected by: " + rservice.InspectorName;
                this.textInspectionDate.Text = "Inspected on: " + rservice.InspectionDate;
            };
        }
Exemple #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var dialogView = inflater.Inflate(Resource.Layout.dialog_alert, null);

            _blurView = dialogView.FindViewById <BlurView>(Resource.Id.dialog_alert_blur_background);
            _blurView.SetBlurredView(Activity.Window.DecorView);
            _blurView.Click += OnBackgroundClick;

            _titleView            = dialogView.FindViewById <TextView>(Resource.Id.dialog_alert_title);
            _titleView.Visibility = Arguments.ContainsKey(TITLE_ARG) ? ViewStates.Visible : ViewStates.Gone;
            _titleView.Text       = Arguments.GetString(TITLE_ARG, string.Empty);

            _messageView            = dialogView.FindViewById <TextView>(Resource.Id.dialog_alert_message);
            _messageView.Visibility = Arguments.ContainsKey(MESSAGE_ARG) ? ViewStates.Visible : ViewStates.Gone;
            _messageView.Text       = Arguments.GetString(MESSAGE_ARG, string.Empty);

            _positiveButton        = dialogView.FindViewById <Android.Widget.Button>(Resource.Id.dialog_alert_positive_button);
            _positiveButton.Text   = Core.Properties.Resources.Ok;
            _positiveButton.Click += OnPositiveClick;

            _negativeButton            = dialogView.FindViewById <Android.Widget.Button>(Resource.Id.dialog_alert_negative_button);
            _negativeButton.Visibility = Arguments.ContainsKey(NEGATIVE_LABEL_ARG) ? ViewStates.Visible : ViewStates.Gone;
            _negativeButton.Text       = Arguments.GetString(NEGATIVE_LABEL_ARG, string.Empty);
            _negativeButton.Click     += OnNegativeClick;

            return(dialogView);
        }
Exemple #4
0
            public void TimeAlert(Android.Views.LayoutInflater inflater, AlertDialog.Builder builder)
            {
                Android.Views.View secondView = inflater.Inflate(Resource.Layout.TimePickerLayout, null);
                builder.SetView(secondView);
                builder.SetCancelable(false);

                /*TextView title = secondView.FindViewById<TextView>(Resource.Id.Login);
                 * title.Text = Title;
                 *
                 * TextView body = secondView.FindViewById<TextView>(Resource.Id.pincodeText);
                 * body.Text = Body;
                 * body.MovementMethod = new Android.Text.Method.ScrollingMovementMethod(); */

                Android.Widget.Button btnPositive = secondView.FindViewById <Android.Widget.Button>(Resource.Id.btnLoginLL);
                Android.Widget.Button btnNegative = secondView.FindViewById <Android.Widget.Button>(Resource.Id.btnClearLL);
                var tp = secondView.FindViewById <Android.Widget.TimePicker>(Resource.Id.timePicker1);

                tp.SetIs24HourView((Java.Lang.Boolean)true);
                //Positive button feedback
                btnPositive.Text   = Buttons.Last().Text;
                btnPositive.Click += delegate
                {
                    var car = (Xamarin.Forms.TimePicker)Content;
                    var ts  = new TimeSpan(tp.Hour, tp.Minute, 0);
                    car.Time = ts;
                    CommandsForButtons(Buttons.Last());
                };

                //Negative button feedback
                btnNegative.Text   = Buttons.First().Text;
                btnNegative.Click += delegate
                {
                    CommandsForButtons(Buttons.First());
                };
            }
Exemple #5
0
            public void YesOrNoAlert(Android.Views.LayoutInflater inflater, AlertDialog.Builder builder)
            {
                Android.Views.View secondView = inflater.Inflate(Resource.Layout.YesOrNoLayout, null);
                builder.SetView(secondView);

                TextView title = secondView.FindViewById <TextView>(Resource.Id.Login);

                title.Text = Title;

                TextView body = secondView.FindViewById <TextView>(Resource.Id.pincodeText);

                body.Text           = Body;
                body.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();

                Android.Widget.Button btnPositive = secondView.FindViewById <Android.Widget.Button>(Resource.Id.btnLoginLL);
                Android.Widget.Button btnNegative = secondView.FindViewById <Android.Widget.Button>(Resource.Id.btnClearLL);


                //Positive button feedback
                btnPositive.Text   = Buttons.Last().Text;
                btnPositive.Click += delegate
                {
                    CommandsForButtons(Buttons.Last());
                };

                //Negative button feedback
                btnNegative.Text   = Buttons.First().Text;
                btnNegative.Click += delegate
                {
                    CommandsForButtons(Buttons.First());
                };
            }
        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            //Get LayoutInflater and inflate from axml
            //Important note, this project utilizes a layout-land folder in the Resources folder
            //Android will use this folder with layout files for Landscape Orientations
            //This is why we don't have to worry about the layout of the play button, it doesn't exist in landscape layout file!!! 
            var activity = Context as Activity;
            var viewHolder = activity.LayoutInflater.Inflate(Resource.Layout.Main, this, false);
            view = viewHolder;
            AddView(view);

            //Get and set Views
            videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView);
            playButton = FindViewById<Android.Widget.Button>(Resource.Id.PlayVideoButton);

            //Give some color to the play button, but not important
            playButton.SetBackgroundColor(Android.Graphics.Color.Aqua);
            //uri for a free video
            var uri = Android.Net.Uri.Parse("http://www.androidbegin.com/tutorial/AndroidCommercial.3gp");
            //Set the videoView with our uri, this could also be a local video on device
            videoView.SetVideoURI(uri);
            //Assign click event on our play button to play the video
            playButton.Click += PlayVideo;
        }
Exemple #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.SetContentView(Resource.Layout.UnitInfoLayout);

            textBarcode        = this.FindViewById <EditText>(Resource.Id.textBarcode);
            textERP            = this.FindViewById <EditText>(Resource.Id.textERP);
            textBrand          = this.FindViewById <EditText>(Resource.Id.textBrand);
            buttonUpload       = this.FindViewById <Android.Widget.Button>(Resource.Id.buttonUpload);
            textInspector      = this.FindViewById <TextView>(Resource.Id.textInspector);
            textInspectionDate = this.FindViewById <TextView>(Resource.Id.textInspectionDate);

            this.textInspector.Text      = "Inspected By: " + LoginActivity.currentUser.Name;
            this.textInspectionDate.Text = "Inspected On: " + LoginActivity.currentUser.Date.ToString();

            buttonUpload.Click += async(sender, e) =>
            {
                this.RunOnUiThread(() => { Erp = this.textERP.Text; });
                this.RunOnUiThread(() => { unit.BardcodeScan = this.textBarcode.Text; });
                this.RunOnUiThread(() => { unit.UnitERP = this.textERP.Text; });
                this.RunOnUiThread(() => { unit.UnitBrand = this.textBrand.Text; });

                unit.InspectorName  = LoginActivity.currentUser.Name;
                unit.InspectionDate = LoginActivity.currentUser.Date.ToString();

                unit.RowKey = Erp;
                currentunit = unit.RowKey;


                await service.Upload(unit);

                StartActivity(typeof(CheckUnitActivity));
            };
        }
Exemple #8
0
            public void NeutralAlert(Android.Views.LayoutInflater inflater, AlertDialog.Builder builder)
            {
                Android.Views.View secondView = inflater.Inflate(Resource.Layout.DefaultAlertLayout, null);
                builder.SetView(secondView);

                TextView title = secondView.FindViewById <TextView>(Resource.Id.Login);

                title.Text = Title;

                TextView body = secondView.FindViewById <TextView>(Resource.Id.pincodeText);

                body.Text           = Body;
                body.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();

                Buttons = new List <AlertButton> {
                    new AlertButton {
                        Text        = "Oké",
                        IsPreferred = true,
                        Action      = () => false
                    }
                };
                Android.Widget.Button btnNeutral = secondView.FindViewById <Android.Widget.Button>(Resource.Id.btnNeutral);
                btnNeutral.Text   = Buttons.First().Text;
                btnNeutral.Click += delegate
                {
                    CommandsForButtons(Buttons.First());
                };
            }
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null && this.Control != null)
            {
                if (iconSpan == null)
                {
                    nativeBtn  = (Android.Widget.Button) this.Control;
                    iconButton = (IconButton)e.NewElement;

                    iconFont            = TrySetFont("fontawesome-webfont.ttf");
                    textFont            = iconButton.Font.ToTypeface();
                    iconButton.IconSize = iconButton.IconSize == 0 ? (float)iconButton.FontSize : iconButton.IconSize;
                    var computedString = BuildRawTextString();

                    iconSpan = BuildSpannableString(computedString);
                    if (iconButton.TextAlignement == Xamarin.Forms.TextAlignment.Center)
                    {
                        nativeBtn.Gravity = Android.Views.GravityFlags.Center;
                    }
                    else if (iconButton.TextAlignement == Xamarin.Forms.TextAlignment.End)
                    {
                        nativeBtn.Gravity = Android.Views.GravityFlags.Right;
                    }
                    else if (iconButton.TextAlignement == Xamarin.Forms.TextAlignment.Start)
                    {
                        nativeBtn.Gravity = Android.Views.GravityFlags.Left;
                    }
                    nativeBtn.TransformationMethod = null;
                    nativeBtn.SetPadding(0, 0, 0, 0);
                    nativeBtn.AfterTextChanged += nativeBtn_AfterTextChanged;
                }
            }
        }
Exemple #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ParkCar);
            //We must intlize xamarin forms and mobile barcode scanner here before using them
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
            Android.Widget.Button scanQRButton = FindViewById <Android.Widget.Button>(Resource.Id.scanQRButton);
            scanQRButton.Click += async(sender, e) =>
            {
                MobileBarcodeScanner.Initialize(Application);

                try
                {
                    var scanner = DependencyService.Get <IQrScanningService>();
                    var result  = await scanner.ScanAsync();

                    if (result != null)
                    {
                        string test = result;
                    }
                }
                catch
                {
                }
            };
        }
        /// <summary>
        /// Shows final data in final screen
        /// </summary>
        /// <param name="bundle"></param>
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);

                SetContentView(Resource.Layout.lastView);

                Console.WriteLine("Write order to database with id {0}", MainActivity.finalOrder.ID);
                MainActivity.Database.SaveOrderAsync(MainActivity.finalOrder);
                Console.WriteLine("Get order from database with id {0}", MainActivity.finalOrder.ID);
                var note = MainActivity.Database.GetOrderAsync(MainActivity.finalOrder.ID);
                Console.WriteLine(MainActivity.finalOrder.ToString());

                FindViewById <TextView>(Resource.Id.placeFinal).Text += MainActivity.finalOrder.Cafe;
                FindViewById <TextView>(Resource.Id.finalTime).Text  += MainActivity.finalOrder.PickupTime;

                Android.Widget.Button button = FindViewById <Android.Widget.Button>(Resource.Id.buttonReturnMain);

                button.Click += delegate
                {
                    var intent = new Intent(this, typeof(MainActivity));
                    this.StartActivity(intent);
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Exemple #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            System.Diagnostics.Debug.WriteLine("In login page...");
            SetContentView(Resource.Layout.Login);
            mGoogleSignIn = FindViewById <SignInButton>(Resource.Id.sign_in_button);
            Android.Widget.Button b2 = FindViewById <Android.Widget.Button>(Resource.Id.button1);
            b2.Click += delegate
            {
                StartActivity(typeof(register));
            };

            mGoogleSignIn.Click += mGoogleSignIn_Click;

            GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this);
            builder.AddConnectionCallbacks(this);
            builder.AddOnConnectionFailedListener(this);
            builder.AddApi(PlusClass.API);
            builder.AddScope(PlusClass.ScopePlusProfile);
            builder.AddScope(PlusClass.ScopePlusLogin);

            //Build our IGoogleApiClient
            mGoogleApiClient = builder.Build();
        }
Exemple #13
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);

            thisButton = Control as Android.Widget.Button;
            if (thisButton != null)
            {
                thisButton.SetMaxLines(1);
                thisButton.Ellipsize = TruncateAt.End;
            }
            List <string> classes = Element.GetValue(ResponsiveProperty.ClassProperty)?.ToString().Split(" ".ToCharArray()).ToList();

            if (classes != null)
            {
                ProcessButtonTheme(classes);

                ProcessButtonSize(classes);
            }


            var padding = (Thickness)Element.GetValue(ButtonProperty.PaddingProperty);

            if (padding.Left != -100 && padding.Top != -100 && padding.Right != -100 && padding.Bottom != -100)
            {
                int top    = int.Parse(padding.Top.ToString());
                int left   = int.Parse(padding.Left.ToString());
                int bottom = int.Parse(padding.Bottom.ToString());
                int right  = int.Parse(padding.Right.ToString());

                thisButton.SetPadding(left, top, right, bottom);
                Element.HeightRequest = Element.FontSize + padding.VerticalThickness + 10;
            }
        }
Exemple #14
0
        private void ExamNameTV_Click(object sender, ExamAdapterClickEventArgs e)
        {
            ExamModel examname_clicked = this.ExamList[e.Position];
            string    examname         = examname_clicked.get_exam_name();
            Dialog    nameDialog       = new Dialog(this);

            nameDialog.SetContentView(Resource.Id.dialog_name_update);
            EditText editText = (EditText)nameDialog.FindViewById(Resource.Id.dialog_name_editText);

            editText.Text = examname;
            /* Non riconosce più android.support.design e quindi ho messo il design che sta in google.design*/
            TextInputLayout textInputLayout = (TextInputLayout)nameDialog.FindViewById(Resource.Id.dialog_name_input_layout);

            Android.Widget.Button okButton = (Android.Widget.Button)nameDialog.FindViewById(Resource.Id.name_ok);
            okButton.Click += async delegate
            {
                string examNameNew = editText.Text.ToUpper();
                if (examNameNew.Trim().Equals(""))
                {
                    textInputLayout.SetErrorTextAppearance(Resource.String.empty_name_field);
                    textInputLayout.RequestFocus();
                }
                else if (examNameNew.Length > 15)
                {
                    textInputLayout.SetErrorTextAppearance(Resource.String.overflow_name_field);
                    textInputLayout.RequestFocus();
                }
                else if (IsSameName(examNameNew))
                {
                    textInputLayout.SetErrorTextAppearance(Resource.String.used_name);
                    textInputLayout.RequestFocus();
                }
                else
                { /*
                   *     Google.Cloud.Firestore.CollectionReference exams = database.Collection("exams");
                   *    Google.Cloud.Firestore.DocumentReference examDoc = exams.Document(examname);
                   *    Google.Cloud.Firestore.DocumentSnapshot snapshot = await examDoc.GetSnapshotAsync();
                   *    if (snapshot.Exists)
                   *    {
                   *        await exams.Document(examNameNew).SetAsync(snapshot);
                   *        await examDoc.DeleteAsync();
                   *    }
                   */
                }


                bool IsSameName(string examNewName)
                {
                    for (int j = 0; j < adapter.ItemCount; j++)
                    {
                        if (ExamList[j].examName.Equals(examNewName))
                        {
                            return(true);
                        }
                    }
                    return(false);
                }
            };
        }
    }
		protected override void OnElementChanged (ElementChangedEventArgs<Xamarin.Forms.View> e)
		{
			base.OnElementChanged (e);

			//Get LayoutInflater and inflate from axml
			//Important note, this project utilizes a layout-land folder in the Resources folder
			//Android will use this folder with layout files for Landscape Orientations
			//This is why we don't have to worry about the layout of the play button, it doesn't exist in landscape layout file!!! 
			var activity = Context as Activity; 
			var viewHolder = activity.LayoutInflater.Inflate (Resource.Layout.Main, this, false);
			view = viewHolder;
			AddView (view);

			//Get and set Views
			videoView = FindViewById<VideoView> (Resource.Id.SampleVideoView);
			playButton = FindViewById<Android.Widget.Button> (Resource.Id.PlayVideoButton);

			//Give some color to the play button, but not important
			playButton.SetBackgroundColor (Android.Graphics.Color.Aqua);
			//uri for a free video
			var uri = Android.Net.Uri.Parse ("https://www.dropbox.com/s/hi45psyy0wq9560/PigsInAPolka1943.mp4?dl=1");
			//Set the videoView with our uri, this could also be a local video on device
			videoView.SetVideoURI (uri);
			//Assign click event on our play button to play the video
			playButton.Click += PlayVideo;
		}      
Exemple #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //Inicializacion de variables
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Datos);
            lista      = FindViewById <Android.Widget.ListView>(Resource.Id.lista);
            nombres    = new List <string>();
            ruta       = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/CameraScanner";
            directorio = new File(ruta);
            archivos   = directorio.ListFiles();
            //Boton volver
            Android.Widget.Button volver = FindViewById <Android.Widget.Button>(Resource.Id.btn_volver);
            //Evento del boton volver
            volver.Click += Volver;
            //Boton flotante para borrado (No funcional/En pruebas)
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += PreguntaBorradoCompleto;

            //Ignora la URI de los archivos
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.SetVmPolicy(builder.Build());

            CrearListado();
            //Eventos del ListView
            lista.ItemClick     += AbrirArchivo;
            lista.ItemLongClick += PreguntaBorradoSimple;
        }
Exemple #17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            httpClient     = new HttpClient();
            button1        = FindViewById <Android.Widget.Button>(Resource.Id.button1);
            textView1      = FindViewById <TextView>(Resource.Id.textView1);
            textView2      = FindViewById <TextView>(Resource.Id.textView2);
            textView3      = FindViewById <TextView>(Resource.Id.textView3);
            textView1.Text = CrossConnectivity.Current.IsConnected.ToString();
            textView2.Text = CrossConnectivity.Current.ConnectionTypes.FirstOrDefault().ToString();

            CrossConnectivity.Current.ConnectivityChanged += Current_ConnectivityChanged;
            button1.Click += delegate(object sender, EventArgs e)
            {
                DateTime PushButtonTime = DateTime.Now;
                var      button         = new { PushButtonTime };
                textView3.Text = PushButtonTime.ToString();
                string      json        = JsonConvert.SerializeObject(button);
                HttpContent httpContent = new StringContent(json);
                httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                httpClient.PostAsync("http://192.168.0.101:53538/api/values", httpContent);
            };
        }
Exemple #18
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabSlidingView> e)
        {
            base.OnElementChanged(e);
            _tabSlidingView = e.NewElement;
            // コンテクストは継承されたものをそのまま使った
            var horizontalScrollView = new HorizontalScrollView(_context);
            var linerLayout          = new LinearLayout(_context);

            for (int i = 0; i < 20; i++)
            {
                // ボタンのレイアウトを整えるiOSでもこのような機能があるといいな
                var layoutParams = new LinearLayout.LayoutParams
                                       (LinearLayout.LayoutParams.MatchParent
                                       , LinearLayout.LayoutParams.WrapContent);
                // コンテクストの為に親が決まる訳ではない(この前の親をとり除けというエラーは一体何だったのだろうか)
                var btn = new Android.Widget.Button(_context);
                btn.Id   = i;
                btn.Text = i.ToString();
                btn.SetBackgroundColor(Android.Graphics.Color.White);
                btn.SetTextColor(Android.Graphics.Color.LightGray);
                linerLayout.AddView(btn, layoutParams);
            }
            horizontalScrollView.AddView(linerLayout);
            base.SetNativeControl(horizontalScrollView);
        }
Exemple #19
0
        AButton IStepperRenderer.CreateButton()
        {
            var button = new AButton(Context);

            button.SetHeight((int)Context.ToPixels(10.0));
            return(button);
        }
Exemple #20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetCanceledOnTouchOutside(true);

            _layout.Orientation = Orientation.Vertical;

            using (var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent))
                SetContentView(_layout, layoutParams);

            if (_arguments.Destruction != null)
            {
                AButton destruct = AddButton(_arguments.Destruction);
                destruct.Background.SetColorFilter(new Color(1, 0, 0, 1).ToAndroid(), PorterDuff.Mode.Multiply);
            }

            foreach (string button in _arguments.Buttons)
            {
                AddButton(button);
            }

            if (_arguments.Cancel != null)
            {
                AButton cancel = AddButton(_arguments.Cancel);
                cancel.Background.SetColorFilter(new Color(0.5, 0.5, 0.5, 1).ToAndroid(), PorterDuff.Mode.Multiply);
            }

            SetTitle(_arguments.Title);
        }
Exemple #21
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            CheckSession();
            View view = inflater.Inflate(Resource.Layout.fragment_login, container, false);

            #region Initialize fragment components
            btnRegister          = view.FindViewById <Button>(Resource.Id.btnRegister);
            btnLogin             = view.FindViewById <Android.Widget.Button>(Resource.Id.btnLogin);
            etEmail              = view.FindViewById <EditText>(Resource.Id.editTextEmail);
            etPassword           = view.FindViewById <EditText>(Resource.Id.editTextPassword);
            txtForgottenPassword = view.FindViewById <TextView>(Resource.Id.txtViewForgottenPass);
            imageView            = view.FindViewById <ImageView>(Resource.Id.imgView);
            //Glide
            //   .With(Android.App.Application.Context)
            //   .Load("gs://educationalsoftware-ba7e4.appspot.com/[email protected]/t")
            //   .Into(imageView);
            btnLogin.Enabled = true;
            #endregion

            btnRegister.Click          += OnRegister_Click;
            btnLogin.Click             += OnLogin_Click;
            txtForgottenPassword.Click += OnForgottenPassword;

            return(view);
        }
Exemple #22
0
        public async void Scan()
        {
            scanner.UseCustomOverlay = true;
            var options = new MobileBarcodeScanningOptions()
            {
                AutoRotate  = false,
                TryInverted = true
            };

            zxingOverlay = LayoutInflater.FromContext(Android.App.Application.Context).Inflate(Resource.Layout.ScanCustom, null);
            //zxingOverlay.scree

            flashButton        = zxingOverlay.FindViewById <Android.Widget.Button>(Resource.Id.buttonFlash);
            flashButton.Click += (sender, e) =>
            {
                if (flashButton.Text == "Tắt Flash")
                {
                    flashButton.Text = "Bật Flash";
                }
                else
                {
                    flashButton.Text = "Tắt Flash";
                }
                scanner.ToggleTorch();
            };
            scanner.CustomOverlay = zxingOverlay;

            //scanner.TopText = "Giữ camera cách mã khoảng 6inch";
            //scanner.BottomText = "Đợi một chút...";

            var result = await scanner.Scan(options);

            System.Diagnostics.Debug.WriteLine("Đợi két quả");
            HandleScanResult(result);
        }
Exemple #23
0
        protected override void OnElementChanged(ElementChangedEventArgs <Stepper> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                _downButton = new AButton(Context)
                {
                    Text = "-", Gravity = GravityFlags.Center, Tag = this
                };
                _downButton.SetHeight((int)Context.ToPixels(10.0));

                _downButton.SetOnClickListener(StepperListener.Instance);

                _upButton = new AButton(Context)
                {
                    Text = "+", Tag = this
                };

                _upButton.SetOnClickListener(StepperListener.Instance);
                _upButton.SetHeight((int)Context.ToPixels(10.0));

                var layout = CreateNativeControl();

                layout.AddView(_downButton);
                layout.AddView(_upButton);

                SetNativeControl(layout);
            }

            UpdateButtonEnabled();
        }
Exemple #24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.main_page);
            var  userName    = FindViewById <TextView>(Resource.Id.textUserName);
            User currentUser = User.Instance;

            userName.Text = currentUser.firstName + " " + currentUser.lastName;
            Android.Widget.Button buttonSeeAccounts = FindViewById <Android.Widget.Button>(Resource.Id.buttonAccounts);
            Android.Widget.Button buttonTransfer    = FindViewById <Android.Widget.Button>(Resource.Id.buttonTransfer);
            buttonSeeAccounts.Click += (e, o) =>
            {
                Intent nextActivity = new Intent(this, typeof(AccountsPage));
                StartActivity(nextActivity);
            };
            buttonTransfer.Click += (e, o) =>
            {
                if (currentUser.numberOfAccounts == 0)
                {
                    Toast.MakeText(ApplicationContext, "You must have at least one account", ToastLength.Long).Show();
                }
                else
                {
                    Intent nextActivity = new Intent(this, typeof(TransferPage));
                    StartActivity(nextActivity);
                }
            };
        }
Exemple #25
0
        /// <summary>
        /// Screen of additional services
        /// </summary>
        /// <param name="bundle"></param>

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.servicesView);

            /// Populates dropdown lists with data

            for (int i = 1; i < 7; i++)
            {
                var res = Resource.Id.spinner1;

                switch (i)
                {
                case 1:
                    res = Resource.Id.spinner1;
                    break;

                case 2:
                    res = Resource.Id.spinner2;
                    break;

                case 3:
                    res = Resource.Id.spinner3;
                    break;

                case 4:
                    res = Resource.Id.spinner4;
                    break;

                case 5:
                    res = Resource.Id.spinner5;
                    break;

                case 6:
                    res = Resource.Id.spinner6;
                    break;
                }


                Spinner spinner = FindViewById <Spinner>(res);

                spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
                var adapter = ArrayAdapter.CreateFromResource(
                    this, Resource.Array.numbers_array, Android.Resource.Layout.SimpleSpinnerItem);

                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                spinner.Adapter = adapter;
            }

            Android.Widget.Button button = FindViewById <Android.Widget.Button>(Resource.Id.servicesButton);

            button.Click += delegate
            {
                var intent = new Intent(this, typeof(DetailsList));
                this.StartActivity(intent);
            };
        }
        public MainPageRenderer()
        {
            Activity activity = (Activity)Forms.Context;

            _view          = activity.LayoutInflater.Inflate(Resource.Layout.MainDroidLayout, this, false);
            _button        = _view.FindViewById <Android.Widget.Button>(Resource.Id.button);
            _button.Click += OnButtonClick;
            AddView(_view);
        }
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.SignedCageballEventActivity);
     signup_button = FindViewById<Button>(Resource.Id.sign_button);
     signup_button.Click += new EventHandler(Signup_button_Click);
     GetDataFromIntent();
     SetTextOnButtons();
 }
        protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);
            MessagingCenter.Subscribe <RootPage, AlertArguments> (this, "DisplayAlert", (sender, arguments) => {
                //If you would like to use style attributes, you can pass this into the builder
//				ContextThemeWrapper customDialog = new ContextThemeWrapper(Context, Resource.Style.AlertDialogCustom);
//				AlertDialog.Builder builder = new AlertDialog.Builder(customDialog);

                //Create instance of AlertDialog.Builder and create the alert
                AlertDialog.Builder builder = new AlertDialog.Builder(Context);
                var alert = builder.Create();

                //Utilize context to get LayoutInflator to set the view used for the dialog
                var layoutInflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
                alert.SetView(layoutInflater.Inflate(Resource.Layout.CustomDialog, null));

                //Create a custom title element
                TextView title = new TextView(Context)
                {
                    Text = arguments.Title,
                };
                title.SetTextColor(Android.Graphics.Color.DodgerBlue);
                title.SetBackgroundColor(Android.Graphics.Color.White);
                //Add the custom title to the AlertDialog
                alert.SetCustomTitle(title);

                //Set the buttons text and click handler events
                if (arguments.Accept != null)
                {
                    alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
                }
                alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
                alert.CancelEvent += (o, args) => { arguments.SetResult(false); };
                alert.Show();

                //This code grabs the line that separates the title and dialog.
                int titleDividerId = Resources.GetIdentifier("titleDivider", "id", "android");
                Android.Views.View titleDivider = alert.FindViewById(titleDividerId);
                if (titleDivider != null)
                {
                    titleDivider.SetBackgroundColor(Android.Graphics.Color.DarkRed);
                }

                //Set properties of the buttons
                Android.Widget.Button positiveButton = alert.GetButton((int)DialogButtonType.Positive);
                positiveButton.SetTextColor(Android.Graphics.Color.Green);
                positiveButton.SetBackgroundColor(Android.Graphics.Color.White);

                Android.Widget.Button negativeButton = alert.GetButton((int)DialogButtonType.Negative);
                negativeButton.SetTextColor(Android.Graphics.Color.Red);
                negativeButton.SetBackgroundColor(Android.Graphics.Color.White);

                //Set the text of the TextView in the dialog
                var textView = alert.FindViewById <TextView>(Resource.Id.textview);
                textView.SetText(arguments.Message, null);
            });
        }
Exemple #29
0
 private void FindView()
 {
     _Class1Button = FindViewById <Button>(Resource.Id.ClassButton1);
     _Class2Button = FindViewById <Button>(Resource.Id.ClassButton2);
     _Class3Button = FindViewById <Button>(Resource.Id.ClassButton3);
     _Class4Button = FindViewById <Button>(Resource.Id.ClassButton4);
     _Class5Button = FindViewById <Button>(Resource.Id.ClassButton5);
     _Class6Button = FindViewById <Button>(Resource.Id.ClassButton6);
 }
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                floatingButton = new Android.Widget.Button(context);

                floatingButton = (Android.Widget.Button)FindViewById(Resource.Layout.floatingButton);
            }
        }
Exemple #31
0
        private void initialSettings()
        {
            pageTitle    = FindViewById <TextView>(Resource.Id.textViewtitle);
            messagePart1 = FindViewById <TextView>(Resource.Id.tvMessagePart1);
            messagePart2 = FindViewById <TextView>(Resource.Id.tvMessagePart2);

            Button messageBtn = FindViewById <Button>(Resource.Id.BtnMessageOk);

            messageBtn.SetOnClickListener(this);
        }
        private void FindAndSetLaterDialogById()
        {
            Button confirmBtn = laterDialog.FindViewById <Button>(Resource.Id.confirmBtn);
            Button cancelBtn  = laterDialog.FindViewById <Button>(Resource.Id.cancelBtn);

            adViewForLater = laterDialog.FindViewById <AdView>(Resource.Id.adView);

            confirmBtn.Click += LaterDialog_ConfirmBtn_Click;
            cancelBtn.Click  += LaterDialog_CancelBtn_Click;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;
            //layout.SetBackgroundColor(Android.Graphics.Color.White);

            var aLabel = new TextView(this);
            aLabel.Text = "Select a language";
            aLabel.TextSize = 15;
            //aLabel.SetTextColor(Android.Graphics.Color.Black);
            //aLabel.TextAlignment = TextAlignment.Center;

            var frenchButton = new Button(this);
            frenchButton.Text = "Français";
            frenchButton.TextAlignment = TextAlignment.Center;

            //frenchButton.SetBackgroundColor(Android.Graphics.Color.AliceBlue);
            //frenchButton.SetTextColor(Android.Graphics.Color.Black);
            var englishButton = new Button(this);
            englishButton.Text = "English";
            englishButton.TextAlignment = TextAlignment.Center;
            //englishButton.SetBackgroundColor(Android.Graphics.Color.AliceBlue);
            //englishButton.SetTextColor(Android.Graphics.Color.Black);

            var deutscheButton = new Button(this);
            deutscheButton.Text = "Deutsche";
            deutscheButton.TextAlignment = TextAlignment.Center;
            //deutscheButton.SetBackgroundColor(Android.Graphics.Color.AliceBlue);
            //deutscheButton.SetTextColor(Android.Graphics.Color.Black);

            frenchButton.Click += (sender, e) =>
            { SetLanguageSettings("french"); };
            englishButton.Click += (sender, e) =>
            { SetLanguageSettings("english"); };
            deutscheButton.Click += (sender, e) =>
            { SetLanguageSettings("deutsche"); };
            layout.AddView(aLabel);
            layout.AddView(deutscheButton);
            layout.AddView(englishButton);
            layout.AddView(frenchButton);
            SetContentView(layout);
        }
        /// <summary>
        /// Handles the Element Changed event messages
        /// </summary>
        /// <param name="e">The e.</param>
        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null && this.Control != null)
            {
                if (_helper == null)
                    _helper = new TextViewRenderHelper(Context);
                if (_iconSpan == null)
                {
                    _nativeBtn = (Android.Widget.Button)this.Control;
                    _iconButton = (IconButton)e.NewElement;

                    _iconFont = _helper.TrySetFont("fontawesome-webfont.ttf");
                    _textFont = _iconButton.Font.ToTypeface();
                    _iconButton.IconSize = _iconButton.IconSize == 0 ? (float)_iconButton.FontSize : _iconButton.IconSize;
                    var computedString = BuildRawTextString();

                    _iconSpan = BuildSpannableString(computedString);
                    if (_iconButton.TextAlignement == Xamarin.Forms.TextAlignment.Center)
                    {
                        _nativeBtn.Gravity = Android.Views.GravityFlags.Center;

                    }
                    else if (_iconButton.TextAlignement == Xamarin.Forms.TextAlignment.End)
                    {
                        _nativeBtn.Gravity = Android.Views.GravityFlags.Right;
                    }
                    else if (_iconButton.TextAlignement == Xamarin.Forms.TextAlignment.Start)
                    {
                        _nativeBtn.Gravity = Android.Views.GravityFlags.Left;
                    }
                    _nativeBtn.TransformationMethod = null;
                    _nativeBtn.SetPadding(0, 0, 0, 0);
                    _nativeBtn.AfterTextChanged += nativeBtn_AfterTextChanged;
                }
            }


        }
        private void setupWidgets()
        {
            mBuyButton = (Button)FindViewById(Resource.Id.buy_button);
            mBuyButton.Enabled = false;
            mBuyButton.Click += delegate
            {
                    BillingController.requestPurchase(this, mSku, true /* confirm */);
            };

            mSelectItemSpinner = (Spinner)FindViewById(Resource.Id.item_choices);
            mCatalogAdapter = new CatalogAdapter(this, CatalogEntry.CATALOG);
            mSelectItemSpinner.Adapter = mCatalogAdapter;
            mSelectItemSpinner.ItemSelected += delegate(object sender, ItemEventArgs e)
            {
                mSku = CatalogEntry.CATALOG[e.Position].sku;
            };

             mOwnedItemsTable = (ListView)FindViewById(Resource.Id.owned_items);
        }
		protected override async void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.profile);
			Log.Debug (tag, "INICIANDO PERFIL");

			Log.Debug (tag, "Seteando toolbar y scrollview");
			mToolbar = FindViewById<SupportToolBar> (Resource.Id.toolbar);
			mScrollView = FindViewById<ScrollView> (Resource.Id.scrollView);

			SetSupportActionBar (mToolbar);
			SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_arrow_back);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			SupportActionBar.SetHomeButtonEnabled (true);

			Point size = new Point ();
			Display display = WindowManager.DefaultDisplay;
			display.GetSize (size);
			mScreenHeight = size.Y;

			mScrollView.ViewTreeObserver.AddOnScrollChangedListener (this);

			nombreu = FindViewById<TextView> (Resource.Id.nombre);
			correou = FindViewById<TextView> (Resource.Id.correo);
			puntos = FindViewById<TextView> (Resource.Id.puntos);
			completado = FindViewById<TextView> (Resource.Id.completado);
			countup = FindViewById<TextView> (Resource.Id.countup);
			completadobarra = FindViewById<ProgressBar> (Resource.Id.completadobarra);
			entradasblog = new List<BlogEntry> ();
			updatefoto = FindViewById<Button> (Resource.Id.updatefoto);
			Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder (this);
			//progressBar.getProgressDrawable().setColorFilter(Color.RED, Mode.SRC_IN);
			completadobarra.ProgressDrawable.SetColorFilter(Color.ParseColor("#68FF68"), Android.Graphics.PorterDuff.Mode.SrcIn);
			source = 1;
			apath = "";
			imgUri = null;

			esperafoto = FindViewById<ProgressBar> (Resource.Id.esperafoto);

			//foto = FindViewById<PlifToolbarMenu.CircleImageView> (Resource.Id.fotoperfil);
			foto = FindViewById<ImageView> (Resource.Id.fotoperfil);
			Typeface font = Typeface.CreateFromAsset(Assets, "Fonts/fa.ttf");

			//Preferencias de la App
			var prefs = this.GetSharedPreferences("RunningAssistant.preferences", FileCreationMode.Private);

			idusuario = prefs.GetString ("id", null);
			correo = prefs.GetString ("email",null);

			var editor = prefs.Edit ();
			var nombre = prefs.GetString("nombre", null);
			SupportActionBar.Title = nombre;

			Log.Debug (tag, "Inicia foto de perfil");
			fotoperfil = FindViewById<ImageView> (Resource.Id.fotoperfil);

			try{
				JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+idusuario);
				Log.Debug ("json","SI existe la ruta");
				string extra="http://plif.mx/";
				string path = rutapre [0] ["imagen_usuarios"] ["ruta"];


				string first=path[0].ToString();

				if(first=="u" || first=="U"){
					//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
					path=extra+path;
				}else{
					//no hagas nada, la imagen es de google o de algun otro lado.
				}


				Log.Debug (tag, "La ruta es: "+path);
				rutafoto=path;
				Koush.UrlImageViewHelper.SetUrlDrawable(fotoperfil, path, Resource.Drawable.profile);
				hayimagen="si";
			}catch(Exception ex){
				Log.Debug ("json","no existe la ruta");
				fotoperfil.SetImageResource (Resource.Drawable.profile);
				hayimagen="no";
			}

			string url = "http://plif.mx/perfil/" + idusuario + ".json?droid";
			Log.Debug (tag, "la URL es: " + url);

			string completadonum = "";



			try{
			datos = await plifserver.FetchWeatherAsync(url);

			nombreu.Text = nombre;
			correou.Text = correo;
			puntos.Text = datos ["0"] ["Users"] ["puntos"]+" puntos";
			//Log.Debug(tag, "El completado: "+datos ["completadoperfil"]);

				int comptemp=Int32.Parse(datos ["completadoperfil"]);

				if(comptemp==20){
					//no hagas nada
				}else{
					comptemp=comptemp+20;
				}

				completadonum = comptemp.ToString();
			completado.Text="Tu perfil está completo al "+completadonum+"% ¡Complétalo desde nuestra web para ganar más puntos!";

		    //aqui ponemos lo que hay completado del perfil;

			}catch(Exception ex){
				Log.Debug (tag, "F**K!! "+ex.ToString() );
			}



			System.Threading.Tasks.Task.Factory.StartNew(() => {

				TextView cp = FindViewById<TextView> (Resource.Id.countup);
				int j = 0;
				Log.Debug(tag,"thread started");
				//while (j<100){
				for(j=0; j<=Int32.Parse(completadonum); j++){
					Log.Debug(tag,"Ciclo For");
					ThreadPool.QueueUserWorkItem (o => setprogreso (countup, j));
					Log.Debug(tag,"Se llama al ThreadPool");
					Thread.Sleep (25);
					Log.Debug(tag,"Retardo de 100ms");
					j++;
					Log.Debug(tag,"El nuevo valor de J: "+j);
				}
				//cp.Text = j.ToString()+"%";

			});

			//Creamos el inflater para las vistas de los negocios
			LayoutInflater inflater = LayoutInflater.From(this);

			//creamos la ll donde se van a meter las entradas
			LinearLayout blogcontainer = FindViewById<LinearLayout> (Resource.Id.blogcontainer);


			try{
			//Aquí vamos a llenar el blog
				JsonValue datosblog = datos["entradas"];
				foreach(JsonObject data in datosblog){
					Log.Debug(tag, "Entrada al blog: "+data["b"]["titulo"]);
					//JsonValue b = data["b"];
					//JsonValue cero = data ["0"];
					entradasblog.Add(new BlogEntry(){
						Id=data["b"]["id"],
						Titulo=data["b"]["titulo"],
						User=data["b"]["user"],
						FechaPublicacion=data["b"]["fecha_publicacion"],
						Likes = data["b"]["likes"],
						ImagenCabezado=data["b"]["imgencabezado"],
						Promedio="lel"
					});
				}

				Log.Debug(tag, "Justo antes del foreach del blog");
				for(int j=0; j<entradasblog.Count; j++){
					Log.Debug(tag, "Entramos al foreach del blog e inflamos");
					View row = inflater.Inflate(Resource.Layout.blog_row, blogcontainer, false);

					//ESTE SETEA EL NOMBRE
					Log.Debug(tag, "creamos textview");
					TextView tituloblog = row.FindViewById<TextView> (Resource.Id.entryname);
					Log.Debug(tag, "seteamos textview");
					tituloblog.Text = entradasblog [j].Titulo;

					//inicia estrellas
					//ESTE SETEA LAS ESTRELLAS DE LA CALIFICACION
					ImageView cali = row.FindViewById<ImageView> (Resource.Id.calificacion);

					string cal = entradasblog[j].Promedio;

					switch (cal) {

					case "0":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "null":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case null:
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "1":
						cali.SetImageResource (Resource.Drawable.e1);
						break;

					case "2":
						cali.SetImageResource (Resource.Drawable.e2);
						break;

					case "3":
						cali.SetImageResource (Resource.Drawable.e3);
						break;

					case "4":
						cali.SetImageResource (Resource.Drawable.e4);
						break;

					case "5":
						cali.SetImageResource (Resource.Drawable.e5);
						break;



					default:
						cali.SetImageResource (Resource.Drawable.e0);
						break;
					}
					//termina estrellas

					//inicia imagen
					//ESTE SETEA LA IMAGEN
					ImageView imagen = row.FindViewById<ImageView> (Resource.Id.NegocioFoto);

					if (entradasblog[j].ImagenCabezado == null || entradasblog[j].ImagenCabezado == "" || entradasblog[j].ImagenCabezado == "null") {
						//pon la imagen por defecto
						imagen.SetImageResource (Resource.Drawable.marca);
					} else {
						//TENEMOS QUE VERIFICAR SI LA IMAGEN ES DE GOOGLE O DE NOSOTROS!!!
						string extra="http://plif.mx/admin/";
						string ruta=entradasblog[j].ImagenCabezado;
						string first=ruta[0].ToString();

						if(first=="u" || first=="U"){
							//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
							ruta=extra+ruta;
						}else{
							//no hagas nada, la imagen es de google
						}

						Koush.UrlImageViewHelper.SetUrlDrawable (imagen, ruta, Resource.Drawable.bolaplace);
					//acaba imagen
					}

					//SETEA EL NUMERO DE CORAZONES
					TextView corazones = row.FindViewById<TextView> (Resource.Id.corazones);
					corazones.Text=entradasblog[j].Likes;


					Log.Debug(tag, "retornamos vista");
					blogcontainer.AddView(row);

				

				}//For


			}catch(Exception ex){
				Log.Debug (tag, "Algo en el blog falló D: "+ex.ToString());
			}


			updatefoto.SetTypeface(font, TypefaceStyle.Normal);

			updatefoto.Click += async (object sender, EventArgs e) => {
				//actualizamos la foto

				alert.SetTitle("Actualizar foto");

				alert.SetPositiveButton ("Desde cámara", (senderAlert, args) => {
					//abrimos el intent de la cámara
					updatefoto.Visibility=ViewStates.Gone;
					esperafoto.Visibility=ViewStates.Visible;
						

					source=2;

					Dictionary<string,string> diccionario = new Dictionary<string,string>();

					List <byte[]> fossbytes = new List<byte[]>();
					GetImage((async (b, p) =>  {
						Log.Debug(tag,"Inicia GETIMAGE");

						AlphaAnimation alpha = new AlphaAnimation(1.0F, 0.4F); // change values as you want
						alpha.Duration=500; // Make animation instant
						alpha.FillAfter=true; // Tell it to persist after the animation ends
						// And then on your imageview
						fotoperfil.StartAnimation(alpha);

						Java.IO.File f = new Java.IO.File(p[0]);
						stream = this.ContentResolver.OpenInputStream(Android.Net.Uri.FromFile(f));
						Bitmap temp =BitmapFactory.DecodeStream(stream);

						if(temp!=null){
							Log.Debug("FOSSBYTES","Inicia conversión a bytes!");
							byte[] tmp2 = pliffunctions.PathToByte2(p[0]);
							Log.Debug("FOSSBYTES","Termina conversión a bytes!");

							fossbytes.Add(tmp2);
							diccionario.Add("imagen_usuario_id",hayimagen);
							diccionario.Add("usuario_id",idusuario);


							try{
							//AQUI vamos a actualizar la foto del perfil con el codigo del multipart
							string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/UpdateImgPerfil", fossbytes, "nada", "file[]", "image/jpeg", diccionario, true);
							Log.Debug(tag,"Respuesta del servidor: "+resp);

							//PONEMOS LA IMAGEN, MOSTRAMOS EL BOTON Y OCULTAMOS EL PROGRESSBAR
							JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+idusuario);
							Log.Debug ("json","SI existe la ruta");
							string path = "http://plif.mx/"+rutapre [0] ["imagen_usuarios"] ["ruta"];
							Log.Debug (tag, "La ruta es: "+path);
								rutafoto=path;
							Koush.UrlImageViewHelper.SetUrlDrawable(fotoperfil, path, Resource.Drawable.profile);
							hayimagen="si";

							

							AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
							alpha2.Duration=500; // Make animation instant
							alpha2.FillAfter=true; // Tell it to persist after the animation ends
							// And then on your imageview
							updatefoto.Visibility=ViewStates.Visible;
							esperafoto.Visibility=ViewStates.Gone;
							fotoperfil.StartAnimation(alpha2);
							}catch(Exception ex){
								updatefoto.Visibility=ViewStates.Visible;
								esperafoto.Visibility=ViewStates.Gone;

								AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
								alpha2.Duration=500; // Make animation instant
								alpha2.FillAfter=true; // Tell it to persist after the animation ends
								// And then on your imageview
								fotoperfil.StartAnimation(alpha2);
								Toast.MakeText (Application.Context, "Ocurrió un error al actualizar la foto de perfil. Inténtalo de nuevo", ToastLength.Long).Show ();

							}

						}

					}));

				} );

				fotoperfil.Click += (object sender2, EventArgs e2) => {
					//abrimos el intent de pantalla completa
					Log.Debug(tag,"clickeo la imagen!");
					var pantallacompleta = new Intent (this, typeof(PantallaCompleta));
					pantallacompleta.PutExtra("ruta",rutafoto);

					StartActivity (pantallacompleta);

				};

				alert.SetNeutralButton ("Desde galería", (senderAlert, args) => {

					//abrimos el intent de la galería
					updatefoto.Visibility=ViewStates.Gone;
					esperafoto.Visibility=ViewStates.Visible;


					source=1;

					Dictionary<string,string> diccionario = new Dictionary<string,string>();

					List <byte[]> fossbytes = new List<byte[]>();
					GetImage((async (b, p) =>  {
						Log.Debug(tag,"Inicia GETIMAGE");

						AlphaAnimation alpha = new AlphaAnimation(1.0F, 0.4F); // change values as you want
						alpha.Duration=500; // Make animation instant
						alpha.FillAfter=true; // Tell it to persist after the animation ends
						// And then on your imageview
						fotoperfil.StartAnimation(alpha);

						Java.IO.File f = new Java.IO.File(p[0]);
						stream = this.ContentResolver.OpenInputStream(Android.Net.Uri.FromFile(f));
						Bitmap temp =BitmapFactory.DecodeStream(stream);

						if(temp!=null){
							Log.Debug("FOSSBYTES","Inicia conversión a bytes!");
							byte[] tmp2 = pliffunctions.PathToByte2(p[0]);
							Log.Debug("FOSSBYTES","Termina conversión a bytes!");

							fossbytes.Add(tmp2);
							diccionario.Add("imagen_usuario_id",hayimagen);
							diccionario.Add("usuario_id",idusuario);


							try{
								//AQUI vamos a actualizar la foto del perfil con el codigo del multipart
								string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/UpdateImgPerfil", fossbytes, "nada", "file[]", "image/jpeg", diccionario, true);
								Log.Debug(tag,"Respuesta del servidor: "+resp);

								//PONEMOS LA IMAGEN, MOSTRAMOS EL BOTON Y OCULTAMOS EL PROGRESSBAR
								JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+idusuario);
								Log.Debug ("json","SI existe la ruta");
								string path = "http://plif.mx/"+rutapre [0] ["imagen_usuarios"] ["ruta"];
								Log.Debug (tag, "La ruta es: "+path);
								rutafoto=path;
								Koush.UrlImageViewHelper.SetUrlDrawable(fotoperfil, path, Resource.Drawable.profile);
								hayimagen="si";



								AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
								alpha2.Duration=500; // Make animation instant
								alpha2.FillAfter=true; // Tell it to persist after the animation ends
								// And then on your imageview
								updatefoto.Visibility=ViewStates.Visible;
								esperafoto.Visibility=ViewStates.Gone;
								fotoperfil.StartAnimation(alpha2);
							}catch(Exception ex){
								updatefoto.Visibility=ViewStates.Visible;
								esperafoto.Visibility=ViewStates.Gone;

								AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
								alpha2.Duration=500; // Make animation instant
								alpha2.FillAfter=true; // Tell it to persist after the animation ends
								// And then on your imageview
								fotoperfil.StartAnimation(alpha2);
								Toast.MakeText (Application.Context, "Ocurrió un error al actualizar la foto de perfil. Inténtalo de nuevo", ToastLength.Long).Show ();

							}

						}

					}));

				} );

				alert.Show();
		

			};


		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView(Resource.Layout.Login_Layout);

			btnLLLoginAuthBtn = (Android.Widget.Button)FindViewById (Resource.Id.btnLLLoginAuthBtn);
			etLLLoginUsername = (EditText)FindViewById (Resource.Id.etLLLoginUsername);
			etLLLoginPassword = (EditText)FindViewById (Resource.Id.etLLLoginPassword);

			//TextView tvLLUserNameLabel = (TextView)FindViewById (Resource.Id.tvLLUserNameLabel);
			//TextView tvLLPassLabel = (TextView)FindViewById (Resource.Id.tvLLPassLabel);

			//TextView tvLLCopyrightText = (TextView)FindViewById (Resource.Id.tvLLCopyrightText);
			//TextView tvLLTermsText = (TextView)FindViewById (Resource.Id.tvLLTermsText);

			//progressDialog = ProgressDialog.Show(this,"Sila tunggu","Sedang memuatkan...");

			mProgressBar = FindViewById<Android.Widget.ProgressBar> (Resource.Id.progressBar1);

			//etLLLoginUsername.Text = "860815435145";
			//etLLLoginUsername.Text = "850408115989";
			etLLLoginUsername.Hint = Resources.GetString(Resource.String.login_username_hint);
			//etLLLoginPassword.Text = "password";
			etLLLoginPassword.Hint = Resources.GetString(Resource.String.login_password_hint);

			mProgressBar.Visibility = ViewStates.Invisible;
				
			//string deviceToken = getAndroidDeviceToken ();

			

			/*
			if (getAndroidDeviceToken () != "") {
				
				deviceTokenGCM = deviceToken;
				progressDialog.Hide ();

			} else {

				getAndroidDeviceToken ();
				OnCreate (bundle);

			}
			*/
			//GetIMEIID ();

			btnLLLoginAuthBtn.Click += (object sender, EventArgs e) => {

				if(etLLLoginUsername.Text != "")
				{
					if(etLLLoginPassword.Text != "") {
						
						mProgressBar.Visibility = ViewStates.Visible;
						btnLLLoginAuthBtn.Enabled = false;
						etLLLoginUsername.Enabled = false;
						etLLLoginPassword.Enabled = false;
						//loadingDialog = ProgressDialog.Show (this, "Sila Tunggu", "Sedang Memuatkan...");
						//Thread.Sleep (2000);
						ThreadPool.QueueUserWorkItem(o => processTheLogin(etLLLoginUsername.Text,etLLLoginPassword.Text,deviceTokenGCM,GetIMEIID ()));
				
					}
					else
					{
						//Log.Error
						Snackbar
							.Make(FindViewById(Android.Resource.Id.Content),Resource.String.login_password_warning,Snackbar.LengthLong)
							.SetAction(Resource.String.generallabel_okbtn,delegate {})
							.Show();
						//Toast.MakeText (this, "Sila isikan Kata Laluan anda...", ToastLength.Short).Show();
					}
				}
				else
				{
					Snackbar
						.Make(FindViewById(Android.Resource.Id.Content),Resource.String.login_username_warning,Snackbar.LengthLong)
						.SetAction(Resource.String.generallabel_okbtn,delegate {})
						.Show();
					//Toast.MakeText (this, "Sila isikan Nama Pengguna...", ToastLength.Short).Show();
				}
					
			};

			/*
			Typeface fontface = Typeface.CreateFromAsset (Assets, "Fonts/Roboto-Regular.ttf");
			tvLLUserNameLabel.SetTypeface (fontface,TypefaceStyle.Normal);
			tvLLUserNameLabel.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121"));
			tvLLPassLabel.SetTypeface (fontface,TypefaceStyle.Normal);
			tvLLPassLabel.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121"));
			etLLLoginUsername.SetTypeface (fontface,TypefaceStyle.Normal);
			etLLLoginUsername.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121"));
			etLLLoginPassword.SetTypeface (fontface,TypefaceStyle.Normal);
			etLLLoginPassword.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121"));
			btnLLLoginAuthBtn.SetTypeface (fontface,TypefaceStyle.Normal);
			tvLLCopyrightText.SetTypeface (fontface,TypefaceStyle.Normal);
			tvLLTermsText.SetTypeface (fontface,TypefaceStyle.Normal);
			*/

		}
		public HomePage ()
		{
			InitializeComponent ();

#if __IOS__
			const string originalText = "Native UILabel.";
			const string longerText = "Native UILabel. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

			var uiLabel = new UILabel {
				MinimumFontSize = 14f,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = originalText,
			};
			stackLayout.Children.Add (uiLabel);

			var uiButton = new UIButton (UIButtonType.RoundedRect);
			uiButton.SetTitle ("Change Text", UIControlState.Normal);
			uiButton.Font = UIFont.FromName ("Helvetica", 14f);
			uiButton.TouchUpInside += (sender, args) => {
				uiLabel.Text = uiLabel.Text == originalText ? longerText : originalText;
				uiLabel.SizeToFit ();
			};
			stackLayout.Children.Add (uiButton);

			var explanation1 = new UILabel {
				MinimumFontSize = 14f,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "The next control is a CustomControl (a customized UILabel with a bad SizeThatFits implementation).",
			};
			stackLayout.Children.Add (explanation1);

			var brokenControl = new CustomControl {
				MinimumFontSize = 14,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "This control has incorrect sizing - there's empty space above and below it."
			};
			stackLayout.Children.Add (brokenControl);

			var explanation2 = new UILabel {
				MinimumFontSize = 14f,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "The next control is a CustomControl, but an override to the GetDesiredSize method is passed in when adding the control to the layout.",
			};
			stackLayout.Children.Add (explanation2);

			var fixedControl = new CustomControl {
				MinimumFontSize = 14,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "This control has correct sizing - there's no empty space above and below it."
			};
			stackLayout.Children.Add (fixedControl, FixSize);
#endif

#if __ANDROID__
			const string originalText = "Native TextView.";
			const string longerText = "Native TextView. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

			var textView = new TextView (Forms.Context) { Text = originalText, TextSize = 14 };
			textView.SetSingleLine (false);
			textView.SetLines (3);
			stackLayout.Children.Add (textView);

			var button = new Android.Widget.Button (Forms.Context) { Text = "Change Text" };
			button.Click += (sender, args) => {
				textView.Text = textView.Text == originalText ? longerText : originalText;
			};
			stackLayout.Children.Add (button);

			var explanation1 = new TextView (Forms.Context) {
				Text = "The next control is a CustomControl (a customized TextView with a bad OnMeasure implementation).",
				TextSize = 14
			};
			stackLayout.Children.Add (explanation1);

			var brokenControl = new CustomControl (Forms.Context) {
				Text = "This control has incorrect sizing - it doesn't occupy the available width of the device.",
				TextSize = 14
			};
			stackLayout.Children.Add (brokenControl);

			var explanation2 = new TextView (Forms.Context) {
				Text = "The next control is a CustomControl, but with a custom GetDesiredSize delegate to accomodate it's sizing problem.",
				TextSize = 14
			};
			stackLayout.Children.Add (explanation2);

			var goodControl = new CustomControl (Forms.Context) {
				Text = "This control has correct sizing - it occupies the available width of the device.",
				TextSize = 14
			};
			stackLayout.Children.Add (goodControl, FixSize);
#endif

#if WINDOWS_PHONE_APP
            const string originalText = "Native TextBlock.";
            const string longerText = "Native TextBlock. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

            var textBlock = new TextBlock
            {
                Text = originalText,
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(textBlock);

            var button = new Windows.UI.Xaml.Controls.Button { Content = "Change Text" };
            button.Click += (sender, args) => { textBlock.Text = textBlock.Text == originalText ? longerText : originalText; };
            stackLayout.Children.Add(button);

            var explanation1 = new TextBlock
            {
                Text = "The next control is a CustomControl (a customized TextBlock with a bad ArrangeOverride implementation).",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation1);

            var brokenControl = new CustomControl { Text = "This control has incorrect sizing - it doesn't occupy the available width of the device." };
            stackLayout.Children.Add(brokenControl);

            var explanation2 = new TextBlock
            {
                Text = "The next control is a CustomControl, but an ArrangeOverride delegate is passed in when adding the control to the layout.",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation2);

            var fixedControl = new CustomControl { Text = "This control has correct sizing - it occupies the available width of the device." };
            stackLayout.Children.Add(fixedControl, arrangeOverrideDelegate: (renderer, finalSize) =>
            {
                if (finalSize.Width <= 0 || double.IsInfinity(finalSize.Width))
                {
                    return null;
                }
                var frameworkElement = renderer.Control;
                frameworkElement.Arrange(new Rect(0, 0, finalSize.Width * 2, finalSize.Height));
                return finalSize;
            }); 
#endif

#if WINDOWS_UWP
            const string originalText = "Native TextBlock.";
            const string longerText = "Native TextBlock. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

            var textBlock = new TextBlock
            {
                Text = originalText,
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(textBlock);

            var button = new Windows.UI.Xaml.Controls.Button { Content = "Change Text" };
            button.Click += (sender, args) => { textBlock.Text = textBlock.Text == originalText ? longerText : originalText; };
            stackLayout.Children.Add(button);

            var explanation1 = new TextBlock
            {
                Text = "The next control is a CustomControl (a customized TextBlock with a bad ArrangeOverride implementation).",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation1);

            var brokenControl = new CustomControl { Text = "This control has incorrect sizing - it doesn't occupy the available width of the device." };
            stackLayout.Children.Add(brokenControl);

            var explanation2 = new TextBlock
            {
                Text = "The next control is a CustomControl, but an ArrangeOverride delegate is passed in when adding the control to the layout.",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation2);

            var fixedControl = new CustomControl { Text = "This control has correct sizing - it occupies the available width of the device." };
            stackLayout.Children.Add(fixedControl, arrangeOverrideDelegate: (renderer, finalSize) =>
            {
                if (finalSize.Width <= 0 || double.IsInfinity(finalSize.Width))
                {
                    return null;
                }
                var frameworkElement = renderer.Control;
                frameworkElement.Arrange(new Rect(0, 0, finalSize.Width * 2, finalSize.Height));
                return finalSize;
            });
#endif
		}