public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			var view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);

            view.SetMinimumHeight(150);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule(LayoutRules.AlignParentLeft);

			_caption = new TextView (context);
			SetCaption (Caption);
            view.AddView(_caption, parms);
			
			if (!String.IsNullOrWhiteSpace (Indicator)) {
	            var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
	                                                         ViewGroup.LayoutParams.WrapContent);
	            tparms.SetMargins(5, 3, 5, 5);
	            tparms.AddRule(LayoutRules.CenterVertical);
				tparms.AddRule(LayoutRules.AlignParentRight);
	
	            _text = new TextView (context) {
					Text = Indicator,
					TextSize = 22f
				};
	            view.AddView(_text, tparms);
			}
			return view;
		}
 public View CreateActionButton(int resourceId)
 {
     var layout = ActionBar.CustomView.FindViewById<RelativeLayout>(Resource.Id.customActionButton);
     _actionButton = LayoutInflater.Inflate(resourceId, null);
     var textView = _actionButton as TextView;
     if (textView != null) textView.SetTypeface(Rep.FontManager.Get(Font.Condensed), TypefaceStyle.Normal);
     var param = new RelativeLayout.LayoutParams(
         ViewGroup.LayoutParams.WrapContent,
         ViewGroup.LayoutParams.MatchParent);
     param.AddRule(LayoutRules.CenterVertical);
     param.AddRule(LayoutRules.AlignParentRight);
     layout.AddView(_actionButton, param);
     return _actionButton;
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RelativeLayout mediarelativelayout =new RelativeLayout(nn_activity);
            var mediarelativelayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
            mediarelativelayout.LayoutParameters = mediarelativelayoutparam;
            mediarelativelayout.SetBackgroundColor (Color.White);

            Button playbut = new Button (nn_activity);
            RelativeLayout.LayoutParams playbutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
            playbut.Alpha = 0;
            playbutparam.AddRule(LayoutRules.CenterInParent);
            playbut.LayoutParameters = playbutparam;
            playbut.Click -=OntouchVideoView;
            playbut.Click += OntouchVideoView;
            mediarelativelayout.AddView (playbut);

            textureview = new TextureView (nn_activity);
            textureview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            textureview.Rotation = 90;
            textureview.SurfaceTextureListener = this;

            mediarelativelayout.AddView (textureview);

            return mediarelativelayout;
        }
Esempio n. 4
0
        //here we only have img and text for each item
        //create a RelativeLayout and add it to dic
        //squear image
        public void AddItem(int imgresource,string text,Action OnCellClick)
        {
            RelativeLayout menucell = new RelativeLayout (nn_context);
            menucell.SetPadding (TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding));
            menucell.LayoutParameters = new LinearLayout.LayoutParams (TapUtil.dptodx(cellwidth),TapUtil.dptodx(cellheight));
            menucell.Click+= (object sender, EventArgs e) => {

                if(OnCellClick!=null){
                    OnCellClick();
                }
            };

            ImageView img = new ImageView (nn_context);
            img.Id = TapUtil.generateViewId ();
            img.LayoutParameters = new RelativeLayout.LayoutParams (TapUtil.dptodx(imagewidth),TapUtil.dptodx(imagewidth));
            //			Bitmap.CreateScaledBitmap(imgresource, TapUtil.dptodx(imagewidth), TapUtil.dptodx(imageheight), false);
            img.SetImageResource (imgresource);
            img.SetBackgroundColor (Color.White);

            TextView textview = new TextView (nn_context);
            RelativeLayout.LayoutParams textviewparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(textwidth),TapUtil.dptodx(textheight));
            textviewparam.AddRule(LayoutRules.RightOf,img.Id);
            textviewparam.LeftMargin = TapUtil.dptodx (space);
            textview.LayoutParameters =textviewparam;
            textview.Text = text;
            textview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
            textview.SetTextColor(Color.Black);
            textview.Gravity = global::Android.Views.GravityFlags.Center;

            menucell.AddView (img);
            menucell.AddView (textview);

            nn_itemlist.Add (menucell);
        }
        public void OnSurfaceTextureAvailable(SurfaceTexture surface, int width, int height)
        {
            nn_surface = new Surface (surface);

            RelativeLayout.LayoutParams l;
            DisplayMetrics metrics = new DisplayMetrics();
            nn_activity.WindowManager.DefaultDisplay.GetMetrics(metrics);
            l = new RelativeLayout.LayoutParams(metrics.HeightPixels, metrics.WidthPixels);
            l.AddRule(LayoutRules.CenterInParent);
            float scale = (metrics.HeightPixels * 1.0f) / (metrics.WidthPixels * 1.0f);
            textureview.ScaleX = scale;
            textureview.LayoutParameters=l;

            try {
                nn_mediaplayer= new MediaPlayer();
                //String uriPath = "android.resource://"+nn_activity.PackageName+"/raw/Tap5050_About";
                nn_mediaplayer.SetDataSource(nn_activity,global::Android.Net.Uri.Parse("android.resource://"+nn_activity.PackageName +"/"+ Resource.Raw.Tap5050_About));
                nn_mediaplayer.SetSurface(nn_surface);
                nn_mediaplayer.Prepare();
                nn_mediaplayer.Prepared+= (object sender, EventArgs e) => {
                    (sender as MediaPlayer).Start ();
                };
                nn_mediaplayer.Completion+= (object sender, EventArgs e) => {
                    (sender as MediaPlayer).SeekTo (0);
                    (sender as MediaPlayer).Pause ();
                };

            }catch(Exception e){
                Toast.MakeText (nn_activity,"Sorry,Can not play the video",ToastLength.Long).Show();
            }
        }
Esempio n. 6
0
        public void AddSpinner(ViewGroup rootview,string loadingtext)
        {
            loading = true;
            if(loadingcontainer==null||(loadingcontainer!=null&&!loadingcontainer.IsShown)){
                loadingcontainer = new RelativeLayout (nn_activity);
                loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                loadingcontainer.SetBackgroundColor (Color.White);

                var detailcontainer = new LinearLayout (nn_activity);

                detailcontainer.Orientation = Orientation.Vertical;
                RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams ((int)TapUtil.dptodx (100), RelativeLayout.LayoutParams.WrapContent);
                param.AddRule (LayoutRules.CenterInParent);
                detailcontainer.LayoutParameters = param;

                LinearLayout.LayoutParams linearlayoutparm = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                linearlayoutparm.Gravity = GravityFlags.CenterHorizontal;

                ProgressBar progressbar = new ProgressBar (nn_activity);
                progressbar.LayoutParameters = linearlayoutparm;

                TextView tectview = new TextView (nn_activity);
                tectview.LayoutParameters = linearlayoutparm;
                tectview.Text = loadingtext;
                tectview.Gravity = GravityFlags.CenterHorizontal;

                detailcontainer.AddView (progressbar);
                detailcontainer.AddView (tectview);

                loadingcontainer.AddView (detailcontainer);
                rootview.AddView (loadingcontainer);
            }
        }
        public override View GetView(Context context, View convertView, ViewGroup parent)
		{
            this.Click = delegate { SelectImage(); };

            Bitmap scaledBitmap = Bitmap.CreateScaledBitmap(_image, dimx, dimy, true);

            var view = convertView as RelativeLayout;
            if (view == null)
            {
                view = new RelativeLayout(context);
                _imageView = new ImageView(context);
            }
            else
            {
                _imageView = (ImageView)view.GetChildAt(0);
            }
            _imageView.SetImageBitmap(scaledBitmap);
            
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule( LayoutRules.AlignParentLeft);
			if(_imageView.Parent != null && _imageView.Parent is ViewGroup)
				((ViewGroup)_imageView.Parent).RemoveView(_imageView);
			view.AddView(_imageView, parms);

            return view;
		}
        public AvatarProgressRelativeLayout(Context context,int width,int progresswidth,int stokewidth,float percent)
            : base(context)
        {
            nn_context = context;
            nn_paint = new Paint ();
            nn_paint.AntiAlias = true;
            nn_outcolor = context.Resources.GetColor (Resource.Color.soarnix_bg_gray);
            nn_progressremainingcolor = Color.WhiteSmoke;
            nn_innercontainercolor = Color.White;
            nn_progresscolor = context.Resources.GetColor (Resource.Color.iosblue);
            nn_radius = TapUtil.dptodx(width)/2;

            this.stokewidthdp = stokewidth;
            this.progresswidthdp = progresswidth;

            progresssendangle =360 * percent;

            RelativeLayout.LayoutParams layoutparam=new RelativeLayout.LayoutParams (nn_radius*2,nn_radius*2);
            layoutparam.AddRule (LayoutRules.CenterInParent);
            this.LayoutParameters = layoutparam;

            SetLayerType (LayerType.Software,null);

            SetWillNotDraw(false);
        }
		public override View GetView(Context context, View convertView, ViewGroup parent)
        {
			var view = convertView as RelativeLayout;
			
			if (view == null)
				view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule((int) LayoutRules.AlignParentLeft);

            _caption = new TextView(context) {Text = Caption, TextSize = 16f};
            view.AddView(_caption, parms);

            if (!string.IsNullOrEmpty(Value))
            {
                var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                             ViewGroup.LayoutParams.WrapContent);
                tparms.SetMargins(5, 3, 5, 0);
                tparms.AddRule((int) LayoutRules.AlignParentRight);

                _text = new TextView(context) {Text = Value, TextSize = 16f};
                view.AddView(_text, tparms);
            }

            return view;
        }
		private static void SetLayotParameters(ConversationMessage currentItem, ConversationMessageViewHolder vh) {
			RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
			if (currentItem.UserWasSender) {
				parameters.AddRule(LayoutRules.AlignParentLeft);
				parameters.SetMargins(5, 5, 30, 5);
				vh.MessageLayout.Background = ContextCompat.GetDrawable(Application.Context, Resource.Drawable.conversation_user_message_background_border);
				vh.MessageHeader.SetTextColor(Color.Black);
				vh.MessageContent.SetTextColor(Color.Black);
			}
			else {
				parameters.AddRule(LayoutRules.AlignParentRight);
				parameters.SetMargins(30, 5, 5, 5);
				vh.MessageLayout.Background = ContextCompat.GetDrawable(Application.Context, Resource.Drawable.conversation_sender_message_background_border);
				vh.MessageHeader.SetTextColor(Color.White);
				vh.MessageContent.SetTextColor(Color.White);
			}
			vh.MessageLayout.LayoutParameters = parameters;
		}
        public HSVColorPickerDialog(Context context, Color initialColor, Action<Color> listener)
            : base(context)
        {
            this.selectedColor = initialColor;
            this.listener = listener;

            colorWheel = new HSVColorWheel(context);
            valueSlider = new HSVValueSlider(context);
            var padding = (int)(context.Resources.DisplayMetrics.Density * PADDING_DP);
            var borderSize = (int)(context.Resources.DisplayMetrics.Density * BORDER_DP);
            var layout = new RelativeLayout(context);

            var lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            colorWheel.setListener((color) => valueSlider.SetColor(color, true));
            colorWheel.setColor(initialColor);
            colorWheel.Id = (1);
            layout.AddView(colorWheel, lp);

            int selectedColorHeight = (int)(context.Resources.DisplayMetrics.Density * SELECTED_COLOR_HEIGHT_DP);

            var valueSliderBorder = new FrameLayout(context);
            valueSliderBorder.SetBackgroundColor(BORDER_COLOR);
            valueSliderBorder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            valueSliderBorder.Id = (2);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP);
            lp.AddRule(LayoutRules.Below, 1);
            layout.AddView(valueSliderBorder, lp);

            valueSlider.SetColor(initialColor, false);
            valueSlider.SetListener((color) =>
            {
                selectedColor = color;
                selectedColorView.SetBackgroundColor(color);
            });
            valueSliderBorder.AddView(valueSlider);

            var selectedColorborder = new FrameLayout(context);
            selectedColorborder.SetBackgroundColor(BORDER_COLOR);
            lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize);
            selectedColorborder.SetPadding(borderSize, borderSize, borderSize, borderSize);
            lp.AddRule(LayoutRules.Below, 2);
            layout.AddView(selectedColorborder, lp);

            selectedColorView = new View(context);
            selectedColorView.SetBackgroundColor(selectedColor);
            selectedColorborder.AddView(selectedColorView);

            SetButton((int)DialogButtonType.Negative, context.GetString(Android.Resource.String.Cancel), ClickListener);
            SetButton((int)DialogButtonType.Positive, context.GetString(Android.Resource.String.Ok), ClickListener);

            SetView(layout, padding, padding, padding, padding);
        }
Esempio n. 12
0
        public override View GetView (Context context, View convertView, ViewGroup parent)
        {
            TextView tv = new TextView (context);
            tv.TextSize = 20f;
            tv.SetText (Android.Text.Html.FromHtml (Caption), TextView.BufferType.Spannable);

            var parms = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            parms.AddRule (LayoutRules.CenterHorizontal);
            
            RelativeLayout view = new RelativeLayout (context, null, Android.Resource.Attribute.ListSeparatorTextViewStyle);
            view.AddView (tv, parms);
            return view;
        }
Esempio n. 13
0
		public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            var view = new RelativeLayout(context);

            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule((int) LayoutRules.CenterVertical);

            tv = new TextView(context) {Text = Caption, TextSize = 16f};
            view.AddView(tv, parms);

            var sparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                         ViewGroup.LayoutParams.WrapContent);
            sparms.SetMargins(5, 3, 5, 0);
            sparms.AddRule((int) LayoutRules.CenterVertical);
            sparms.AddRule((int) LayoutRules.AlignParentRight);

            sw = new ToggleButton(context) {Tag = 1, Checked = Value};

            view.AddView(sw, sparms);
            return view;
        }
Esempio n. 14
0
		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			var view = convertView as RelativeLayout;
			
			if (view == null)
				view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule(LayoutRules.AlignParentLeft);
			
			view.AddView(scaled,parms);

            return view;
		}
Esempio n. 15
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            if (scaled == null)
                scaled = Scale(Value);

            Click = delegate { SelectImage(); };

            var view = convertView as RelativeLayout ?? new RelativeLayout(context);

            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule(LayoutRules.AlignParentLeft);

            // SEC bug fix, not yet submitted to Kenny.  Getting exception "specified view already has a parent"
            if (scaled.Parent != view)
                view.AddView(scaled, parms);

            return view;
        }
Esempio n. 16
0
        private void InitTablet()
        {
            SetContentView(Resource.Layout.TabletContainer);

            var container = FindViewById<RelativeLayout>(Resource.Id.fragmentContainer);
            var blotterViewId = View.GenerateViewId();
            var pricesView = PricesListFragment.OnCreateView(LayoutInflater, container, null);
            var pricesParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            pricesParams.AddRule(LayoutRules.Above, blotterViewId);
            pricesView.LayoutParameters = pricesParams;
            pricesView.Id = View.GenerateViewId();

            container.AddView(pricesView);

            var blotterView = BlotterFragment.OnCreateView(LayoutInflater, container, null);
            var layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 280);
            blotterView.Id = blotterViewId;
            layoutParams.AddRule(LayoutRules.AlignParentBottom);
            blotterView.LayoutParameters = layoutParams;

            container.AddView(blotterView);
        }
Esempio n. 17
0
        public ToolBarButton(Context context,View parent,int imagresource)
            : base(context)
        {
            //initial params
            if(parent is LinearLayout){
                LinearLayout.LayoutParams param=new LinearLayout.LayoutParams(TapUtil.dptodx(45),TapUtil.dptodx(45));
                param.Weight = 1;
                LayoutParameters = param;
            }
            if (parent is RelativeLayout) {
                RelativeLayout.LayoutParams param=new RelativeLayout.LayoutParams(TapUtil.dptodx(45),TapUtil.dptodx(45));
                LayoutParameters = param;
            }
            this.SetPadding (TapUtil.dptodx (1), TapUtil.dptodx (1), TapUtil.dptodx (1), TapUtil.dptodx (1));
            //add child view
            ImageView img = new ImageView (context);
            img.Id = TapUtil.generateViewId ();

            RelativeLayout.LayoutParams paramimg=new RelativeLayout.LayoutParams(TapUtil.dptodx(40),TapUtil.dptodx(40));
            paramimg.AddRule (LayoutRules.CenterHorizontal);
            img.LayoutParameters = paramimg;
            img.SetImageResource (imagresource);
            AddView (img);
        }
Esempio n. 18
0
        /**
         * Creates a new view that will be used to display the specified pointer id on the touchpad
         * view.
         *
         * @param pointerId the id of the pointer that this finger trace view will represent; used to
         *     determine its color and text
         * @return the {@code TextView} that was created
         */
        private TextView createFingerTraceView(int pointerId)
        {
            var fingerTraceView = new TextView(Context); 
            fingerTraceView.SetBackgroundResource(FINGER_RES_IDS[pointerId]);
            fingerTraceView.Text = pointerId.ToString();
            fingerTraceView.Gravity = GravityFlags.Center;
            fingerTraceView.SetTextAppearance(Context, Android.Resource.Style.TextAppearanceDeviceDefaultSmall);
            fingerTraceView.Alpha = 0;

            var lp = new RelativeLayout.LayoutParams(FINGER_TRACE_SIZE, FINGER_TRACE_SIZE);
            lp.AddRule(LayoutRules.AlignParentTop);
            lp.AddRule(LayoutRules.AlignParentLeft);

            // The right and bottom margin here are required so that the view doesn't get "squished"
            // as it touches the right or bottom side of the touchpad view.
            lp.RightMargin = -2 * FINGER_TRACE_SIZE;
            lp.BottomMargin = -2 * FINGER_TRACE_SIZE;
            fingerTraceView.LayoutParameters = lp;

            return fingerTraceView;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.allocation_msg_detail_activity);

            context = Android.App.Application.Context;

            string iss_date = Intent.GetStringExtra("ISS_DATE");

            made_no       = Intent.GetStringExtra("MADE_NO");
            tag_locate_no = Intent.GetStringExtra("TAG_LOCATE_NO");
            string tag_stock_no     = Intent.GetStringExtra("TAG_STOCK_NO");
            string ima03            = Intent.GetStringExtra("IMA03");
            string pre_get_datetime = Intent.GetStringExtra("PRE_GET_DATETIME");

            datetime_0 = Intent.GetStringExtra("dateTime_0");
            datetime_1 = Intent.GetStringExtra("dateTime_1");
            datetime_2 = Intent.GetStringExtra("dateTime_2");
            iss_no     = Intent.GetStringExtra("ISS_NO");

            //ActionBar actionBar = getSupportActionBar();
            Android.App.ActionBar actionBar = ActionBar;
            if (actionBar != null)
            {
                actionBar.SetDisplayHomeAsUpEnabled(true);
                actionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_chevron_left_white_24dp);
                actionBar.Title = "";
            }

            mLayoutManager = new LinearLayoutManager(context);

            relativeLayout = FindViewById <RelativeLayout>(Resource.Id.lookup_in_stock_list_container);
            progressBar    = new ProgressBar(context);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200);
            layoutParams.AddRule(LayoutRules.CenterInParent);
            relativeLayout.AddView(progressBar, layoutParams);
            progressBar.Visibility = ViewStates.Gone;

            s_iss_date         = FindViewById <TextView>(Resource.Id.s_iss_date);
            sp_made_no         = FindViewById <TextView>(Resource.Id.sp_made_no);
            s_tag_stock_no     = FindViewById <TextView>(Resource.Id.s_tag_stock_no);
            s_tag_locate_no    = FindViewById <TextView>(Resource.Id.s_tag_locate_no);
            s_pre_get_datetime = FindViewById <TextView>(Resource.Id.s_pre_get_datetime);
            s_ima03            = FindViewById <TextView>(Resource.Id.s_ima03);
            btnTransfer        = FindViewById <Button>(Resource.Id.btnTransfer);

            detailRecyclerView = FindViewById <RecyclerView>(Resource.Id.allocationDetailListView);
            detailRecyclerView.SetLayoutManager(mLayoutManager);

            s_iss_date.Text         = iss_date;
            sp_made_no.Text         = made_no;
            s_tag_locate_no.Text    = tag_locate_no;
            s_tag_stock_no.Text     = tag_stock_no;
            s_ima03.Text            = ima03;
            s_pre_get_datetime.Text = pre_get_datetime;

            showList.Clear();

            if (AllocationMsgFragment.msgDataTable.Rows.Count > 0)
            {
                foreach (DataRow rx in AllocationMsgFragment.msgDataTable.Rows)
                {
                    AllocationMsgDetailItem item = new AllocationMsgDetailItem();

                    //rx.setValue("scan_sp", "N");
                    //rx.setValue("scan_desc", "");

                    item.setItem_part_no(rx["part_no"].ToString());
                    item.setItem_ima021(rx["ima021"].ToString());
                    item.setItem_qty(rx["qty"].ToString());
                    item.setItem_src_stock_no(rx["src_stock_no"].ToString());
                    item.setItem_src_locate_no(rx["src_locate_no"].ToString());
                    item.setItem_src_batch_no(rx["src_batch_no"].ToString());
                    item.setItem_sfa12(rx["sfa12"].ToString());
                    item.setItem_scan_desc(rx["scan_desc"].ToString());

                    showList.Add(item);
                }
            }

            allocationMsgDetailItemAdapter            = new AllocationMsgDetailItemAdapter(this, Resource.Layout.inspected_receive_list_detail_item, showList);
            allocationMsgDetailItemAdapter.ItemClick += (sender, e) =>
            {
                for (int i = 0; i < showList.Count; i++)
                {
                    if (i == e)
                    {
                        if (showList[i].isSelected())
                        {
                            showList[i].setSelected(false);
                            item_select = -1;
                        }
                        else
                        {
                            showList[i].setSelected(true);
                            item_select = e;
                        }
                    }
                    else
                    {
                        showList[i].setSelected(false);
                    }
                }

                allocationMsgDetailItemAdapter.NotifyDataSetChanged();
            };
            allocationMsgDetailItemAdapter.ItemLongClick += (sender, e) =>
            {
                Intent detailIntent = new Intent(context, typeof(AllocationMsgDetailOfDetailActivity));
                detailIntent.PutExtra("PART_NO", showList[e].getItem_part_no());
                detailIntent.PutExtra("IMA021", showList[e].getItem_ima021());
                detailIntent.PutExtra("QTY", showList[e].getItem_qty());
                detailIntent.PutExtra("SRC_STOCK_NO", showList[e].getItem_src_stock_no());
                detailIntent.PutExtra("SRC_LOCATE_NO", showList[e].getItem_src_locate_no());
                detailIntent.PutExtra("SRC_BATCH_NO", showList[e].getItem_src_batch_no());
                detailIntent.PutExtra("SFA12", showList[e].getItem_sfa12());
                detailIntent.PutExtra("SCAN_DESC", showList[e].getItem_scan_desc());
                context.StartActivity(detailIntent);
            };
            detailRecyclerView.SetAdapter(allocationMsgDetailItemAdapter);
        }
