protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);

            imageView = (ImageView)cell.GetChildAt(0);
            var linear = (LinearLayout)cell.GetChildAt(1);

            label       = (TextView)linear.GetChildAt(0);
            detailLabel = (TextView)linear.GetChildAt(1);
            SetImage();

            if (convertView == null)
            {
                SetPadding();

                SetImageSize();

                linear.SetGravity(Android.Views.GravityFlags.CenterVertical);

                label.SetLines(1);
                label.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                label.Gravity   = (Android.Views.GravityFlags.CenterVertical);
                label.SetSingleLine(true);
                label.SetMaxLines(1);
                SetTextFont();
                SetTextSize();

                detailLabel.Gravity = (Android.Views.GravityFlags.CenterVertical);
                detailLabel.SetSingleLine(false);
                SetDetailFont();
                SetDetailSize();
            }

            return(cell);
        }
Exemple #2
0
        private void CloudEnable_CheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e)
        {
            Switch togglerSwitch = (Switch)sender;

            LinearLayout linearParentLayout = togglerSwitch.Parent.Parent as LinearLayout;

            string email_address       = ((AppCompatEditText)linearParentLayout.GetChildAt(1)).Text;
            string login_user          = ((AppCompatEditText)linearParentLayout.GetChildAt(2)).Text;
            string pass_user           = ((AppCompatEditText)linearParentLayout.GetChildAt(3)).Text;
            string pop3_server_address = ((AppCompatEditText)linearParentLayout.GetChildAt(4)).Text;
            string smtp_server_address = ((AppCompatEditText)linearParentLayout.GetChildAt(5)).Text;

            Preferences.Set(Resources.GetResourceEntryName(togglerSwitch.Id), e.IsChecked);
            if (e.IsChecked)
            {
                if (string.IsNullOrWhiteSpace(email_address) || string.IsNullOrWhiteSpace(login_user) || string.IsNullOrWhiteSpace(pass_user) || string.IsNullOrWhiteSpace(pop3_server_address) || string.IsNullOrWhiteSpace(smtp_server_address))
                {
                    togglerSwitch.Checked = false;
                    Toast.MakeText(this, GetText(Resource.String.err_empty_prop_any_cloud), ToastLength.Short).Show();
                    return;
                }

                LinearLayout ll = togglerSwitch.Parent as LinearLayout;
                ll.AddView(new ProgressBar(this)
                {
                    ScaleX = 0.4f, ScaleY = 0.4f
                }, 1);
                togglerSwitch.Enabled = false;
                _ = TestEmailConnect(email_address, login_user, pass_user, pop3_server_address, smtp_server_address, togglerSwitch);
            }
        }
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);

            if (Control != null)
            {
                var searchView = Control;
                searchView.Iconified = true;
                searchView.SetIconifiedByDefault(false);
                int searchIconId = Context.Resources.GetIdentifier("android:id/search_mag_icon", null, null);
                var icon         = searchView.FindViewById(searchIconId);

                //TODO: image bindolása
                //(icon as ImageView).SetImageResource(Resource.Drawable.searchbaricon);
            }

            LinearLayout linearLayout = this.Control.GetChildAt(0) as LinearLayout;

            linearLayout = linearLayout.GetChildAt(2) as LinearLayout;
            linearLayout = linearLayout.GetChildAt(1) as LinearLayout;

            GradientDrawable gd = new GradientDrawable();

            gd.SetStroke(BorderWidth, BorderColor);

            linearLayout.Background = gd;

            AutoCompleteTextView textView = linearLayout.GetChildAt(0) as AutoCompleteTextView;
        }
        private void ColorCircle_Click(object sender, EventArgs e)
        {
            if (!diagram.PageSettings.ShowGrid)
            {
                return;
            }
            ColorCircle circle = (ColorCircle)sender;

            diagram.PageSettings.GridColor = circle.m_color;
            circle.Selected = true;
            circle.SetWillNotDraw(true);
            circle.SetWillNotDraw(false);
            for (int i = 0; i < scrollLayout.ChildCount; i++)
            {
                ColorCircle colorCircle = scrollLayout.GetChildAt(i) as ColorCircle;
                if (colorCircle.m_color.ToString().Equals(circle.m_color.ToString()))
                {
                    continue;
                }
                else if (colorCircle.Selected)
                {
                    colorCircle.Selected = false;
                    colorCircle.SetWillNotDraw(true);
                    colorCircle.SetWillNotDraw(false);
                }
            }
        }
