Exemplo n.º 1
0
 public void SetEditText(Android.Widget.ScrollView scrollView, EditText newEditText)
 {
     this.scrollView = scrollView;
     this.editText   = newEditText;
     SetText(this.text);
     SetEditable(this.editable);
     SetFontSize(this.fontSize);
     this.editText.SetTextColor(Android.Graphics.Color.Rgb(98, 00, 237)); // "6200ED"
 }
Exemplo n.º 2
0
        private Android.Widget.LinearLayout AddStandardLayout(Android.App.AlertDialog.Builder builder,
                                                              string title, string msg)
        {
            Android.Widget.ScrollView   scrollView = new Android.Widget.ScrollView(builder.Context);
            Android.Widget.LinearLayout container  = new LinearLayout(builder.Context);
            int horizontalPadding = GetViewPadding(builder);
            int verticalPadding   = string.IsNullOrEmpty(msg) ? horizontalPadding : 0;

            container.Orientation = Android.Widget.Orientation.Vertical;
            container.SetPadding(
                /* left */ horizontalPadding,
                /* top */ verticalPadding,
                /* right */ horizontalPadding,
                /* bottom */ verticalPadding);
            scrollView.AddView(container);
            builder.SetTitle(title)
            .SetMessage(msg)
            .SetView(scrollView);
            return(container);
        }
Exemplo n.º 3
0
        /*   private string getDate()
         * {
         *   //datePicker = new DatePickerDialog(mContext);
         *     StringBuilder strCurrentDate = new StringBuilder();
         *     int month = datePicker.Month+1;
         *     strCurrentDate.Append("date: " + month + "/" + datePicker.DayOfMonth + "/" + datePicker.Year);
         *
         *     return strCurrentDate.ToString();
         * }*/

        public void initView()
        {
            mDialogManager = new DialogManager(mContext);
            firstLayout    = (LinearLayout)view.FindViewById(Resource.Id.first_layout);
            secondLayout   = (LinearLayout)view.FindViewById(Resource.Id.second_layout);
            imageView      = (ImageView)view.FindViewById(Resource.Id.childImage1);

            dateOfBirth = (TextView)view.FindViewById(Resource.Id.birth_date);
            // dateOfBirth.SetText("5");
            dateOfBirth.Text = "";


            firstName          = (EditText)view.FindViewById(Resource.Id.edt_first_name);
            bloodType          = (EditText)view.FindViewById(Resource.Id.edt_blood_type);
            race               = (EditText)view.FindViewById(Resource.Id.edt_race);
            hairColor          = (EditText)view.FindViewById(Resource.Id.edt_hair_color);
            eyeColor           = (EditText)view.FindViewById(Resource.Id.edt_eye_color);
            height             = (EditText)view.FindViewById(Resource.Id.edt_height);
            weight             = (EditText)view.FindViewById(Resource.Id.edt_weight);
            glasses            = (EditText)view.FindViewById(Resource.Id.edt_glasses);
            distinguishingMark = (EditText)view.FindViewById(Resource.Id.edt_distinguishing_mark);
            contact            = (EditText)view.FindViewById(Resource.Id.edt_contact);
            comments           = (EditText)view.FindViewById(Resource.Id.edt_comments);
            gender             = (EditText)view.FindViewById(Resource.Id.edt_gender);


            next   = view.FindViewById <ImageView> (Resource.Id.iv_next);
            cencle = view.FindViewById <Button>(Resource.Id.btn_cencle);
            save   = view.FindViewById <Button>(Resource.Id.btn_save);

            _milkDigitalIdService = DependencyService.Get <ImilkDigitalIDService>();

            Android.Widget.ScrollView sv_lay          = (Android.Widget.ScrollView)view.FindViewById(Resource.Id.sv_lay);
            Android.Graphics.Color    backgroundColor = new Android.Graphics.Color(ThemeUtill.OnActivityCreateSetTheme((Activity)mContext));

            /**
             * set back ground color dynamicly here
             */
            sv_lay.SetBackgroundColor(backgroundColor);
        }