Esempio n. 20
0
        public override global::Android.Views.View OnCreateView(global::Android.Views.LayoutInflater inflater,  global::Android.Views.ViewGroup container,  global::Android.OS.Bundle savedInstanceState)
        {
            var view = (RelativeLayout)inflater.Inflate (Resource.Layout.signup_fragment, container, false);

            rootlayout = (RelativeLayout)view.FindViewById (Resource.Id.rootlayout);
            loadingcontainer = new RelativeLayout (nn_activity);
            loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            loadingcontainer.SetBackgroundColor(Color.White);

            var detailcontainer = new LinearLayout (nn_activity);

            detailcontainer.Orientation = Orientation.Vertical;
            RelativeLayout.LayoutParams param=new RelativeLayout.LayoutParams((int)TapUtil.dptodx(100), RelativeLayout.LayoutParams.WrapContent);
            param.AddRule (LayoutRules.CenterInParent);
            detailcontainer.LayoutParameters = param;

            LinearLayout.LayoutParams linearlayoutparm=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            linearlayoutparm.Gravity=GravityFlags.CenterHorizontal;

            ProgressBar progressbar = new ProgressBar (nn_activity);
            progressbar.LayoutParameters =  linearlayoutparm;

            TextView tectview = new TextView (nn_activity);
            tectview.LayoutParameters = linearlayoutparm;
            tectview.Text = RaffleBuyerSignUpScreenData.LoadingScreenTextInit;
            tectview.Gravity = GravityFlags.CenterHorizontal;

            detailcontainer.AddView (progressbar);
            detailcontainer.AddView (tectview);

            loadingcontainer.AddView (detailcontainer);
            rootlayout.AddView (loadingcontainer);

            picktimebutton = view.FindViewById<Button> (Resource.Id.signup_birthday_button);
            picktimebutton.Hint=RaffleBuyerSignUpScreenData.BirthDateTextFieldPlaceholder;
            picktimebutton.Click += (object sender, EventArgs e) => {
                showDatePickerDialog ();
            };
            countryspinner = view.FindViewById<Spinner> (Resource.Id.signup_country_spinner);
            countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                if(stateandprovincespinneradapter!=null){
                    stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
                    stateandprovincespinneradapter.NotifyDataSetChanged ();
                }
                countryspinner.Tag=e.Position;
            };
            provincespinner= view.FindViewById<Spinner> (Resource.Id.signup_province_spinner);
            provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                provincespinner.Tag=e.Position;
            };

            raffleresultspinner= view.FindViewById<Spinner> (Resource.Id.signup_raffleresult_spinner);
            resultadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            raffleresultspinner.Adapter = resultadapter;
            resultadapter.NotifyDataSetChanged ();
            raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                raffleresultspinner.Tag=e.Position;
            };

            marketmesagespinner= view.FindViewById<Spinner> (Resource.Id.signup_marketingmessage_spinner);

            messaegadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            marketmesagespinner.Adapter = messaegadapter;
            messaegadapter.NotifyDataSetChanged ();

            marketmesagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                marketmesagespinner.Tag=e.Position;
            };

            firstname_edittext = view.FindViewById<EditText> (Resource.Id.signup_firstname_edittext);
            SetEditTextMaximumLength (firstname_edittext,100);
            firstname_edittext.Hint = RaffleBuyerSignUpScreenData.FirstNameTextFieldPlaceholder;

            lastname_edittext = view.FindViewById<EditText> (Resource.Id.signup_lastname_edittext);
            SetEditTextMaximumLength (lastname_edittext,100);
            lastname_edittext.Hint = RaffleBuyerSignUpScreenData.LastNameTextFieldPlaceholder;

            mobilephone_edittext = view.FindViewById<EditText> (Resource.Id.signup_mobilephone_edittext);
            SetEditTextMaximumLength (mobilephone_edittext,20);
            mobilephone_edittext.InputType = global::Android.Text.InputTypes.ClassPhone;
            mobilephone_edittext.Hint = RaffleBuyerSignUpScreenData.MobilePhoneTextFieldPlaceholder;

            email_edittext = view.FindViewById<EditText> (Resource.Id.signup_email_edittext);
            SetEditTextMaximumLength (email_edittext,60);
            if(!string.IsNullOrEmpty(nn_email)){
                email_edittext.Text = nn_email;
            }
            email_edittext.Hint = RaffleBuyerSignUpScreenData.EmailTextFieldPlaceholder;

            confirmemail_edittext = view.FindViewById<EditText> (Resource.Id.signup_reemail_edittext);
            SetEditTextMaximumLength (confirmemail_edittext,60);
            confirmemail_edittext.Hint=RaffleBuyerSignUpScreenData.EmailConfirmTextFieldPlaceholder;

            address1_edittext = view.FindViewById<EditText> (Resource.Id.signup_address1_edittext);
            SetEditTextMaximumLength (address1_edittext,100);
            address1_edittext.Hint = RaffleBuyerSignUpScreenData.Address1TextFieldPlaceholder;

            address2_edittext = view.FindViewById<EditText> (Resource.Id.signup_address2_edittext);
            SetEditTextMaximumLength (address2_edittext,100);
            address2_edittext.Hint = RaffleBuyerSignUpScreenData.Address2TextFieldPlaceholder;

            city_edittext = view.FindViewById<EditText> (Resource.Id.signup_city_edittext);
            SetEditTextMaximumLength (city_edittext,50);
            city_edittext.Hint=RaffleBuyerSignUpScreenData.CityTextFieldPlaceholder;

            postcode_edittext = view.FindViewById<EditText> (Resource.Id.signup_postal_edittext);
            SetEditTextMaximumLength (postcode_edittext,20);
            postcode_edittext.Hint=RaffleBuyerSignUpScreenData.ZipcodeTextFieldPlaceholder;

            TextView basicinfo=view.FindViewById<TextView> (Resource.Id.signup_basicinfo_textview);
            basicinfo.Text = RaffleBuyerSignUpScreenData.BasicInfoLabelText;

            TextView contactinfo=view.FindViewById<TextView> (Resource.Id.signup_contactinfo_textview);
            contactinfo.Text = RaffleBuyerSignUpScreenData.ContactInfoLabelText;

            TextView address=view.FindViewById<TextView> (Resource.Id.signup_addressinfo_textview);
            address.Text = RaffleBuyerSignUpScreenData.AddressInfoLabelText;

            TextView communicateraffle=view.FindViewById<TextView> (Resource.Id.signup_communicateraffle_textview);
            communicateraffle.Text = RaffleBuyerSignUpScreenData.RaffleResultsLabelText;

            TextView receivecharity=view.FindViewById<TextView> (Resource.Id.signup_receivecharity_textview);
            receivecharity.Text = RaffleBuyerSignUpScreenData.CharityMarketingMessagesLabelText;

            Button createaccountbutton = view.FindViewById<Button> (Resource.Id.signup_createaccount_button);
            createaccountbutton.Text = RaffleBuyerSignUpScreenData.CreateAccountBtnTitle;
            createaccountbutton.Click+= (object sender, EventArgs e) => {

                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[14];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message="First Name";
                    }
                    if(i==1){
                        message="Last Name";
                    }
                    if(i==2){
                        message="Mobile Phone";
                    }
                    if(i==3){
                        message="Email";
                    }
                    if(i==4){
                        message="Email Confirm";
                    }
                    if(i==5){
                        message="Address1";
                    }
                    if(i==6){
                        message="Address2";
                    }
                    if(i==7){
                        message="City";
                    }
                    if(i==8){
                        message="Postcode";
                    }
                    if(i==9){
                        message="Country";
                    }
                    if(i==10){
                        message="State And Province";
                    }
                    if(i==11){
                        message="Raffle Results";
                    }
                    if(i==12){
                        message="Market Message";
                    }
                    if(i==13){
                        message="Birthdate";
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                string firstname = firstname_edittext.Text;
                string lastname=lastname_edittext.Text;
                string mobilephone=mobilephone_edittext.Text;
                string email=email_edittext.Text;
                string reemail=confirmemail_edittext.Text;
                string address1=address1_edittext.Text;
                string address2=address2_edittext.Text;
                string city=city_edittext.Text;
                string postcode=postcode_edittext.Text;

                string country=countryspinner.Tag==null?"":listcountry[(int)countryspinner.Tag].country_code;
                string stateandprovince=provincespinner.Tag==null?"":stateandprovincespinneradapter.showlist[(int)provincespinner.Tag].state_province_abbrev;

                string raffleresults=raffleresultspinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)raffleresultspinner.Tag];
                string marketmesage=marketmesagespinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)marketmesagespinner.Tag];

                string datetime=picktimebutton.Text;

                if(FormatManager.chechinput(firstname,FormatManager.FormatOption.OnlyLetter)){
                    flags[0].flag=true;
                }
                if(FormatManager.chechinput(lastname,FormatManager.FormatOption.OnlyLetter)){
                    flags[1].flag=true;
                }
                if(FormatManager.chechinput(mobilephone,FormatManager.FormatOption.OnlyNumber)&&mobilephone.Length>=5){
                    flags[2].flag=true;
                }
                if(FormatManager.chechinput(email,FormatManager.FormatOption.Email)){
                    flags[3].flag=true;
                }
                if(FormatManager.chechinput(reemail,FormatManager.FormatOption.Email)){
                    flags[4].flag=true;
                }
                if(!email.Equals(reemail)){
                    flags[4].flag=false;
                }
                if(FormatManager.chechinput(address1,FormatManager.FormatOption.Regular)){
                    flags[5].flag=true;
                }
                if(FormatManager.chechinput(address2,FormatManager.FormatOption.Regular)){
                    flags[6].flag=true;
                }
                //address2 can be empty
                if(address2.Equals("")){
                    flags[6].flag=true;
                }
                if(FormatManager.chechinput(city,FormatManager.FormatOption.Regular)){
                    flags[7].flag=true;
                }
                if(FormatManager.chechinput(postcode,FormatManager.FormatOption.Regular)){
                    flags[8].flag=true;
                }
                if(postcode.Equals("")){
                    flags[8].flag=true;
                }
                if(FormatManager.chechinput(country,FormatManager.FormatOption.Regular)){
                    flags[9].flag=true;
                }
                if(FormatManager.chechinput(stateandprovince,FormatManager.FormatOption.Regular)){
                    flags[10].flag=true;
                }
                if(FormatManager.chechinput(raffleresults,FormatManager.FormatOption.Regular)){
                    flags[11].flag=true;
                }
                if(FormatManager.chechinput(marketmesage,FormatManager.FormatOption.Regular)){
                    flags[12].flag=true;
                }
                if(FormatManager.chechinput(datetime,FormatManager.FormatOption.Date)){
                    flags[13].flag=true;
                }
                bool totalfalg=true;
                foreach(var flagobj in flags){
                    if(!flagobj.flag){
                        totalfalg=false;
                    }
                }
                if(totalfalg==true){

                    AddSpinner(rootlayout,RaffleBuyerSignUpScreenData.LoadingScreenTextCreate);

                    Dictionary<string,string> paramdic =new Dictionary<string, string>();
                    paramdic.Add("email",email);
                    paramdic.Add("firstname",firstname);
                    paramdic.Add("lastname",lastname);
                    paramdic.Add("birthdate",datetime);
                    paramdic.Add("m_phone",mobilephone);
                    paramdic.Add("add1",address1);
                    paramdic.Add("add2",address2);
                    paramdic.Add("city",city);
                    paramdic.Add("province",stateandprovince);
                    paramdic.Add("postal",postcode);
                    paramdic.Add("country",country);
                    paramdic.Add("raffle_result",raffleresults);
                    paramdic.Add("charity_marketing_message",marketmesage);

                    App.INSTANCE.networknamager.Register (paramdic,(Tap5050WebResponse response)=>{
                        nn_activity.RunOnUiThread(()=>{
                            RemoveSpinner (rootlayout);
                        });
                        if(response.available){
                            if((response.parsedobject as Register).result_success.Equals("Y")) {
                                nn_activity.ShowCustomAlterDialogFragment(RaffleBuyerSignUpScreenData.AlertScreenCreateAccountRespondTitle,RaffleBuyerSignUpScreenData.AlertScreenCreateAccountRespondSuccessMessage,"OK",null,"successdialog.buyersignup.success");
                            }
                            else if((response.parsedobject as Register).result_success.Equals("N")){
                                nn_activity.ShowCustomAlterDialogFragment((response.parsedobject as Register).err_message,"OK",null,"invalidedialog.buyersignup.failed");
                            }
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,"Ok",null,"exceptiondialog.buyersignup.failed");
                        }
                    });

                }
                else if(!email.Equals(reemail)){
                    Toast.MakeText(nn_activity,RaffleBuyerSignUpScreenData.AlertScreenEmailNotMatchTitle+"\n"+RaffleBuyerSignUpScreenData.AlertScreenEmailNotMatchMessage,ToastLength.Long).Show();
                }
                else if(totalfalg==false){
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+"\n";
                            }else{
                                message+=flags[i].message+".";
                            }
                        }
                    }
                    nn_activity.ShowCustomAlterDialogFragment(RaffleBuyerSignUpScreenData.AlertScreenFormatErrorTitle,message,"OK",null,"formatcheckdialog");
                }

            };

            return view;
        }
Esempio n. 21
0
        public void RetrieveEvents()
        {
            if (!string.IsNullOrEmpty (GlobalVariable.currentlocation)) {
                Dictionary<string,string> parameters =new Dictionary<string, string>();
                parameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken(parameters,(Tap5050WebResponse response)=>{
                    if(response.available){
                        var result=(Tap5050Result)response.parsedobject;
                        if(result.result_success.Equals("Y")){
                            eventlist.Clear ();
                            eventcards.Clear ();
                            confirmedcards.Clear();
                            potencialcards.Clear();
                            Dictionary<string, string> geteventsparameters = new Dictionary<string, string> ();
                            geteventsparameters.Add ("location", GlobalVariable.currentlocation);
                            geteventsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetEvents (geteventsparameters,(Tap5050WebResponse geteventsresponse)=>{
                     			if(geteventsresponse.available){
                                 	eventlist=(List<Tap5050Event>)geteventsresponse.parsedobject;
                                    eventlist.Sort(delegate(Tap5050Event x, Tap5050Event y)
                                        {
                                            if (x.have_contract == null || y.have_contract == null) return 0;
                                            else if (x.have_contract.Equals("N")) return 1;
                                            else return -1;
                                        }
                                    );
                                        for(int i=0;i<eventlist.Count;i++){
                                            EventCard eventcard =new EventCard(eventlist[i],detaltimgsmall,detaltimgoriginal);
                                            eventcards.Add(eventcard);
                                        }
                                        for(int m=0;m<eventcards.Count;m++){

                                        if(eventcards[m].eventinfo.have_contract!=null&&eventcards[m].eventinfo.have_contract.Equals("Y")){
                                            confirmedcards.Add(eventcards[m]);
                                        }else{
                                            potencialcards.Add(eventcards[m]);
                                        }
                                            if(!String.IsNullOrEmpty(eventlist[m].image_url)){
                                                App.INSTANCE.networknamager.LoadImage(new Tap5050ImageFlag(m,eventlist[m].image_url,Tap5050ImageFlag.ImageType.OrganizationImage),
                                                    (Tap5050WebResponse imgresponse)=>{
                                                        if(imgresponse.available){
                                                            var array=(byte[])imgresponse.parsedobject;
                                                            var flag=(Tap5050ImageFlag)imgresponse.flagobject;
                                                            try{
                                                                Bitmap imageBitmap= BitmapFactory.DecodeByteArray(array, 0, array.Length);

                                                                //Bitmap imageWithBG = Bitmap.CreateBitmap(imageBitmap.Width, imageBitmap.Height, imageBitmap.GetConfig());  // Create another image the same size
                                                                //imageWithBG.EraseColor(global::Android.Graphics.Color.Transparent);
                                                                //Canvas canvas = new Canvas(imageWithBG);
                                                                //canvas.DrawBitmap(imageBitmap, 0f, 0f, null);
                                                                //imageBitmap.Recycle();

                                                                //var imageBitmaphandle=imageBitmap.Copy(imageBitmap.GetConfig(), true);
                                                                //var imageBitmaphandle = Bitmap.CreateBitmap(imageBitmap.Width, imageBitmap.Height, Bitmap.Config.Argb8888);

                                                                // for (int x = 0; x < imageBitmaphandle.Width; x++)
                                                                //{
                                                                //    for (int y = 0; y < imageBitmaphandle.Height; y++)
                                                                //    { d

                                                                //        if (imageBitmaphandle.GetPixel(x, y) == global::Android.Graphics.Color.White)
                                                                //        {
                                                                //            imageBitmaphandle.SetPixel(x, y, global::Android.Graphics.Color.Transparent);
                                                                //        }
                                                                //    }
                                                                //}

                                                                eventcards[flag.position].originalmap = Bitmap.CreateScaledBitmap(imageBitmap, TapUtil.dptodx(120), TapUtil.dptodx(120), false);
                                                                Bitmap newbitmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(50), TapUtil.dptodx(50), false);
                                                                eventcards[flag.position].imagemap=newbitmap;

                                                                nn_activity.RunOnUiThread(()=>{
                                                                    adapter.NotifyDataSetChanged();
                                                                });
                                                            }
                                                            catch(Exception e){
                                                                Console.WriteLine (e);
                                                            }
                                                        }
                                                    });
                                            }
                                        }

                                    //update tap
                                    nn_activity.RunOnUiThread(()=>{
                                        if(showconfirmed){

                                            adapter.ChangeListAndUpdate(confirmedcards);
                                        }
                                        else{
                                            adapter.ChangeListAndUpdate(potencialcards);
                                        }
                                    });

                                        nn_activity.RunOnUiThread(()=>{
                                            if(eventcards.Count==0){

                                            if(noeventcard!=null&&noeventcard.Parent!=null){
                                                (noeventcard.Parent as RelativeLayout).RemoveView(noeventcard);
                                            }

                                                LayoutInflater inflator = LayoutInflater.From (nn_activity);

                                                noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
                                                RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                                                noeventcardreparam.AddRule(LayoutRules.Below,locationcontainerlayout.Id);
                                                noeventcard.LayoutParameters=noeventcardreparam;

                                                TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
                                                hinttextview.Text=RaffleListScreenData.NoRaffleText;

                                                EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
                                                charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;

                                                EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
                                                numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;

                                                Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
                                                chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
                                                chritysubmitbutton.Click+= (object sender, EventArgs e) => {
                                                //set flags
                                                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                                                for(int i=0;i<flags.Length;i++){
                                                    string message="";
                                                    if(i==0){
                                                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                                                    }
                                                    if(i==1){
                                                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                                                    }
                                                }

                                                //
                                                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                                                    flags[0].flag=true;
                                                }
                                                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                                                    flags[1].flag=true;
                                                }
                                                bool totalfalg=true;
                                                foreach(var flagobj in flags){
                                                    if(!flagobj.flag){
                                                        totalfalg=false;
                                                    }
                                                }
                                                if(totalfalg){
                                                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                                                }
                                                else{
                                                    string message="Please check:\n";
                                                    for(int i=0;i<flags.Length;i++){
                                                        if(flags[i].flag==false){
                                                            if(i!=flags.Length-1){
                                                                message+=flags[i].message+",";
                                                            }else{
                                                                message+=flags[i].message;
                                                            }
                                                        }
                                                    }
                                                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
                                                }
                                            };
            //												if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,nn_location,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //												}
            //												else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
            //												}
            //												else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //													nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
            //												}
            //
            //												};
                                                rootview.AddView(noeventcard);
                                        }// end of if eventcards.Count==0

                                        RemoveSpinner(rootview);
                                        });
                                    }else{
                                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.getevents");
                                    }

                                }); //end of getevents

                            //for pop alert for teanm events
                            popthread.ClearQueue();
                            teaminvitations.Clear();
                            teamrequests.Clear();
                            popinitialized=false;
                            //get invitation notifications
                            Dictionary<string, string> getinvitaitonsparameters = new Dictionary<string, string> ();
                            getinvitaitonsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetTeamInvitationNotification (getinvitaitonsparameters,(Tap5050WebResponse getinviationresponse)=>{
                                if(getinviationresponse.available){
                                    teaminvitations=(List<Tap5050TeamInvitation>)getinviationresponse.parsedobject;
                                    popthread.Push(teaminvitations);
                                    if(popinitialized){
                                        popthread.SetSignal();
                                    }
                                    popinitialized=true;
                                    //									if(teaminvitations.Count>0){
                                    //										var invitaioninfo=teaminvitations[0];
                                    //										nn_activity.ShowCustomNeutralAlterDialogFragment(TeamScreenData.InvitationPopTitle,string.Format(TeamScreenData.InvitationPopDetail,invitaioninfo.leader_first_name+" "+invitaioninfo.leader_last_name,invitaioninfo.group_name,invitaioninfo.event_name),
                                    //											TeamScreenData.InvitationPopPositive,TeamScreenData.InvitationPopNegative,TeamScreenData.InvitationPopNeurtal,"invitepop.relationships.team",invitaioninfo);
                                    //										teaminvitations.RemoveAt(0);
                                    //									}
                                }
                            });
                            //get all reqeust
                            Dictionary<string, string> getreqeustsparameters = new Dictionary<string, string> ();
                            getreqeustsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetJoinTeamRequestNotification (getreqeustsparameters,(Tap5050WebResponse getreqeustresponse)=>{
                                if(getreqeustresponse.available){
                                    teamrequests=(List<Tap5050TeamRequest>)getreqeustresponse.parsedobject;
                                    popthread.Push(teamrequests);
                                }
                                if(popinitialized){
                                    popthread.SetSignal();
                                }
                                popinitialized=true;

                            });

                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.InvalidetokenTitle,GlobalScreenData.InvalidetokenMessage,GlobalScreenData.DefaultPositive,"invalidedialog.raffleroot.checktoken");
                        }
                    }//end of token available
                        else{
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.raffleroot.gettoken");
                        }
                    });//end of get token

            }
        }