Exemple #5
0
 private void UpdateFilledCircles()
 {
     for (int i = 0; i < _numbersEntered; i++)
     {
         _selectedLayout.GetChildAt(i).Activated = true;
     }
 }
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                LinearLayout linearLayout = Control.GetChildAt(0) as LinearLayout;
                linearLayout            = linearLayout.GetChildAt(2) as LinearLayout;
                linearLayout            = linearLayout.GetChildAt(1) as LinearLayout;
                linearLayout.Background = null; //removes underline


                /*lort til at skifte searchicon til farven
                 * var searchView = Control;
                 * searchView.Iconified = true;
                 * searchView.SetIconifiedByDefault(false);
                 * // (Resource.Id.search_mag_icon); is wrong / Xammie bug
                 * int searchIconId = Context.Resources.GetIdentifier("android:id/search_mag_icon", null, null);
                 * var icon = searchView.FindViewById(searchIconId);
                 *
                 * (icon as ImageView).SetImageResource(Resource.Drawable.youriconforsearch);
                 *
                 * int cancelIconId = Context.Resources.GetIdentifier("android:id/search_close_btn", null, null);
                 * var eicon = searchView.FindViewById(cancelIconId);
                 * (eicon as ImageView).SetImageResource(Resource.Drawable.youriconforcancel);*/

                AutoCompleteTextView textView = linearLayout.GetChildAt(0) as AutoCompleteTextView; //modify for text appearance customization
            }
        }
        void UpdateDtoImageView()
        {
            ImageView preImage;
            ImageView nextImage;
            ImageView currentImage = (ImageView)linearDto.GetChildAt(currentPage * 2);

            if (isMoveRight)
            {
                preImage = (ImageView)linearDto.GetChildAt((currentPage - 1) * 2);
                preImage.SetImageResource(Resource.Drawable.icon_dark);
            }
            else
            {
                nextImage = (ImageView)linearDto.GetChildAt((currentPage + 1) * 2);
                nextImage.SetImageResource(Resource.Drawable.icon_dark);
            }
            currentImage.SetImageResource(Resource.Drawable.icon_white);
            //linearDto.chi
            if (currentPage == imageCount - 1)
            {
                btnMain.Visibility = ViewStates.Visible;
            }
            else
            {
                btnMain.Visibility = ViewStates.Gone;
            }
        }
Exemple #8
0
        public void SetInitialTab(string title, int index)
        {
            OnTabSelected?.Invoke(title);
            ImageView tab = (ImageView)layout.GetChildAt(index);

            tab.SetImageResource(SelectedIcons[index]);
        }
Exemple #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.About);

            // TODO cf. https://forums.xamarin.com/discussion/comment/61781/#Comment_61781
            // Use a ViewModel to prevent the use of this loop ?
            LinearLayout aboutMainLayout = FindViewById <LinearLayout>(Resource.Id.aboutMainLayout);

            // Loop over the layout looking for TextView
            for (int i = 0; i < aboutMainLayout.ChildCount; i++)
            {
                if (aboutMainLayout.GetChildAt(i) is TextView)
                {
                    TextView tv = (TextView)aboutMainLayout.GetChildAt(i);
                    // This is to make the "a href" clickable and it opens a web browser
                    tv.MovementMethod = LinkMovementMethod.Instance;
                }
            }

            List <StoreLink> links = new List <StoreLink>()
            {
                new StoreLink()
                {
                    Text             = Resources.GetString(Resource.String.aboutWinPhone),
                    ImageRessourceId = Resource.Drawable.ic_wpstore
                }
            };
            var list          = FindViewById <ListView>(Resource.Id.OtherDeviceAppList);
            var layoutManager = new CustomLinearLayoutManager(this);

            layoutManager.Orientation = (int)Orientation.Vertical;
            list.Adapter = (new AboutListAdapter2(this, links));
        }
