예제 #1
0
        private void HideCategoryImageView(ImageView categoryImageView)
        {
            var layoutParams = new TableRow.LayoutParams();

            layoutParams.Height = 0;
            categoryImageView.LayoutParameters = layoutParams;
        }
예제 #2
0
        /// <summary>
        /// Create and populate UI block table based on engine data
        /// </summary>
        private void PopulateTable()
        {
            var height = _gameEngine.GetHeight();
            var width  = _gameEngine.GetWidth();

            _blocks = new Block[width, height];
            for (var row = 0; row < height; row++)
            {
                var mineRow       = new TableRow(this);
                var mineRowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent, 0.0f);

                for (var col = 0; col < width; col++)
                {
                    var block = new Block(this)
                    {
                        Row       = row,
                        Col       = col,
                        IsFlipped = false,
                        IsFlagged = false
                    };
                    _blocks[col, row] = block;
                    mineRow.AddView(_blocks[col, row]);
                }
                _mineTable.AddView(mineRow, mineRowParams);
            }
        }
예제 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here

            var container = new LinearLayout(this)
            {
                Background = Android.Graphics.Color.Yellow.ToDrawable(),
            };

            SetContentView(container);

            var table = new TableLayout(this)
            {
                Background        = Android.Graphics.Color.Red.ToDrawable(),
                StretchAllColumns = true,                       // カラムを均等割にする
                WeightSum         = rows,                       // 行を均等割にしたいので行数を指定
            };

            container.AddView(table,
                              new LinearLayout.LayoutParams(
                                  LinearLayout.LayoutParams.MatchParent,        // 幅は親に合わせる
                                  LinearLayout.LayoutParams.MatchParent)        // 高さは親に合わせる
                              );

            for (int i = 0; i < rows; i++)
            {
                var rowlayouts = new TableLayout.LayoutParams(
                    TableLayout.LayoutParams.WrapContent,
                    TableLayout.LayoutParams.WrapContent)
                {
                    Weight = 1,                 // テーブルの中で均等割するので全ての重みを1にする
                    Height = 0                  // 高さを自動指定
                };

                var row = new TableRow(this);
                table.AddView(row, rowlayouts);

                for (int j = 0; j < cols; j++)
                {
                    var buttonlayout = new TableRow.LayoutParams(
                        TableRow.LayoutParams.WrapContent,
                        TableRow.LayoutParams.MatchParent                               // 高さは行に合わせる
                        )
                    {
                        Width       = 0,                                // 幅を自動設定
                        RightMargin = 4,                                // 隙間を開ける
                        TopMargin   = 4                                 // 隙間を開ける
                    };

                    var button = new Button(this)
                    {
                        Text       = $"{i}-{j}",
                        Background = Android.Graphics.Color.Blue.ToButtonPressEffect()
                    };
                    row.AddView(button, buttonlayout);
                }
            }
        }
예제 #4
0
        private void UpdateTableView()
        {
            // add the strings into the table layout
            TableLayout table  = FindViewById <TableLayout>(Resource.Id.tableLayout);
            var         layout = new TableRow.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent);

            table.RemoveAllViews();

            int i = 0;

            foreach (string s in directories)
            {
                TableRow row = new TableRow(this);

                TextView text = new TextView(this)
                {
                    Text = s
                };

                text.TextSize = 15;


                row.AddView(text);

                if (i++ % 2 == 0)
                {
                    row.SetBackgroundColor(Android.Graphics.Color.LightBlue);
                }
                table.AddView(row);
            }
        }
예제 #5
0
        private void ShowGeneratedRoutes() //drawing UI elements needs to be fixed
        {
            TableLayout layout = FindViewById <TableLayout>(Resource.Id.routeList);

            foreach (var route in _generatedRoutes)
            {
                var text = new TextView(this);
                text.Text = route.ToString();
                text.SetTextColor(new Color(252, 177, 80)); //our orange
                text.SetTextSize(Android.Util.ComplexUnitType.Pt, 7);
                //text.SetWidth();
                //text.SetHeight();

                TableRow.LayoutParams par = new TableRow.LayoutParams();
                par.SetMargins(100, 0, 0, 0);
                var button = new Button(this);

                button.Text       = "Pirkti";
                button.Background = Resources.GetDrawable(Resource.Drawable.OrangeActionBtn); //deprecated but f**k it
                button.SetTextColor(Color.White);
                button.Click += (obj, evnt) => { Order(route); };


                var tableRow = new TableRow(this);
                tableRow.SetMinimumHeight(250);
                tableRow.AddView(text);
                tableRow.AddView(button, par);

                layout.AddView(tableRow);
            }
        }
예제 #6
0
        /// <summary>
        ///     Create the table layout, and the image buttons,
        ///     everything is assigned accordingly to the screen size.
        /// </summary>
        private void initializeTableLayout()
        {
            var metrics    = Resources.DisplayMetrics;
            var widthInDp  = metrics.WidthPixels;
            var heightInDp = metrics.HeightPixels;

            gameBoard = (TableLayout)FindViewById(Resource.Id.boardTable);
            TableRow.LayoutParams layoutParams = new TableRow.LayoutParams((widthInDp / 4), (widthInDp / 4));
            TableRow tableRow1 = new TableRow(this);
            TableRow tableRow2 = new TableRow(this);
            TableRow tableRow3 = new TableRow(this);
            TableRow tableRow4 = new TableRow(this);

            bool flag = false;

            for (int i = 0; i < SIZE; i++)
            {
                flag = !flag;
                for (int j = 0; j < SIZE; j++)
                {
                    gameImgButtons[i, j].SetImageResource(Resource.Drawable.blank);
                    gameImgButtons[i, j].LayoutParameters = layoutParams;
                    if (flag)
                    {
                        if ((j % 2) == 0)
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Black);
                        }
                        else
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Gray);
                        }
                    }
                    else
                    {
                        if ((j % 2) != 0)
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Black);
                        }
                        else
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Gray);
                        }
                    }
                }
                tableRow1.AddView(gameImgButtons[0, i], i);
                tableRow2.AddView(gameImgButtons[1, i], i);
                tableRow3.AddView(gameImgButtons[2, i], i);
                tableRow4.AddView(gameImgButtons[3, i], i);
            }
            // Add rows to table
            gameBoard.AddView(tableRow1, 0);
            gameBoard.AddView(tableRow2, 1);
            gameBoard.AddView(tableRow3, 2);
            gameBoard.AddView(tableRow4, 3);
        }
예제 #7
0
        public List <FavoriteElementId> SetTableData(List <FavoriteData> favorites,
                                                     Context context, Resources resources, TableLayout mTableLayout)
        {
            while (mTableLayout.ChildCount > 0)
            {
                mTableLayout.RemoveViewAt(0);
            }

            TableRow.LayoutParams tableRowLayoutparams = new TableRow.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent);

            List <FavoriteElementId> response = new List <FavoriteElementId>();

            Boolean colored = true;

            foreach (FavoriteData Row in favorites)
            {
                TableRow tr = new TableRow(context);
                if (colored)
                {
                    tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult));
                }
                colored             = !colored;
                tr.LayoutParameters = tableRowLayoutparams;
                Boolean  WITH_DIRECTION = Row.direction != null;
                TextView tv1            = new TextView(context);
                tv1.Text          = Row.name + (WITH_DIRECTION ? " " + Row.direction : "");
                tv1.TextAlignment = TextAlignment.ViewEnd;

                tv1.SetPadding(0, 0, 13, 0);
                tv1.SetMinimumWidth(320);
                tv1.SetTextSize(Android.Util.ComplexUnitType.Dip, WITH_DIRECTION ? 14 : 22);
                tv1.SetMaxWidth(1000);
                ImageButton deleteBtn = new ImageButton(context);

                deleteBtn.SetImageResource(Android.Resource.Drawable.IcMenuDelete);
                deleteBtn.SetMaxWidth(30);
                deleteBtn.SetBackgroundColor(Android.Graphics.Color.Transparent);

                deleteBtn.TextAlignment = TextAlignment.ViewEnd;

                tr.AddView(tv1);
                tr.AddView(deleteBtn);
                mTableLayout.AddView(tr);
                if (Row.direction == null)
                {
                    response.Add(new FavoriteElementId(deleteBtn, tv1, Row.name, Row.searchType));
                }
                else
                {
                    response.Add(new FavoriteLineElementId(deleteBtn, tv1, Row.name, Row.searchType, Row.direction));
                }
            }
            return(response);
        }