Esempio n. 22
0
        public override View GetSampleContent(Context context)
        {
            var AreaData = new List <SparklineModel>
            {
                new SparklineModel {
                    Value = 0.8
                },
                new SparklineModel {
                    Value = 1.8
                },
                new SparklineModel {
                    Value = 1.3
                },
                new SparklineModel {
                    Value = 1.1
                },
                new SparklineModel {
                    Value = 1.6
                },
                new SparklineModel {
                    Value = 2.0
                },
                new SparklineModel {
                    Value = 1.7
                },
                new SparklineModel {
                    Value = 2.3
                },
                new SparklineModel {
                    Value = 2.7
                },
                new SparklineModel {
                    Value = 2.3
                },
                new SparklineModel {
                    Value = 1.9
                },
                new SparklineModel {
                    Value = 1.4
                },
                new SparklineModel {
                    Value = 1.2
                },
                new SparklineModel {
                    Value = 0.8
                },
            };

            var LineData = new List <SparklineModel>
            {
                new SparklineModel {
                    Value = 1.1
                },
                new SparklineModel {
                    Value = 0.9
                },
                new SparklineModel {
                    Value = 1.1
                },
                new SparklineModel {
                    Value = 1.3
                },
                new SparklineModel {
                    Value = 1.1
                },
                new SparklineModel {
                    Value = 1.8
                },
                new SparklineModel {
                    Value = 2.1
                },
                new SparklineModel {
                    Value = 2.3
                },
                new SparklineModel {
                    Value = 1.7
                },
                new SparklineModel {
                    Value = 1.5
                },
                new SparklineModel {
                    Value = 2.5
                },
                new SparklineModel {
                    Value = 1.9
                },
                new SparklineModel {
                    Value = 1.3
                },
                new SparklineModel {
                    Value = 0.9
                },
            };

            var ColumnData = new List <SparklineModel>
            {
                new SparklineModel {
                    Value = 34
                },
                new SparklineModel {
                    Value = -12
                },
                new SparklineModel {
                    Value = 43
                },
                new SparklineModel {
                    Value = 66
                },
                new SparklineModel {
                    Value = 26
                },
                new SparklineModel {
                    Value = 10
                }
            };

            var WinLossData = new List <SparklineModel>
            {
                new SparklineModel {
                    Value = 34
                },
                new SparklineModel {
                    Value = 23
                },
                new SparklineModel {
                    Value = -31
                },
                new SparklineModel {
                    Value = 0
                },
                new SparklineModel {
                    Value = 26
                },
                new SparklineModel {
                    Value = 44
                }
            };

            float width  = context.Resources.DisplayMetrics.WidthPixels;
            float height = context.Resources.DisplayMetrics.HeightPixels;

            LayoutInflater layoutInflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
            View           view           = layoutInflater.Inflate(Resource.Layout.SfSparkline, null);

            lineSparkLine    = new SfLineSparkline(context);
            columnSparkLine  = new SfColumnSparkline(context);
            areaSparLine     = new SfAreaSparkline(context);
            winLossSparkLine = new SfWinLossSparkline(context);

            int layoutPadding = 30;
            int topPadding    = 80;

            TextView lineSparkLineLabel = new TextView(context);

            lineSparkLineLabel.Text = "Line";
            lineSparkLineLabel.SetPadding(0, topPadding, 0, 0);
            lineSparkLineLabel.Typeface = Typeface.Create((Typeface)null, TypefaceStyle.Bold);
            lineSparkLineLabel.Gravity  = GravityFlags.Center;

            TextView columnSparkLineLabel = new TextView(context);

            columnSparkLineLabel.Text = "Column";
            columnSparkLineLabel.SetPadding(0, topPadding, 0, 0);
            columnSparkLineLabel.Typeface = Typeface.Create((Typeface)null, TypefaceStyle.Bold);
            columnSparkLineLabel.Gravity  = GravityFlags.Center;

            TextView areaSparLineLabel = new TextView(context);

            areaSparLineLabel.Text = "Area";
            areaSparLineLabel.SetPadding(0, topPadding, 0, 0);
            areaSparLineLabel.Typeface = Typeface.Create((Typeface)null, TypefaceStyle.Bold);
            areaSparLineLabel.Gravity  = GravityFlags.Center;

            TextView winLossSparkLineLabel = new TextView(context);

            winLossSparkLineLabel.Text = "WinLoss";
            winLossSparkLineLabel.SetPadding(0, topPadding, 0, 0);
            winLossSparkLineLabel.Typeface = Typeface.Create((Typeface)null, TypefaceStyle.Bold);
            winLossSparkLineLabel.Gravity  = GravityFlags.Center;

            RelativeLayout lineSparkLineLayout = view.FindViewById <RelativeLayout>(Resource.Id.lineSparkLineLayout);

            lineSparkLineLayout.SetPadding(0, layoutPadding, 0, 0);
            lineSparkLineLayout.SetGravity(GravityFlags.Center);

            var lineParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height / 10);

            lineParams.AddRule(LayoutRules.AlignParentTop);
            lineSparkLine.LayoutParameters = lineParams;

            var lineLabelParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height);

            lineLabelParams.AddRule(LayoutRules.AlignBaseline, lineSparkLine.Id);
            lineSparkLineLabel.LayoutParameters = lineLabelParams;

            lineSparkLineLayout.AddView(lineSparkLine, lineParams);
            lineSparkLineLayout.AddView(lineSparkLineLabel, lineLabelParams);

            RelativeLayout columnSparkLineLayout = view.FindViewById <RelativeLayout>(Resource.Id.columnSparkLineLayout);

            columnSparkLineLayout.SetPadding(0, layoutPadding, 0, 0);
            columnSparkLineLayout.SetGravity(GravityFlags.Center);

            var columnParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height / 10);

            columnParams.AddRule(LayoutRules.AlignParentTop);
            columnSparkLine.LayoutParameters = columnParams;

            var columnLabelParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height);

            columnLabelParams.AddRule(LayoutRules.Below, columnSparkLine.Id);
            columnSparkLineLabel.LayoutParameters = columnLabelParams;

            columnSparkLineLayout.AddView(columnSparkLine, columnParams);
            columnSparkLineLayout.AddView(columnSparkLineLabel, columnLabelParams);

            RelativeLayout areaSparLineLayout = view.FindViewById <RelativeLayout>(Resource.Id.areaSparLineLayout);

            areaSparLineLayout.SetPadding(0, layoutPadding, 0, 0);
            areaSparLineLayout.SetGravity(GravityFlags.Center);

            var areaParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height / 10);

            areaParams.AddRule(LayoutRules.AlignParentTop);
            areaSparLine.LayoutParameters = areaParams;

            var areaLabelParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height);

            areaLabelParams.AddRule(LayoutRules.Below, areaSparLine.Id);
            areaSparLineLabel.LayoutParameters = areaLabelParams;

            areaSparLineLayout.AddView(areaSparLine, areaParams);
            areaSparLineLayout.AddView(areaSparLineLabel, areaLabelParams);

            RelativeLayout winLossSparkLineLayout = view.FindViewById <RelativeLayout>(Resource.Id.winLossSparkLineLayout);

            winLossSparkLineLayout.SetPadding(0, layoutPadding, 0, 0);
            winLossSparkLineLayout.SetGravity(GravityFlags.Center);

            var winLossParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height / 10);

            winLossParams.AddRule(LayoutRules.AlignParentTop);
            winLossSparkLine.LayoutParameters = winLossParams;

            var winLossLabelParams = new RelativeLayout.LayoutParams((int)width / 2, (int)height);

            winLossLabelParams.AddRule(LayoutRules.Below, winLossSparkLine.Id);
            winLossSparkLineLabel.LayoutParameters = winLossLabelParams;

            winLossSparkLineLayout.AddView(winLossSparkLine, winLossParams);
            winLossSparkLineLayout.AddView(winLossSparkLineLabel, winLossLabelParams);

            lineSparkLine.ItemsSource       = LineData;
            lineSparkLine.YBindingPath      = "Value";
            lineSparkLine.Marker.Visibility = ViewStates.Visible;

            columnSparkLine.ItemsSource  = ColumnData;
            columnSparkLine.YBindingPath = "Value";

            areaSparLine.ItemsSource       = AreaData;
            areaSparLine.YBindingPath      = "Value";
            areaSparLine.Marker.Visibility = ViewStates.Visible;

            winLossSparkLine.ItemsSource  = WinLossData;
            winLossSparkLine.YBindingPath = "Value";

            return(view);
        }
Esempio n. 23
0
 private void AttachPublisherView(Publisher publisher)
 {
     mPublisher.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill);
     RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(320, 240);
     layoutParams.AddRule(LayoutRules.AlignParentBottom, (int)LayoutRules.True);
     layoutParams.AddRule(LayoutRules.AlignParentRight, (int)LayoutRules.True);
     layoutParams.BottomMargin = DpToPx(8);
     layoutParams.RightMargin = DpToPx(8);
     mPublisherViewContainer.AddView(mPublisher.View, layoutParams);
 }
Esempio n. 24
0
        void RefreshContent2()
        {
            LinearLayout.LayoutParams p = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            foreach (var q in queue) {
                RelativeLayout rl = new RelativeLayout (Activity);
                rl.LayoutParameters = p;

                if (q.isSync) {
                    rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                } else {
                    rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
                }

                TextView type = new TextView (Activity);
                TextView loc = new TextView (Activity);

                switch (q.type) {
                case SyncQueueType.sqtAttendance:
                    Attendance att = SyncQueueManager.GetAttendace (q.fileLoacation);
                    Pharmacy pharm = PharmacyManager.GetPharmacy (att.pharmacy);
                    type.Text = string.Format(@"Посещение аптеки {0} за дату {1}", pharm.fullName, att.date.ToString(@"d"));
                    loc.Text = q.fileLoacation;
                    break;
                case SyncQueueType.sqtAttendanceResult:
                    AttendanceResult attRes = SyncQueueManager.GetAttendaceResult (q.fileLoacation);
                    Attendance att2 = AttendanceManager.GetAttendance(attRes.attendance);
                    Pharmacy pharm2 = PharmacyManager.GetPharmacy (att2.pharmacy);
                    type.Text = string.Format(@"Значение по препарату в посещение аптеки {0} за дату {1}", pharm2.fullName, att2.date.ToString(@"d"));
                    loc.Text = q.fileLoacation;
                    break;
                case SyncQueueType.sqtAttendancePhoto:
                    type.Text = string.Format(@"Фото");
                    loc.Text = q.fileLoacation;
                    break;
                default:
                    type.Text = @"Неизвестный тип файла";
                    type.SetTextColor (Android.Graphics.Color.DarkRed);
                    break;
                }

                rl.AddView (type);

                RelativeLayout.LayoutParams rlLP = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                rlLP.AddRule(LayoutRules.Above, type.Id);
                loc.LayoutParameters = rlLP;
                rl.AddView (loc);

                View v = new View (Activity);
                v.SetMinimumHeight (2);

                rl.AddView (v);

                llSyncItems.AddView (rl);
            }
        }
Esempio n. 25
0
		void Initialize ()
		{
			BackgroundColor = Color.Black;
			strokeColor = Color.White;
			StrokeWidth = 2f;

			canvasView = new SignatureCanvasView (this.context);
			canvasView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);

			//Set the attributes for painting the lines on the screen.
			paint = new Paint ();
			paint.Color = strokeColor;
			paint.StrokeWidth = StrokeWidth;
			paint.SetStyle (Paint.Style.Stroke);
			paint.StrokeJoin = Paint.Join.Round;
			paint.StrokeCap = Paint.Cap.Round;
			paint.AntiAlias = true;

			#region Add Subviews
			RelativeLayout.LayoutParams layout;

			BackgroundImageView = new ImageView (this.context);
			BackgroundImageView.Id = generateId ();
			AddView (BackgroundImageView);

			//Add an image that covers the entire signature view, used to display already drawn
			//elements instead of having to redraw them every time the user touches the screen.
			imageView = new ClearingImageView (context);
			imageView.SetBackgroundColor (Color.Transparent);
			imageView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
			AddView (imageView);

			lblSign = new TextView (context);
			lblSign.Id = generateId ();
			lblSign.SetIncludeFontPadding (true);
			lblSign.Text = "Sign Here";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.AlignWithParent = true;
			layout.BottomMargin = 6;
			layout.AddRule (LayoutRules.AlignBottom);
			layout.AddRule (LayoutRules.CenterHorizontal);
			lblSign.LayoutParameters = layout;
			lblSign.SetPadding (0, 0, 0, 6);
			AddView (lblSign);

			//Display the base line for the user to sign on.
			signatureLine = new View (context);
			signatureLine.Id = generateId ();
			signatureLine.SetBackgroundColor (Color.Gray);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, 1);
			layout.SetMargins (10, 0, 10, 5);
			layout.AddRule (LayoutRules.Above, lblSign.Id);
            signatureLine.LayoutParameters = layout;
			AddView (signatureLine);

			//Display the X on the left hand side of the line where the user signs.
			xLabel = new TextView (context);
			xLabel.Id = generateId ();
			xLabel.Text = "X";
			xLabel.SetTypeface (null, TypefaceStyle.Bold);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.LeftMargin = 11;
			layout.AddRule (LayoutRules.Above, signatureLine.Id);
			xLabel.LayoutParameters = layout;
			AddView (xLabel);

			AddView (canvasView);

			lblClear = new TextView (context);
			lblClear.Id = generateId ();
			lblClear.Text = "Clear";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.SetMargins (0, 10, 22, 0);
			layout.AlignWithParent = true;
			layout.AddRule (LayoutRules.AlignRight);
			layout.AddRule (LayoutRules.AlignTop);
			lblClear.LayoutParameters = layout;
			lblClear.Visibility = ViewStates.Invisible;
			lblClear.Click += (object sender, EventArgs e) => {
				Clear ();
			};
			AddView (lblClear);
			#endregion

			paths = new List<Path> ();
			points = new List<System.Drawing.PointF[]> ();
			currentPoints = new List<System.Drawing.PointF> ();

			dirtyRect = new RectF ();
		}
Esempio n. 26
0
        void Sample13()
        {
            _parentView = new RelativeLayout(Context);

            _container             = new LinearLayout(Context);
            _container.Orientation = Orientation.Horizontal; //並べる方向

            var param = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent)
            {
                Width       = 0,
                Weight      = 1,                           //余白は平等に
                Gravity     = GravityFlags.CenterVertical, //垂直方向位置
                RightMargin = (int)Context.ToPixels(6),    //要素間マージン
            };

            _container.AddView(_label1, param);
            _container.AddView(_label2, param);

            //最後の要素にはマージンは不要
            var param2 = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent)
            {
                Width   = 0,
                Weight  = 1,
                Gravity = GravityFlags.CenterVertical
            };

            _container.AddView(_label3, param2);

            using (var p = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent))
            {
                //親Viewにぴったりに合わせて挿入
                _parentView.AddView(_container, p);
            }

            var margin = (int)Context.ToPixels(6);

            var label4 = new TextView(Context)
            {
                Text = "Four"
            };

            label4.SetBackgroundColor(Android.Graphics.Color.Argb(125, 0, 0, 0));
            label4.SetTextColor(Android.Graphics.Color.White);


            using (var p = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent))
            {
                p.AddRule(LayoutRules.AlignParentTop);  //親の上の合わせる
                p.AddRule(LayoutRules.AlignParentLeft); //親の左に合わせる
                p.TopMargin  = margin;
                p.LeftMargin = margin;
                _parentView.AddView(label4, p);
            }

            var label5 = new TextView(Context)
            {
                Text = "Five"
            };

            label5.SetBackgroundColor(Android.Graphics.Color.Argb(125, 0, 0, 0));
            label5.SetTextColor(Android.Graphics.Color.White);

            using (var p = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent))
            {
                p.AddRule(LayoutRules.AlignParentTop);   //親の上に合わせる
                p.AddRule(LayoutRules.AlignParentRight); //親の右に合わせる
                p.TopMargin   = margin;
                p.RightMargin = margin;
                _parentView.AddView(label5, p);
            }

            var label6 = new TextView(Context)
            {
                Text = "Six"
            };

            label6.SetBackgroundColor(Android.Graphics.Color.Argb(125, 0, 0, 0));
            label6.SetTextColor(Android.Graphics.Color.White);

            using (var p = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent))
            {
                p.AddRule(LayoutRules.AlignParentBottom); //親の下に合わせる
                p.AddRule(LayoutRules.AlignParentRight);  //親の右に合わせる
                p.BottomMargin = margin;
                p.RightMargin  = margin;
                _parentView.AddView(label6, p);
            }

            var label7 = new TextView(Context)
            {
                Text = "Seven"
            };

            label7.SetBackgroundColor(Android.Graphics.Color.Argb(125, 0, 0, 0));
            label7.SetTextColor(Android.Graphics.Color.White);

            using (var p = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent))
            {
                p.AddRule(LayoutRules.AlignParentLeft);     //親の左に合わせる
                p.AddRule(LayoutRules.AlignParentBottom);   //親の下に合わせる
                p.LeftMargin   = margin;
                p.BottomMargin = margin;
                _parentView.AddView(label7, p);
            }

            var label8 = new TextView(Context)
            {
                Text = "Eight"
            };

            label8.SetBackgroundColor(Android.Graphics.Color.Argb(125, 0, 0, 0));
            label8.SetTextColor(Android.Graphics.Color.White);

            using (var p = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent))
            {
                p.AddRule(LayoutRules.CenterInParent);  //親の水平垂直ど真ん中に合わせる
                _parentView.AddView(label8, p);
            }
        }
Esempio n. 27
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            StepViewHolder viewHolder = holder as StepViewHolder;
            Step           step       = Route.Steps[position];

            // First update
            if (holder.OldPosition == -1)
            {
                viewHolder.Name.Text = step.Stop.Name;

                viewHolder.Rail1.SetBackgroundColor(color);
                viewHolder.Rail2.SetBackgroundColor(color);

                viewHolder.Rail1.Visibility = position == 0 ? ViewStates.Gone : ViewStates.Visible;
                viewHolder.Rail2.Visibility = position == Route.Steps.Length - 1 ? ViewStates.Gone : ViewStates.Visible;
            }

            // Update texts
            viewHolder.Favorite.SetImageResource(step.Stop.GetIsFavorite() ? Resource.Drawable.ic_star : Resource.Drawable.ic_star_border);

            if (stepTimes != null)
            {
                TimeStep[] timeSteps = stepTimes[position];

                if (timeSteps.Length > 0)
                {
                    viewHolder.Description.Text = Utils.GetReadableTimes(timeSteps, DateTime.Now);
                }
                else
                {
                    viewHolder.Description.Text = "Service terminé";
                }
            }
            else
            {
                viewHolder.Description.Text = "Informations non disponibles";
            }

            // Update icon positions
            if (stepTransports != null)
            {
                float density = viewHolder.ItemView.Context.Resources.DisplayMetrics.Density;

                {
                    Transport currentTransport = position == stepTransports.Length ? null : stepTransports[position];
                    float     currentPosition  = currentTransport == null ? 72 : (int)(1 + 36 - 16 + 72 * currentTransport.Progress);

                    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams((int)(32 * density), (int)(32 * density));
                    layoutParams.AddRule(LayoutRules.CenterHorizontal);
                    layoutParams.SetMargins(0, (int)(currentPosition * density), 0, 0);

                    viewHolder.Icon1.LayoutParameters = layoutParams;
                }

                {
                    Transport previousTransport = position == 0 ? null : stepTransports[position - 1];
                    float     previousPosition  = previousTransport == null ? 72 : (int)(-1 - 36 - 16 + 72 * previousTransport.Progress);

                    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams((int)(32 * density), (int)(32 * density));
                    layoutParams.AddRule(LayoutRules.CenterHorizontal);
                    layoutParams.SetMargins(0, (int)(previousPosition * density), 0, 0);

                    viewHolder.Icon2.LayoutParameters = layoutParams;
                }
            }

            if (!viewHolders.Contains(viewHolder))
            {
                viewHolders.Add(viewHolder);
            }
        }
Esempio n. 28
0
        public FormPlusMinusCounter(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource     = context.Resources;
            contextx     = context;
            OwnerID      = ownerID;
            VerifierID   = verifiedID;
            Popup        = new InformationPopup(context);
            reportStatus = Reportstatus;

            if (element.Value == "")
            {
                element.Value = "0";
            }

            theme = new FormTheme(context, element.Title);
            RelativeLayout countHolder = new RelativeLayout(context);

            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();

            RelativeLayout stepperlayout = new RelativeLayout(context);

            stepperlayout.FocusableInTouchMode = true;
            stepperlayout.Focusable            = true;
            stepperlayout.SetPadding(0, 5, 0, 5);

            RelativeLayout.LayoutParams paramsForStepperLayout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            paramsForStepperLayout.AddRule(LayoutRules.CenterHorizontal);
            stepperlayout.LayoutParameters = paramsForStepperLayout; //causes layout update

            ImageButton negativeButton = new ImageButton(context);

            negativeButton.SetImageResource(0);
            negativeButton.SetBackgroundResource(Resource.Drawable.decrement);

            ImageButton positiveButton = new ImageButton(context);

            positiveButton.SetImageResource(0);
            positiveButton.SetBackgroundResource(Resource.Drawable.increment);

            negativeButton.Click += (sender3, e) => decreaseCount(sender3, e, element.Info);
            positiveButton.Click += (sender4, e) => increaseCount(sender4, e, element.Info);

            counterEditText           = new EditText(context);
            counterEditText.Id        = element.Id;
            counterEditText.Text      = element.Value;
            counterEditText.TextSize  = 25;
            counterEditText.InputType = Android.Text.InputTypes.ClassNumber;
            counterEditText.SetTextColor(Color.ParseColor((resource.GetString(Resource.Color.green_primary))));

            counterEditText.Gravity = GravityFlags.Center;
            counterEditText.SetBackgroundResource(Resource.Drawable.back);
            counterEditText.SetPadding(10, 15, 10, 10);

            counterEditText.SetMaxWidth(350);
            counterEditText.SetMinWidth(220);
            counterEditText.SetMinimumWidth(220);

            counterEditText.SetMaxHeight(200);
            counterEditText.SetMinHeight(100);
            counterEditText.SetMinimumHeight(100);

            //counterEditText.Focusable = false;

            RelativeLayout.LayoutParams paramsForSliderCounter = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForSliderCounter.AddRule(LayoutRules.CenterInParent);
            counterEditText.LayoutParameters = paramsForSliderCounter;

            RelativeLayout.LayoutParams paramsForNegative = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForNegative.AddRule(LayoutRules.LeftOf, counterEditText.Id);
            paramsForNegative.AddRule(LayoutRules.AlignBottom, counterEditText.Id);
            paramsForNegative.AddRule(LayoutRules.AlignTop, counterEditText.Id);
            negativeButton.LayoutParameters = paramsForNegative;

            negativeButton.SetMinimumHeight(100);
            negativeButton.SetMaxHeight(150);
            negativeButton.SetMinimumWidth(200);
            negativeButton.SetMaxHeight(100);

            RelativeLayout.LayoutParams paramsForPositive = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForPositive.AddRule(LayoutRules.RightOf, counterEditText.Id);
            paramsForPositive.AddRule(LayoutRules.AlignBottom, counterEditText.Id);
            paramsForPositive.AddRule(LayoutRules.AlignTop, counterEditText.Id);
            positiveButton.LayoutParameters = paramsForPositive;

            positiveButton.SetMinimumHeight(100);
            positiveButton.SetMaxHeight(150);
            positiveButton.SetMinimumWidth(200);
            positiveButton.SetMaxHeight(100);

            ImageView indicatorImageView = (ImageView)theme.GetChildAt(1);

            indicatorImageView.SetImageResource(0);
            Popup.activateElementInfo(theme, element);

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            counterEditText.TextChanged += (sender, e) =>
            {
                if (!counterEditText.Text.Equals("0"))
                {
                    indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                    sharedPreferencesEditor.Commit();
                }
                else
                {
                    indicatorImageView.SetImageResource(0);
                }
            };

            //when opening a Draft or Archive
            if (!counterEditText.Text.Equals("0"))
            {
                indicatorImageView.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    negativeButton.Enabled  = false;
                    positiveButton.Enabled  = false;
                    counterEditText.Enabled = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        negativeButton.Enabled  = true;
                        positiveButton.Enabled  = true;
                        counterEditText.Enabled = true;
                    }
                }

                else
                {
                    negativeButton.Enabled  = true;
                    positiveButton.Enabled  = true;
                    counterEditText.Enabled = true;
                }
            }
            else
            {
                negativeButton.Enabled  = false;
                positiveButton.Enabled  = false;
                counterEditText.Enabled = false;
            }

            if (isArcheived)
            {
                negativeButton.Enabled  = false;
                positiveButton.Enabled  = false;
                counterEditText.Enabled = false;
            }

            stepperlayout.AddView(negativeButton);
            stepperlayout.AddView(counterEditText);
            stepperlayout.AddView(positiveButton);

            AddView(theme);
            AddView(stepperlayout);
            SetPadding(45, 10, 45, 20);
        }