Exemple #10
0
        private void MqttClient_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
        {
            string result = System.Text.Encoding.UTF8.GetString(e.Message);

            RunOnUiThread(() => {
                int _btnCount = m_frame_control.ChildCount;

                List <Button> _listBtn = new List <Button>();
                for (int i = 0; i < _btnCount; i++)
                {
                    _listBtn.Add((Button)m_frame_control.GetChildAt(i));
                }

                foreach (Button b in _listBtn)
                {
                    if (((DevInfo)b.Tag).Topic == e.Topic)
                    {
                        if (result == "STATE:1")
                        {
                            b.SetTextColor(Android.Graphics.Color.Green);
                            ((DevInfo)b.Tag).State = 1;
                        }
                        if (result == "STATE:0")
                        {
                            b.SetTextColor(Android.Graphics.Color.Red);
                            ((DevInfo)b.Tag).State = 0;
                        }
                    }
                }
            });
        }
Exemple #11
0
 /// <summary>
 /// Refreshing list method
 /// </summary>
 /// <param name="layout">List layout</param>
 private void Refresh(LinearLayout layout)
 {
     layout.GetChildAt(0).FindViewById <TextView>(Resource.Id.categoryName).SetTextColor(BuildColor(_rootActivity.GetString(Resource.String.All)));
     for (int i = 1; i < layout.ChildCount; i++)
     {
         layout.GetChildAt(i).FindViewById <TextView>(Resource.Id.categoryName).SetTextColor(BuildColor(NoteStorage.GetCurrentCategories(_rootActivity)[i - 1]));
     }
 }
 public GUIHero(LinearLayout container)
 {
     this.container = container;
     NameText       = (TextView)container.GetChildAt(0);
     LifePointsText = (TextView)container.GetChildAt(1);
     SkillText      = (TextView)container.GetChildAt(2);
     UseSkillbutton = (Button)container.GetChildAt(3);
 }
Exemple #13
0
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                LinearLayout linearLayout = this.Control.GetChildAt(0) as LinearLayout;
                linearLayout            = linearLayout.GetChildAt(2) as LinearLayout;
                linearLayout            = linearLayout.GetChildAt(1) as LinearLayout;
                linearLayout.Background = null;                                                     //removes underline
                AutoCompleteTextView textView = linearLayout.GetChildAt(0) as AutoCompleteTextView; //modify for text appearance customization
            }
            if (Control == null)
            {
                return;
            }

            #region for edittext

            var editText = Control.GetChildrenOfType <EditText>().FirstOrDefault();
            if (editText != null)
            {
                var shape = new ShapeDrawable(new RectShape());
                shape.Paint.Color       = Android.Graphics.Color.Transparent;
                shape.Paint.StrokeWidth = 0;

                shape.Paint.SetStyle(Paint.Style.Stroke);
                editText.Background = shape;
            }

            #endregion

            #region control searchbar

            var gradient = new GradientDrawable();
            gradient.SetCornerRadius(50);
            int[][] states =
            {
                new[] { Android.Resource.Attribute.StateEnabled }, // enabled
                new[] {-Android.Resource.Attribute.StateEnabled } // disabled
            };

            int[] colors =
            {
                Xamarin.Forms.Color.FromHex("#EDEDED").ToAndroid(),
                Xamarin.Forms.Color.Blue.ToAndroid()
            };
            var stateList = new ColorStateList(states: states, colors: colors);
            gradient.SetStroke((int)this.Context.ToPixels(1.0f), stateList);

            this.Control.SetBackground(gradient);

            #endregion
        }
Exemple #14
0
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                LinearLayout linearLayout = this.Control.GetChildAt(0) as LinearLayout;
                linearLayout = linearLayout.GetChildAt(2) as LinearLayout;
                linearLayout = linearLayout.GetChildAt(1) as LinearLayout;

                linearLayout.Background = null; //removes underline
            }
        }