예제 #8
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			// Create your application here

			var container = new LinearLayout (this) {
				Background=Android.Graphics.Color.Yellow.ToDrawable(),
			};

			SetContentView (container);

			var table = new TableLayout (this) {
				Background=Android.Graphics.Color.Red.ToDrawable(),
				StretchAllColumns=true,		// カラムを均等割にする
				WeightSum=rows,				// 行を均等割にしたいので行数を指定									
			};

			container.AddView (table,
				new LinearLayout.LayoutParams (
					LinearLayout.LayoutParams.MatchParent,	// 幅は親に合わせる
					LinearLayout.LayoutParams.MatchParent)	// 高さは親に合わせる
			);

			for (int i = 0; i < rows; i++) {
				
				var rowlayouts = new TableLayout.LayoutParams (
					TableLayout.LayoutParams.WrapContent,
					TableLayout.LayoutParams.WrapContent)
				{ Weight = 1,	// テーブルの中で均等割するので全ての重みを1にする
					Height=0	// 高さを自動指定
				};

				var row = new TableRow (this);
				table.AddView (row, rowlayouts);

				for (int j = 0; j < cols; j++) {

					var buttonlayout = new TableRow.LayoutParams (
						TableRow.LayoutParams.WrapContent,
						TableRow.LayoutParams.MatchParent	// 高さは行に合わせる
					) {
						Width = 0,			// 幅を自動設定
						RightMargin = 4, 	// 隙間を開ける
						TopMargin = 4		// 隙間を開ける
					};

					var button = new Button (this) {
						Text=$"{i}-{j}",
						Background=Android.Graphics.Color.Blue.ToButtonPressEffect()
					};
					row.AddView (button, buttonlayout);
				}						
			}
		}
예제 #9
0
        private void CreateEditorPanel()
        {
            var table = FindViewById <TableLayout>(Resource.Id.gameFieldEditorLayout);

            table.SetBackgroundColor(Color.LightGray);

            var row1 = new TableRow(this);
            var row2 = new TableRow(this);

            for (int i = 1; i < 13; i++)
            {
                var cellView = new Button(this);
                cellView.SetText($"{i}", TextView.BufferType.Normal);
                cellView.SetBackgroundColor(Color.White);
                cellView.SetTextColor(Color.Peru);
                cellView.SetTextSize(Android.Util.ComplexUnitType.Dip, 15);
                var layoutParams = new TableRow.LayoutParams(120, 120);
                layoutParams.SetMargins(1, 1, 1, 1);
                cellView.LayoutParameters = layoutParams;
                cellView.Click           += EditorCell_Click;

                if (i < 7)
                {
                    if (i == 6)
                    {
                        cellView.SetTextColor(Color.Red);
                        cellView.SetText("X", TextView.BufferType.Normal);
                    }
                    row1.AddView(cellView);
                }
                else if (i > 6 && i < 13)
                {
                    if (i == 11)
                    {
                        cellView.SetText("", TextView.BufferType.Normal);
                    }
                    else if (i == 12)
                    {
                        cellView.SetTextColor(Color.Blue);
                        cellView.SetText("?", TextView.BufferType.Normal);
                    }
                    else
                    {
                        cellView.SetText($"{i - 1}", TextView.BufferType.Normal);
                    }
                    row2.AddView(cellView);
                }
            }


            table.AddView(row1, 0);
            table.AddView(row2, 1);
        }
예제 #10
0
        private TableRow CreateRow(string indexField, string senderNameField, string hearthCountField, string timeField, bool isHeader = false)
        {
            TableRow row = new TableRow(this);

            TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent);
            row.LayoutParameters = layoutParams;

            TextView numberTextView      = new TextView(this);
            TextView usernameTextView    = new TextView(this);
            TextView heartCountTextView  = new TextView(this);
            TextView receiveTimeTextView = new TextView(this);

            numberTextView.SetPadding(0, 2, 10, 2);
            usernameTextView.SetPadding(3, 2, 3, 2);
            heartCountTextView.SetPadding(3, 2, 3, 2);
            receiveTimeTextView.SetPadding(3, 2, 0, 2);

            heartCountTextView.SetMinWidth(35);

            numberTextView.SetText(indexField, TextView.BufferType.Normal);
            usernameTextView.SetText(senderNameField, TextView.BufferType.Normal);
            heartCountTextView.SetText(hearthCountField, TextView.BufferType.Normal);
            receiveTimeTextView.SetText(timeField, TextView.BufferType.Normal);

            if (isHeader)
            {
                numberTextView.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold);
                usernameTextView.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold);
                heartCountTextView.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold);
                receiveTimeTextView.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold);

                numberTextView.SetTextSize(ComplexUnitType.Sp, (numberTextView.TextSize * 1.25f) / Resources.DisplayMetrics.Density);
                usernameTextView.SetTextSize(ComplexUnitType.Sp, (usernameTextView.TextSize * 1.25f) / Resources.DisplayMetrics.Density);
                heartCountTextView.SetTextSize(ComplexUnitType.Sp, (heartCountTextView.TextSize * 1.25f) / Resources.DisplayMetrics.Density);
                receiveTimeTextView.SetTextSize(ComplexUnitType.Sp, (receiveTimeTextView.TextSize * 1.25f) / Resources.DisplayMetrics.Density);
            }

            numberTextView.LayoutParameters      = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent);
            usernameTextView.LayoutParameters    = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent, 0.6f);
            heartCountTextView.LayoutParameters  = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent, 0.4f);
            receiveTimeTextView.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent);

            receiveTimeTextView.TextAlignment = TextAlignment.ViewEnd;

            row.AddView(numberTextView);
            row.AddView(usernameTextView);
            row.AddView(heartCountTextView);
            row.AddView(receiveTimeTextView);

            return(row);
        }
예제 #11
0
        public void addITR(TableLayout tl)
        {
            TableRow notes = new TableRow(this.Activity);

            notes.Tag = "notes";
            note      = new EditText(this.Activity);
            note.Hint = "Notes";
            if (DataController.note != "")
            {
                note.Text = DataController.note;
            }
            note.Gravity = GravityFlags.Center;

            TableRow.LayoutParams stretchRow = new TableRow.LayoutParams();
            stretchRow.Span = 6;

            notes.AddView(note, stretchRow);
            tl.AddView(notes);

            TableRow btnRow = new TableRow(this.Activity);

            btnRow.Tag = "btnRow";

            Button requestITR = new Button(this.Activity);

            requestITR.Text   = "ITR";
            requestITR.Click += (object sender, EventArgs e) => {
                if (checkNetwork())
                {
                    Android.Support.V4.App.Fragment residentsFragment = null;
                    residentsFragment = new ResidentsFragment();
                    ((ResidentsFragment)residentsFragment).SetResidentUpdate(residents);
                    ((ResidentsFragment)residentsFragment).SetNotePrev(note.Text);
                    Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();

                    ft.Add(Resource.Id.content_frame, residentsFragment, "residentsFragment");
                    ft.Hide(FragmentManager.FindFragmentByTag("residentsPrevFragment"));
                    ft.AddToBackStack(null);
                    ft.Commit();
                }
                else
                {
                    showNetworkError();
                }
            };



            btnRow.AddView(requestITR, stretchRow);
            tl.AddView(btnRow);
        }