Esempio n. 29
0
        private RelativeLayout MakeLayout(IEnumerable <Event> events, double startHour)
        {
            RelativeLayout layout = new RelativeLayout(Context);

            layout.LayoutParameters = new LayoutParams(0, LayoutParams.WrapContent, 0.5f);

            List <SortedSet <Event> > horizontalEventGroups = GroupHorizontalEvents(events);
            SortedSet <Event>         lastHEG = null;

            foreach (SortedSet <Event> horizontalEventGroup in horizontalEventGroups)
            {
                Event  firstEvent = events.Min();
                double groupStart = (firstEvent.StartTime - Day.StartTime).TotalHours;

                LinearLayout horizontalEvents = new LinearLayout(Context);
                horizontalEvents.Orientation = Orientation.Horizontal;

                RelativeLayout.LayoutParams groupParams =
                    new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);

                groupParams.AddRule(LayoutRules.AlignParentTop);

                double emptyTime = groupStart - startHour;
                groupParams.TopMargin = (int)(emptyTime * HourHeight);

                List <SortedSet <Event> > verticalEventGroups = GroupVerticalEvents(horizontalEventGroup);

                foreach (SortedSet <Event> verticalEventGroup in verticalEventGroups)
                {
                    Event  ev             = verticalEventGroup.First();
                    double eventStart     = (ev.StartTime - Day.StartTime).TotalHours;
                    double emptyGroupTime = eventStart - groupStart;
                    if (verticalEventGroup.Count == 1)
                    {
                        EventView view = new EventView(Context, ev);
                        view.HourHeight = HourHeight;
                        if (lastHEG != null)
                        {
                            view.SetBorder(true, !lastHEG.All(lastEvent => lastEvent.EndTime == ev.StartTime), true, true);
                        }

                        LayoutParams lp = (LayoutParams)view.LayoutParameters;
                        lp.TopMargin          = (int)(emptyGroupTime * HourHeight);
                        view.LayoutParameters = lp;

                        horizontalEvents.AddView(view);
                    }
                    else
                    {
                        RelativeLayout groupLayout = MakeLayout(verticalEventGroup, eventStart);
                        groupLayout.SetPadding(0, (int)emptyGroupTime, 0, 0);
                        horizontalEvents.AddView(groupLayout);
                    }
                }

                layout.AddView(horizontalEvents, groupParams);

                lastHEG = horizontalEventGroup;
            }

            return(layout);
        }
Esempio n. 30
0
        public FormGPS(Context context, ReportElement element, int ownerID, int userID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource    = context.Resources;
            contextx    = context;
            OwnerID     = userID;
            VerifierID  = verifiedID;
            theme       = new FormTheme(context, element.Title);
            Orientation = Orientation.Vertical;
            RelativeLayout gpsHolder = new RelativeLayout(contextx);

            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            List <KeyValue> existingValue = element.Values;

            Popup        = new InformationPopup(context);
            reportStatus = Reportstatus;

            editText = new EditText(context);
            Id       = element.Id;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            if (existingValue != null)
            {
                foreach (var address in existingValue)
                {
                    if (address.Name == "address")
                    {
                        editText.Text = address.Value;
                        curaddress    = address.Value;
                    }

                    if (address.Name == "longitude")
                    {
                        longtitude = address.Value;
                    }

                    if (address.Name == "latitude")
                    {
                        latitude = address.Value;
                    }
                }
            }

            editText.SetBackgroundResource(Resource.Drawable.custom_edit_text_color);

            RelativeLayout.LayoutParams paramsForGPSHolder = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            gpsHolder.LayoutParameters = paramsForGPSHolder;

            ImageButton locationBtn = new ImageButton(context);

            locationBtn.Id = 891;
            locationBtn.SetBackgroundResource(0);
            locationBtn.SetImageResource(Resource.Drawable.android_form_gps_icon);
            locationBtn.Click += (senderGPS, e) => AddressButton_OnClick(editText, this);

            RelativeLayout.LayoutParams paramsForlocationBtn = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForlocationBtn.AddRule(LayoutRules.AlignParentTop);
            paramsForlocationBtn.AddRule(LayoutRules.AlignParentEnd);
            locationBtn.LayoutParameters = paramsForlocationBtn;

            RelativeLayout.LayoutParams paramsForEditText = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForEditText.AddRule(LayoutRules.AlignParentTop);
            paramsForEditText.AddRule(LayoutRules.AlignParentStart);
            paramsForEditText.AddRule(LayoutRules.StartOf, locationBtn.Id);
            editText.LayoutParameters = paramsForEditText;
            //editText.Gravity = GravityFlags.CenterVertical;

            gpsHolder.AddView(editText);
            gpsHolder.AddView(locationBtn);

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);
            editText.TextChanged += (sender, e) =>
            {
                if (!editText.Text.Equals(""))
                {
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    curaddress = editText.Text;
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                }
            };

            //when opening a Draft or Archive
            if (!editText.Text.Equals(""))
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
            }


            if (string.IsNullOrEmpty(element.FilledBy))
            {
                //do nothing
            }
            else if (element.FilledBy == userID + "")
            {
                //do nothing
            }
            else
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            TextView elementSplitLine = new TextView(context);

            elementSplitLine.TextSize = 0.5f;
            elementSplitLine.SetBackgroundColor(Color.ParseColor(resource.GetString(Resource.Color.grey)));


            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    editText.Enabled = false;
                    editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
                    locationBtn.Enabled = false;
                    locationBtn.Click  += null;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        editText.Enabled = true;
                        editText.SetTextColor(Resources.GetColor(Resource.Color.black));
                        locationBtn.Enabled = true;
                    }
                }

                else
                {
                    editText.Enabled = true;
                    editText.SetTextColor(Resources.GetColor(Resource.Color.black));
                    locationBtn.Enabled = true;
                }
            }
            else
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
                locationBtn.Enabled = false;
                locationBtn.Click  += null;
            }

            if (isArcheived)
            {
                editText.Enabled = false;
                editText.SetTextColor(Resources.GetColor(Resource.Color.grey));
                locationBtn.Enabled = false;
                locationBtn.Click  += null;
            }


            AddView(theme);
            AddView(gpsHolder);
            SetPadding(45, 10, 45, 20);
        }
Esempio n. 31
0
        public FormSwitch(Context context, ReportElement element, int userID, int ownerID, int verifiedID, String type, ReportStatus Reportstatus, string sectionType, ImageLoader imgLoader)
            : base(context)
        {
            resource                = context.Resources;
            contextx                = context;
            OwnerID                 = ownerID;
            UserID                  = userID;
            VerifierID              = verifiedID;
            formType                = type;
            section                 = sectionType;
            theme                   = new FormTheme(context, element.Title);
            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            Popup                   = new InformationPopup(context);
            reportStatus            = Reportstatus;
            imageLoader             = imgLoader;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            Switch swch = new Switch(context);

            RelativeLayout.LayoutParams paramsOfSwitch = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsOfSwitch.AddRule(LayoutRules.AlignParentLeft);
            swch.LayoutParameters = paramsOfSwitch;

            swch.SetPadding(0, 30, 30, 30);
            swch.Id = element.Id;
            swch.SetTextColor(Color.White);

            switchState = element.Value;
            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);

            if (switchState == "")
            {
                swch.Text = "1";
            }

            else if (switchState == "false")
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                swch.Checked = false;
                swch.Text    = "";
            }
            else if (switchState == "true")
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                swch.Checked = true;
                swch.Text    = "";
            }

            swch.CheckedChange += (sender, e) =>
            {
                swch.Text = "";
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);

                //if (element.Options != null && element.Options.FirstOrDefault(a => a.Code == "conditional").Value == "true")
                //{
                //    if (swch.Checked)
                //    {
                //        switchState = "true";
                //        element.Value = "true";

                //        if (ChildCount > 2)
                //        {
                //            RemoveViews(2, element.Rejected[0].Count);
                //        }

                //        for (int j = 0; j < element.Accepted[0].Count; j++)
                //        {
                //            AddView(getView(element.Accepted[0][j], element.Accepted[0]));
                //        }
                //    }
                //    else
                //    {
                //        switchState = "false";
                //        element.Value = "false";
                //        if (ChildCount > 2)
                //        {
                //            RemoveViews(2, element.Accepted[0].Count);
                //        }

                //        for (int k = 0; k < element.Rejected[0].Count; k++)
                //        {
                //            AddView(getView(element.Rejected[0][k], element.Rejected[0]));
                //        }
                //    }
                //}

                sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                sharedPreferencesEditor.Commit();
            };

            //when opening a Draft or Archive
            if (swch.Checked)
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                switchState = "true";
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    swch.Enabled = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        swch.Enabled = true;
                    }
                }

                else
                {
                    swch.Enabled = true;
                }
            }
            else
            {
                swch.Enabled = false;
            }

            TextView elementSplitLine = new TextView(context);

            elementSplitLine.TextSize = 0.5f;
            elementSplitLine.SetBackgroundColor(Color.ParseColor(resource.GetString(Resource.Color.grey)));

            if (isArcheived)
            {
                swch.Enabled = false;
            }

            AddView(theme);
            AddView(swch);
            SetPadding(55, 10, 45, 20);

            //if (element.Options != null)
            //{
            //    var conditionalCode = element.Options.FirstOrDefault(a => a.Code == "conditional");
            //    if (conditionalCode == null || !Convert.ToBoolean(conditionalCode.Value)) return;
            //    if (switchState.Equals("true"))
            //    {
            //        for (int i = 0; i < element.Accepted[0].Count; i++)
            //        {
            //            AddView(getView(element.Accepted[0][i], element.Accepted[0]));
            //        }
            //    }
            //    else
            //    {
            //        for (int i = 0; i < element.Rejected[0].Count; i++)
            //        {
            //            AddView(getView(element.Rejected[0][i], element.Rejected[0]));
            //        }

            //    }
            //}
        }
Esempio n. 32
0
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
            lpRow.Height = TableLayout.LayoutParams.WrapContent;
            lpRow.Width = TableLayout.LayoutParams.WrapContent;
            lpRow.Gravity = GravityFlags.Center;

            //header
            TableRow trHeader = new TableRow (Activity);
            TextView tvHDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
            //tvHDrug.SetTextAppearance (Activity, Resource.Style.text_header_large);
            tvHDrug.Text = "Препараты";
            tvHDrug.LayoutParameters = lpRow;
            ((TableRow.LayoutParams)tvHDrug.LayoutParameters).SetMargins (0, 0, ToDIP(1) , 0);
            tvHDrug.SetBackgroundColor (Android.Graphics.Color.White);
            trHeader.AddView (tvHDrug);

            int i = 0;

            TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
            lpValue.Height = TableLayout.LayoutParams.WrapContent;
            lpValue.Width = TableLayout.LayoutParams.WrapContent;
            lpValue.Gravity = GravityFlags.Center;
            lpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

            foreach (var drug in drugs) {

                i++;

                TableRow trRow = new TableRow (Activity);
                TextView tvDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
                tvDrug.Gravity = GravityFlags.CenterVertical;
                tvDrug.SetTextAppearance (Activity, Resource.Style.text_row_large);
                tvDrug.Text = string.Format(@"{0}: {1}", i, drug.fullName);
                tvDrug.LayoutParameters = lpRow;
                tvDrug.SetBackgroundColor (Android.Graphics.Color.White);
                trRow.AddView (tvDrug);

                foreach (var info in infos) {

                    if (trHeader.Parent == null) {
                        TextView tvHInfo = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoValueHeader, null);
                        tvHInfo.Text = info.name;
                        tvHInfo.SetBackgroundColor (Android.Graphics.Color.White);
                        trHeader.AddView (tvHInfo);
                    }

                    RelativeLayout rlValue = new RelativeLayout(Activity);
                    rlValue.SetGravity (GravityFlags.Center);
                    rlValue.SetMinimumHeight (ToDIP(64));
                    rlValue.SetMinimumWidth (ToDIP(64));
                    rlValue.LayoutParameters = lpValue;

                    rlValue.SetTag (Resource.String.IDinfo, info.id);
                    rlValue.SetTag (Resource.String.IDdrug, drug.id);
            //					rlValue.SetTag (Resource.String.IDattendance, attendace.id);

                    string value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);

                    if (info.valueType == @"number") {
                        RelativeLayout.LayoutParams nlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        nlpValue.AddRule (LayoutRules.CenterInParent);
                        nlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = nlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.ClassNumber;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += NumberValue_AfterTextChanged;
                    }

                    if (info.valueType == @"decimal") {
                        RelativeLayout.LayoutParams dlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        dlpValue.AddRule (LayoutRules.CenterInParent);
                        dlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = dlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.NumberFlagDecimal;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += DecimalValue_AfterTextChanged;
                    }

                    if (info.valueType == @"boolean") {
                        rlValue.Click += Rl_Click;

                        TextView tvValue = new TextView (Activity);
                        tvValue.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals (@"N")) {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_danger);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightPink);
                        } else {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_success);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                        }
                        tvValue.Text = AttendanceResult.StringBoolToRussian (value);
                        rlValue.AddView (tvValue);
                    }

                    trRow.AddView (rlValue);
                }

                if (trHeader.Parent == null) {
                    table.AddView (trHeader);
                    table.AddView (GetDelim(Android.Graphics.Color.Black));
                }
                table.AddView (trRow);
                table.AddView (GetDelim(Android.Graphics.Color.Brown));
            }
        }
Esempio n. 33
0
        /// <summary>
        /// Creates and gets the view.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="convertView"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            item = this[position];

            if (view == null)
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.list_segmentlayout, parent, false);
            }

            var layoutView  = view.FindViewById <RelativeLayout>(Resource.Id.SegmentLayout);
            var companyType = view.FindViewById <TextView>(Resource.Id.CompanyTypeText);

            view.FindViewById <MvxImageView>(Resource.Id.CompanyImageView).ImageUrl          = item.ImageUrl;
            view.FindViewById <MvxImageView>(Resource.Id.CompanyTypeBackgroundView).ImageUrl = item.CompanyTypeBackgroundIcon;
            view.FindViewById <MvxImageView>(Resource.Id.CompanyTypeIconView).ImageUrl       = item.CompanyTypeIcon;
            view.FindViewById <TextView>(Resource.Id.RecommendationText).Text = item.RecommendedRide;
            view.FindViewById <TextView>(Resource.Id.CompanyNameText).Text    = item.CompanyTitle;
            companyType.Text = item.CompanyTypeText;
            view.FindViewById <TextView>(Resource.Id.DistanceTextView).Text   = item.CompanyDistanceFromCurrLocation;
            view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Text = item.NoOfOffers;
            var recText = view.FindViewById <TextView>(Resource.Id.RecommendationText);
            var comText = view.FindViewById <TextView>(Resource.Id.CompanyNameText);

            if (item.CompanyType == Core.Enums.CompanyTypeEnum.Dealership)
            {
                view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Visibility = ViewStates.Visible;
                view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Text       = item.NoOfOffers;
                view.FindViewById <MvxImageView>(Resource.Id.OfferImage).ImageUrl       = item.OfferImageUrl;
                view.FindViewById <TextView>(Resource.Id.OfferText).Text = item.OfferText;
                view.FindViewById <RelativeLayout>(Resource.Id.OfferLayout).Visibility = ViewStates.Visible;
            }
            else
            {
                view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Visibility = ViewStates.Gone;
                view.FindViewById <RelativeLayout>(Resource.Id.OfferLayout).Visibility  = ViewStates.Gone;
            }

            RelativeLayout.LayoutParams parameters = (RelativeLayout.LayoutParams)comText.LayoutParameters;

            if (item.CompanyType == Core.Enums.CompanyTypeEnum.Retailer || item.CompanyType == Core.Enums.CompanyTypeEnum.Dealership)
            {
                companyType.SetBackgroundResource(Resource.Drawable.green_textbackground);
            }
            else
            {
                companyType.SetBackgroundResource(Resource.Drawable.blue_textbackground);
            }

            mapview = view.FindViewById <MapView>(Resource.Id.MapFragmentList);
            if (view != null)
            {
                mapview.OnCreate(mBundle);
                mapview.OnResume();
                mapview.GetMapAsync(this);
            }

            if (string.IsNullOrWhiteSpace(item.RecommendedRide))
            {
                mapview.Visibility = ViewStates.Gone;
            }

            if (string.IsNullOrWhiteSpace(recText.Text))
            {
                parameters.AddRule(LayoutRules.AlignParentTop);
                comText.LayoutParameters = parameters;
            }
            else
            {
                parameters.RemoveRule(LayoutRules.AlignParentTop);
                comText.LayoutParameters = parameters;
            }

            return(view);
        }
Esempio n. 34
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape;

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            SignaturePadView signature = FindViewById <SignaturePadView>(Resource.Id.signatureView);

            if (true)
            { // Customization activated
                View root = FindViewById <View>(Resource.Id.rootView);

                // Activate this to internally use a bitmap to store the strokes
                // (good for frequent-redraw situations, bad for memory footprint)
                // signature.UseBitmapBuffer = true;

                signature.Caption.Text = "Authorization Signature";
                signature.Caption.SetTypeface(Typeface.Serif, TypefaceStyle.BoldItalic);
                signature.Caption.SetTextSize(Android.Util.ComplexUnitType.Sp, 16f);
                signature.SignaturePrompt.Text = ">>";
                signature.SignaturePrompt.SetTypeface(Typeface.SansSerif, TypefaceStyle.Normal);
                signature.SignaturePrompt.SetTextSize(Android.Util.ComplexUnitType.Sp, 32f);
                signature.BackgroundColor = Color.Rgb(255, 255, 200); // a light yellow.
                signature.StrokeColor     = Color.Black;

                signature.BackgroundImageView.SetImageResource(Resource.Drawable.logo_galaxy_black_64);
                //signature.BackgroundImageView.SetAlpha(16);
                signature.BackgroundImageView.SetAdjustViewBounds(true);

                var layout = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                layout.AddRule(LayoutRules.CenterInParent);
                layout.SetMargins(20, 20, 20, 20);
                signature.BackgroundImageView.LayoutParameters = layout;

                // You can change paddings for positioning...
                var caption = signature.Caption;
                caption.SetPadding(caption.PaddingLeft, 1, caption.PaddingRight, 25);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            Button btnSave = FindViewById <Button>(Resource.Id.btnSave);

            btnSave.Click += delegate {
                if (signature.IsBlank)
                {//Display the base line for the user to sign on.
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetMessage("No signature to save.");
                    alert.SetNeutralButton("Okay", delegate { });
                    alert.Create().Show();
                }
                points = signature.Points;
            };

            btnSave.Dispose();

            Button btnLoad = FindViewById <Button>(Resource.Id.btnLoad);

            btnLoad.Click += delegate {
                if (points != null)
                {
                    signature.LoadPoints(points);
                }
            };
            btnLoad.Dispose();
        }
Esempio n. 35
0
		public override View GetView(Context context, View convertView, ViewGroup parent)
		{
            _context = context;
			var cell = new RelativeLayout(context);

			if (entry == null)
			{
				var _entry = new EditText(context)
								 {
									 Tag = 1,
									 Hint = hint ?? "",
									 Text = Value ?? "",
								 };

				if(isPassword)
				{
					_entry.InputType = Android.Text.InputTypes.TextVariationPassword;
				}

				entry = _entry;

				entry.TextChanged += delegate
				{
					FetchValue();
				};
			}
			var tvparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
														  ViewGroup.LayoutParams.WrapContent);
			tvparams.SetMargins(5,3,5,0);
            tvparams.AddRule(LayoutRules.CenterVertical);
            tvparams.AddRule(LayoutRules.AlignParentLeft);

			var tv = new TextView(context) {Text = Caption, TextSize = 16f};

			var eparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
														  ViewGroup.LayoutParams.WrapContent);
			eparams.SetMargins(5, 3, 5, 0);
            eparams.AddRule(LayoutRules.CenterVertical);
            eparams.AddRule(LayoutRules.AlignParentRight);

			cell.AddView(tv,tvparams);
			cell.AddView(entry,eparams);
			return cell;
		}
