Example #1
0
        private void InitUI()
        {
            var root = new TableLayout(this);

            root.SetPadding(0, 20, 0, 0);

            //add buttons
            var buttonLayout = new LinearLayout(this);

            root.AddView(buttonLayout);

            selectFolderButton = new Button(this)
            {
                Text = "Select Folder",
            };
            selectFolderButton.Click += BrowseOnClick;
            buttonLayout.AddView(selectFolderButton);

            readWriteButton = new Button(this)
            {
                Text = "Read & Write",
            };
            readWriteButton.Click += ReadWriteClick;
            buttonLayout.AddView(readWriteButton);

            readZipButton = new Button(this)
            {
                Text = "Read Zip Contents",
            };
            readZipButton.Click += ReadZipClick;
            buttonLayout.AddView(readZipButton);

            //add uri
            uriView = new TextView(this)
            {
                Text = "Uri: ",
            };
            root.AddView(uriView);

            //add text
            infoView = new TextView(this)
            {
                TextSize = 20,
                Text     = StorageUri == null ? "Info: First \"Select Folder\" then press \"Read & Write\" to check access." : "",
            };
            root.AddView(infoView);
            SetContentView(root);
        }
Example #2
0
        public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(theContext).Inflate(Resource.Layout.theMatAppAdapter, null, false);
            }


            TableLayout theItem = row.FindViewById <TableLayout> (Resource.Id.tableLayout1);

            theItem.Focusable            = false;
            theItem.FocusableInTouchMode = false;
            theItem.RemoveAllViews();
            /// UI code for the TableLayout , theItem.

            theItem.SetPadding(1, 20, 20, 10);
            theItem.SetHorizontalGravity(GravityFlags.Center);
            theItem.Clickable = true;
            Expression CurrentExpression = theExpressionList [position];

            TextView theStatement = StyleCSCode.MatAppStyleCSCode.StyledTextView(theContext);             //Text view to print the give Statement of the Expression.

            theStatement.Text = "Statement : \t\t\t" + CurrentExpression.getStatement() + "\t\t\t";
            theStatement.SetTextSize(ComplexUnitType.Dip, 12);
            theStatement.TextAlignment = TextAlignment.TextEnd;
            theItem.AddView(theStatement);

            if (CurrentExpression.getExpType() == 2)
            {
                var text = StyleCSCode.MatAppStyleCSCode.StyledTextView(theContext);                 //new TextView (theContext);
                text.Text = $"{CurrentExpression.getTag()} = {(CurrentExpression.getNumber().getNumber())}";
                theItem.AddView(text);
            }

            if (CurrentExpression.getExpType() == 1)
            {
                Matrix theMatrix    = CurrentExpression.getMatrix();
                var    theMatrixTag = StyleCSCode.MatAppStyleCSCode.StyledTextView(theContext);              //new TextView (theContext);
                theMatrixTag.SetTypeface(Android.Graphics.Typeface.Serif, Android.Graphics.TypefaceStyle.Normal);

                theMatrixTag.Text = $"{theMatrix.getTag()} = ";
                theItem.AddView(theMatrixTag);
                for (int c = 1; c <= theMatrix.getRows(); c++)
                {
                    var theText = StyleCSCode.MatAppStyleCSCode.StyledTextView(theContext);                     //new TextView (theContext);
                    theText.TextAlignment = TextAlignment.Center;
                    theText.Text          = "";
                    string theString = "\t\t\t";
                    for (int c1 = 1; c1 <= theMatrix.getColumns(); c1++)
                    {
                        theString += "\t\t\t" + Math.Round(theMatrix.getElement(c, c1), 6);
                    }
                    theString   += "\t\t\t\t\t\t";
                    theText.Text = theString;
                    theItem.AddView(theText);
                }
            }
            return(row);
        }