예제 #12
0
        private void InitializeGameField(Cell[,] field)
        {
            var table = FindViewById <TableLayout>(Resource.Id.gameFieldLayout);

            table.SetBackgroundColor(Color.Gray);

            var width  = field.GetLength(0);
            var height = field.GetLength(1);

            for (int i = 0; i < height; i++)
            {
                var row = new TableRow(this);

                for (int j = 0; j < width; j++)
                {
                    View view         = null;
                    var  cell         = field[i, j];
                    var  cellView     = new Button(this);
                    var  layoutParams = new TableRow.LayoutParams(100, 100);
                    layoutParams.SetMargins(1, 1, 1, 1);
                    cellView.LayoutParameters = layoutParams;
                    if (cell.Check)
                    {
                        cellView.SetBackgroundColor(Color.White);
                        cellView.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
                        if (cell.Value != 0)
                        {
                            cellView.SetTextColor(Color.DarkGreen);
                            cellView.SetText($"{cell.Value}", TextView.BufferType.Normal);
                        }
                        else
                        {
                            cellView.SetTextColor(Color.Black);
                            cellView.Click += CellView_Click;
                        }
                        view = cellView;
                    }
                    else
                    {
                        view = new BlackCellView(this, cell.VertValue, cell.HorValue);
                        view.LayoutParameters = layoutParams;
                    }
                    row.AddView(view);

                    cells.Add(view, (i, j));
                }

                table.AddView(row, i);
            }
        }
예제 #13
0
        private void UpdateListView()
        {
            var table  = FindViewById <TableLayout>(Resource.Id.tableLayout1);
            var layout = new TableRow.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent);

            // clear the table apart from header
            if (table.ChildCount > 1)
            {
                table.RemoveViews(1, table.ChildCount - 1);
            }

            foreach (var pair in activeDownloads)
            {
                TableRow row = new TableRow(this);

                TextView text = new TextView(this)
                {
                    Text = pair.Value.Name
                };
                text.SetMaxWidth(160);
                text.SetMinWidth(160);
                text.LayoutParameters = layout;
                row.AddView(text, 0);

                text = new TextView(this)
                {
                    Text = pair.Value.Progress
                };
                text.LayoutParameters = layout;
                row.AddView(text, 1);

                text = new TextView(this)
                {
                    Text = pair.Value.State
                };
                text.LayoutParameters = layout;
                row.AddView(text, 2);

                // change colour
                if (table.ChildCount % 2 == 0)
                {
                    row.SetBackgroundColor(Android.Graphics.Color.LightBlue);
                }
                table.AddView(row, layout);
            }
        }
예제 #14
0
		public void InitView(List<BookingDocumentDto> _bookingDocs) {
			this.RemoveAllViews ();
			int size = _bookingDocs.Count;
			for(int i = 0; i < size; i ++) {
				LinearLayout ll = new LinearLayout (_context);
				ll.Orientation = Orientation.Horizontal;
				ll.SetVerticalGravity (GravityFlags.CenterVertical);

				ImageView imgFile = new ImageView (_context);
				imgFile.SetImageResource (Resource.Drawable.ic_attach);

				var tvFileAttach = new TextView (_context) {
					Text = _bookingDocs[i].OriginalFileName
				};
				tvFileAttach.Id = i;
				tvFileAttach.SetTextColor (Color.Blue);
				tvFileAttach.PaintFlags = PaintFlags.UnderlineText;
				tvFileAttach.SetTypeface (null, TypefaceStyle.Bold);
				tvFileAttach.SetSingleLine (true);
				tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
				tvFileAttach.SetPadding (5, 0, 10, 0);
				LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f);
				tvFileAttach.LayoutParameters = param;
				tvFileAttach.Click += (sender, e) => {
					utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName);
				};

				ImageButton imgDelete = new ImageButton (_context);
				imgDelete.Id = i;
				imgDelete.SetImageResource (Resource.Drawable.ic_delete);
				imgDelete.SetMinimumWidth (50);
				imgDelete.SetMinimumHeight (50);
				imgDelete.SetBackgroundColor (Color.Transparent);
				imgDelete.Click += (sender, e) => {
					_deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]);
				};

				ll.AddView (imgFile);
				ll.AddView (tvFileAttach);
				ll.AddView (imgDelete);
				ll.SetPadding (0, 5, 0, 5);

				this.AddView (ll);
			}
		}
예제 #15
0
        private void BuildGameField()
        {
            Square[,] field = game.GetField();
            for (int i = 0; i < field.GetLength(0); i++)
            {
                TableRow tableRow = new TableRow(this); // создание строки таблицы
                for (int j = 0; j < field.GetLength(1); j++)
                {
                    Button button = new Button(this);
                    button.SetSingleLine(true);
                    buttons[i, j] = button;
                    button.SetOnClickListener(new Listener(i, j));
                    //button.SetBackgroundColor(Android.Graphics.Color.Red);
                    button.SetBackgroundResource(Resource.Drawable.button_cell);
                    button.TextAlignment = TextAlignment.Center;
                    float factor = Application.Context.Resources.DisplayMetrics.Density;
                    button.TextSize = 10;
                    button.SetTextColor(Color.White);
                    TableRow.LayoutParams layPar = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.WrapContent);

                    layPar.SetMargins(0, 0, -2, -2);

                    if (i == field.GetLength(0) - 1)
                    {
                        layPar.SetMargins(0, 0, -2, 2);
                    }
                    if (j == field.GetLength(1) - 1)
                    {
                        layPar.SetMargins(0, 0, 2, -2);
                    }

                    layPar.Width  = Convert.ToInt32(31 * factor);
                    layPar.Height = Convert.ToInt32(31 * factor);

                    button.LayoutParameters = layPar;
                    tableRow.AddView(button, j);
                }
                tableLayout.AddView(tableRow, i);
            }
            //if (typeGame != null && typeGame.Contains("Android"))
            //{
            //    Listener.SetAndroidPosition();
            //}
        }
예제 #16
0
        private void InitHeaderOfCalender()
        {
            var layout = new TableRow.LayoutParams(0, ViewGroup.LayoutParams.WrapContent, 1f);

            layout.SetMargins(0, 8, 0, 8);
            daysHeader = new TableRow(_context);
            daysHeader.SetGravity(GravityFlags.Center);
            for (var i = 0; i < 7; i++)
            {
                var textView = new TextView(_context);
                textView.LayoutParameters = layout;
                textView.TextSize         = 11;
                textView.SetTextColor(
                    new Color(ContextCompat.GetColor(_context, Resource.Color.hijri_date_picker_accent_color)));
                textView.Gravity = GravityFlags.Center;
                textView.Text    = days[i];
                daysHeader.AddView(textView);
            }
        }
예제 #17
0
        TableRow GetDelim(Android.Graphics.Color color)
        {
            TableRow.LayoutParams lpDelim = new TableRow.LayoutParams();
            lpDelim.Height = TableLayout.LayoutParams.WrapContent;
            lpDelim.Width  = TableLayout.LayoutParams.WrapContent;
            lpDelim.SetMargins(ToDIP(2), ToDIP(1), ToDIP(2), ToDIP(1));
//			lpDelim.Span = currentAttendances.Count + 2;
            lpDelim.Span = newAttendanceResults.Count + 2;

            TableRow rDelim = new TableRow(Activity);
            View     vDelim = new View(Activity);

            vDelim.SetMinimumHeight(ToDIP(3));
            vDelim.SetBackgroundColor(color);
            vDelim.LayoutParameters = lpDelim;
            rDelim.AddView(vDelim);

            return(rDelim);
        }