Esempio n. 36
0
        public void RetrieveEvents()
        {
            if (!string.IsNullOrEmpty (GlobalVariable.currentlocation)) {
                Dictionary<string,string> parameters =new Dictionary<string, string>();
                parameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken(parameters,(Tap5050WebResponse response)=>{
                    if(response.available){
                        var result=(Tap5050Result)response.parsedobject;
                        if(result.result_success.Equals("Y")){
                            eventlist.Clear ();
                            eventcards.Clear ();
                            Dictionary<string, string> geteventsparameters = new Dictionary<string, string> ();
                            geteventsparameters.Add ("location", GlobalVariable.currentlocation);
                            geteventsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetEvents (geteventsparameters,(Tap5050WebResponse geteventsresponse)=>{
                            if(geteventsresponse.available){
                                    eventlist=(List<Tap5050Event>)geteventsresponse.parsedobject;
                                    eventlist.Sort(delegate(Tap5050Event x, Tap5050Event y){
                                            if (x.have_contract == null || y.have_contract == null) return 0;
                                            else if (x.have_contract.Equals("N")) return 1;
                                            else return -1;
                                        }
                                    );
                                    for(int i=0;i<eventlist.Count;i++){
                                            EventCard eventcard =new EventCard(eventlist[i],detaltimgsmall,detaltimgoriginal);
                                            eventcards.Add(eventcard);
                                    }
                                    for(int m=0;m<eventcards.Count;m++){
                                        if(!String.IsNullOrEmpty(eventlist[m].image_url)){
                                            App.INSTANCE.networknamager.LoadImage(new Tap5050ImageFlag(m,eventlist[m].image_url,Tap5050ImageFlag.ImageType.OrganizationImage),
                                                (Tap5050WebResponse imgresponse)=>{
                                                    if(imgresponse.available){
                                                        var array=(byte[])imgresponse.parsedobject;
                                                        var flag=(Tap5050ImageFlag)imgresponse.flagobject;
                                                        try{
                                                            Bitmap imageBitmap= BitmapFactory.DecodeByteArray(array, 0, array.Length);
                                                            eventcards[flag.position].originalmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(120), TapUtil.dptodx(120), false);
                                                            Bitmap newbitmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(40), TapUtil.dptodx(40), false);
                                                            eventcards[flag.position].imagemap=newbitmap;

                                                            nn_activity.RunOnUiThread(()=>{
                                                                adapter.NotifyDataSetChanged();
                                                            });
                                                        }
                                                        catch(Exception e){
                                                            Console.WriteLine (e);
                                                        }
                                                    }
                                                });
                                        }
                                    }
                                        nn_activity.RunOnUiThread(()=>{
                                            if(eventcards.Count==0){
                                            if(noeventcard!=null&&noeventcard.Parent!=null){
                                                (noeventcard.Parent as RelativeLayout).RemoveView(noeventcard);
                                            }
                                                LayoutInflater inflator = LayoutInflater.From (nn_activity);
                                                noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
                                                RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                                                noeventcardreparam.AddRule(LayoutRules.Below,locationcontainerlayout.Id);
                                                noeventcard.LayoutParameters=noeventcardreparam;
                                                TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
                                                hinttextview.Text=RaffleListScreenData.NoRaffleText;
                                                EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
                                                charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;
                                                EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
                                                numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;
                                                Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
                                                chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
                                                chritysubmitbutton.Click+= (object sender, EventArgs e) => {
                                                //set flags
                                                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                                                for(int i=0;i<flags.Length;i++){
                                                    string message="";
                                                    if(i==0){
                                                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                                                    }
                                                    if(i==1){
                                                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                                                    }
                                                }

                                                //
                                                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                                                    flags[0].flag=true;
                                                }
                                                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                                                    flags[1].flag=true;
                                                }
                                                bool totalfalg=true;
                                                foreach(var flagobj in flags){
                                                    if(!flagobj.flag){
                                                        totalfalg=false;
                                                    }
                                                }
                                                if(totalfalg){
                                                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                                                }
                                                else{
                                                    string message="Please check:\n";
                                                    for(int i=0;i<flags.Length;i++){
                                                        if(flags[i].flag==false){
                                                            if(i!=flags.Length-1){
                                                                message+=flags[i].message+",";
                                                            }else{
                                                                message+=flags[i].message;
                                                            }
                                                        }
                                                    }
                                                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,"OK",null,"invalidedialog.raffleroot.noeventinput");
                                                }
                                            };
            //												if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,nn_location,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //												}
            //												else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty","OK",null,"invalidedialog.raffleroot.noeventinput");
            //												}
            //												else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //													nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number","OK",null,"invalidedialog.raffleroot.noeventcardnumber");
            //												}
            //
            //												};
                                                rootview.AddView(noeventcard);
                                            }
                                        adapter.NotifyListChange();
                                        RemoveSpinner(rootview);
                                        });
                                    }else{
                                    nn_activity.ShowCustomAlterDialogFragment(RaffleListScreenData.AlertScreenLoadRafflesFailTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.getevents");
                                    }

                                }); //end of getevents
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.InvalidetokenTitle,GlobalScreenData.InvalidetokenMessage,"Ok",null,"invalidedialog.raffleroot.checktoken");
                        }
                    }//end of token available
                        else{
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.raffleroot.gettoken");
                        }
                    });//end of get token

            }
        }
Esempio n. 37
0
        private void Initialize()
        {
            // add the background view
            {
                BackgroundImageView = new ImageView(Context)
                {
                    Id = GenerateId(this),
                    LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent)
                };
                AddView(BackgroundImageView);
            }

            // add the main signature view
            {
                SignaturePadCanvas = new SignaturePadCanvasView(Context)
                {
                    Id = GenerateId(this),
                    LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent)
                };
                SignaturePadCanvas.StrokeCompleted += (sender, e) =>
                {
                    UpdateUi();
                    StrokeCompleted?.Invoke(this, EventArgs.Empty);
                };
                SignaturePadCanvas.Cleared += (sender, e) => Cleared?.Invoke(this, EventArgs.Empty);
                AddView(SignaturePadCanvas);
            }

            // add the caption
            {
                Caption = new TextView(Context)
                {
                    Id   = GenerateId(this),
                    Text = "Sign Here"
                };
                var layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent)
                {
                    AlignWithParent = true,
                    BottomMargin    = 6
                };
                layout.AddRule(LayoutRules.AlignBottom);
                layout.AddRule(LayoutRules.CenterHorizontal);
                Caption.LayoutParameters = layout;
                Caption.SetIncludeFontPadding(true);
                Caption.SetPadding(0, 0, 0, 6);
                AddView(Caption);
            }

            // add the signature line
            {
                SignatureLine = new View(Context)
                {
                    Id = GenerateId(this)
                };
                SignatureLine.SetBackgroundColor(Color.Gray);
                var layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, 1);
                layout.SetMargins(10, 0, 10, 5);
                layout.AddRule(LayoutRules.Above, Caption.Id);
                SignatureLine.LayoutParameters = layout;
                AddView(SignatureLine);
            }

            // add the prompt
            {
                SignaturePrompt = new TextView(Context)
                {
                    Id   = GenerateId(this),
                    Text = "X"
                };
                SignaturePrompt.SetTypeface(null, TypefaceStyle.Bold);
                var layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent)
                {
                    LeftMargin = 11
                };
                layout.AddRule(LayoutRules.Above, SignatureLine.Id);
                SignaturePrompt.LayoutParameters = layout;
                AddView(SignaturePrompt);
            }

            // add the clear label
            {
                ClearLabel = new TextView(Context)
                {
                    Id         = GenerateId(this),
                    Text       = "Clear",
                    Visibility = ViewStates.Invisible
                };
                var layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent)
                {
                    AlignWithParent = true
                };
                layout.SetMargins(0, 10, 22, 0);
                layout.AddRule(LayoutRules.AlignRight);
                layout.AddRule(LayoutRules.AlignTop);
                ClearLabel.LayoutParameters = layout;
                AddView(ClearLabel);

                // attach the "clear" command
                ClearLabel.Click += (sender, e) => Clear();
            }

            // clear / initialize the view
            Clear();
        }
Esempio n. 38
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mapView = base.OnCreateView(inflater, container, savedInstanceState);

            // Save ScreenController for later use
            ctrl = ((GameController)this.Activity);

            RelativeLayout view = new RelativeLayout(ctrl);

            view.AddView(mapView, new RelativeLayout.LayoutParams(-1, -1));

//			var view = inflater.Inflate(Resource.Layout.ScreenMap, container, false);
//
//			mapView = new MapView(ctrl);
//			mapView.OnCreate(savedInstanceState);
//
            // Set all relevant data for map

            _zoom = (float)Main.Prefs.GetDouble("MapZoom", 16);

            _map         = this.Map;
            _map.MapType = GoogleMap.MapTypeNormal;
            _map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Main.GPS.Location.Latitude, Main.GPS.Location.Longitude), _zoom));
            _map.MyLocationEnabled = true;
            _map.BuildingsEnabled  = true;
            _map.UiSettings.ZoomControlsEnabled     = false;
            _map.UiSettings.MyLocationButtonEnabled = false;
            _map.UiSettings.CompassEnabled          = false;
            _map.UiSettings.TiltGesturesEnabled     = false;
            _map.UiSettings.RotateGesturesEnabled   = false;
            _map.MapClick += OnMapClick;

            // Create tile layers
            _osmTileLayer = new OsmTileProvider("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png");
            _ocmTileLayer = new OsmTileProvider("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png");

            // Set selected map type
            SetMapType(Main.Prefs.GetInt("map_source", 0));

            // Create the zones the first time
            CreateZones();

            // Create layout for map buttons
            layoutButtons = new RelativeLayout(ctrl);

            // Button for center menu
            var lp = new RelativeLayout.LayoutParams(64, 64);

            lp.SetMargins(16, 16, 16, 8);
            lp.AddRule(LayoutRules.AlignParentLeft);
            lp.AddRule(LayoutRules.AlignParentTop);

            btnMapCenter    = new ImageButton(ctrl);
            btnMapCenter.Id = 1;
            btnMapCenter.SetImageResource(Resource.Drawable.ic_button_center);
            btnMapCenter.SetBackgroundResource(Resource.Drawable.MapButton);
            btnMapCenter.Click += OnMapCenterButtonClick;

            layoutButtons.AddView(btnMapCenter, lp);

            // Button for the orientation: north up or always in direction
            lp = new RelativeLayout.LayoutParams(64, 64);
            lp.SetMargins(16, 8, 16, 16);
            lp.AddRule(LayoutRules.Below, btnMapCenter.Id);
            lp.AddRule(LayoutRules.AlignParentLeft);

            btnMapOrientation = new ImageButton(ctrl);
            if (Main.Prefs.GetBool("MapOrientationNorth", true))
            {
                btnMapOrientation.SetImageResource(Resource.Drawable.ic_button_orientation_north);
            }
            else
            {
                btnMapOrientation.SetImageResource(Resource.Drawable.ic_button_orientation);
            }
            btnMapOrientation.SetBackgroundResource(Resource.Drawable.MapButton);
            btnMapOrientation.Click += OnMapOrientationButtonClick;

            layoutButtons.AddView(btnMapOrientation, lp);

            // Button for selecting the map type
            lp = new RelativeLayout.LayoutParams(64, 64);
            lp.SetMargins(16, 16, 16, 8);
            lp.AddRule(LayoutRules.AlignParentTop);
            lp.AddRule(LayoutRules.AlignParentRight);

            btnMapType = new ImageButton(ctrl);
            btnMapType.SetImageResource(Resource.Drawable.ic_button_layer);
            btnMapType.SetBackgroundResource(Resource.Drawable.MapButton);
            btnMapType.Click += OnMapTypeButtonClick;

            layoutButtons.AddView(btnMapType, lp);

            view.AddView(layoutButtons);

            return(view);
        }
        void Initialize()
        {
            BackgroundColor = Color.Black;
            strokeColor     = Color.White;
            StrokeWidth     = 2f;

            canvasView = new SignatureCanvasView(this.context);
            canvasView.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);

            //Set the attributes for painting the lines on the screen.
            paint             = new Paint();
            paint.Color       = strokeColor;
            paint.StrokeWidth = StrokeWidth;
            paint.SetStyle(Paint.Style.Stroke);
            paint.StrokeJoin = Paint.Join.Round;
            paint.StrokeCap  = Paint.Cap.Round;
            paint.AntiAlias  = true;

            #region Add Subviews
            RelativeLayout.LayoutParams layout;

            BackgroundImageView    = new ImageView(this.context);
            BackgroundImageView.Id = generateId();
            AddView(BackgroundImageView);

            //Add an image that covers the entire signature view, used to display already drawn
            //elements instead of having to redraw them every time the user touches the screen.
            imageView = new ClearingImageView(context);
            imageView.SetBackgroundColor(Color.Transparent);
            imageView.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
            AddView(imageView);

            Caption    = new TextView(context);
            Caption.Id = generateId();
            Caption.SetIncludeFontPadding(true);
            Caption.Text           = "Sign Here";
            layout                 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            layout.AlignWithParent = true;
            layout.BottomMargin    = 6;
            layout.AddRule(LayoutRules.AlignBottom);
            layout.AddRule(LayoutRules.CenterHorizontal);
            Caption.LayoutParameters = layout;
            Caption.SetPadding(0, 0, 0, 6);
            AddView(Caption);

            //Display the base line for the user to sign on.
            SignatureLine    = new View(context);
            SignatureLine.Id = generateId();
            SignatureLine.SetBackgroundColor(Color.Gray);
            layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, 1);
            layout.SetMargins(10, 0, 10, 5);
            layout.AddRule(LayoutRules.Above, Caption.Id);
            SignatureLine.LayoutParameters = layout;
            AddView(SignatureLine);

            //Display the X on the left hand side of the line where the user signs.
            SignaturePrompt      = new TextView(context);
            SignaturePrompt.Id   = generateId();
            SignaturePrompt.Text = "X";
            SignaturePrompt.SetTypeface(null, TypefaceStyle.Bold);
            layout            = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            layout.LeftMargin = 11;
            layout.AddRule(LayoutRules.Above, SignatureLine.Id);
            SignaturePrompt.LayoutParameters = layout;
            AddView(SignaturePrompt);

            AddView(canvasView);

            ClearLabel      = new TextView(context);
            ClearLabel.Id   = generateId();
            ClearLabel.Text = "Clear";
            layout          = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            layout.SetMargins(0, 10, 22, 0);
            layout.AlignWithParent = true;
            layout.AddRule(LayoutRules.AlignRight);
            layout.AddRule(LayoutRules.AlignTop);
            ClearLabel.LayoutParameters = layout;
            ClearLabel.Visibility       = ViewStates.Invisible;
            ClearLabel.Click           += (object sender, EventArgs e) => {
                Clear();
            };
            AddView(ClearLabel);
            #endregion

            paths         = new List <Path>();
            points        = new List <System.Drawing.PointF[]>();
            currentPoints = new List <System.Drawing.PointF>();

            dirtyRect = new RectF();
        }
Esempio n. 40
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootview = new RelativeLayout (nn_activity);
            rootview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            rootview.SetBackgroundColor (Resources.GetColor(Resource.Color.soarnix_bg_gray));
            rootview.Id = TapUtil.generateViewId ();

            //list to show event history

            historyeventlist = new ListView (nn_activity);
            historyeventlist.LayoutParameters= new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            historyeventlist.Id = TapUtil.generateViewId ();

            adapter = new EventHistoryListAdapter (nn_activity,historylist);
            historyeventlist.Adapter = adapter;

            //add a relative layout to rootview to show no result event
            nohistorylayout=new RelativeLayout(nn_activity);
            nohistorylayout.LayoutParameters= new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            nohistorylayout.SetBackgroundResource(Resource.Color.soarnix_bg_gray);
            nohistorylayout.Visibility = ViewStates.Gone;

            nohistorytext = new TextView (nn_activity);
            nohistorytext.Text = HistoryScreenData.NoRecordMessage;
            nohistorytext.Gravity = GravityFlags.Center;
            RelativeLayout.LayoutParams nohistorytextparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            nohistorytextparam.AddRule (LayoutRules.CenterInParent);
            nohistorytextparam.SetMargins (TapUtil.dptodx (10), 0, TapUtil.dptodx (10), 0);
            nohistorytext.LayoutParameters = nohistorytextparam;

            nohistorylayout.AddView (nohistorytext);
            rootview.AddView (historyeventlist);
            rootview.AddView (nohistorylayout);
            return rootview;
        }
Esempio n. 41
0
        public static void DeleteGoal()
        {
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            var resGoalTime = GoalTimeDao.GetGoalTime();

            if (resGoalTime == null)
            {
                return;
            }
            switch (resGoalTime.Name)
            {
            case "Year":
                Singleton.Instance.GoalCheckBoxs = new List <ProjectData.GoalCheckBox>();
                Singleton.Instance.DeleteGoalDialog.SetTitle("Goal of Month");
                var resGoals = SelfJournalDbContext.Instance.Goals;
                for (int i = 0; i < resGoals.Count; i++)
                {
                    RelativeLayout rl = new RelativeLayout(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lp
                    };
                    Singleton.Instance.DGLinearLayout.AddView(rl);

                    RelativeLayout.LayoutParams lpTv = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    lpTv.AddRule(LayoutRules.AlignParentLeft);
                    TextView tv = new TextView(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lpTv,
                        Text             = resGoals[i].Name,
                        TextSize         = 15
                    };
                    rl.AddView(tv);

                    RelativeLayout.LayoutParams lpChk = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    lpChk.AddRule(LayoutRules.AlignParentRight);
                    CheckBox chk = new CheckBox(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lpChk
                    };
                    rl.AddView(chk);

                    Singleton.Instance.GoalCheckBoxs.Add(new ProjectData.GoalCheckBox {
                        IDGoal = resGoals[i].ID, CheckBox = chk
                    });
                }
                break;

            case "Month":
                Singleton.Instance.GoalCheckBoxs = new List <ProjectData.GoalCheckBox>();
                Singleton.Instance.DeleteGoalDialog.SetTitle("Goal of Month");
                var resGoalOfMonths = GoalOfMonthDao.GetGoalOfMonths(Singleton.Instance.IDMonth);
                for (int i = 0; i < resGoalOfMonths.Count; i++)
                {
                    RelativeLayout rl = new RelativeLayout(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lp
                    };
                    Singleton.Instance.DGLinearLayout.AddView(rl);

                    RelativeLayout.LayoutParams lpTv = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    lpTv.AddRule(LayoutRules.AlignParentLeft);
                    TextView tv = new TextView(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lpTv,
                        Text             = GoalDao.GetGoal(resGoalOfMonths[i].IDGoal).Name,
                        TextSize         = 15
                    };
                    rl.AddView(tv);

                    RelativeLayout.LayoutParams lpChk = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    lpChk.AddRule(LayoutRules.AlignParentRight);
                    CheckBox chk = new CheckBox(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lpChk
                    };
                    rl.AddView(chk);

                    Singleton.Instance.GoalCheckBoxs.Add(new ProjectData.GoalCheckBox {
                        IDGoal = resGoalOfMonths[i].ID, CheckBox = chk
                    });
                }
                break;

            case "Day":
                Singleton.Instance.GoalCheckBoxs = new List <ProjectData.GoalCheckBox>();
                Singleton.Instance.DeleteGoalDialog.SetTitle("Goal of Day");
                var resGoalOfDays = GoalOfDayDao.GetGoalOfDays(0, Singleton.Instance.IDDay);
                for (int i = 0; i < resGoalOfDays.Count; i++)
                {
                    RelativeLayout rl = new RelativeLayout(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lp
                    };
                    Singleton.Instance.DGLinearLayout.AddView(rl);

                    RelativeLayout.LayoutParams lpTv = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    lpTv.AddRule(LayoutRules.AlignParentLeft);
                    TextView tv = new TextView(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lpTv,
                        Text             = GoalDao.GetGoal(GoalOfMonthDao.GetGoalOfMonth(resGoalOfDays[i].IDGoalOfMonth).IDGoal).Name,
                        TextSize         = 15
                    };
                    rl.AddView(tv);

                    RelativeLayout.LayoutParams lpChk = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    lpChk.AddRule(LayoutRules.AlignParentRight);
                    CheckBox chk = new CheckBox(Singleton.Instance.GoalActivity)
                    {
                        LayoutParameters = lpChk
                    };
                    rl.AddView(chk);

                    Singleton.Instance.GoalCheckBoxs.Add(new ProjectData.GoalCheckBox {
                        IDGoal = resGoalOfDays[i].ID, CheckBox = chk
                    });
                }
                break;
            }
        }
Esempio n. 42
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (nn_historycard [position].isdefaultcard) {
                RelativeLayout layout = new RelativeLayout (nn_context);
                AbsListView.LayoutParams param=new AbsListView.LayoutParams (AbsListView.LayoutParams.MatchParent,TapUtil.dptodx(45));
                layout.LayoutParameters = param;
                layout.SetPadding (TapUtil.dptodx(5),TapUtil.dptodx(5),TapUtil.dptodx(5),TapUtil.dptodx(5));

                TextView defaultinfo = new TextView (nn_context);
                defaultinfo.Gravity = GravityFlags.Center;
                RelativeLayout.LayoutParams infoparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                infoparam.AddRule (LayoutRules.CenterInParent);
                defaultinfo.LayoutParameters = infoparam;
                defaultinfo.Text = nn_historycard [position].defaultinfo;

                layout.AddView (defaultinfo);

                return layout;
            }
            ViewHolder holder = null;
            if (convertView == null) {
                LayoutInflater inflator = LayoutInflater.From (nn_context);
                convertView = inflator.Inflate (Resource.Layout.goals_eventhistory_item, null);

                holder = new ViewHolder ();
                holder.ContentView = convertView;
                holder.eventnametextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_eventnametextview);
                holder.organizationtextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_organizationnametextview);
                holder.enddatetextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_enddatetextview);
                holder.sellresulttextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_sellresulttextview);
                holder.eventimageview=(ImageView)convertView.FindViewById (Resource.Id.goals_eventhistory_eventimage);
                convertView.Tag=holder;
            } else {
                holder= (ViewHolder) convertView.Tag;
            }

            holder.eventnametextview.Text = nn_historycard [position].eventinfo.event_name;
            holder.organizationtextview.Text = nn_historycard [position].eventinfo.organization;

            string datetimestring="";
            try{
                DateTime eventEndTime=DateTime.ParseExact (nn_historycard [position].eventinfo.event_end_time.Substring (0, 19),
                    "yyyy-MM-ddTHH:mm:ss", null);
                datetimestring=eventEndTime.ToShortDateString();
            }
            catch{
                datetimestring = "";
            }
            holder.enddatetextview.Text = HistoryScreenData.RaisedLabelText+datetimestring;

            int peronalrise = 0;
            int goalamount = 0;
            if (!string.IsNullOrEmpty(nn_historycard [position].eventinfo.gross_sales) ) {
                peronalrise = Int32.Parse(nn_historycard [position].eventinfo.gross_sales);
            }
            if(!string.IsNullOrEmpty(nn_historycard [position].eventinfo.seller_goal)){
                goalamount = Int32.Parse(nn_historycard [position].eventinfo.seller_goal);
            }

            decimal percent=(decimal)0;
            if (!string.IsNullOrEmpty(nn_historycard [position].eventinfo.gross_sales) && !string.IsNullOrEmpty(nn_historycard [position].eventinfo.seller_goal)) {
                if (peronalrise < 0 | goalamount < 0) {
                    percent = 0;
                }else if(peronalrise>=goalamount){
                    percent = 1;
                }else if(peronalrise<goalamount){
                    percent = (decimal)peronalrise / goalamount;
                }
            }
            string sellresult_percentageformat = Math.Round(percent*100) +"%";

            string raisedstring=String.Format(HistoryScreenData.RaisedLabelText+"{0}/"+HistoryScreenData.GoalLabelText+"{1}({2})",peronalrise,goalamount,sellresult_percentageformat);

            holder.sellresulttextview.Text = raisedstring;

            holder.eventimageview.SetImageBitmap (nn_historycard[position].bitmmapeventimage);

            return convertView;
        }