Exemple #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Map);

            ImageView banner = FindViewById <ImageView>(Resource.Id.homeBanner);

            banner.Click += delegate {
                StartActivity(typeof(MainActivity));
            };

            InitializeLocationManager();
            locationManager.RequestLocationUpdates(locationProvider, 2000, 0, this);
            SetUpMap();

            attractionsEnabled = new List <attractionBool>();
            mapButtons         = new List <imageViewButton>();

            foreach (Facility.attractionType type in Enum.GetValues(typeof(Facility.attractionType)))
            {
                LinearLayout buttonLayout = FindViewById <LinearLayout>(Resource.Id.mapButtons);
                buttonLayout.WeightSum = Enum.GetValues(typeof(Facility.attractionType)).Length;

                LinearLayout button = (LinearLayout)LayoutInflater.Inflate(Resource.Layout.ImageView, null);
                LinearLayout.LayoutParams LayoutParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WrapContent);
                LayoutParams.Weight     = 1;
                button.LayoutParameters = LayoutParams;


                System.IO.Stream ims    = Assets.Open("img/MapButtons/" + type.ToString() + "Button.png");
                Bitmap           bitmap = BitmapFactory.DecodeStream(ims);
                ims.Close();

                (button.GetChildAt(0) as ImageView).SetImageBitmap(bitmap);
                button.Click += delegate
                {
                    attractionsEnabled.Find(x => x.type == type).enabled =
                        !attractionsEnabled.Find(x => x.type == type).enabled;
                    SetMarkers(mMap.CameraPosition.Zoom);
                    updateMapButtons();
                };

                attractionBool aB = new attractionBool();
                aB.type    = type;
                aB.enabled = true;
                attractionsEnabled.Add(aB);
                buttonLayout.AddView(button);
                mapButtons.Add(new imageViewButton((ImageView)button.GetChildAt(0), type));
            }
        }
        private void CallOptionEditDialog(int pos)
        {
            editView      = new EditText(context);
            editView.Text = ((TextView)options.GetChildAt(pos)).Text;
            editView.Tag  = ((TextView)options.GetChildAt(pos)).Tag;

            AlertDialog.Builder b = new AlertDialog.Builder(context);
            b.SetView(editView);
            b.SetNegativeButton("Cancel", this);
            b.SetPositiveButton("Ok", this);
            b.SetNeutralButton("Delete", this);

            b.Create().Show();
        }
Exemple #17
0
 public void OnPageSelected(int position)
 {
     bannerPosition = position;
     position      %= DefaultBannerSize;
     handler.Post(() =>
     {
         for (int i = 0; i < layoutDotlist.ChildCount; i++)
         {
             (layoutDotlist.GetChildAt(i) as ImageView).SetImageResource(Resource.Drawable.dot_normal);
         }
         (layoutDotlist.GetChildAt(position) as ImageView).SetImageResource(Resource.Drawable.dot_focused);
         title.Text = topDailys[position].Title;
     });
 }
        private void OnGlobalLayoutChanged(ViewTreeObserver.IOnGlobalLayoutListener listener)
        {
            mRootLayout.ViewTreeObserver.RemoveOnGlobalLayoutListener(listener);

            mPagerElementActiveSize = mPagerIconsContainer.Height;
            mPagerElementNormalSize = System.Math.Min(mPagerIconsContainer.GetChildAt(0).Height,
                                                      mPagerIconsContainer.GetChildAt(mPagerIconsContainer.ChildCount - 1).Height);

            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams)mPagerIconsContainer.GetChildAt(0).LayoutParameters;
            mPagerElementLeftMargin  = layoutParams.LeftMargin;
            mPagerElementRightMargin = layoutParams.RightMargin;

            mPagerIconsContainer.SetX(CalculateNewPagerPosition(0));
            mContentCenteredContainer.SetY((mContentRootLayout.Height / 2));
        }