예제 #18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);
            TableLayout  tl           = FindViewById <TableLayout>(Resource.Id.camera_preview);
            LayoutParams layoutParams = new TableRow.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);

            TableRow.LayoutParams tableLayoutParams = new TableRow.LayoutParams();
            tableLayoutParams.Span   = 4;
            tableLayoutParams.Weight = 1;
            TableRow tr = new TableRow(this);

            mCamera        = getCameraInstance();
            mCameraPreview = new CameraPreview(this, mCamera, null, Android.Views.SurfaceOrientation.Rotation0);
            mCameraPreview.LayoutParameters = tableLayoutParams;
            tr.AddView(mCameraPreview, 0);
            tl.AddView(tr, 6);

            Button captureButton = FindViewById <Button>(Resource.Id.button_capture);

            captureButton.Click += CaptureButton_Click;
        }
예제 #19
0
        private void InitDays()
        {
            tableLayout.RemoveAllViews();
            tableLayout.AddView(daysHeader);
            UpdateCalenderInformation();

            var count     = 1;
            var firstTime = true;
            var layout    = new TableRow.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                      ViewGroup.LayoutParams.WrapContent, 1f);

            layout.SetMargins(0, 8, 0, 8);
            for (var i = 0; i < 5; i++)
            {
                var row = new TableRow(_context);
                row.SetGravity(GravityFlags.Center);
                for (var j = 1; j <= 7; j++)
                {
                    var textView = new TextView(_context)
                    {
                        LayoutParameters = layout,
                        Gravity          = GravityFlags.Center
                    };
                    textView.SetOnClickListener(this);
                    textView.SetTextColor(Color.DarkGray);
                    if (count <= calendarInstance.lengthOfMonth())
                    {
                        if (firstTime && j == calendarInstance.getWeekStartFrom())
                        {
                            textView.Text = GeneralAttribute.language ==
                                            HijriCalendarDialog.Language.Arabic.LanguageValue
                                ? Utility.ToArabicNumbers(count + "")
                                : count + "";
                            firstTime = false;
                            count++;
                        }
                        else if (!firstTime)
                        {
                            textView.Text = GeneralAttribute.language ==
                                            HijriCalendarDialog.Language.Arabic.LanguageValue
                                ? Utility.ToArabicNumbers(count + "")
                                : count + "";
                            count++;
                        }
                        else
                        {
                            textView.Text = " ";
                        }
                    }
                    else
                    {
                        textView.Text = " ";
                    }

                    if ((calendarInstance.GetCurrentMonth() == GeneralAttribute.defaultMonth ||
                         (calendarInstance.GetCurrentMonth() == GeneralAttribute.defaultMonth &&
                          calendarInstance.GetCurrentYear() == GeneralAttribute.defaultYear)) &&
                        count - 1 == calendarInstance.GetDayOfMonth())
                    {
                        textView.SetBackgroundColor(
                            new Color(ContextCompat.GetColor(_context, Resource.Color.hijri_date_picker_accent_color)));
                        textView.SetTextColor(Color.White);
                        lastSelectedDay = textView;
                    }
                    textViewList.Add(textView);
                    row.AddView(textView);
                }
                tableLayout.AddView(row);
            }
        }
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (88);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

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

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in currentAttendances) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -70;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in currentAttendances) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;

                        string value = string.Empty;
                        if (attendace.id != -1) {
                            value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id);
                        } else {
                            value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
                            rl.Click += Rl_Click;
                        }

                        TextView vvv = new TextView (Activity);
                        vvv.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals(@"N")) {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_danger);
            //							rl.SetBa
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                        } else {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
            //							vvv.SetTextSize (ComplexUnitType.Sp, 24);
            //							vvv.SetTextColor(Android.Graphics.Color.Argb);

                            rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                        }
                        vvv.Text = AttendanceResult.StringBoolToRussian(value);
                        rl.AddView (vvv);
                        rr.AddView (rl);
                    }

                    tl.AddView (rr);
                }

                r.AddView (tl);
                table.AddView (r);
            }
        }
예제 #21
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));
            }
        }
예제 #22
0
        TableRow GetDelim(Android.Graphics.Color color)
        {
            TableRow.LayoutParams lpDelim = new TableRow.LayoutParams ();
            lpDelim.Height = TableLayout.LayoutParams.WrapContent;
            lpDelim.Width = TableLayout.LayoutParams.WrapContent;
            lpDelim.SetMargins (ToDIP(2), ToDIP(1), ToDIP(2), ToDIP(1));
            //			lpDelim.Span = currentAttendances.Count + 2;
            lpDelim.Span = newAttendanceResults.Count + 2;

            TableRow rDelim = new TableRow (Activity);
            View vDelim = new View (Activity);
            vDelim.SetMinimumHeight (ToDIP(3));
            vDelim.SetBackgroundColor (color);
            vDelim.LayoutParameters = lpDelim;
            rDelim.AddView (vDelim);

            return rDelim;
        }
