コード例 #1
0
        public void LongAlert(string message)
        {
            Toast f = Toast.MakeText(Android.App.Application.Context, message, ToastLength.Short);

            f.SetGravity(Gravity.GetAbsoluteGravity(GravityFlags.Center, GravityFlags.Center), 0, 0);
            f.Show();
        }
コード例 #2
0
        async void OnItemClick(int position)
        {
            if (!categories_list[position].isRoot)
            {
                if (!userMethods.UserExists())
                {
                    SubCategoryAdapter.my_specializations_static.Add(new SubCategory()
                    {
                        id = categories_list[position].id, name = categories_list[position].name
                    });
                    var activity2 = new Intent(_context, typeof(AddSpecializationActivity));
                    _context.StartActivity(activity2);
                }
                else
                {
                    var res = await SubCategoryActivity.show_activity(categories_list[position].id, userMethods.GetUsersAuthToken());

                    _context.StartActivity(new Intent(_context, typeof(UserProfileActivity)));
                }
            }
            else
            {
                Toast toast = Toast.MakeText(_context, _context.GetString(Resource.String.only_child_categs_can_be_chosen), ToastLength.Short);
                toast.SetGravity(Gravity.GetAbsoluteGravity(GravityFlags.Top, GravityFlags.Center), 0, 150);
                toast.Show();
            }
        }
コード例 #3
0
 public void OnTextChanged(ICharSequence s, int start, int before, int count)
 {
     if (skill_descET.LineCount == 3)
     {
         skill_descET.Text = skill_descET.Text.Remove(skill_descET.Text.Length - 1);
         skill_descET.SetSelection(skill_descET.Text.Length);
         Toast toast = Toast.MakeText(this, GetString(Resource.String.description_cannot_occupy_more_than_two_lines), ToastLength.Short);
         toast.SetGravity(Gravity.GetAbsoluteGravity(GravityFlags.Top, GravityFlags.Center), 0, 150);
         toast.Show();
     }
 }
コード例 #4
0
        /**
         * Compute insets.
         *
         * <pre>
         *  ______________________
         * |_________dx/2_________|
         * |......| /'''''\|......|
         * |-dx/2-|| View ||-dx/2-|
         * |______| \_____/|______|
         * |________ dx/2_________|
         * </pre>
         *
         * @param dx the dx the horizontal unfilled space
         * @param dy the dy the horizontal unfilled space
         */
//		@SuppressLint("NewApi")
        void ComputeInsets(int Dx, int Dy)
        {
            int absoluteGravity = (int)_gravity;

            if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
            {
                absoluteGravity = (int)Gravity.GetAbsoluteGravity(GravityFlags.Center, GravityFlags.Center);
            }

            switch (absoluteGravity & (int)GravityFlags.HorizontalGravityMask)
            {
            case (int)GravityFlags.Left:
                _horizontalInset = 0;
                break;

            case (int)GravityFlags.Right:
                _horizontalInset = Dx;
                break;

            case (int)GravityFlags.CenterHorizontal:
            default:
                _horizontalInset = Dx / 2;
                break;
            }
            switch (absoluteGravity & (int)GravityFlags.VerticalGravityMask)
            {
            case (int)GravityFlags.Top:
                _verticalInset = 0;
                break;

            case (int)GravityFlags.Bottom:
                _verticalInset = Dy;
                break;

            case (int)GravityFlags.CenterVertical:
            default:
                _verticalInset = Dy / 2;
                break;
            }
        }