/**
         * 节点浏览示例
         * @param v
         */
        public void NodeClick(View v)
        {

            if (nodeIndex < -1 || route == null || nodeIndex >= route.NumSteps)
                return;
            viewCache = LayoutInflater.Inflate(Resource.Layout.custom_text_view, null);
            popupText = viewCache.FindViewById<TextView>(Resource.Id.textcache);
            //上一个节点
            if (mBtnPre.Equals(v) && nodeIndex > 0)
            {
                //索引减
                nodeIndex--;
                //移动到指定索引的坐标
                mMapView.Controller.AnimateTo(route.GetStep(nodeIndex).Point);
                //弹出泡泡
                popupText.Text = route.GetStep(nodeIndex).Content;
                popupText.SetBackgroundResource(Resource.Drawable.popup);
                pop.ShowPopup(BMapUtil.GetBitmapFromView(popupText),
                        route.GetStep(nodeIndex).Point,
                        5);
            }
            //下一个节点
            if (mBtnNext.Equals(v) && nodeIndex < (route.NumSteps - 1))
            {
                //索引加
                nodeIndex++;
                //移动到指定索引的坐标
                mMapView.Controller.AnimateTo(route.GetStep(nodeIndex).Point);
                //弹出泡泡
                popupText.Text = route.GetStep(nodeIndex).Content;
                popupText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.popup));
                pop.ShowPopup(BMapUtil.GetBitmapFromView(popupText),
                        route.GetStep(nodeIndex).Point,
                        5);
            }
        }
		public static void SetTheme(TextView textView, FlatTheme theme,
			FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, int textColor, int backgroundColor,
			int customBackgroundColor, int cornerRadius)
		{

			if (backgroundColor != -1)
			{
				var bgColor = theme.DarkAccentColor;

				if (backgroundColor == 0)
					bgColor = theme.DarkAccentColor;
				else if (backgroundColor == 1)
					bgColor = theme.BackgroundColor;
				else if (backgroundColor == 2)
					bgColor = theme.LightAccentColor;
				else if (backgroundColor == 3)
					bgColor = theme.VeryLightAccentColor;

				GradientDrawable gradientDrawable = new GradientDrawable();
				gradientDrawable.SetColor(bgColor);
				gradientDrawable.SetCornerRadius(cornerRadius);
				textView.SetBackgroundDrawable(gradientDrawable);
			} 
			else if (customBackgroundColor != -1) 
			{
				var bgColor = theme.DarkAccentColor;

				if (customBackgroundColor == 0)
					bgColor = theme.DarkAccentColor;
				else if (customBackgroundColor == 1)
					bgColor = theme.BackgroundColor;
				else if (customBackgroundColor == 2)
					bgColor = theme.LightAccentColor;
				else if (customBackgroundColor == 3)
					bgColor = theme.VeryLightAccentColor;

				GradientDrawable gradientDrawable = new GradientDrawable();
				gradientDrawable.SetColor(bgColor);
				gradientDrawable.SetCornerRadius(cornerRadius);
				textView.SetBackgroundDrawable(gradientDrawable);
			}

			var txtColor = theme.VeryLightAccentColor;
			if (textColor == 0)
				txtColor = theme.DarkAccentColor;
			if (textColor == 1)
				txtColor = theme.BackgroundColor;
			if (textColor == 2)
				txtColor = theme.LightAccentColor;
			if (textColor == 3)
				txtColor = theme.VeryLightAccentColor;

			textView.SetTextColor(txtColor);

			var typeface = FlatUI.GetFont(textView.Context, fontFamily, fontWeight);
			if (typeface != null)
				textView.SetTypeface(typeface, TypefaceStyle.Normal);
		}
Ejemplo n.º 3
0
        private void Init()
        {
            RemoveAllViews();
 
            Orientation = Orientation.Horizontal;

            LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            lp.Gravity = GravityFlags.CenterVertical;
            LayoutParameters = lp;

            cardImageLayout = new FrameLayout(Context);

            LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            cardImageLayoutParams.Gravity = GravityFlags.CenterVertical;
            cardImageLayout.LayoutParameters = cardImageLayoutParams;

            cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0);

            SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2);

            cv2TextView = new CV2TextView(Context);

            LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            parameters.Weight = 1;
            parameters.Gravity = GravityFlags.Center;

            cv2TextView.LayoutParameters = parameters;

            cv2TextView.OnEntryComplete += cardNumber =>
            {
                if (OnCreditCardEntered != null)
                {
                    OnCreditCardEntered(cardNumber);
                }
            };

            LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent);
            textViewLayoutParams.Gravity = GravityFlags.Center;

            last4CCNosTextView = new TextView(Context);
            last4CCNosTextView.Gravity = GravityFlags.Center;
            last4CCNosTextView.Text = "0000";
            last4CCNosTextView.LayoutParameters = textViewLayoutParams;
            last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            last4CCNosTextView.TextSize = 18;
            last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text));
            last4CCNosTextView.Focusable = false;
            last4CCNosTextView.Enabled = false;
            last4CCNosTextView.SetSingleLine();
            last4CCNosTextView.SetBackgroundDrawable(null);

            AddView(cardImageLayout);
            AddView(last4CCNosTextView);
            AddView(cv2TextView);
        }