예제 #23
0
        /// <summary>
        /// Create and populate UI block table based on engine data
        /// </summary>
        private void PopulateTable()
        {
            var height = _gameEngine.GetHeight();
            var width = _gameEngine.GetWidth();
            _blocks = new Block[width, height];
            for (var row = 0; row < height; row++)
            {

                var mineRow = new TableRow(this);
                var mineRowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent, 0.0f);

                for (var col = 0; col < width; col++)
                {
                    var block = new Block(this)
                    {
                        Row = row,
                        Col = col,
                        IsFlipped = false,
                        IsFlagged = false
                    };
                    _blocks[col, row] = block;
                    mineRow.AddView(_blocks[col, row]);
                }
                _mineTable.AddView(mineRow, mineRowParams);
            }
        }
        private TableLayout CreateTableLayout()
        {
            TableLayout table = new TableLayout(this);

            table.StretchAllColumns = true;
            table.ShrinkAllColumns  = true;

            TableRow rowTitle = new TableRow(this);

            rowTitle.SetGravity(GravityFlags.CenterHorizontal);

            TableRow rowDayLabels  = new TableRow(this);
            TableRow rowHighs      = new TableRow(this);
            TableRow rowLows       = new TableRow(this);
            TableRow rowConditions = new TableRow(this);

            rowConditions.SetGravity(GravityFlags.Center);

            TextView empty = new TextView(this);

            // title column/row
            TextView title = new TextView(this);

            title.Text = "Xamarin Weather Table";

            title.SetTextSize(ComplexUnitType.Dip, 18);
            title.Gravity = GravityFlags.Center;
            title.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TableRow.LayoutParams items = new TableRow.LayoutParams();
            items.Span = 6;

            rowTitle.AddView(title, items);

            // labels column
            TextView highsLabel = new TextView(this);

            highsLabel.Text = "Day High";
            highsLabel.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView lowsLabel = new TextView(this);

            lowsLabel.Text = "Day Low";
            lowsLabel.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView conditionsLabel = new TextView(this);

            conditionsLabel.Text = "Conditions";
            conditionsLabel.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            rowDayLabels.AddView(empty);
            rowHighs.AddView(highsLabel);
            rowLows.AddView(lowsLabel);
            rowConditions.AddView(conditionsLabel);

            // day 1 column
            TextView day1Label = new TextView(this);

            day1Label.Text = "Feb 7";
            day1Label.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView day1High = new TextView(this);

            day1High.Text    = "28°F";
            day1High.Gravity = GravityFlags.CenterHorizontal;

            TextView day1Low = new TextView(this);

            day1Low.Text    = "15°F";
            day1Low.Gravity = GravityFlags.CenterHorizontal;

            TextView day1Conditions = new TextView(this);

            day1Conditions.Text = "HOT";

            rowDayLabels.AddView(day1Label);
            rowHighs.AddView(day1High);
            rowLows.AddView(day1Low);
            rowConditions.AddView(day1Conditions);

            // day2 column
            TextView day2Label = new TextView(this);

            day2Label.Text = "Feb 8";
            day2Label.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView day2High = new TextView(this);

            day2High.Text    = "26°F";
            day2High.Gravity = GravityFlags.CenterHorizontal;

            TextView day2Low = new TextView(this);

            day2Low.Text    = "14°F";
            day2Low.Gravity = GravityFlags.CenterHorizontal;

            TextView day2Conditions = new TextView(this);

            day2Conditions.Text = "CLOUDY";

            rowDayLabels.AddView(day2Label);
            rowHighs.AddView(day2High);
            rowLows.AddView(day2Low);
            rowConditions.AddView(day2Conditions);

            // day3 column
            TextView day3Label = new TextView(this);

            day3Label.Text = "Feb 9";
            day3Label.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView day3High = new TextView(this);

            day3High.Text    = "23°F";
            day3High.Gravity = GravityFlags.CenterHorizontal;

            TextView day3Low = new TextView(this);

            day3Low.Text    = "3°F";
            day3Low.Gravity = GravityFlags.CenterHorizontal;

            TextView day3Conditions = new TextView(this);

            day3Conditions.Text = "SNOW";

            rowDayLabels.AddView(day3Label);
            rowHighs.AddView(day3High);
            rowLows.AddView(day3Low);
            rowConditions.AddView(day3Conditions);

            // day4 column
            TextView day4Label = new TextView(this);

            day4Label.Text = "Feb 10";
            day4Label.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView day4High = new TextView(this);

            day4High.Text    = "17°F";
            day4High.Gravity = GravityFlags.CenterHorizontal;

            TextView day4Low = new TextView(this);

            day4Low.Text    = "5°F";
            day4Low.Gravity = GravityFlags.CenterHorizontal;

            TextView day4Conditions = new TextView(this);

            day4Conditions.Text = "SNOW";

            rowDayLabels.AddView(day4Label);
            rowHighs.AddView(day4High);
            rowLows.AddView(day4Low);
            rowConditions.AddView(day4Conditions);

            // day5 column
            TextView day5Label = new TextView(this);

            day5Label.Text = "Feb 11";
            day5Label.SetTypeface(Typeface.Serif, TypefaceStyle.Bold);

            TextView day5High = new TextView(this);

            day5High.Text    = "19°F";
            day5High.Gravity = GravityFlags.CenterHorizontal;

            TextView day5Low = new TextView(this);

            day5Low.Text    = "6°F";
            day5Low.Gravity = GravityFlags.CenterHorizontal;

            TextView day5Conditions = new TextView(this);

            day5Conditions.Text = "SUN";

            rowDayLabels.AddView(day5Label);
            rowHighs.AddView(day5High);
            rowLows.AddView(day5Low);
            rowConditions.AddView(day5Conditions);

            table.AddView(rowTitle);
            table.AddView(rowDayLabels);
            table.AddView(rowHighs);
            table.AddView(rowLows);
            table.AddView(rowConditions);

            return(table);
        }
예제 #25
0
        protected async override void OnCreate(Bundle bundle)
        {
            // string path = "C:/Users/mof1/Documents/Visual Studio 2015/Projects/NDSSF/NDSSF/recordings/test.3gpp";
            System.Diagnostics.Debug.Write("------------------------->OnCreate()");
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.STE5);
            string[] array = { "sun", "moon", "try", "sun", "moon", "try" };
            int      m     = array.Length;

            LinearLayout Dp = FindViewById <LinearLayout>(Resource.Id.linearLayout1);

            LinearLayout.LayoutParams li = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            TableLayout.LayoutParams  lp = new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent);
            TableLayout linear           = new TableLayout(this);

            //   TableRow row = FindViewById<TableRow>(Resource.Id.row1);
            TableRow.LayoutParams tableRowParams = new TableRow.LayoutParams();
            tableRowParams.SetMargins(1, 1, 1, 1);
            tableRowParams.Weight = 1;

            TableRow tableRow = new TableRow(this);

            tableRow.SetGravity(GravityFlags.Top);
            tableRow.SetBackgroundColor(Color.Black);



            for (int i = 0; i < m; i++)
            {
                TextView tv = new TextView(this);
                tv.SetBackgroundColor(Color.Gray);
                tv.SetTextColor(Color.Black);
                tv.SetTypeface(null, TypefaceStyle.Bold);
                tv.Gravity = GravityFlags.Center;


                tv.Id = i;
                //int id = tv.FindViewById<Button>(i);

                int n = tv.Id;

                //   tv.SetText(Resource.Id.textView1_tab);
                lp.SetMargins(1, 1, 1, 1);
                tv.Text = array[i];

                tv.SetWidth(50);
                tv.SetHeight(50);
                li.RightMargin  = 5;
                li.LeftMargin   = 5;
                li.TopMargin    = 5;
                li.BottomMargin = 5;
                tableRow.AddView(tv, tableRowParams);
                tableRow.SetGravity(GravityFlags.Top);
                tv.SetBackgroundColor(Color.Beige);
                tv.SetSelectAllOnFocus(true);
                tv.RequestFocus();

                // tv.SetSelectAllOnFocus(FocusablesFlags.TouchMode);
            }
            //tv.SetBackgroundColor("red");

            linear.AddView(tableRow, lp);
            Dp.AddView(linear, li);
            //  Dp.SetGravity(GravityFlags.Top);
            // Dp.SetGravity.



            //  l1.AddView(tv);



            Toast.MakeText(this, "Database is updated", ToastLength.Short).Show();
            nlistview = FindViewById <ListView>(Resource.Id.listViewR);


            wordList = (await DataRepository.Words.GetAll());
            // wordStrings = new List<string>();

            MyServiceItemsAdapter       = new MyAdapter3(this, wordList);
            nlistview.Adapter           = MyServiceItemsAdapter;
            nlistview.FastScrollEnabled = true;
            Button btn = FindViewById <Button>(Resource.Id.button1);

            btn.Click += delegate { StartActivity(typeof(STE4_tokens)); };

            Button btn2 = FindViewById <Button>(Resource.Id.button3);

            btn2.Click += delegate { StartActivity(typeof(STE5_custom)); };
            Button btn3 = FindViewById <Button>(Resource.Id.button4);

            btn3.Click += delegate { StartActivity(typeof(tester)); };
        }
예제 #26
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));
            }
        }