Esempio n. 43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            CopyDocuments("baseInterna.sqlite", "LeonaliDB.db");
            txtUsuario  = (EditText)FindViewById(Resource.Id.txtUsuario);
            txtPassword = (EditText)FindViewById(Resource.Id.txtContrasena);
            btnLogin    = (Button)FindViewById(Resource.Id.btnLogin);
            var ln = (LinearLayout)FindViewById(Resource.Id.lnPreguntas);

            btnLogin.Click += async delegate {
                progressBar = new ProgressBar(this, null, Android.Resource.Attribute.ProgressBarStyleLarge);
                RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(200, 200);
                p.AddRule(LayoutRules.CenterInParent);
                progressBar.IndeterminateDrawable.SetColorFilter(Android.Graphics.Color.Rgb(255, 255, 255), Android.Graphics.PorterDuff.Mode.Multiply);

                FindViewById <RelativeLayout>(Resource.Id.FondoLogin).AddView(progressBar, p);
                await Task.Delay(10000);

                progressBar.Visibility = Android.Views.ViewStates.Visible;
                Window.AddFlags(Android.Views.WindowManagerFlags.NotTouchable);

                try
                {
                    com.somee.servicioweb1test.Service service = new com.somee.servicioweb1test.Service();
                    var           xml           = service.Consulta("select * from usuarios where user_name = '" + txtUsuario.Text + "' and user_password = '******';");
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(ClaseDato));
                    var           claseDato     = new ClaseDato();

                    var jsonLimpio = "";
                    var bandera    = false;

                    foreach (var item in xml)
                    {
                        if (item == '[')
                        {
                            bandera = true;
                        }
                        if (bandera)
                        {
                            jsonLimpio += item;
                        }
                        if (item == ']')
                        {
                            break;
                        }
                    }

                    var results = JsonConvert.DeserializeObject <List <ClaseDato> >(jsonLimpio);

                    new General().GuardarDatosUsuario(results[0].id_user, results[0].user_name, results[0].user_password);
                    FinishAffinity();
                    StartActivity(typeof(ActivityMenu));
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "Error al iniciar \r\n Verifica tu conexion a internet o tu Usuario y/o contraseña", ToastLength.Short).Show();
                    progressBar.Visibility = Android.Views.ViewStates.Invisible;
                    Window.ClearFlags(Android.Views.WindowManagerFlags.NotTouchable);
                }
            };

            video = (VideoView)FindViewById(Resource.Id.videoPlay);

            video.SetOnPreparedListener(this);
            string videoPaht = "android.resource://DanielProyecto.DanielProyecto/" + Resource.Raw.agri;

            Android.Net.Uri uri = Android.Net.Uri.Parse(videoPaht);
            video.SetVideoURI(uri);
            video.Start();
        }
        public RoundKnobButton(Context context, int back, Bitmap bmpRotorOn, Bitmap bmpRotorOff, int w, int h)
            : base(context)
        {
            Console.WriteLine("RoundKnobButton :: ctor :: Start");

            // We won't wait for our size to be calculated, we'll just store our fixed size
            m_Width  = w;
            m_Height = h;

            m_BmpRotorOn  = bmpRotorOn;
            m_BmpRotorOff = bmpRotorOff;

            //
            // Create stator
            //
            ImageView ivBack = new ImageView(context);

            ivBack.SetImageResource(back);
            RelativeLayout.LayoutParams lp_ivBack = new RelativeLayout.LayoutParams(w, h);
            lp_ivBack.AddRule(LayoutRules.CenterInParent);
            AddView(ivBack, lp_ivBack);

            //
            // Create Rotor
            //

            m_RotorImaveView = new ImageView(context);
            m_RotorImaveView.SetImageBitmap(bmpRotorOff);

            RelativeLayout.LayoutParams lp_ivKnob = new RelativeLayout.LayoutParams(w, h);            //LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            lp_ivKnob.AddRule(LayoutRules.CenterInParent);
            AddView(m_RotorImaveView, lp_ivKnob);

            SetState(true);

            //
            // Create Current Value Text
            //
            m_CurrentValueTextView = new TextView(context);
            m_CurrentValueTextView.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);
            m_CurrentValueTextView.Gravity = GravityFlags.Center;
            RelativeLayout.LayoutParams lp_cvKnob = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, h / 2);
            lp_cvKnob.AddRule(LayoutRules.CenterInParent);
            AddView(m_CurrentValueTextView, lp_cvKnob);

            // Border for TextView
            GradientDrawable gd = new GradientDrawable();

            gd.SetColor(20);             // Changes this drawbale to use a single color instead of a gradient
            gd.SetCornerRadius(5);
            gd.SetStroke(1, Color.LightGray);
            // m_CurrentValueTextView.Background = gd;

            //
            // Circles
            //
            m_InnerCircle            = new CircleView(context, w, h, w / 8);
            m_InnerCircle.Visibility = (m_ShowTouchPath) ? ViewStates.Visible : ViewStates.Invisible;
            RelativeLayout.LayoutParams lp_circle = new RelativeLayout.LayoutParams(w, h);
            lp_circle.AddRule(LayoutRules.CenterInParent);
            AddView(m_InnerCircle, lp_circle);

            m_OuterCircle            = new CircleView(context, w, h, w / 3);
            m_OuterCircle.Visibility = (m_ShowTouchPath) ? ViewStates.Visible : ViewStates.Invisible;
            RelativeLayout.LayoutParams lp_circle2 = new RelativeLayout.LayoutParams(w, h);
            lp_circle2.AddRule(LayoutRules.CenterInParent);
            AddView(m_OuterCircle, lp_circle2);

            // Enable Gesture Detector
            gestureDetector = new GestureDetector(Context, this);
        }
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{

			base.OnCreateView (inflater, container, savedInstanceState);


			if (savedInstanceState != null) {
				//restore fragment here

			}




			View view = inflater.Inflate (Resource.Layout.Fragment2, container, false);
			//Toast.MakeText (Application.Context, "Estas en el fragmento 2", ToastLength.Long).Show ();

			//ANTES QUE NADA, CREAMOS LOS BOTONES, LOS INPUTS, LAS LAYOUTS Y LOS PROGRESSBAR, Y PORSUPUESTO EL LISTVIEW
			Button busqueda = view.FindViewById<Button> (Resource.Id.busqueda); //pestaña busqueda
			Button resultados = view.FindViewById<Button> (Resource.Id.resultados);//pestaña resultados

			LinearLayout botones = view.FindViewById<LinearLayout> (Resource.Id.linearLayout0); //capa de botones busqueda-resultados
			LinearLayout cuadbusqueda = view.FindViewById<LinearLayout> (Resource.Id.linearLayout1); //capa de cuadro de busqueda
			LinearLayout cuadresultados = view.FindViewById<LinearLayout> (Resource.Id.linearLayout3); //capa de cuadro de busqueda
			LinearLayout prevnext = view.FindViewById<LinearLayout> (Resource.Id.linearLayout4); //capa de botones siguiente y anterior

			EditText cad = view.FindViewById<EditText> (Resource.Id.cadena); //cuadro de texto que contiene las palabras a buscar
			//cad.Text="pulpo";
			Button buscar = view.FindViewById<Button> (Resource.Id.buscar); //botón de buscar en mi ciudad
			Button geo = view.FindViewById<Button> (Resource.Id.geo); //botón de buscar cerca de mi

			Button prev = view.FindViewById<Button> (Resource.Id.prev); //botón de anterior en los resultados
			Button next = view.FindViewById<Button> (Resource.Id.next); //boton de siguiente en los resultados

			ProgressBar wait = view.FindViewById<ProgressBar> (Resource.Id.progressBar1); //progress bar para la búsqueda
			ProgressBar waitpagina = view.FindViewById<ProgressBar> (Resource.Id.progressBar2); //progress bar para las paginas

			ListView reslista = view.FindViewById<ListView> (Resource.Id.listView1); //la lista donde se mmuestran los resultados de la busqueda

			TextView noresults = view.FindViewById<TextView> (Resource.Id.textView2); //texto que dice que no se encontraron resultados

			gps = this.Arguments;
				

			//CREAMOS LAS VARIABLES QUE VA A RECIBIR LA API

			string cadena="";

			string lat_long = "";
			string lat = "";
			string longt = "";

			string region_heredada = null;

			Typeface font = Typeface.CreateFromAsset(Activity.Assets, "Fonts/fa.ttf");
			buscar.SetTypeface(font, TypefaceStyle.Normal);
			geo.SetTypeface(font, TypefaceStyle.Normal);

			//TERMINAMOS DE CREAR LOS ELEMENTOS, AHORA SI A PROGRAMAR TODO LO DEMÁS
			busqueda.Click += (sender, e) => {
				
				busqueda.SetBackgroundResource(Resource.Drawable.busquedaactive); 
				resultados.SetBackgroundResource(Resource.Drawable.busqueda);
				//cambiar colores
				busqueda.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
				resultados.SetTextColor(Android.Graphics.Color.ParseColor("#000000"));
				//hacer visible el cuadro de busqueda y hacer invisible el cuadro de resultados
				cuadbusqueda.Visibility=ViewStates.Visible;
				cuadresultados.Visibility = ViewStates.Gone;

			};

			resultados.Click += (sender, e) => {
				busqueda.SetBackgroundResource(Resource.Drawable.busqueda);
				resultados.SetBackgroundResource(Resource.Drawable.busquedaactive);
				//cambiar colores
				busqueda.SetTextColor(Android.Graphics.Color.ParseColor("#000000"));
				resultados.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
				//hacer invisible el cuadro de busqueda y visible el cuadro de resultados
				cuadbusqueda.Visibility=ViewStates.Gone;
				cuadresultados.Visibility = ViewStates.Visible;
				};

			//CATEGORIAS
			Spinner categ = view.FindViewById<Spinner> (Resource.Id.categorias);
							
			mItems = new List<Categoria> ();

			mItems.Add(new Categoria(){
				//NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
				Id = "",
				Nombre = "Selecciona una categoría"

			});



			//inicia lo de para traer las categorias
			Button getcats = view.FindViewById<Button> (Resource.Id.getcats);

			getcats.Click += async (sender, e) => {
				
				JsonValue objeto;

				try{
			categorias_array = await FetchWeatherAsync("http://plif.mx/mobile/get_cats_neg");
					objeto = categorias_array["respuesta"];

					foreach(JsonObject data in objeto){
							mItems.Add(new Categoria(){
							Id = data["categorias"]["id"],
							Nombre = data["categorias"]["nombre"]

						});
					}


				}catch(Exception ex){
					Toast.MakeText (Application.Context, "Ocurrió un error al recuperar las categorías", ToastLength.Long).Show ();
				}
			
			};

			getcats.PerformClick ();
			//termina lo de para traer las categorias



			MyNegociosAdapter adapter_c = new MyNegociosAdapter (Application.Context, mItems);
			categ.Adapter = adapter_c;

			//REGIONES
			Spinner regio = view.FindViewById<Spinner> (Resource.Id.regiones);
			ArrayAdapter<String> regadapter;

			//Android.Resource.Layout.SimpleSpinnerDropDownItem
			regadapter = new ArrayAdapter<string>(Application.Context, Resource.Layout.spinnerfuck, Resource.Id.company);

			rItems = new List<Region> ();

			//AGREGAMOS LAS REGIONES
			rItems.Add(new Region(){
				//NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
				Id = "9",
				Nombre = "Durango"

			});

			rItems.Add(new Region(){
				//NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
				Id = "2",
				Nombre = "Mazatlán"

			});

			rItems.Add(new Region(){
				//NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
				Id = "3",
				Nombre = "Torreón"

			});

			rItems.Add(new Region(){
				//NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
				Id = "4",
				Nombre = "Zacatecas"

			});

			MyRegionesAdapter adapter_r = new MyRegionesAdapter (Application.Context, rItems);
			regio.Adapter = adapter_r;


			categ.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (c_spinner_ItemSelected);
			regio.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (r_spinner_ItemSelected);

			buscar.Click += async (sender, e) => {
				counter=0;
				reslista.Adapter=null;
				//ESTE VA A TENER QUE SER ASÍNCRONO!
				cadena=cad.Text;
				noresults.Visibility=ViewStates.Gone;
				//ocultamos el teclado
				InputMethodManager imm = (InputMethodManager)Application.Context.GetSystemService(Context.InputMethodService);
				imm.HideSoftInputFromWindow(cad.WindowToken, 0);

				//primero deberíamos validar que el usuario haya introducido algún texto
				if((cadena=="" || cadena==null) && (cat_id=="" || cat_id == null) && (region_heredada == null || region_heredada=="")){
					Toast.MakeText (Application.Context, "¡Espera! Primero dinos que estás buscando.", ToastLength.Long).Show ();
				}else{
			     //antes que nada, comenzamos a armar la url desde la base

					string uri="http://plif.mx/filtrar.json?";

					//comenzaremos desde la pagina 1
					pagina=1;

					//añadimos la cadenas
					uri=uri+"cadena="+cadena;
					//añadimos la categoría
					uri=uri+"&categoria="+cat_id;
					//añadimos el lat_long, que en este caso será nulo
					uri=uri+"&lat_long="+lat_long;
					//añadimos la latitud que pues tambien será nula
					uri=uri+"&lat="+lat;
					//y la longitud igual
					uri=uri+"&long="+longt;
					//añadimos la región
					uri=uri+"&region="+reg_id;
					//guardamos la url hasta ahí para los botones prev next
					urlnextprev=uri;
					//y por último añadimos la página
					uri=uri+"&pagina="+pagina;

				   // Toast.MakeText (Application.Context, uri, ToastLength.Long).Show ();

					//mostrar los botones y los resultados, y ocultar el cuadro de busqueda
					botones.Visibility = ViewStates.Visible;
					cuadresultados.Visibility = ViewStates.Visible;
					cuadbusqueda.Visibility=ViewStates.Gone;
					prev.Visibility=ViewStates.Gone;
					next.Visibility=ViewStates.Gone;



					//mostramos el progressbar
					wait.Visibility=ViewStates.Visible;

					//cambiar el estilo de los botones busqueda y resultados
					busqueda.SetBackgroundResource(Resource.Drawable.busqueda);
					resultados.SetBackgroundResource(Resource.Drawable.busquedaactive);
					//cambiar colores
					busqueda.SetTextColor(Android.Graphics.Color.ParseColor("#000000"));
					resultados.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));

					//cambiar el margen de la busqueda
					RelativeLayout.LayoutParams pms = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
					pms.AddRule(LayoutRules.Below, Resource.Id.linearLayout0);
					pms.TopMargin = -90;
					cuadbusqueda.LayoutParameters=pms;

					Log.Debug("BUSQUEDA","LA URI ES: "+uri);
					//Y aqui vamos a pedirle al servidor que busque
					try{
						negocios = await FetchWeatherAsync(uri);
						objeto = negocios["respuesta"];

						negItems = new List<Negocio> ();

						foreach(JsonObject data in objeto){
							Log.Debug("GEO","Waaaaat!!!");
							//AQUI LOS AGREGAMOS
				
								negItems.Add(new Negocio(){
								NegocioId = WebUtility.HtmlDecode(data["Data"]["id"]),
								NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
								NegocioDir = WebUtility.HtmlDecode(data["Data"]["geo_calle"]+" "+data["Data"]["geo_numero"]+" "+data["Data"]["geo_colonia"]),
								NegocioCat = WebUtility.HtmlDecode(data["Data"]["categoria"]),
								NegocioFoto = WebUtility.HtmlDecode(data["Data"]["ruta"]),
								NegocioCal = WebUtility.HtmlDecode(data["Data"]["calificacion"]),
								NegocioPrem = data["Data"]["premium"],
								NegocioNum = counter

							});

							//Toast.MakeText (Application.Context, "YUSS!!", ToastLength.Long).Show ();
							counter++;
						}

						wait.Visibility=ViewStates.Gone;

						if(counter==0){
							noresults.Visibility=ViewStates.Visible;
						}else{

						MyListAdapter res_adapter = new MyListAdapter (Application.Context, negItems);


						

						if(pagina<=1){
							prev.Enabled=false;
						}else{
							prev.Enabled=true;
						}

						if(counter<10){
							next.Enabled=false;
						}else{
							next.Enabled=true;
						}

						prev.Visibility=ViewStates.Visible;
						next.Visibility=ViewStates.Visible;
						reslista.Adapter = res_adapter;

						}//else si no se encontraron resultados

					}catch(Exception ex){
						Log.Debug("BUSQUEDA","Error"+ex);
						busqueda.PerformClick();
						Toast.MakeText (Application.Context, "Ooops! Parece que algo salió mal. ¿Por qué no lo intentas de nuevo?", ToastLength.Long).Show ();
					}


				
				}//ELSE SI LA CADENA NO ESTÁ VACIA
			};

			//AQUI CHECAMOS SI RECIBE UN ID DE REGION PARA LA PANTALLA PRINCIPAL
			region_heredada=gps.GetString("region");
			//Toast.MakeText (Application.Context, "la region es: "+region_heredada, ToastLength.Long).Show ();
			if(region_heredada != "nada"){
				reg_id = region_heredada;
				//Toast.MakeText (Application.Context, "la region es: "+reg_id+" SI HAY", ToastLength.Long).Show ();
				buscar.PerformClick ();

			}

			prev.Click += async (sender, e) => {
				if(pagina==1){
					//No hagas nada
				}else{
				pagina--;
				counter=0;

				prev.Visibility=ViewStates.Gone;
				next.Visibility=ViewStates.Gone;

				waitpagina.Visibility=ViewStates.Visible;

				string newuri = urlnextprev + "&pagina="+pagina;

				try{
					negocios = await FetchWeatherAsync(newuri);
					objeto = negocios["respuesta"];

					negItems = new List<Negocio> ();

						//esto es para la distancia en la geolocalizacion
						float dist=0;
						string dist_final="";
						double dist2=0;

					foreach(JsonObject data in objeto){
						//AQUI LOS AGREGAMOS


							try{
							//HAY QUE VALIDAR ESTO, SI NO VA A TRONAR
							dist=float.Parse(WebUtility.HtmlDecode(data["Data"]["distance"]));
								//Log.Debug (tag, "La Distancia de la BD es: "+dist);

							if(dist<1){
								dist=dist*1000;
								dist2=Math.Round(dist, 1);
								dist_final=dist2.ToString();
								dist_final=dist_final+" mts.";
							}else{
								dist2=Math.Round(dist, 1);
								dist_final=dist2.ToString();
								dist_final=dist_final+" kms.";
							}
							}catch(Exception ex){
								Log.Debug (tag, "Error detectado: NO HAY DISTANCIA");
							}


						negItems.Add(new Negocio(){
							NegocioId = WebUtility.HtmlDecode(data["Data"]["id"]),
							NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
							NegocioDir = WebUtility.HtmlDecode(data["Data"]["geo_calle"]+" "+data["Data"]["geo_numero"]+" "+data["Data"]["geo_colonia"]),
							NegocioCat = WebUtility.HtmlDecode(data["Data"]["categoria"]),
							NegocioFoto = WebUtility.HtmlDecode(data["Data"]["ruta"]),
							NegocioCal = WebUtility.HtmlDecode(data["Data"]["calificacion"]),
						    NegocioPrem = data["Data"]["premium"],
							NegocioNum = counter,
								NegocioDist = dist_final


						});

						//Toast.MakeText (Application.Context, "YUSS!!", ToastLength.Long).Show ();
						counter++;
					}

					MyListAdapter res_adapter = new MyListAdapter (Application.Context, negItems);




					if(pagina<=1){
						prev.Enabled=false;
					}else{
						prev.Enabled=true;
					}

					if(counter<10){
						next.Enabled=false;
					}else{
						next.Enabled=true;
					}



					prev.Visibility=ViewStates.Visible;
					next.Visibility=ViewStates.Visible;

					waitpagina.Visibility=ViewStates.Gone;

					reslista.Adapter = res_adapter;




				}catch(Exception ex){
					if(pagina<=1){
						prev.Enabled=false;
					}else{
						prev.Enabled=true;
					}

					prev.Visibility=ViewStates.Visible;
					next.Visibility=ViewStates.Visible;

					waitpagina.Visibility=ViewStates.Gone;

					Toast.MakeText (Application.Context, "Oops! Parece que algo salió mal. ¿Por qué no oprimes \"Anterior\" para intentarlo de nuevo?", ToastLength.Long).Show ();
				}
			}//else si la pagina no es la primera
					
			};

			next.Click += async (sender, e) => {
				pagina++;
				counter=0;

				prev.Visibility=ViewStates.Gone;
				next.Visibility=ViewStates.Gone;

				waitpagina.Visibility=ViewStates.Visible;

				string newuri = urlnextprev + "&pagina="+pagina;

				try{
					negocios = await FetchWeatherAsync(newuri);
					objeto = negocios["respuesta"];

					negItems = new List<Negocio> ();

					//esto es para la distancia en la geolocalizacion
					float dist=0;
					string dist_final="";
					double dist2=0;

					foreach(JsonObject data in objeto){
						//AQUI LOS AGREGAMOS

						try{
							//HAY QUE VALIDAR ESTO, SI NO VA A TRONAR
							dist=float.Parse(WebUtility.HtmlDecode(data["Data"]["distance"]));

							if(dist<1){
								dist=dist*1000;
								dist2=Math.Round(dist, 1);
								dist_final=dist2.ToString();
								dist_final=dist_final+" mts.";
							}else{
								dist2=Math.Round(dist, 1);
								dist_final=dist2.ToString();
								dist_final=dist_final+" kms.";
							}
						}catch(Exception ex){
							Log.Debug (tag, "Error detectado: NO HAY DISTANCIA");
						}

						negItems.Add(new Negocio(){
							NegocioId = WebUtility.HtmlDecode(data["Data"]["id"]),
							NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
							NegocioDir = WebUtility.HtmlDecode(data["Data"]["geo_calle"]+" "+data["Data"]["geo_numero"]+" "+data["Data"]["geo_colonia"]),
							NegocioCat = WebUtility.HtmlDecode(data["Data"]["categoria"]),
							NegocioFoto = WebUtility.HtmlDecode(data["Data"]["ruta"]),
							NegocioCal = WebUtility.HtmlDecode(data["Data"]["calificacion"]),
							NegocioPrem = data["Data"]["premium"],
							NegocioNum = counter,
							NegocioDist = dist_final

						});

						//Toast.MakeText (Application.Context, "YUSS!!", ToastLength.Long).Show ();
						counter++;
					}

					MyListAdapter res_adapter = new MyListAdapter (Application.Context, negItems);




					if(pagina<=1){
						prev.Enabled=false;
					}else{
						prev.Enabled=true;
					}

					if(counter<10){
						next.Enabled=false;
					}else{
						next.Enabled=true;
					}



					prev.Visibility=ViewStates.Visible;
					next.Visibility=ViewStates.Visible;

					waitpagina.Visibility=ViewStates.Gone;

					reslista.Adapter = res_adapter;




				}catch(Exception ex){
						if(pagina<=1){
						prev.Enabled=false;
					}else{
						prev.Enabled=true;
					}

					prev.Visibility=ViewStates.Visible;
					next.Visibility=ViewStates.Visible;

					waitpagina.Visibility=ViewStates.Gone;

					Toast.MakeText (Application.Context, "Oops! Parece que algo salió mal. ¿Por qué no oprimes \"Siguiente\" para intentarlo de nuevo?", ToastLength.Long).Show ();
				}

			};

			//BOTON DE GEOLOCALIZACION
			geo.Click += async (sender, e) => {
				Log.Debug(tag, "Si clickeó");



				string longitud=gps.GetString("longitud");
				string latitud=gps.GetString("latitud");
				//cad.Text=gps.GetString("longitud")+","+gps.GetString("latitud");

				//HAY QUE CONVERTIR LAS COMAS DE LAS COORDENADAS EN PUNTOS PARA QUE NO MARQUE ERROR EL SERVIDOR
				//input.Replace("_::_", "Areo");
				longitud=longitud.Replace(",",".");
				latitud=latitud.Replace(",",".");

				cadena=cad.Text;
				noresults.Visibility=ViewStates.Gone;
				//ocultamos el teclado
				InputMethodManager imm = (InputMethodManager)Application.Context.GetSystemService(Context.InputMethodService);
				imm.HideSoftInputFromWindow(cad.WindowToken, 0);


				if(longitud=="nada" || latitud == "nada"){
					Toast.MakeText (Application.Context, "Parece que aún no hemos podido determinar tu ubicación. Toca para intentarlo de nuevo!", ToastLength.Long).Show ();
				}else{
					if(longitud=="nogps" || latitud == "nogps"){
						Toast.MakeText (Application.Context, "Tienes el GPS y la ubicación desactivados, por favor actívalos!", ToastLength.Long).Show ();
					}else{
						//Toast.MakeText (Application.Context, "Latitud: "+latitud+" Longitud: "+longitud, ToastLength.Long).Show ();

						//AQUI VAMOS A ARMAR TODO!

						//INICIA BUSQUEDA
						//antes que nada, comenzamos a armar la url desde la base

						string uri="http://plif.mx/filtrar.json?";

						//comenzaremos desde la pagina 1
						pagina=1;
						reslista.Adapter=null;

						//añadimos la cadena
						uri=uri+"cadena="+cadena;
						//añadimos la categoría
						uri=uri+"&categoria="+cat_id;
						//añadimos el lat_long
						//uri=uri+"&lat_long="+"(6371*acos(cos(radians("+latitud+")*cos(radians(geo_lat))*cos(radians(geo_long)-radians("+longitud+"))+sin(radians("+latitud+"))*sin(radians(geo_lat))))";
						//uri=uri+"&lat_long="+"(6371*acos(cos(radians("+latitud+"))*cos(radians(geo_lat))*cos(radians(geo_long)-radians("+longitud+"))+sin(radians("+latitud+"))*sin(radians(geo_lat))))";
						uri=uri+"&lat_long="+"&lat_long=%28+6371+*+acos%28+cos%28+radians%28"+latitud+"+%29+%29+*+cos%28+radians%28+geo_lat+%29+%29+*+cos%28+radians%28+geo_long+%29+-+radians%28"+longitud+"%29+%29+%2B+sin%28+radians%28"+latitud+"%29+%29+*+sin%28+radians%28+geo_lat+%29+%29+%29+%29+";
						//añadimos la latitud 
						uri=uri+"&lat="+latitud;
						//y la longitud igual
						uri=uri+"&long="+longitud;
						//añadimos la región
						uri=uri+"&region="+reg_id;
						//guardamos la url hasta ahí para los botones prev next
						urlnextprev=uri;
						//y por último añadimos la página
						uri=uri+"&pagina="+pagina;

						//cad.Text=uri;

						//Toast.MakeText (Application.Context, uri, ToastLength.Long).Show ();

						//mostrar los botones y los resultados, y ocultar el cuadro de busqueda
						botones.Visibility = ViewStates.Visible;
						cuadresultados.Visibility = ViewStates.Visible;
						cuadbusqueda.Visibility=ViewStates.Gone;
						prev.Visibility=ViewStates.Gone;
						next.Visibility=ViewStates.Gone;



						//mostramos el progressbar
						wait.Visibility=ViewStates.Visible;

						//cambiar el estilo de los botones busqueda y resultados
						busqueda.SetBackgroundResource(Resource.Drawable.busqueda);
						resultados.SetBackgroundResource(Resource.Drawable.busquedaactive);
						//cambiar colores
						busqueda.SetTextColor(Android.Graphics.Color.ParseColor("#000000"));
						resultados.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF"));

						//cambiar el margen de la busqueda
						RelativeLayout.LayoutParams pms = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
						pms.AddRule(LayoutRules.Below, Resource.Id.linearLayout0);
						pms.TopMargin = -90;
						cuadbusqueda.LayoutParameters=pms;

						Log.Debug("GEO","LA URI ES: "+uri);

						//Y aqui vamos a pedirle al servidor que busque
						try{
							Log.Debug("GEO","ENTRAMOS");
							negocios = await FetchWeatherAsync(uri);
							objeto = negocios["respuesta"];
							Log.Debug("GEO","PASAMOS LA ASIGNACION");

							negItems = new List<Negocio> ();

							float dist=0;
							string dist_final;
							double dist2=0;

							foreach(JsonObject data in objeto){
								Log.Debug("GEO","Entramos a FOREACH");
								//AQUI LOS AGREGAMOS

								//INICIA VERIFICACION DE LA IMAGEN
								//TERMINA VERIFICACION DE LA IMAGEN
								dist=float.Parse(WebUtility.HtmlDecode(data["Data"]["distance"]));

								if(dist<1){
									dist=dist*1000;
									dist2=Math.Round(dist, 1);
									dist_final=dist2.ToString();
									dist_final=dist_final+" mts.";
								}else{
									dist2=Math.Round(dist, 1);
									dist_final=dist2.ToString();
									dist_final=dist_final+" kms.";
								}

								negItems.Add(new Negocio(){
									
									NegocioId = WebUtility.HtmlDecode(data["Data"]["id"]),
									NegocioName = WebUtility.HtmlDecode(data["Data"]["titulo"]),
									NegocioDir = WebUtility.HtmlDecode(data["Data"]["geo_calle"]+" "+data["Data"]["geo_numero"]+" "+data["Data"]["geo_colonia"]),
									NegocioCat = WebUtility.HtmlDecode(data["Data"]["categoria"]),
									NegocioFoto = WebUtility.HtmlDecode(data["Data"]["ruta"]),
									NegocioCal = WebUtility.HtmlDecode(data["Data"]["calificacion"]),
									NegocioPrem = data["Data"]["premium"],
									NegocioDist = dist_final,
									NegocioNum = counter

								});

								//Toast.MakeText (Application.Context, "YUSS!!", ToastLength.Long).Show ();
								counter++;
							}

							wait.Visibility=ViewStates.Gone;

							if(counter==0){
								noresults.Visibility=ViewStates.Visible;
							}else{

								MyListAdapter res_adapter = new MyListAdapter (Application.Context, negItems);




								if(pagina<=1){
									prev.Enabled=false;
								}else{
									prev.Enabled=true;
								}

								if(counter<10){
									next.Enabled=false;
								}else{
									next.Enabled=true;
								}

								prev.Visibility=ViewStates.Visible;
								next.Visibility=ViewStates.Visible;
								reslista.Adapter = res_adapter;

							}//else si no se encontraron resultados

						}catch(Exception ex){
							Log.Debug("GEO","El error: "+ex);
							busqueda.PerformClick();
							Toast.MakeText (Application.Context, "Ooops! Parece que algo salió mal. ¿Por qué no lo intentas de nuevo? "+ex, ToastLength.Long).Show ();
						}


						//TERMINA BUSQUEDA



					}//ELSE GPS DESACTIVADO
				}//ELSE NO SE HA ENCONTRADO LA UBICACION


			};

			reslista.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
				//Toast.MakeText (Application.Context, "El ID del negocio es: "+negItems [e.Position].NegocioId, ToastLength.Long).Show ();

				if(negItems[e.Position].NegocioPrem!="0"){
					//Toast.MakeText (Application.Context, negItems [e.Position].NegocioName+" Es premium!!"+" NegocioPrem es: "+negItems[e.Position].NegocioPrem, ToastLength.Long).Show ();
					var negocio = new Intent (this.Activity, typeof(PerfilPremium));
					negocio.PutExtra("id",negItems [e.Position].NegocioId);
					negocio.PutExtra("nombre",negItems [e.Position].NegocioName);
					negocio.PutExtra("direccion",negItems [e.Position].NegocioDir);
					negocio.PutExtra("categoria",negItems [e.Position].NegocioCat);
					negocio.PutExtra("calificacion",negItems [e.Position].NegocioCal);

					StartActivity (negocio);
				}else{

				var negocio = new Intent (this.Activity, typeof(PerfilNegocio));
				negocio.PutExtra("id",negItems [e.Position].NegocioId);
				negocio.PutExtra("nombre",negItems [e.Position].NegocioName);
				negocio.PutExtra("direccion",negItems [e.Position].NegocioDir);
				negocio.PutExtra("categoria",negItems [e.Position].NegocioCat);
				negocio.PutExtra("calificacion",negItems [e.Position].NegocioCal);

				StartActivity (negocio);
				}

				//StartActivity(typeof(PerfilNegocio));
				//AQUI INCICIAMOS LA ACTIVIDAD DE PERFIL Y LE PASAMOS DATOS



				/*
				var myActivity = (MainActivity) this.Activity;
				myActivity.VerNegocio(negItems [e.Position].NegocioId);
				*/

			};
		
			return view;
		}