Exemple #19
0
        public static bool showAllChildren(View v)
        {
            LinearLayout li = (LinearLayout)(v);

            if (li.ChildCount == 1)
            {
                return(false);
            }
            for (int i = 1; i < li.ChildCount; i++)
            {
                li.GetChildAt(i).Animate().TranslationY(0).Alpha(1.0f).SetDuration(200);
                li.GetChildAt(i).Visibility = ViewStates.Visible;
            }
            return(true);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                LinearLayout linearLayout = Control.GetChildAt(0) as LinearLayout;
                linearLayout = linearLayout.GetChildAt(2) as LinearLayout;
                linearLayout = linearLayout.GetChildAt(1) as LinearLayout;

                linearLayout.Background = null;                                                     //removes underline

                AutoCompleteTextView textView = linearLayout.GetChildAt(0) as AutoCompleteTextView; //modify for text appearance customization
            }
        }
Exemple #21
0
 private void SetRunning(string str)
 {
     if (AllAgents != null)
     {
         int i;
         for (i = 0; i < AllAgents.Agents.Count; i++)
         {
             if (str == AllAgents.Agents[i].Name)
             {
                 RunOnUiThread(() => ((TextView)agents.GetChildAt(i)).SetTextColor(Color.Green));
                 break;
             }
         }
     }
 }
Exemple #22
0
        private void SaveTaskInstance()
        {
            Spinner spVerbTense = FindViewById <Spinner>(Resource.Id.spVerbTense);
            int     valueInt    = Convert.ToInt32(spVerbTense.SelectedItemId);

            m_TaskInstance.AddAnswer(Lib.lTense, valueInt: valueInt);

            Spinner spVerbAspect = FindViewById <Spinner>(Resource.Id.spVerbAspect);

            valueInt = Convert.ToInt32(spVerbAspect.SelectedItemId);
            m_TaskInstance.AddAnswer(Lib.lAspect, valueInt: valueInt);

            List <int>   valuesInt         = new List <int>();
            LinearLayout llFormulaItemList = FindViewById <LinearLayout>(Resource.Id.llFormulaItemList);

            for (int i = 0; i < llFormulaItemList.ChildCount; i++)
            {
                LinearLayout ll = llFormulaItemList.GetChildAt(i) as LinearLayout;
                Spinner      sp = ll.GetChildAt(ll.ChildCount - 1) as Spinner;
                valuesInt.Add(Convert.ToInt32(sp.SelectedItemId));
            }
            m_TaskInstance.AddAnswer(Lib.lSentencePart, valuesInt: valuesInt.ToArray());

            List <string> valuesString  = new List <string>();
            EditText      etTranslation = FindViewById <EditText>(Resource.Id.etTranslation);

            valuesString.Add(etTranslation.Text);
            m_TaskInstance.AddAnswer(Lib.lTranslate, valuesString: valuesString.ToArray());

            DBController.Instance.SaveTaskInstance(m_TaskInstance);
            Intent.PutExtra("IS_CORRECT_TASK_INSTANCE", m_TaskInstance.IncorrectAnswerAmount == 0);
        }
        private void DeleteItemClicked(object sender, EventArgs e)
        {
            ViewGroup parent = (ViewGroup)((ImageButton)sender).Parent;

            for (int i = 0; i < parent.ChildCount; i++)
            {
                View child = parent.GetChildAt(i);
                if (child.GetType() == typeof(AppCompatTextView))
                {
                    entries.Remove(((TextView)child).Text);
                    break;
                }
            }

            ViewGroup topParent = (ViewGroup)parent.Parent.Parent;

            for (int i = 0; i < choicesRoot.ChildCount; i++)
            {
                View child = choicesRoot.GetChildAt(i);
                if (child.Id == topParent.Id)
                {
                    choicesRoot.RemoveViewAt(i);
                    break;
                }
            }

            if (choicesRoot.ChildCount <= 1)
            {
                optionsHeader.Text = Resources.GetString(Resource.String.createNewMultChoiceNone);
            }
        }