예제 #27
0
        public void SetTableData(List <MonitoredStopVisit> data, TableLayout mTableLayout, Context context, Resources resources
                                 , string searchType)
        {
            while (mTableLayout.ChildCount > 2)
            {
                mTableLayout.RemoveViewAt(2);
            }
            TableRow.LayoutParams tableRowLayoutparams = new TableRow.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent);

            Boolean colored = false;


            if (searchType == "line")
            {
                List <string> idLoop = new List <string>();

                foreach (MonitoredStopVisit Row in data.OrderBy(s => s.MonitoredVehicleJourney.FramedVehicleJourneyRef.DatedVehicleJourneyRef))
                {
                    string crntIdLoop = Row.MonitoredVehicleJourney.FramedVehicleJourneyRef.DatedVehicleJourneyRef;
                    if (crntIdLoop == "0" || idLoop.FindIndex(x => x == crntIdLoop) >= 0)
                    {
                        // go to next row
                        // in search by line we display only one time per bus route
                    }
                    else
                    {
                        idLoop.Add(crntIdLoop);
                        if (Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Count > 0)
                        {
                            if (idLoop.Count > 0) // after complete bus round adding space
                            {
                                Space space = new Space(context);
                                space.SetMinimumHeight(40);
                                mTableLayout.AddView(space);
                            }
                            foreach (OnwardCall call in Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall)
                            {
                                TableRow tr = new TableRow(context);
                                if (colored)
                                {
                                    tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult));
                                }
                                colored             = !colored;
                                tr.LayoutParameters = tableRowLayoutparams;

                                TextView tv1 = new TextView(context);
                                string   firstStationName = dbHelper.ReadStationName(call.StopPointRef);
                                firstStationName = GetShortDest(firstStationName); // design the destination

                                tv1.Text          = firstStationName;
                                tv1.TextAlignment = TextAlignment.ViewEnd;
                                tv1.SetMaxWidth(400);
                                tv1.SetPadding(0, 0, 13, 0);
                                TextView tv2 = new TextView(context);
                                tv2.Text          = DateTime.Parse(call.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                                tv2.TextAlignment = TextAlignment.Center;

                                TextView tv3 = new TextView(context);
                                tv3.SetMaxWidth(400);
                                string stationName = dbHelper.ReadStationName(Row.MonitoredVehicleJourney.DestinationRef);
                                stationName = GetShortDest(stationName);

                                tv3.Text          = stationName;
                                tv3.TextAlignment = TextAlignment.Center;

                                TextView tv4 = new TextView(context);
                                if (Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Count > 0)
                                {
                                    OnwardCall endStationCall = Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Where(a => a.StopPointRef == Row.MonitoredVehicleJourney.DestinationRef).FirstOrDefault();
                                    tv4.Text = endStationCall is null ? "לא ידוע" : DateTime.Parse(endStationCall.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                                }
                                else
                                {
                                    tv4.Text = tv2.Text;
                                }

                                tv4.TextAlignment = TextAlignment.Center;

                                tr.AddView(tv4);
                                tr.AddView(tv3);
                                tr.AddView(tv2);
                                tr.AddView(tv1);
                                mTableLayout.AddView(tr);
                            }
                        }
                    }
                }
            }
            else // by station and train
            {
                foreach (MonitoredStopVisit Row in data)
                {
                    TableRow tr = new TableRow(context);
                    if (colored)
                    {
                        tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult));
                    }
                    colored             = !colored;
                    tr.LayoutParameters = tableRowLayoutparams;
                    TextView tv1 = new TextView(context);
                    tv1.SetPadding(0, 0, 13, 0);
                    switch (searchType)
                    {
                    case "station":
                        tv1.Text          = Row.MonitoredVehicleJourney.PublishedLineName;
                        tv1.TextAlignment = TextAlignment.Center;
                        break;

                    default:
                        break;
                    }

                    TextView tv2 = new TextView(context);
                    tv2.Text          = DateTime.Parse(Row.MonitoredVehicleJourney.MonitoredCall.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                    tv2.TextAlignment = TextAlignment.Center;

                    TextView tv3         = new TextView(context);
                    string   stationName = dbHelper.ReadStationName(Row.MonitoredVehicleJourney.DestinationRef);

                    tv3.Text          = stationName;
                    tv3.TextAlignment = TextAlignment.Center;

                    TextView tv4 = new TextView(context);
                    if (Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Count > 0)
                    {
                        OnwardCall endStationCall = Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Where(a => a.StopPointRef == Row.MonitoredVehicleJourney.DestinationRef).FirstOrDefault();
                        tv4.Text = endStationCall is null ? "לא ידוע" : DateTime.Parse(endStationCall.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                    }
                    else
                    {
                        tv4.Text = tv2.Text;
                    }

                    tv4.TextAlignment = TextAlignment.Center;

                    tr.AddView(tv4);
                    tr.AddView(tv3);
                    tr.AddView(tv2);
                    tr.AddView(tv1);
                    mTableLayout.AddView(tr);
                }
            }
        }