Esempio n. 46
0
        void InitializeView()
        {
            var relativeLayout = new RelativeLayout(this);

            relativeLayout.LayoutParameters = new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent
                );

            int nextID  = 100;
            var density = this.Resources.DisplayMetrics.Density;

            _backgroundImageView = new ImageView(this);
            var backgroundLayout = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent
                );

            _backgroundImageView.LayoutParameters = backgroundLayout;
            _backgroundImageView.SetBackgroundColor(Color.LightGray);
            relativeLayout.AddView(_backgroundImageView);

            _lowAndHighTemperatureLabel    = new TextView(this);
            _lowAndHighTemperatureLabel.Id = nextID++;
            _lowAndHighTemperatureLabel.SetTextSize(ComplexUnitType.Dip, 20f);
            _lowAndHighTemperatureLabel.SetPadding(
                PixelHelper.DpToPixels(10, density),
                0,
                0,
                PixelHelper.DpToPixels(60, density)
                );
            _lowAndHighTemperatureLabel.SetTextColor(Color.White);
            var lowAndHighTemperatureLayout = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent
                );

            lowAndHighTemperatureLayout.AddRule(LayoutRules.AlignParentBottom);
            _lowAndHighTemperatureLabel.LayoutParameters = lowAndHighTemperatureLayout;
            relativeLayout.AddView(_lowAndHighTemperatureLabel);

            _currentTemperatureLabel    = new TextView(this);
            _currentTemperatureLabel.Id = nextID++;
            _currentTemperatureLabel.SetTextSize(ComplexUnitType.Dip, 50f);
            _currentTemperatureLabel.SetPadding(
                PixelHelper.DpToPixels(10, density),
                0,
                0,
                0
                );
            _currentTemperatureLabel.SetTextColor(Color.White);
            var currentTemperatureLayout = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent
                );

            currentTemperatureLayout.AddRule(LayoutRules.Above, _lowAndHighTemperatureLabel.Id);
            _currentTemperatureLabel.LayoutParameters = currentTemperatureLayout;
            relativeLayout.AddView(_currentTemperatureLabel);

            _descriptionLabel    = new TextView(this);
            _descriptionLabel.Id = nextID++;
            _descriptionLabel.SetTextSize(ComplexUnitType.Dip, 20f);
            _descriptionLabel.SetPadding(
                PixelHelper.DpToPixels(10, density),
                0,
                0,
                0
                );
            _descriptionLabel.SetTextColor(Color.White);
            var descriptionLayout = new RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent
                );

            descriptionLayout.AddRule(LayoutRules.Above, _currentTemperatureLabel.Id);
            _descriptionLabel.LayoutParameters = descriptionLayout;
            relativeLayout.AddView(_descriptionLabel);

            SetContentView(relativeLayout);
        }
Esempio n. 47
0
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (requestCode == 1 || resultCode == Result.Ok)
            {
                if (resultCode == Result.Ok)
                {
                    labelDictionary.Clear();

                    SimpleStorage.SetContext(ApplicationContext);

                    SetContentView(Resource.Layout.activity_main);

                    WebView     webView     = (WebView)FindViewById(Resource.Id.webView1);
                    WebSettings webSettings = webView.Settings;
                    webSettings.JavaScriptEnabled = true;

                    string HTMLText = "<html>" + "<body><script src=\"https://widgets.coingecko.com/coingecko-coin-ticker-widget.js\"></script>" +
                                      "<coingecko-coin-ticker-widget currency=\"usd\" coin-id=\"rpicoin\" locale=\"en\"></coingecko-coin-ticker-widget></body>" +
                                      "</html>";

                    webView.LoadData(HTMLText, "text/html", null);

                    Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
                    SetSupportActionBar(toolbar);

                    string status = MNInfo();
                    if (status != "Error")
                    {
                        status = status.Replace("}", "");
                        status = status.Replace("{", "");

                        string[] parse = status.Split(',');
                        foreach (string s in parse)
                        {
                            if (s.Contains("total"))
                            {
                                string[] temp    = s.Split(':');
                                TextView totalMN = (TextView)FindViewById(Resource.Id.textViewMNTotal);
                                totalMN.Text = "Total Masternodes: " + temp[1];
                            }
                            else if (s.Contains("stable"))
                            {
                                string[] temp     = s.Split(':');
                                TextView stableMN = (TextView)FindViewById(Resource.Id.textViewStable);
                                stableMN.Text = "Stable: " + temp[1];
                            }
                            else if (s.Contains("enabled"))
                            {
                                string[] temp      = s.Split(':');
                                TextView enabledMN = (TextView)FindViewById(Resource.Id.textViewEnabled);
                                enabledMN.Text = "Enabled: " + temp[1];
                            }
                            else if (s.Contains("inqueue"))
                            {
                                string[] temp      = s.Split(':');
                                TextView inQueueMN = (TextView)FindViewById(Resource.Id.textViewInQueue);
                                inQueueMN.Text = "In Queue: " + temp[1];
                            }
                            else if (s.Contains("ipv4"))
                            {
                                string[] temp   = s.Split(':');
                                TextView ipv4MN = (TextView)FindViewById(Resource.Id.textViewIPv4);
                                ipv4MN.Text = "IPv4: " + temp[1];
                            }
                            else if (s.Contains("ipv6"))
                            {
                                string[] temp   = s.Split(':');
                                TextView ipv6MN = (TextView)FindViewById(Resource.Id.textViewIPv6);
                                ipv6MN.Text = "IPv6: " + temp[1];
                            }
                            else if (s.Contains("onion"))
                            {
                                string[] temp    = s.Split(':');
                                TextView onionMN = (TextView)FindViewById(Resource.Id.textViewOnion);
                                onionMN.Text = "Onion: " + temp[1];
                            }
                        }
                    }
                    else
                    {
                        TextView totalMN = (TextView)FindViewById(Resource.Id.textViewMNTotal);
                        totalMN.Text = "Total Masternodes: ERROR GATHERING DATA";
                    }

                    LinearLayout ll = (LinearLayout)FindViewById(Resource.Id.linearLayout1);

                    List <Button>       buttonList = new List <Button>();
                    List <LinearLayout> rows       = new List <LinearLayout>();

                    var           storage     = SimpleStorage.EditGroup("Addresses");
                    var           addressList = storage.Get("AddressList", "").Split(',').ToList();
                    List <string> addresses   = new List <string>();
                    foreach (string s in addressList)
                    {
                        if (!string.IsNullOrWhiteSpace(s))
                        {
                            addresses.Add(s);
                        }
                    }

                    //Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                    //Android.App.AlertDialog alert = dialog.Create();
                    //alert.SetTitle("Info");
                    //alert.SetMessage(addressList.Count.ToString());
                    //alert.SetButton("OK", (c, ev) =>
                    //{
                    //    //ok button click task
                    //});
                    //alert.Show();

                    if (addresses.Any())
                    {
                        labelDictionary.Clear();
                        for (int j = 0; j < (addresses.Count + 3); j++)
                        {
                            LinearLayout row = new LinearLayout(this);
                            row.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                            rows.Add(row);
                            row.Id = (j + 1);
                        }

                        for (int i = 1; i < (addresses.Count + 2); i++)
                        {
                            RelativeLayout rl = new RelativeLayout(this);
                            rl.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                            rl.SetPadding(5, 0, 5, 0);
                            if (i % 2 == 0)
                            {
                                rl.SetBackgroundColor(Android.Graphics.Color.LightGray);
                            }
                            else
                            {
                                rl.SetBackgroundColor(Android.Graphics.Color.White);
                            }

                            if (i == 1)
                            {
                                TextView label1 = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                label1.Text     = "Address Nickname";
                                label1.TextSize = 12;
                                label1.SetTextColor(Android.Graphics.Color.Black);
                                RelativeLayout.LayoutParams lbp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                lbp.AddRule(LayoutRules.AlignParentLeft);
                                lbp.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(label1, lbp);

                                TextView label3 = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                label3.Text     = "Stats";
                                label3.TextSize = 12;
                                label3.SetTextColor(Android.Graphics.Color.Black);
                                label3.SetPadding(0, 0, 30, 0);
                                RelativeLayout.LayoutParams lbp3 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                lbp3.AddRule(LayoutRules.AlignParentRight);
                                lbp3.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(label3, lbp3);

                                TextView label2 = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                label2.Text     = "Balance";
                                label2.TextSize = 12;
                                label2.SetTextColor(Android.Graphics.Color.Black);
                                label2.SetPadding(0, 0, 100, 0);
                                label2.TextAlignment = TextAlignment.ViewStart;
                                RelativeLayout.LayoutParams lbp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                lbp2.AddRule(LayoutRules.LeftOf, label3.Id);
                                lbp2.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(label2, lbp2);
                            }
                            else
                            {
                                var addressData = SimpleStorage.EditGroup(addresses[i - 2]);

                                string   mnNick  = addressData.Get("Nickname");
                                TextView mnLabel = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                mnLabel.Text     = mnNick;
                                mnLabel.TextSize = 20;
                                mnLabel.SetTextColor(Android.Graphics.Color.Black);
                                RelativeLayout.LayoutParams mnp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                mnp.AddRule(LayoutRules.AlignParentLeft);
                                mnp.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(mnLabel, mnp);

                                ImageButton iButton = new ImageButton(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                iButton.SetImageResource(Resource.Drawable.stats);
                                //iButton.Background = null;
                                iButton.Tag = addresses[i - 2];
                                RelativeLayout.LayoutParams bnp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                bnp.AddRule(LayoutRules.AlignParentRight);
                                bnp.AddRule(LayoutRules.CenterVertical);
                                iButton.Click += delegate(object sender, EventArgs e)
                                {
                                    btnStatsClick(sender, e, iButton.Tag.ToString());
                                };
                                rl.AddView(iButton, bnp);

                                TextView blLabel = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                labelDictionary.Add(addresses[i - 2], blLabel.Id);
                                blLabel.Text     = "Contacting explorer...";
                                blLabel.TextSize = 15;
                                blLabel.SetTextColor(Android.Graphics.Color.Goldenrod);
                                blLabel.SetPadding(10, 0, 10, 0);
                                blLabel.TextAlignment = TextAlignment.ViewEnd;
                                RelativeLayout.LayoutParams blp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                blp.AddRule(LayoutRules.LeftOf, iButton.Id);
                                blp.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(blLabel, blp);
                            }


                            rows[i - 1].AddView(rl);
                            ll.AddView(rows[i - 1]);
                        }

                        TotalsDictionary.Clear();
                        RelativeLayout rl3 = new RelativeLayout(this);
                        rl3.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                        rl3.SetPadding(5, 0, 5, 0);
                        rl3.SetBackgroundColor(Android.Graphics.Color.Black);
                        TextView grandTotal = new TextView(this)
                        {
                            Id = View.GenerateViewId()
                        };
                        TotalsDictionary.Add("total", grandTotal.Id);
                        grandTotal.Text = "Total RPI";
                        grandTotal.SetPadding(10, 0, 10, 0);
                        grandTotal.TextSize = 15;
                        grandTotal.SetTextColor(Android.Graphics.Color.White);
                        grandTotal.TextAlignment = TextAlignment.ViewStart;
                        RelativeLayout.LayoutParams lbp4 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                        lbp4.AddRule(LayoutRules.AlignParentStart);
                        lbp4.AddRule(LayoutRules.CenterVertical);
                        rl3.AddView(grandTotal, lbp4);
                        TextView USDValue = new TextView(this)
                        {
                            Id = View.GenerateViewId()
                        };
                        TotalsDictionary.Add("value", USDValue.Id);
                        USDValue.Text = "USD Value";
                        USDValue.SetPadding(10, 0, 10, 0);
                        USDValue.TextSize = 15;
                        USDValue.SetTextColor(Android.Graphics.Color.White);
                        USDValue.TextAlignment = TextAlignment.ViewStart;
                        RelativeLayout.LayoutParams lbp5 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                        lbp5.AddRule(LayoutRules.AlignParentEnd);
                        lbp5.AddRule(LayoutRules.CenterVertical);
                        rl3.AddView(USDValue, lbp5);
                        rows[rows.Count - 2].AddView(rl3);
                        ll.AddView(rows[rows.Count - 2]);



                        RelativeLayout rl2 = new RelativeLayout(this);
                        rl2.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                        rl2.SetPadding(5, 0, 5, 0);
                        Button button2 = new Button(this)
                        {
                            Id = View.GenerateViewId()
                        };
                        button2.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
                        button2.Text             = "Add New Address";
                        button2.TextAlignment    = TextAlignment.Center;
                        RelativeLayout.LayoutParams blp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                        blp2.AddRule(LayoutRules.CenterHorizontal);
                        blp2.AddRule(LayoutRules.CenterVertical);
                        button2.Click += btnAddClick;

                        rl2.AddView(button2, blp2);
                        rows[rows.Count - 1].AddView(rl2);
                        ll.AddView(rows[rows.Count - 1]);
                    }
                    else
                    {
                        labelDictionary.Clear();
                        for (int j = 0; j < 3; j++)
                        {
                            LinearLayout row = new LinearLayout(this);
                            row.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                            rows.Add(row);
                            row.Id = (j + 1);
                        }

                        for (int i = 1; i < 3; i++)
                        {
                            RelativeLayout rl = new RelativeLayout(this);
                            rl.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                            rl.SetPadding(5, 0, 5, 0);
                            rl.SetBackgroundColor(Android.Graphics.Color.White);

                            if (i == 1)
                            {
                                TextView label1 = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                label1.Text     = "Address Nickname";
                                label1.TextSize = 12;
                                label1.SetTextColor(Android.Graphics.Color.Black);
                                RelativeLayout.LayoutParams lbp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                lbp.AddRule(LayoutRules.AlignParentLeft);
                                lbp.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(label1, lbp);

                                TextView label3 = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                label3.Text     = "Stats";
                                label3.TextSize = 12;
                                label3.SetTextColor(Android.Graphics.Color.Black);
                                label3.SetPadding(0, 0, 30, 0);
                                RelativeLayout.LayoutParams lbp3 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                lbp3.AddRule(LayoutRules.AlignParentRight);
                                lbp3.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(label3, lbp3);

                                TextView label2 = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                label2.Text     = "Balance";
                                label2.TextSize = 12;
                                label2.SetTextColor(Android.Graphics.Color.Black);
                                label2.SetPadding(0, 0, 100, 0);
                                label2.TextAlignment = TextAlignment.ViewStart;
                                RelativeLayout.LayoutParams lbp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                lbp2.AddRule(LayoutRules.LeftOf, label3.Id);
                                lbp2.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(label2, lbp2);
                            }
                            else
                            {
                                TextView mnLabel = new TextView(this)
                                {
                                    Id = View.GenerateViewId()
                                };
                                mnLabel.Text     = "No saved addresses." + System.Environment.NewLine + "Please select \"Add New Address\" below.";
                                mnLabel.TextSize = 20;
                                mnLabel.Gravity  = GravityFlags.CenterHorizontal;
                                mnLabel.SetTextColor(Android.Graphics.Color.Maroon);
                                RelativeLayout.LayoutParams mnp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                                mnp.AddRule(LayoutRules.CenterHorizontal);
                                mnp.AddRule(LayoutRules.CenterVertical);
                                rl.AddView(mnLabel, mnp);
                            }


                            rows[i - 1].AddView(rl);
                            ll.AddView(rows[i - 1]);
                        }

                        RelativeLayout rl2 = new RelativeLayout(this);
                        rl2.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                        rl2.SetPadding(5, 0, 5, 0);
                        Button button2 = new Button(this)
                        {
                            Id = View.GenerateViewId()
                        };
                        button2.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
                        button2.Text             = "Add New Address";
                        button2.TextAlignment    = TextAlignment.Center;
                        RelativeLayout.LayoutParams blp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                        blp2.AddRule(LayoutRules.CenterHorizontal);
                        blp2.AddRule(LayoutRules.CenterVertical);
                        button2.Click += btnAddClick;

                        rl2.AddView(button2, blp2);
                        rows[rows.Count - 1].AddView(rl2);
                        ll.AddView(rows[rows.Count - 1]);
                    }
                }
            }
            else
            {
                Intent myIntent = new Intent(this, typeof(Refresh));
                this.StartActivityForResult(myIntent, 1);
            }
        }