Exemplo n.º 4
0
        public static void getTiles(Android.Widget.ScrollView parent)
        {
            parent.RemoveAllViewsInLayout();
            if (UserTiles != null)
            {
                UserTiles.Clear();
            }
            UserTiles = new List <LinearLayout>();
            int pixelDensity = (int)Android.Content.Res.Resources.System.DisplayMetrics.Density;
            ContextThemeWrapper mainContext = new ContextThemeWrapper(parent.Context, Resource.Style.MainLinearForUserTiles);
            LinearLayout        MainLinear  = new LinearLayout(mainContext);

            MainLinear.Orientation = Orientation.Vertical;
            parent.AddView(MainLinear);
            LinearLayout currentRow = null;
            int          i          = 0;

            foreach (User user in Controller._users)
            {
                if (i % 2 == 0)
                {
                    ContextThemeWrapper rowContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTileRowLayoutStyle);
                    currentRow             = new LinearLayout(rowContext);
                    currentRow.Orientation = Orientation.Horizontal;
                }

                ContextThemeWrapper userTileContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTileLayoutStyle);
                LinearLayout        currentUser     = new LinearLayout(userTileContext);
                currentUser.Orientation = Orientation.Vertical;
                currentUser.Id          = i;

                ContextThemeWrapper userNameContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserNameCenteredText);
                TextView            userName        = new TextView(userNameContext);
                userName.Text = user.Name.FirstName;

                ContextThemeWrapper relativeLayoutStyle = new ContextThemeWrapper(parent.Context, Resource.Style.ProgressBorderStyle);
                FrameLayout         currentUserBar      = new FrameLayout(relativeLayoutStyle);

                ContextThemeWrapper        PgBarFillContext   = new ContextThemeWrapper(parent.Context, Resource.Style.ProgressBarFillStyle);
                Android.Widget.ProgressBar currentUserBarMask = new Android.Widget.ProgressBar(PgBarFillContext, null, Resource.Style.ProgressBarFillStyle);
                try
                {
                    double progress = (1 - ((double)user.Used / user.Allocated)) * 100;
                    currentUserBarMask.Progress = (int)(progress);
                }
                catch (DivideByZeroException)
                {
                    double progress = (1 - ((double)user.Used / Controller._totalRemainder)) * 100;
                    currentUserBarMask.Progress = (int)(progress);
                }

                currentUserBar.AddView(currentUserBarMask);
                currentUser.AddView(userName);
                currentUser.AddView(currentUserBar);
                UserTiles.Add(currentUser);
                currentRow.AddView(currentUser);
                MainLinear.RemoveView(currentRow);
                MainLinear.AddView(currentRow);
                i++;
            }
        }
Exemplo n.º 5
0
        private bool CanScrollUp(Android.Views.View view)
        {
            if (!RefreshView.IsPullToRefreshEnabled)
            {
                return(true);
            }
            else
            {
                ViewGroup viewGroup = view as ViewGroup;
                if (viewGroup == null)
                {
                    return(base.CanChildScrollUp());
                }

                int sdk = (int)global::Android.OS.Build.VERSION.SdkInt;
                if (sdk >= 16)
                {
                    //
                    //is a scroll container such as listview, scroll view, gridview
                    //
                    if (viewGroup.IsScrollContainer)
                    {
                        return(base.CanChildScrollUp());
                    }
                }

                //
                //if you have something custom and you can't scroll up you might need to enable this
                //for instance on a custom recycler view where the code above isn't working!
                //
                for (int i = 0; i < viewGroup.ChildCount; i++)
                {
                    var child = viewGroup.GetChildAt(i);
                    if (child is Android.Widget.AbsListView)
                    {
                        Android.Widget.AbsListView list = child as Android.Widget.AbsListView;
                        if (list != null)
                        {
                            if (list.FirstVisiblePosition == 0)
                            {
                                Android.Views.View subChild = list.GetChildAt(0);

                                return(subChild != null && subChild.Top != 0);
                            }

                            //
                            //if children are in list and we are scrolled a bit... sure you can scroll up
                            //
                            return(true);
                        }
                    }
                    else if (child is Android.Widget.ScrollView)
                    {
                        Android.Widget.ScrollView scrollview = child as Android.Widget.ScrollView;
                        return(scrollview.ScrollY <= 0.0);
                    }
                    else if (child is Android.Webkit.WebView)
                    {
                        Android.Webkit.WebView webView = child as Android.Webkit.WebView;
                        return(webView.ScrollY > 0.0);
                    }
                    else if (child is Android.Support.V4.Widget.SwipeRefreshLayout)
                    {
                        return(CanScrollUp(child as ViewGroup));
                    }
                    //
                    //else if something else like a recycler view?
                    //
                }

                return(false);
            }
        }
Exemplo n.º 6
0
 public void ClearEditText()
 {
     this.text       = editText.Text; // save the last text before deallocation
     this.editText   = null;
     this.scrollView = null;
 }