예제 #28
0
        public void drawTable(View view)
        {
            if (checkNetwork())
            {
                string canvass = NetworkCalls.getJobs(DataController.token);

                string response         = NetworkCalls.getProperties(DataController.token);
                string responseResident = NetworkCalls.getResidents(DataController.token, DataController.canvassID, DataController.uprn);
                //residents = MockingController.getResidentsPrev();
                residents = DataController.residents;
                addresses = DataController.addresses;


                TableLayout tl = (TableLayout)view.FindViewById(Resource.Id.residentstable);
                TableLayout tb = (TableLayout)view.FindViewById(Resource.Id.tableHeaders);
                ScrollView  ts = (ScrollView)view.FindViewById(Resource.Id.tableScroll);

                tl.StretchAllColumns = true;
                tl.BringToFront();
                TableRow headings = new TableRow(this.Activity);
                headings.SetBackgroundColor(Resources.GetColor(Resource.Color.headers));
                headings.Tag = "headers";

                TextView heading0 = new TextView(this.Activity);
                heading0.Text = " ITR";
                float density = this.Activity.Resources.DisplayMetrics.Density;
                heading0.SetWidth((int)(40 * density));
                heading0.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading0.TextSize = 15.0f;



                TextView heading1 = new TextView(this.Activity);
                heading1.Text = " Name";
                heading1.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading1.TextSize = 15.0f;
                heading1.SetWidth((int)(220 * density));
                TextView heading2 = new TextView(this.Activity);
                heading2.Text = "Nationality";
                heading2.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading2.TextSize = 15.0f;
                TextView heading3 = new TextView(this.Activity);
                heading3.Text = "Opt Out";
                heading3.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading3.TextSize = 15.0f;
                TextView heading4 = new TextView(this.Activity);
                heading4.Text = "Absent Vote";
                heading4.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading4.TextSize = 15.0f;
                TextView heading5 = new TextView(this.Activity);
                heading5.Text = "Jury Duty";
                heading5.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading5.TextSize = 15.0f;
                //			TextView heading6 = new TextView(this.Activity);
                //			heading6.Text = "Residents";

                headings.AddView(heading0);
                headings.AddView(heading1);
                headings.AddView(heading2);
                headings.AddView(heading3);
                headings.AddView(heading4);
                headings.AddView(heading5);
                //headings.AddView(heading6);
                tl.AddView(headings);


                for (int i = 0; i < residents.Count; i++)
                {
                    Dictionary <string, object> residentDict = new Dictionary <string, object> ();
                    //String OptOut, Absent, Jury;


                    residentDict = residents [i];

                    TableRow tr = new TableRow(this.Activity);

                    if (i % 2 == 0)
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.even));
                    }
                    else
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.odd));
                    }

                    tr.Tag = residentDict ["id"].ToString();
                    tr.Id  = i;
                    TextView name = new TextView(this.Activity);

                    name.Text = " " + residentDict ["fullName"].ToString();


                    float density1 = this.Activity.Resources.DisplayMetrics.Density;
                    name.SetWidth((int)(200 * density1));
                    name.SetPadding(5, 5, 0, 5);


                    name.Tag      = "name" + i;
                    name.TextSize = 18.0f;
                    name.SetTextColor(Resources.GetColor(Resource.Color.tableText));
                    name.Click += (object sender, EventArgs e) => {
                        nameCorrect(name);
                    };


                    ImageView itr = new ImageView(this.Activity);


                    if (residentDict ["itr_added"] != null)
                    {
                        itr.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.itr6));
                        itr.Background = null;
                    }
                    else
                    {
                        itr.SetImageDrawable(null);
                        itr.Background = null;
                    }

                    itr.SetPadding((int)(-50 * density1), 5, 0, 5);



                    TextView nationality = new TextView(this.Activity);
                    nationality.Text = residentDict ["nationality"].ToString();
                    //residentUpdate[i].Add ("nationality", residentDict ["nationality"].ToString ());
                    nationality.Tag      = i;
                    nationality.TextSize = 18.0f;
                    nationality.SetTextColor(Resources.GetColor(Resource.Color.tableText));
                    nationality.Click += (object sender, EventArgs e) => {
                        nationalityCorrect(nationality);
                    };
                    CheckBox optOut = new CheckBox(this.Activity);
                    optOut.Tag = i;
                    if (residentDict ["optOut"].ToString() == "YES")
                    {
                        optOut.Checked = true;
                        //OptOut = "YES";
                    }
                    else
                    {
                        optOut.Checked = false;
                        //OptOut = "NO";
                    }
                    optOut.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkOptOut(optOut);
                    };
                    //residentUpdate[i].Add ("optOut");
                    CheckBox absentVote = new CheckBox(this.Activity);

                    //absentVote.Enabled = false;
                    absentVote.Tag = i;
                    if (residentDict ["absent"].ToString() == "YES")
                    {
                        absentVote.Checked = true;
                        //Absent = "YES";
                    }
                    else
                    {
                        absentVote.Checked = false;
                        //Absent = "NO";
                    }
                    absentVote.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkAbsentVote(absentVote);
                    };
                    //residentUpdate[i].Add ("absent");
                    CheckBox juryDuty = new CheckBox(this.Activity);
                    juryDuty.Tag = i;
                    if (residentDict ["jury"].ToString() == "YES")
                    {
                        juryDuty.Checked = true;
                        //Jury = "YES";
                    }
                    else
                    {
                        juryDuty.Checked = false;
                        //Jury = "NO";
                    }
                    juryDuty.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkJuryDuty(juryDuty);
                    };
                    //residentUpdate[i].Add ("jury");

                    TableRow.LayoutParams stretchRow = new TableRow.LayoutParams();
                    stretchRow.Width = (int)(10 * density1);


                    tr.AddView(itr, stretchRow);
                    tr.AddView(name);
                    tr.AddView(nationality);
                    tr.AddView(optOut);
                    tr.AddView(absentVote);
                    tr.AddView(juryDuty);
                    tl.AddView(tr);
                }
                View headers = tl.FindViewWithTag("headers");
                tl.RemoveView(tl.FindViewWithTag("headers"));
                tb.RemoveAllViews();
                //					//tb.RemoveView (tl);
                tb.AddView(headers);
                tb.StretchAllColumns = true;
                ts.RemoveAllViews();
                ts.AddView(tl);
                tb.AddView(ts);

                addITR(tl);
            }
        }
        private void scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                if (scanDataCollection.GetScanData() != null)
                {
                    IList <TableRow> rows = new List <TableRow>();
                    TableRow         row  = new TableRow(this);
                    row.SetBackgroundColor(Android.Graphics.Color.Black);
                    row.SetPadding(1, 1, 1, 1);
                    TableRow.LayoutParams llp = new TableRow.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.MatchParent);
                    llp.SetMargins(0, 0, 2, 0);

                    TextView keyText = new TextView(this);
                    keyText.SetPadding(5, 5, 5, 5);
                    keyText.LayoutParameters = llp;
                    //keyText.SetLayerType(llp);
                    keyText.SetBackgroundColor(Android.Graphics.Color.White);
                    keyText.Text = "Type";
                    row.AddView(keyText);

                    TextView valueText = new TextView(this);
                    valueText.SetPadding(5, 5, 5, 5);
                    valueText.SetBackgroundColor(Android.Graphics.Color.White);
                    valueText.Text = "Value";
                    row.AddView(valueText);

                    rows.Add(row);

                    IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                    foreach (ScanDataCollection.ScanData data in scanData)
                    {
                        string dataString = data.Data;
                        row = new TableRow(this);
                        row.SetBackgroundColor(Android.Graphics.Color.Black);
                        row.SetPadding(1, 1, 1, 1);

                        string mKey   = data.LabelType.ToString();
                        string mValue = data.Data;

                        keyText = new TextView(this);
                        keyText.SetPadding(5, 5, 5, 5);
                        keyText.LayoutParameters = llp;
                        keyText.SetBackgroundColor(Android.Graphics.Color.White);
                        keyText.Text = mKey;
                        row.AddView(keyText);

                        valueText = new TextView(this);
                        valueText.SetPadding(5, 5, 5, 5);
                        valueText.SetBackgroundColor(Android.Graphics.Color.White);
                        valueText.LayoutParameters = llp;
                        valueText.Text             = mValue;
                        row.AddView(valueText);

                        rows.Add(row);
                        //RunOnUiThread(() => DisplayScanData(mValue));
                        RunOnUiThread(() => DisplayScanData(dataString));
                    }
                    new AsyncMultiDataUpdate(rows).Execute("MultiBarcode Scanning result");
                }
            }
        }
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (70);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

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

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in drugInfo.attendaces) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -60;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in drugInfo.attendaces) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;
                        rl.Click += (object sender, EventArgs e) => {
                            RelativeLayout rlAttendace = (RelativeLayout) sender;
                            TableRow trDrug = (TableRow) rl.Parent;
                            TableLayout trInfo = (TableLayout) rl.Parent.Parent;

                            string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id);

                            Toast.MakeText(Activity,  message, ToastLength.Short).Show();

                            FragmentTransaction trans = FragmentManager.BeginTransaction ();
                            DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog ();
                            Bundle args = new Bundle();
                            args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id);
                            args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id);
                            args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id);
            //							args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id));

                            drugInfoValueDialog.Arguments = args;
                            drugInfoValueDialog.AfterSave += DrugInfoValueDialog_AfterSave;

                            drugInfoValueDialog.Show (trans, "dialog fragment");

                            Log.Info ("ifSignInButton", "Click");
                        };

            //						string value = GetDrugInfoValue (attendace.results, info.id, drug.id);

                        if (string.IsNullOrEmpty (value)) {
                            ImageView iv = new ImageView (Activity);
                            iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                            rl.AddView (iv);
                        } else {
                            TextView vvv = new TextView (Activity);
                            vvv.Gravity = GravityFlags.Center;
                            vvv.Text = value;
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
            //							vvv.SetTextSize (ComplexUnitType.Sp, 24);
            //							vvv.SetTextColor(Android.Graphics.Color.Argb);

                            rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                            rl.AddView (vvv);
                        }

                        rr.AddView (rl);
                    }

                    //					for (int i = 0; i < 2; i++) { // Values
                    //						ImageView iv = new ImageView (Activity);
                    //						iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
                    //						rr.AddView (iv);
                    //					}

                    tl.AddView (rr);
                }

                r.AddView (tl);
                table.AddView (r);
            }
        }
예제 #31
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);
            tblLayout = FindViewById(Resource.Id.tblLayout) as TableLayout;

            sensMan = GetSystemService(Context.SensorService) as SensorManager;
            if (sensMan == null)
            {
                return;
            }
            var sensors = sensMan.GetSensorList(SensorType.All);

            row = new TableRow(this);

            param = new TableRow.LayoutParams(300, 300);

            foreach (var item in sensors)
            {
                Console.WriteLine(item.Name);
                Console.WriteLine(item.StringType);
                Console.WriteLine("=======================");
                imgSensor = new ImageView(this);
                lblName   = new TextView(this);
                lLayout   = new LinearLayout(this);


                imgSensor.LayoutParameters = new TableRow.LayoutParams(150, 150);
                lblName.Text = item.Name;
                if (item.Type == SensorType.Accelerometer)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_gravity);
                }

                else if (item.Type == SensorType.AmbientTemperature)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_tempe);
                }

                else if (item.Type == SensorType.Gyroscope)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_gyro);
                }

                else if (item.Type == SensorType.Light)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_light);
                }

                else if (item.Type == SensorType.MagneticField)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_magn);
                }

                else if (item.Type == SensorType.Orientation)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_orien);
                }

                else if (item.Type == SensorType.Pressure)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_pressure);
                }

                else if (item.Type == SensorType.Proximity)
                {
                    imgSensor.SetImageResource(Resource.Drawable.main_dist);
                }
                else
                {
                    imgSensor = null;
                    lblName   = null;
                    lLayout   = null;
                    continue;
                }
                lLayout.Orientation = Orientation.Vertical;
                lLayout.AddView(imgSensor);
                lLayout.AddView(lblName);
                //lLayout.LayoutParameters = new TableRow.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                lLayout.LayoutParameters = param;
                lLayout.Click           += delegate
                {
                    Intent sensor = new Intent(this, typeof(SensorActivity));
                    sensor.PutExtra("sensorType", item.Type.ToString());
                    StartActivity(sensor);
                };
                row.AddView(lLayout);

                if (row.ChildCount == 3)
                {
                    tblLayout.AddView(row);
                    row = new TableRow(this);
                }
            }
            if (row.ChildCount > 0)
            {
                tblLayout.AddView(row);
            }
        }