Exemple #24
0
        private void MessageBoxShowWithPic(string str)
        {
            var item = Toast.MakeText(this, str, ToastLength.Short);

            item.SetGravity(GravityFlags.Center, 0, 0);

            //创建一个图片视图
            ImageView iv = new ImageView(this);

            iv.SetImageResource(Android.Resource.Drawable.StatSysWarning);   //安卓自带的图片

            //得到Toast布局(强制改变为线型布局)
            LinearLayout toastView = (LinearLayout)item.View;

            //设置内容显示位置
            toastView.SetGravity(GravityFlags.Center);
            //设置布局的方向
            toastView.Orientation = Orientation.Horizontal;

            //给布局添加一个视图,并添加到前面
            toastView.AddView(iv, 0);

            //取得文字,让图片居中文字对齐
            TextView textView = toastView.GetChildAt(1) as TextView;

            textView.Gravity = GravityFlags.CenterVertical; //文字本身
            LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
            p.Gravity = GravityFlags.Center;                //对外容器也居中
            textView.LayoutParameters = p;

            //显示Toast
            item.Show();
        }
Exemple #25
0
 private void SetFontSize()
 {
     using (LinearLayout layout = FindViewById <LinearLayout>(Resource.Id.linearLayout1))
     {
         for (int i = 0; i < layout.ChildCount; i++)
         {
             var element = layout.GetChildAt(i);
             if (element is Button)
             {
                 (element as Button).SetTextSize(ComplexUnitType.Sp, fontSize);
             }
             else if (element is TextView)
             {
                 (element as TextView).SetTextSize(ComplexUnitType.Sp, fontSize);
             }
             else if (element is EditText)
             {
                 (element as TextView).SetTextSize(ComplexUnitType.Sp, fontSize);
             }
             else if (element is CheckBox)
             {
                 (element as CheckBox).SetTextSize(ComplexUnitType.Sp, fontSize);
             }
             else if (element is Switch)
             {
                 (element as Switch).SetTextSize(ComplexUnitType.Sp, fontSize);
             }
         }
     }
 }
        private void AddTabBadge(int tabIndex)
        {
            if (!(_tabLinearLayout.GetChildAt(tabIndex) is ViewGroup view))
            {
                return;
            }

            var element = Element.Children[tabIndex];

            var badgeView = view.FindChildOfType <BadgeView>();

            if (badgeView == null)
            {
                var badgeTarget = view.FindChildOfType <TextView>();
                if (badgeTarget == null)
                {
                    Console.WriteLine("Plugin.Badge: No Text view found to attach badge");
                    return;
                }

                //create badge for tab
                badgeView = new BadgeView(Context, badgeTarget);
            }

            BadgeViews[element] = badgeView;

            badgeView.UpdateFromElement(element);

            element.PropertyChanged += OnTabbedPagePropertyChanged;
        }
        protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
        {
            base.OnElementChanged(e);

            if (GlobalSetting.IsArabic)
            {
                base.Control.SetGravity(Android.Views.GravityFlags.Right);
            }

            //removes underline
            LinearLayout linearLayout = this.Control.GetChildAt(0) as LinearLayout;

            linearLayout            = linearLayout.GetChildAt(2) as LinearLayout;
            linearLayout            = linearLayout.GetChildAt(1) as LinearLayout;
            linearLayout.Background = null;
        }