Esempio n. 48
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            //RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape;

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView);

            if (true) { // Customization activated
                View root = FindViewById<View> (Resource.Id.rootView);
                root.SetBackgroundColor (Color.White);

                // Activate this to internally use a bitmap to store the strokes
                // (good for frequent-redraw situations, bad for memory footprint)
                // signature.UseBitmapBuffer = true;

                signature.CaptionTextView.Text = "Authorization Signature";
                signature.CaptionTextView.SetTypeface (Typeface.Serif, TypefaceStyle.BoldItalic);
                signature.CaptionTextView.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 16f);
                signature.SignaturePromptTextView.Text = ">>";
                signature.SignaturePromptTextView.SetTypeface (Typeface.SansSerif, TypefaceStyle.Normal);
                signature.SignaturePromptTextView.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 32f);
                signature.BackgroundColor = Color.Rgb (255, 255, 200); // a light yellow.
                signature.StrokeColor = Color.Black;

                signature.BackgroundImageView.SetImageResource (Resource.Drawable.logo_galaxy_black_64);
                signature.BackgroundImageView.SetAlpha (16);
                signature.BackgroundImageView.SetAdjustViewBounds (true);
                var layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
                layout.AddRule (LayoutRules.CenterInParent);
                layout.SetMargins (20, 20, 20, 20);
                signature.BackgroundImageView.LayoutParameters = layout;

                // You can change paddings for positioning...
                var caption = signature.CaptionTextView;
                caption.SetPadding (caption.PaddingLeft, 1, caption.PaddingRight, 25);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            Button btnSave = FindViewById<Button> (Resource.Id.btnSave);
            btnSave.Click += delegate {
                if (signature.IsBlank)
                {//Display the base line for the user to sign on.
                    AlertDialog.Builder alert = new AlertDialog.Builder (this);
                    alert.SetMessage ("No signature to save.");
                    alert.SetNeutralButton ("Okay", delegate { });
                    alert.Create ().Show ();
                }
                points = signature.Points;
            };
            btnSave.Dispose ();

            Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad);
            btnLoad.Click += delegate {
                if (points != null)
                    signature.LoadPoints (points);
            };
            btnLoad.Dispose ();
        }
Esempio n. 49
0
        public FormTime(Context context, ReportElement element, int userID, int ownerID, int verifiedID, ReportStatus Reportstatus)
            : base(context)
        {
            resource                = context.Resources;
            contextx                = context;
            OwnerID                 = ownerID;
            VerifierID              = verifiedID;
            theme                   = new FormTheme(context, element.Title);
            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            Popup                   = new InformationPopup(context);
            reportStatus            = Reportstatus;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            timeFrame = new RelativeLayout(context);

            RelativeLayout.LayoutParams parms2 = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            timeFrame.LayoutParameters = parms2;

            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);

            RelativeLayout.LayoutParams paramsOfTimeDisplay = new RelativeLayout.LayoutParams(500, RelativeLayout.LayoutParams.WrapContent);
            paramsOfTimeDisplay.AddRule(LayoutRules.CenterVertical);
            paramsOfTimeDisplay.AddRule(LayoutRules.AlignParentLeft);

            timeDisplay    = new EditText(context);
            timeDisplay.Id = element.Id;
            timeDisplay.SetTextColor(Color.Black);
            timeDisplay.LayoutParameters = paramsOfTimeDisplay;
            timeDisplay.Focusable        = false;
            timeDisplay.SetBackgroundResource(Resource.Drawable.custom_edit_text_color);
            timeDisplay.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;

            RelativeLayout.LayoutParams paramsOfClearButton = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsOfClearButton.AddRule(LayoutRules.RightOf, timeDisplay.Id);

            timeDisplay.Touch += (s, e) =>
            {
                var handled = false;
                if (e.Event.Action == MotionEventActions.Down)
                {
                    createTimeDialog(context);
                    handled = true;
                }
                else if (e.Event.Action == MotionEventActions.Up)
                {
                    handled = true;
                }
                e.Handled = handled;
            };

            clearTimeButton          = new Button(context);
            clearTimeButton.Text     = "Clear";
            clearTimeButton.TextSize = 12;
            clearTimeButton.SetTextColor(Resources.GetColor(Resource.Color.theme_color));
            clearTimeButton.SetBackgroundResource(0);
            clearTimeButton.LayoutParameters = paramsOfClearButton;
            clearTimeButton.Click           += delegate { clearTime(); };

            hour   = DateTime.Now.Hour;
            minute = DateTime.Now.Minute;

            if (string.IsNullOrEmpty(element.Value))
            {
                timeDisplay.Text = "";
                indicatorImage.SetImageResource(0);
                clearTimeButton.Visibility = ViewStates.Gone;
            }
            else
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                timeDisplay.Text = element.Value;
            }

            timeDisplay.TextChanged += (sender, e) =>
            {
                if (!timeDisplay.Text.Equals(""))
                {
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                    clearTimeButton.Visibility = ViewStates.Visible;
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                    clearTimeButton.Visibility = ViewStates.Gone;
                }

                sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                sharedPreferencesEditor.Commit();
            };

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    clearTimeButton.Enabled    = false;
                    clearTimeButton.Visibility = ViewStates.Gone;
                    timeDisplay.Enabled        = false;
                    timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        clearTimeButton.Enabled    = true;
                        clearTimeButton.Visibility = ViewStates.Gone;
                        timeDisplay.Enabled        = true;
                        timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                    }
                }

                else
                {
                    clearTimeButton.Enabled    = true;
                    clearTimeButton.Visibility = ViewStates.Gone;
                    timeDisplay.Enabled        = true;
                    timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.black));
                }
            }
            else
            {
                clearTimeButton.Enabled    = false;
                clearTimeButton.Visibility = ViewStates.Gone;
                timeDisplay.Enabled        = false;
                timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }


            if (isArcheived)
            {
                timeDisplay.Enabled        = false;
                clearTimeButton.Visibility = ViewStates.Gone;
                timeDisplay.Enabled        = false;
                timeDisplay.SetTextColor(Resources.GetColor(Resource.Color.grey));
            }

            timeFrame.AddView(timeDisplay);
            timeFrame.AddView(clearTimeButton);
            AddView(theme);
            AddView(timeFrame);
            SetPadding(45, 10, 45, 20);
        }
Esempio n. 50
0
        void SetupViewBindings()
        {
            btnBack.Click += (sender, e) =>
            {
                Finish();
            };

            ShowHelpIfNecessary(TutorialHelper.Profiles);

            sportId = Intent.GetStringExtra("SportId");

            fragments = new List <Fragment>();
            fragments.Add(new SportProfileFragment()
            {
                SportId = sportId
            });
            fragments.Add(new ScoresFragment()
            {
                SportId = sportId
            });
            fragments.Add(new SportRankingsFragment()
            {
                SportId = sportId
            });
            fragments.Add(new SportAboutFragment()
            {
                SportId = sportId
            });

            vpPager.Adapter = new FragmentViewPagerAdapter(FragmentManager, fragments);

            btnProfile.Click += (sender, args) =>
            {
                vpPager.SetCurrentItem(0, true);
            };
            btnEvents.Click += (sender, args) =>
            {
                vpPager.SetCurrentItem(1, true);
            };
            btnRankings.Click += (sender, args) =>
            {
                vpPager.SetCurrentItem(2, true);
            };

            btnAbout.Click += (sender, args) =>
            {
                vpPager.SetCurrentItem(3, true);
            };

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

            display.GetSize(size);
            var screenWidth = size.X;

            var parameters = new RelativeLayout.LayoutParams((int)(screenWidth / (float)fragments.Count), (int)(2 * Resources.DisplayMetrics.Density));

            parameters.AddRule(LayoutRules.AlignParentBottom);
            rlIndicator.LayoutParameters = parameters;
            vpPager.OffscreenPageLimit   = 4;
            vpPager.PageScrolled        += (sender, args) =>
            {
                var margins = rlIndicator.LayoutParameters as RelativeLayout.MarginLayoutParams;
                margins.LeftMargin           = (int)((args.Position) * (screenWidth / (float)fragments.Count) + (args.PositionOffsetPixels / (float)fragments.Count));
                rlIndicator.LayoutParameters = margins;

                rlIndicator.LayoutParameters = margins;

                int position = args.PositionOffsetPixels > screenWidth / 2 ? args.Position + 1 : args.Position;
                if (position == 1)
                {
                    ShowHelpIfNecessary(TutorialHelper.SchedulesScores);
                }
            };
            if (Intent.GetBooleanExtra("GoToRankings", false))
            {
                vpPager.SetCurrentItem(2, true);
            }
            GetData();
        }
Esempio n. 51
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            View view = inflater.Inflate(Resource.Layout.production_storage_fragment, container, false);

            fragmentContext = Application.Context;

            //get default
            prefs = PreferenceManager.GetDefaultSharedPreferences(fragmentContext);
            //emp_no
            emp_no = prefs.GetString("EMP_NO", "");

            mLayoutManager = new LinearLayoutManager(fragmentContext);

            relativeLayout = view.FindViewById <RelativeLayout>(Resource.Id.production_storage_list_container);

            progressBar = new ProgressBar(fragmentContext);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200);
            layoutParams.AddRule(LayoutRules.CenterInParent);
            relativeLayout.AddView(progressBar, layoutParams);
            progressBar.Visibility = ViewStates.Gone;

            editTextInNo            = view.FindViewById <EditText>(Resource.Id.editTextInNo);
            btnUserInputConfirm     = view.FindViewById <Button>(Resource.Id.btnUserInputConfirm);
            c_in_no                 = view.FindViewById <TextView>(Resource.Id.c_in_no);
            c_in_date               = view.FindViewById <TextView>(Resource.Id.c_in_date);
            c_made_no               = view.FindViewById <TextView>(Resource.Id.c_made_no);
            c_dept_name             = view.FindViewById <TextView>(Resource.Id.c_dept_name);
            productListRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.productListView);
            btnInStockConfirm       = view.FindViewById <Button>(Resource.Id.btnInStockConfirm);

            productList.Clear();

            btnUserInputConfirm.Click += (Sender, e) =>
            {
                progressBar.Visibility = ViewStates.Visible;

                WebReference.Service dx = new WebReference.Service();
                try
                {
                    bool ret = dx.Check_TT_product_Entry_already_confirm("MAT", editTextInNo.Text);

                    if (!ret)
                    {
                        Intent checkResultIntent = new Intent(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO);
                        fragmentContext.SendBroadcast(checkResultIntent);
                    }
                    else
                    {
                        Intent checkResultIntent = new Intent(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES);
                        fragmentContext.SendBroadcast(checkResultIntent);
                    }
                }
                catch (SocketTimeoutException ex)
                {
                    ex.PrintStackTrace();
                    Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT);
                    fragmentContext.SendBroadcast(timeoutIntent);
                }
                catch (SoapException ex)
                {
                    Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL);
                    fragmentContext.SendBroadcast(timeoutIntent);
                }
            };

            btnInStockConfirm.Click += (Sender, e) =>
            {
                bool found_product_not_scan = false;

                if (productList.Count > 0)
                {
                    for (int i = 0; i < productList.Count; i++)
                    {
                        if (productList[i].getLocate_no_scan().Equals(""))
                        {
                            found_product_not_scan = true;
                            break;
                        }
                    }


                    if (!found_product_not_scan)
                    { //all scanner, start in stock
                        //unselect all
                        for (int i = 0; i < productList.Count; i++)
                        {
                            productList[i].setSelected(false);
                        }
                        productionStorageItemAdapter.NotifyDataSetChanged();
                        item_select = -1;

                        Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(fragmentContext);
                        alert.SetTitle(Resource.String.production_storage_dialog_title);
                        alert.SetIcon(Resource.Drawable.ic_warning_black_48dp);
                        alert.SetMessage(Resource.String.production_storage_dialog_content);
                        alert.SetPositiveButton(Resource.String.ok, (senderAlert, args) =>
                        {
                            progressBar.Visibility = ViewStates.Visible;

                            WebReference.Service dx = new WebReference.Service();

                            try
                            {
                                bool found_error = false;
                                foreach (DataRow dr in dataTable_RR.Rows)
                                {
                                    bool is_exist = dx.Check_stock_locate_no_exist("MAT", dr["stock_no"].ToString(), dr["locate_no"].ToString());
                                    if (is_exist) //update product entry
                                    {
                                        dx.Update_TT_product_Entry_locate_no("MAT", dr["in_no"].ToString(), int.Parse(dr["item_no"].ToString()), dr["locate_no"].ToString());
                                    }
                                    else
                                    {
                                        toast(fragmentContext.GetString(Resource.String.production_storage_in_stock_process_abort));
                                        found_error = true;
                                        break;
                                    }
                                }

                                if (!found_error)
                                {
                                    if (product_table_X_M != null)
                                    {
                                        product_table_X_M.Clear();
                                    }
                                    else
                                    {
                                        product_table_X_M = new DataTable("X_M");
                                    }
                                    DataColumn v1 = new DataColumn("script");
                                    product_table_X_M.Columns.Add(v1);

                                    DataRow kr;
                                    kr = product_table_X_M.NewRow();

                                    string script_string = "sh run_me 1 2 " + c_in_no.Text + " " + emp_no;

                                    Log.Warn(TAG, "script_string = " + script_string);

                                    kr["script"] = script_string;
                                    product_table_X_M.Rows.Add(kr);

                                    //execute Execute_Script_TT
                                    bool executeTT_ret = dx.Execute_Script_TT("MAT", product_table_X_M);

                                    Intent checkResultIntent;
                                    if (!executeTT_ret)
                                    {
                                        checkResultIntent = new Intent(Constants.ACTION_EXECUTE_TT_FAILED);
                                        fragmentContext.SendBroadcast(checkResultIntent);
                                    }
                                    else
                                    {
                                        checkResultIntent = new Intent(Constants.ACTION_PRODUCT_IN_STOCK_WORK_COMPLETE);
                                        checkResultIntent.PutExtra("IN_NO", c_in_no.Text);
                                        fragmentContext.SendBroadcast(checkResultIntent);
                                    }
                                }
                                //dx.Check_stock_locate_no_exist("MAT", productList[e].getStock_no(), barcode, k_id);

                                /*Intent checkIntent = new Intent(fragmentContext, CheckStockLocateNoExistService.class);
                                 * checkIntent.setAction(Constants.ACTION.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_ACTION);
                                 *  checkIntent.putExtra("STOCK_NO", productList.get(last).getStock_no());
                                 *  checkIntent.putExtra("LOCATE_NO", productList.get(last).getLocate_no());
                                 *  checkIntent.putExtra("CURRENT_INDEX", String.valueOf(last));
                                 *  fragmentContext.startService(checkIntent);*/
                            }
                            catch (SocketTimeoutException ex)
                            {
                                ex.PrintStackTrace();
                                Intent timeoutIntent = new Intent(Constants.ACTION_SOCKET_TIMEOUT);
                                fragmentContext.SendBroadcast(timeoutIntent);
                            }
                            catch (SoapException ex)
                            {
                                Intent timeoutIntent = new Intent(Constants.SOAP_CONNECTION_FAIL);
                                fragmentContext.SendBroadcast(timeoutIntent);
                            }
                        });

                        alert.SetNegativeButton(Resource.String.cancel, (senderAlert, args) =>
                        {
                        });

                        Dialog dialog = alert.Create();
                        dialog.Show();
                    }
                    else
                    {
                        toast(fragmentContext.GetString(Resource.String.production_storage_product_locate_not_scanned));
                    }
                }
            };


            if (!isRegister)
            {
                IntentFilter filter = new IntentFilter();
                mReceiver = new MyBoradcastReceiver();
                filter.AddAction(Constants.SOAP_CONNECTION_FAIL);
                filter.AddAction(Constants.ACTION_SOCKET_TIMEOUT);
                filter.AddAction(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_YES);
                filter.AddAction(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_NO);
                filter.AddAction(Constants.ACTION_CHECK_TT_PRODUCT_ENTRY_ALREADY_CONFIRM_FAILED);

                filter.AddAction(Constants.ACTION_GET_TT_PRODUCT_ENTRY_FAILED);
                filter.AddAction(Constants.ACTION_GET_TT_PRODUCT_ENTRY_SUCCESS);
                filter.AddAction(Constants.ACTION_GET_TT_PRODUCT_ENTRY_EMPTY);

                filter.AddAction(Constants.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_YES);
                filter.AddAction(Constants.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_NO);
                filter.AddAction(Constants.ACTION_PRODUCT_CHECK_STOCK_LOCATE_NO_EXIST_FAILED);

                filter.AddAction(Constants.ACTION_PRODUCT_UPDATE_TT_PRODUCT_ENTRY_LOCATE_NO_FAILED);
                filter.AddAction(Constants.ACTION_PRODUCT_UPDATE_TT_PRODUCT_ENTRY_LOCATE_NO_SUCCESS);

                filter.AddAction(Constants.ACTION_EXECUTE_TT_FAILED);
                filter.AddAction(Constants.ACTION_PRODUCT_IN_STOCK_WORK_COMPLETE);
                filter.AddAction(Constants.ACTION_PRODUCT_SWIPE_LAYOUT_UPDATE);

                filter.AddAction(Constants.ACTION_GET_TT_ERROR_STATUS_FAILED);
                filter.AddAction(Constants.ACTION_GET_TT_ERROR_STATUS_SUCCESS);

                filter.AddAction(Constants.ACTION_PRODUCT_DELETE_ITEM_CONFIRM);
                filter.AddAction("unitech.scanservice.data");
                fragmentContext.RegisterReceiver(mReceiver, filter);
                isRegister = true;
            }

            return(view);
        }