예제 #32
0
        /// <summary>
        ///     Create the table layout, and the image buttons,
        ///     everything is assigned accordingly to the screen size.
        /// </summary>
        private void initializeTableLayout()
        {
            var metrics = Resources.DisplayMetrics;
            var widthInDp = metrics.WidthPixels;
            var heightInDp = metrics.HeightPixels;
            gameBoard = (TableLayout)FindViewById(Resource.Id.boardTable);
            TableRow.LayoutParams layoutParams = new TableRow.LayoutParams((widthInDp / 4), (widthInDp / 4));
            TableRow tableRow1 = new TableRow(this);
            TableRow tableRow2 = new TableRow(this);
            TableRow tableRow3 = new TableRow(this);
            TableRow tableRow4 = new TableRow(this);

            bool flag = false;
            for (int i = 0; i < SIZE; i++)
            {

                flag = !flag;
                for (int j = 0; j < SIZE; j++)
                {
                    gameImgButtons[i, j].SetImageResource(Resource.Drawable.blank);
                    gameImgButtons[i, j].LayoutParameters = layoutParams;
                    if (flag)
                    {
                        if ((j % 2) == 0)
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Black);
                        }
                        else
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Gray);
                        }
                    }
                    else
                    {
                        if ((j % 2) != 0)
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Black);
                        }
                        else
                        {
                            gameImgButtons[i, j].SetBackgroundColor(Color.Gray);
                        }
                    }

                }
                tableRow1.AddView(gameImgButtons[0, i], i);
                tableRow2.AddView(gameImgButtons[1, i], i);
                tableRow3.AddView(gameImgButtons[2, i], i);
                tableRow4.AddView(gameImgButtons[3, i], i);
            }
            // Add rows to table
            gameBoard.AddView(tableRow1, 0);
            gameBoard.AddView(tableRow2, 1);
            gameBoard.AddView(tableRow3, 2);
            gameBoard.AddView(tableRow4, 3);
        }
예제 #33
0
        //int count = 1;



        protected override void OnCreate(Bundle bundle)
        {
            // string path = "C:/Users/mof1/Documents/Visual Studio 2015/Projects/NDSSF/NDSSF/recordings/test.3gpp";
            System.Diagnostics.Debug.Write("------------------------->OnCreate()");
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.STE4_tokens);
            //  Context context= new Context(BaseContext);
            int borderWidth  = 10;
            int borderHeight = 5;
            int thickness    = 2;
            // LinearLayout l1 = FindViewById<LinearLayout>(Resource.Id)
            ImageView selectionBorder = BorderDrawer.generateBorderImageView(this, borderWidth, borderHeight, thickness, Color.White);

            //  string next;
            // Get our button from the layout resource,
            // and attach an event to it
            string[] array = { "sun", "moon", "try", "sun", "moon", "try" };
            int      m     = array.Length;

            LinearLayout Dp = FindViewById <LinearLayout>(Resource.Id.linearLayout1);

            LinearLayout.LayoutParams li = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            TableLayout.LayoutParams  lp = new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent);
            TableLayout linear           = new TableLayout(this);

            //   TableRow row = FindViewById<TableRow>(Resource.Id.row1);
            TableRow.LayoutParams tableRowParams = new TableRow.LayoutParams();
            tableRowParams.SetMargins(1, 1, 1, 1);
            tableRowParams.Weight = 1;

            TableRow tableRow = new TableRow(this);

            tableRow.SetGravity(GravityFlags.Top);
            tableRow.SetBackgroundColor(Color.Black);



            for (int i = 0; i < m; i++)
            {
                TextView tv = new TextView(this);
                tv.SetBackgroundColor(Color.Gray);
                tv.SetTextColor(Color.Black);
                tv.SetTypeface(null, TypefaceStyle.Bold);
                tv.Gravity = GravityFlags.Center;


                tv.Id = i;
                //int id = tv.FindViewById<Button>(i);

                int n = tv.Id;

                //   tv.SetText(Resource.Id.textView1_tab);
                lp.SetMargins(1, 1, 1, 1);
                tv.Text = array[i];

                tv.SetWidth(50);
                tv.SetHeight(50);
                li.RightMargin  = 5;
                li.LeftMargin   = 5;
                li.TopMargin    = 5;
                li.BottomMargin = 5;
                tableRow.AddView(tv, tableRowParams);
                tableRow.SetGravity(GravityFlags.Top);
            }
            //tv.SetBackgroundColor("red");

            linear.AddView(tableRow, lp);
            Dp.AddView(linear, li);
            ImageButton next_ste5 = FindViewById <ImageButton>(Resource.Id.imageButton_next);
        }
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Connect to the server
            hubConnection = new HubConnection("http://192.168.100.3:4000/");

            // Create a proxy to the 'IOTHub' SignalR Hub
            chatHubProxy = hubConnection.CreateHubProxy("IOTHub");

            // Start the connection
            await hubConnection.Start();


            chatHubProxy.On<List<IOTDevice>>("UpdateState", nodes =>
            {
                var Msg = string.Empty;
                foreach (var item in nodes)
                {
                    Msg += item.ID + " = " + item.State+", ";
                }
                Toast.MakeText(this, Msg, ToastLength.Short).Show();
            });

          

            hubConnection.ConnectionSlow += () =>
            {
               Toast.MakeText(this, "Connection problems.\r\n",ToastLength.Short).Show();
            };
            hubConnection.Error += ex =>
            {
                Toast.MakeText(this, string.Format("SignalR error: {0}\r\n", ex.Message), ToastLength.Short).Show();
            };


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

            TableLayout _table = (TableLayout)FindViewById(Resource.Id.table);

            var layoutParams = new TableRow.LayoutParams(
                    ViewGroup.LayoutParams.MatchParent,
                    ViewGroup.LayoutParams.MatchParent);
           
            // create buttons in a loop
            for (int i = 0; i < 27; i++)
            {
                TableRow tableRow = new TableRow(this);
                TextView Lbl = new TextView(this);
                Lbl.Text = "PIN - "+i;
                Button button = new Button(this);
                Button button2 = new Button(this);
                button.Text = "Turn Pin " + i + " ON";
                button2.Text = "Turn Pin " + i + " OFF";
                button.Tag = "ON:"+i;
                button2.Tag = "OFF:" + i;
                // R.id won't be generated for us, so we need to create one
                //button.Id = i;
                button.Click += Button_Click;
                button2.Click += Button_Click;
                button.LayoutParameters = layoutParams;
                button2.LayoutParameters = layoutParams;

                tableRow.AddView(Lbl, 0);
                tableRow.AddView(button, 1);
                tableRow.AddView(button2, 2);

                _table.AddView(tableRow, 0);
            }
          
         
            

        }