Exemple #28
0
        private void setSearchIcons(SearchView mSearchView)
        {
            try
            {
                Java.Lang.Reflect.Field searchField = mSearchView.Class.GetDeclaredField("mSearchButton");
                searchField.Accessible = true;
                ImageView searchBtn = (ImageView)searchField.Get(mSearchView);
                searchBtn.Background = null;

                searchBtn.SetImageResource(Resource.Drawable.search123);
                searchBtn.SetScaleType(ImageView.ScaleType.FitCenter);
                //searchBtn.LayoutParameters.Width = 80;
                //searchBtn.LayoutParameters.Height = 80;
                searchBtn.RequestLayout();
                searchField            = mSearchView.Class.GetDeclaredField("mSearchPlate");
                searchField.Accessible = true;
                LinearLayout searchPlate = (LinearLayout)searchField.Get(mSearchView);
                ImageView    closeBtn    = ((ImageView)searchPlate.GetChildAt(1));
                closeBtn.SetImageResource(Resource.Drawable.closed);
                closeBtn.SetScaleType(ImageView.ScaleType.FitCenter);
                //closeBtn.LayoutParameters.Width = 80;
                //closeBtn.LayoutParameters.Height = 80;
                closeBtn.RequestLayout();
                //searchPlate.SetBackgroundResource(Resource.Drawable.SearchPlate);
                //searchPlate.LayoutParameters.Height = 1;
            }
            catch (System.Exception e)
            {
                string dst = "sdfsfs";
            }
        }
        public void ScrollToItem(int itemIndex)
        {
            var index = itemIndex;

            if (itemIndex < 0)
            {
                index = 0;
            }

            if (itemIndex > _itemsSource.Count())
            {
                index = _itemsSource.Count() - 1;
            }

            LinearLayout linearLayout = (LinearLayout)_horizontalScrollView.GetChildAt(0);

            if (linearLayout != null)
            {
                View itemAtIndex = linearLayout.GetChildAt(index);
                if (itemAtIndex != null)
                {
                    _horizontalScrollView.ScrollTo(itemAtIndex.Left, 0);
                }
            }
        }
        private void TryToEnableCameraButton(object sender, EventArgs e)
        {
            bool   enableCameraButton = true;
            Button cameraButton       = FindViewById <Button>(Resource.Id.btnOpenCamera);

            LinearLayout layoutPictureInfo = FindViewById <LinearLayout>(Resource.Id.layoutPictureInfo);

            for (int i = 0; i < layoutPictureInfo.ChildCount; i++)
            {
                var childView = layoutPictureInfo.GetChildAt(i);

                if (childView is EditText)
                {
                    EditText childViewAsEditText = (EditText)childView;
                    if (string.IsNullOrEmpty(childViewAsEditText.Text) ||
                        string.IsNullOrWhiteSpace(childViewAsEditText.Text))
                    {
                        enableCameraButton = false;
                        break;
                    }
                }
            }

            FindViewById <Button>(Resource.Id.btnOpenCamera).Enabled = enableCameraButton;
            cameraButton.Alpha = enableCameraButton ? 1 : Constant.BUTTON_ALPHA;
        }
Exemple #31
0
 /// <summary>
 /// page selected
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PageSelected(object sender, PageSelectedEventArgs e)
 {
     ll = FindViewById<LinearLayout>(Resource.Id.ll);
     for (int i = 0; i < views.Count; i++)
     {
         dots[i] = (ImageView)ll.GetChildAt(i);
         dots[i].Enabled = false;
     }
     dots[e.Position].Enabled = true;
 }
Exemple #32
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_guide);

            viewPager = FindViewById<ViewPager>(Resource.Id.viewpager);

            //the layout
            LayoutInflater mLi = LayoutInflater.From(this);
            view1 = mLi.Inflate(Resource.Layout.guide_first, null);
            view2 = mLi.Inflate(Resource.Layout.guide_second, null);
            view3 = mLi.Inflate(Resource.Layout.guide_third, null);

            views = new List<View>();

            views.Add(view1);
            views.Add(view2);
            views.Add(view3);
            
            //the adapter
            viewPager.Adapter = new ViewPagerAdapter(views);

            //page selected
            viewPager.PageSelected += PageSelected;

            ll = FindViewById<LinearLayout>(Resource.Id.ll);

            //the dot infomation
            dots = new ImageView[3];
            for (int i = 0; i < views.Count; i++)
            {
                dots[i] = (ImageView)ll.GetChildAt(i);
                dots[i].Enabled = false;                
            }
            dots[0].Enabled = true;

            //the button
            btnStart = view3.FindViewById<Button>(Resource.Id.startBtn);
            btnStart.Click += Start;
        }
Exemple #33
0
        private bool CardContains(string s, LinearLayout content)
        {
            for (int i = 0; i < content.ChildCount; i++)
            {
                if (content.GetChildAt(i).FindViewById<TextView>(Resource.Id.profile_card_entry_content).Text == s)
                {
                    return true;
                }
            }

            return false;
        }