コード例 #1
0
        private void ResetOrder()
        {
            currentOrder = new OrderModel(svc.GetNewOrderId(), true, svc.GetNewOrderNumber());

            orderTitleView.Text   = "Order #" + currentOrder.OrderNumber.ToString();
            customerTypeText.Text = "Patient";

            layout.RemoveAllViews();

            nameViews.Clear();
            priceViews.Clear();
            deleteButtons.Clear();
            editButtons.Clear();

            if (container.Parent.Parent is CurrentOrderLayout)
            {
                totalView.SetPadding(120, 10, 0, 10);
            }
            else
            {
                totalView.SetPadding(580, 10, 0, 10);
            }

            totalView.Text = "£ 0.00";

            ((VariationsFragment)((CurrentOrderLayout)container.Parent.Parent).LeftFragment).Reset();
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.CommentLayout);

            post_id = Intent.GetStringExtra("post_id");

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = Intent.GetStringExtra("Titulo");
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            DashboardController = new EscritorioController();
            post = DashboardController.GetSinglePost(post_id);
            FillPost();
            svComentarios = FindViewById <ScrollView>(Resource.Id.svComentarios);
            tlComentarios = FindViewById <TableLayout>(Resource.Id.comment_table);
            comentarios   = DashboardController.GetComentariosPost(post_id, localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"), page, sizePage);
            if (Convert.ToInt32(Intent.GetStringExtra("comments_total")) > 0)
            {
                tlComentarios.RemoveAllViews();
                FillComments();
            }
            SwipeRefreshLayout refresher = FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_container);

            refresher.SetColorSchemeColors(Color.Gray, Color.LightGray, Color.Gray, Color.DarkGray, Color.Black, Color.DarkGray);
            refresher.Refresh += (sender, e) =>
            {
                comentarios = DashboardController.GetComentariosPost(post_id, localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"), page, sizePage);
                if (comentarios.Count != 0)
                {
                    tlComentarios.RemoveAllViews();
                    FillComments();
                }
                ((SwipeRefreshLayout)sender).Refreshing = false;
            };
            svComentarios.ScrollChange += (sender, e) =>
            {
                if ((comentarios.Count / (page + 1)) < sizePage - 1)
                {
                    if ((((ScrollView)sender).ScrollY / (page + 1)) > ((svComentarios.Height) * .4))
                    {
                        ++page;
                        FillComments();
                    }
                }
            };
        }
コード例 #3
0
        void FillHistorial()
        {
            TableLayout table = SalasView.FindViewById <TableLayout>(Resource.Id.historial_table);

            table.RemoveAllViews();
            historico.AsParallel().ToList().ForEach(reservacion =>
            {
                LayoutInflater inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
                View ReservaView        = inflater.Inflate(Resource.Layout.ReservacionElementoLayout, null, true);
                ReservaView.FindViewById <GridLayout>(Resource.Id.glReservacion).SetMinimumWidth(context.Resources.DisplayMetrics.WidthPixels);
                ReservaView.FindViewById <TextView>(Resource.Id.lblSalaJunta).Text     = reservacion.Sala_Descripcion;
                ReservaView.FindViewById <TextView>(Resource.Id.lblDiaSemana).Text     = DateTime.Parse(reservacion.Sala_Fecha).Day.ToString();
                ReservaView.FindViewById <TextView>(Resource.Id.lblDia).Text           = DateTime.Parse(reservacion.Sala_Fecha).DayOfWeek.ToString();
                ReservaView.FindViewById <TextView>(Resource.Id.lblHorario).Text       = reservacion.Sala_Hora_Inicio.Substring(0, 5) + " - " + reservacion.Sala_Hora_Fin.Substring(0, 5);
                ReservaView.FindViewById <ImageButton>(Resource.Id.btnCancelar).Click += delegate
                {
                    if (controller.CancelarSalaJuntas("Baja", reservacion.Sala_Junta_Reservacion_Id))
                    {
                        Toast.MakeText(context, Resource.String.str_meeting_room_canceled, ToastLength.Short).Show();
                        historico.Remove(reservacion);
                        HistorialValidation();
                    }
                    else
                    {
                        Toast.MakeText(context, Resource.String.ErrorIntento, ToastLength.Short).Show();
                    }
                };

                TableRow row = new TableRow(context);
                row.AddView(ReservaView);
                table.AddView(row);
            });
        }
コード例 #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 BtnRGExamItem_Click(object sender, EventArgs e)
        {
            //人工评判
            var text   = ((Button)sender).Text;
            var result = GetDeductionRule(text);

            RGSelectExamItem = text;
            // View view = View.Inflate(this, Resource.Layout.Dialog_ArtificialEvaluation, null);
            TableLayout tableLayout         = (TableLayout)alertDialog.FindViewById(Resource.Id.DeductionRuleTable);
            TableLayout tableLayoutExamItem = (TableLayout)alertDialog.FindViewById(Resource.Id.ExamItemBtnTable);

            //清空所有的 扣分规则
            tableLayout.RemoveAllViews();
            foreach (var item in result)
            {
                TableRow tableRow          = (TableRow)LayoutInflater.From(this).Inflate(Resource.Layout.tableArtificialEvaluation, null);
                TextView tvDeductionReason = (TextView)tableRow.FindViewById(Resource.Id.tvDeductionReason);
                TextView tvDeductionScore  = (TextView)tableRow.FindViewById(Resource.Id.tvDeductionScore);
                Button   btnDeduction      = (Button)tableRow.FindViewById(Resource.Id.btnDeduction);
                tvDeductionReason.Text = item.RuleName;
                tvDeductionScore.Text  = item.DeductedScores.ToString();
                btnDeduction.Text      = "扣分";
                btnDeduction.Tag       = item.RuleCode + "," + item.SubRuleCode;
                btnDeduction.Click    += BtnDeduction_Click;
                tableLayout.AddView(tableRow);
            }
        }
コード例 #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
            SetContentView(Resource.Layout.DataStream);
            layout = FindViewById<TableLayout>(Resource.Id.tableLayout);
            layout.RemoveAllViews();

            protocolFuncs = new Dictionary<string, ProtocolFunc>();
            protocolFuncs[Database.GetText("QM125T-8H", "QingQi")] = OnSynerjectProtocol;
            protocolFuncs[Database.GetText("QM200GY-F", "QingQi")] = OnMikuniProtocol;
            protocolFuncs[Database.GetText("QM250GY", "QingQi")] = OnSynerjectProtocol;
            protocolFuncs[Database.GetText("QM250T", "QingQi")] = OnSynerjectProtocol;
            protocolFuncs[Database.GetText("QM200-3D", "QingQi")] = OnMikuniProtocol;
            protocolFuncs[Database.GetText("QM200J-3L", "QingQi")] = OnMikuniProtocol;
            protocolFuncs[Database.GetText("QM250J-2L", "QingQi")] = OnVisteonProtocol;
            protocolFuncs[Database.GetText("QM250J-2L", "QingQi") + "Freeze"] = OnVisteonFreezeProtocol;

            backFuncs = new Dictionary<string, ProtocolFunc>();
            backFuncs[Database.GetText("QM125T-8H", "QingQi")] = OnSynerjectBack;
            backFuncs[Database.GetText("QM200GY-F", "QingQi")] = OnMikuniBack;
            backFuncs[Database.GetText("QM250GY", "QingQi")] = OnSynerjectBack;
            backFuncs[Database.GetText("QM250T", "QingQi")] = OnSynerjectBack;
            backFuncs[Database.GetText("QM200-3D", "QingQi")] = OnMikuniBack;
            backFuncs[Database.GetText("QM200J-3L", "QingQi")] = OnMikuniBack;
            backFuncs[Database.GetText("QM250J-2L", "QingQi")] = OnVisteonBack;
            backFuncs[Database.GetText("QM250J-2L", "QingQi") + "Freeze"] = OnVisteonFreezeBack;
        }
コード例 #7
0
            protected override void OnPostExecute(string result)
            {
                TextView tv = present_Activity.FindViewById <TextView>(Resource.Id.textViewStatus);

                tv.Text = result;

                TableLayout tl = (TableLayout)present_Activity.FindViewById(Resource.Id.tableView);

                tl.RemoveAllViews();
                foreach (TableRow row in rows)
                {
                    tl.AddView(row);
                }
            }
コード例 #8
0
        private void UpdateHeartView()
        {
            TableLayout tableLayout = FindViewById <TableLayout>(Resource.Id.tableLayout1);

            tableLayout.RemoveAllViews();

            List <TsumTsumSender> tableList;

            int sortingType = Settings.GetInt("sortingType", 0);

            switch (sortingType)
            {
            case 0:     // Alphabetic
                tableList = tsumTsumDatabaseManager.PerformRawQuery <TsumTsumSender>($"SELECT * FROM Senders ORDER BY SenderName COLLATE NOCASE ASC, HeartCount DESC");
                break;

            case 1:     // Heartcount
                tableList = tsumTsumDatabaseManager.PerformRawQuery <TsumTsumSender>($"SELECT * FROM Senders ORDER BY HeartCount DESC, SenderName COLLATE NOCASE ASC");
                break;

            case 2:     // Time (TODO)
                tableList = tsumTsumDatabaseManager.PerformRawQuery <TsumTsumSender>($"SELECT * FROM Senders ORDER BY LastReceiveTimestamp DESC, SenderName COLLATE NOCASE ASC");
                break;

            default:
                throw new NotImplementedException();
            }

            tableLayout.AddView(CreateRow("#", "Name", "Total", "Last Received", true), 0);

            for (int i = 0; i < tableList.Count; i++)
            {
                TsumTsumSender sender = tableList[i];

                TableRow row = CreateRow(
                    (i + 1).ToString(),
                    sender.SenderName,
                    sender.HeartCount.ToString(),
                    string.Format("{0} {1}", sender.LastReceiveTimestamp.ToString("t"), sender.LastReceiveTimestamp.ToString("d"))
                    );


                tableLayout.AddView(row, i + 1);
            }
        }
コード例 #9
0
        public void SetMathWithAnswersTable(Operacije pOperacija, TableLayout pTable)
        {
            List <CRecord> listOfRecords = App.db.GetTopThreeRecords(pOperacija, App.MathWithAnswersCode);

            pTable.RemoveAllViews();

            if (listOfRecords == null || listOfRecords.Count == 0)
            {
                var prazanRed = Activity.LayoutInflater.Inflate(Resource.Layout.matematika_sa_odgovorima_record_row, null);
                prazanRed.FindViewById <TextView>(Resource.Id.broj_pogodjenih).Text = GetString(Resource.String.nema_rezultata);
                pTable.AddView(prazanRed);
                return;
            }

            var zaglavlje = Activity.LayoutInflater.Inflate(Resource.Layout.matematika_sa_odgovorima_record_row, null);

            zaglavlje.FindViewById <TextView>(Resource.Id.broj_pogodjenih).Text = GetString(Resource.String.tacnih_odgovora);
            zaglavlje.FindViewById <TextView>(Resource.Id.vreme).Text           = GetString(Resource.String.vreme);
            pTable.AddView(zaglavlje);

            int i = 0;

            foreach (var record in listOfRecords)
            {
                var view = Activity.LayoutInflater.Inflate(Resource.Layout.matematika_sa_odgovorima_record_row, null);
                if (i == 0)
                {
                    view.FindViewById <ImageView>(Resource.Id.star).SetImageResource(Resource.Drawable.ic_star_g);
                }
                else if (i == 1)
                {
                    view.FindViewById <ImageView>(Resource.Id.star).SetImageResource(Resource.Drawable.ic_star_s);
                }
                else if (i == 2)
                {
                    view.FindViewById <ImageView>(Resource.Id.star).SetImageResource(Resource.Drawable.ic_star_b);
                }

                view.FindViewById <TextView>(Resource.Id.broj_pogodjenih).Text = record.Result.ToString();
                view.FindViewById <TextView>(Resource.Id.vreme).Text           = record.Time.ToString();

                pTable.AddView(view);
                i++;
            }
        }
コード例 #10
0
        private void SetMeasurements(IEnumerable <Tuple <string, double, string, double> > measurements)
        {
            if (measurements == null)
            {
                return;
            }
            TableLayout tableLayout = ItemView.FindViewById <TableLayout>(Resource.Id.highlight_wrapper);

            tableLayout.RemoveAllViews();
            foreach (var tuple in measurements)
            {
                var row = LayoutInflater.From(ItemView.Context).Inflate(Resource.Layout.HighlightItemRow, null);
                row.FindViewById <TextView>(Resource.Id.description).Text         = tuple.Item1;
                row.FindViewById <TextView>(Resource.Id.current_measurement).Text = $"{tuple.Item2}{tuple.Item3}";
                var gainLoss = row.FindViewById <TextView>(Resource.Id.gain_loss);
                gainLoss.Text = $"{Math.Abs(tuple.Item4)}{tuple.Item3}";
                gainLoss.SetTextColor((tuple.Item4 > 0 ? gainColor : lossColor));
                tableLayout.AddView(row);
            }
        }
コード例 #11
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.logout:
                //Console.WriteLine ("Log out!");
                Activity.StartActivity(typeof(LoginActivity));
                LocationManager locMgr;
                locMgr = (LocationManager)this.Activity.GetSystemService(Context.LocationService);
                //run the alert in UI thread to display in the screen

                //Activity.StartActivity (typeof(LoginActivity));
                //LocationManager locMgr;
                //locMgr = (LocationManager)this.Activity.GetSystemService (Context.LocationService);
                locMgr.RemoveUpdates((ILocationListener)this.Activity);
                DataController.addresses = null;
                DataController.coords    = null;
                return(true);

            case Resource.Id.menu_refresh:
                if (checkNetwork())
                {
                    TableLayout tl = (TableLayout)this.View.FindViewById(Resource.Id.table);
                    tl.RemoveAllViews();
                    if (DataController.coords != null)
                    {
                        DataController.coords.Clear();
                    }
                    drawTable(this.View);
                }
                else
                {
                    showNetworkError();
                }
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
コード例 #12
0
        /**
         * Display your menu. Not we require a view from the parent.  This is so we can get
         * a window token.  It doesn't matter which view on the parent is passed in.
         * @param View v
         * @return void
         */
        public void Show(View v, GravityFlags screenLocation, bool enableSelectedIndicator)
        {
            if (table != null && table.Visibility == ViewStates.Gone)
            {
                Reshow();
                return;
            }

            if (mIsShowing)
            {
                return;
            }

            int itemCount = mMenuItems.Count;

            if (itemCount < 1)
            {
                return;
            }

            if (imageViewList.Count > 0)
            {
                imageViewList.Clear();
            }
            if (badgeTextViewList.Count > 0)
            {
                badgeTextViewList.Clear();
            }
            if (titleViewList.Count > 0)
            {
                titleViewList.Clear();
            }
            if (indicatorList.Count > 0)
            {
                indicatorList.Clear();
            }

            mView       = mLayoutInflater.Inflate(UIHelper.GetResource(UIHelper.Layout, "custom_menu"), null);
            tableParent = mView.FindViewById(UIHelper.GetResource(UIHelper.Id, "table_parent")) as LinearLayout;

            if (mView == null)
            {
                return;
            }

            var tableId = UIHelper.GetResource(UIHelper.Id, "custom_menu_table");

            table = (TableLayout)mView.FindViewById(tableId);
            if (table == null)
            {
                return;
            }

            var windowManager = (mContext as Activity).WindowManager;

            table.RemoveAllViews();

            TableRow row     = null;
            TextView tv      = null;
            TextView tvBadge = null;
            TextView selected_item_indicator = null;

            ImageView iv = null;

            row = new TableRow(mContext);
            row.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
            for (int j = 0; j < mItemsCount; j++)
            {
                if (j >= itemCount)
                {
                    break;
                }

                CustomMenuItem cmi        = mMenuItems.ElementAt(j);
                View           itemLayout = mLayoutInflater.Inflate(UIHelper.GetLayoutResource("custom_menu_item"), null);
                tv = (TextView)itemLayout.FindViewById(UIHelper.GetId("custom_menu_item_caption"));
                tv.SetTextColor(this.textColor);

                if (String.IsNullOrEmpty(cmi.Caption))
                {
                    tv.Visibility = ViewStates.Gone;
                }
                else
                {
                    tv.Text       = cmi.Caption;
                    tv.Visibility = ViewStates.Visible;
                }
                titleViewList.Add(tv);

                iv = (ImageView)itemLayout.FindViewById(UIHelper.GetId("custom_menu_item_icon"));

                if (cmi.ImageResourceId > 0)
                {
                    iv.SetImageResource(cmi.ImageResourceId);
                }

                iv.Tag = cmi.Id;
                imageViewList.Add(iv);

                selected_item_indicator = itemLayout.FindViewById(UIHelper.GetId("selected_item_indicator")) as TextView;
                if (enableSelectedIndicator)
                {
                    selected_item_indicator.Visibility = ViewStates.Visible;
                }

                indicatorList.Add(selected_item_indicator);

                tvBadge = itemLayout.FindViewById(UIHelper.GetId("custom_badge")) as TextView;

                if (String.IsNullOrEmpty(cmi.Badge))
                {
                    tvBadge.Visibility = ViewStates.Gone;
                }
                else
                {
                    int badgeCount = int.Parse(cmi.Badge);
                    if (badgeCount > 0)
                    {
                        tvBadge.Text = badgeCount.ToString();
                        //tvBadge.SetBackgroundDrawable(drawbg(tvBadge));
                        tvBadge.Visibility = ViewStates.Visible;

                        //if (Build.VERSION.SdkInt <= Android.OS.BuildVersionCodes.JellyBean)
                        //{
                        //    //TODO: Fix x location of badge
                        //    tvBadge.SetX(iv.GetX() + iv.Drawable.IntrinsicWidth);
                        //}
                    }
                }
                badgeTextViewList.Add(tvBadge);

                itemLayout.Click += delegate(object sender, EventArgs e)
                {
                    if (EnableClickingTab)
                    {
                        selectedIndex = cmi.Id;
                        mListener.MenuItemSelectedEvent(cmi, imageViewList, titleViewList);
                    }
                };

                row.AddView(itemLayout);
            }

            if (selectedIndex >= 0)
            {
                if (mMenuItems.ElementAt(selectedIndex).ActiveImageId > 0)
                {
                    imageViewList.ElementAt(selectedIndex).SetImageResource(mMenuItems.ElementAt(selectedIndex).ActiveImageId);
                }

                titleViewList.ElementAt(selectedIndex).SetTextColor(selectedTextColor);
                indicatorList.ElementAt(selectedIndex).SetBackgroundColor(selectedTextColor);

                //var ivParent = (RelativeLayout)imageViewList[selectedIndex].Parent.Parent;
                //ivParent.Background = mContext.Resources.GetDrawable(UIHelper.GetDrawableResource("my_menu_item_pressed"));
            }

            table.AddView(row);

            mIsShowing = true;
        }
コード例 #13
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);
            }
        }
コード例 #14
0
        public void FillMenu()
        {
            TableLayout menuLayout = context.FindViewById <TableLayout>(Resource.Id.menu_layout);

            menuLayout.RemoveAllViews();
            menuLayout.SetMinimumWidth(context.Resources.DisplayMetrics.WidthPixels);
            ListMenu.Where((ItemsMenu arg) => arg.Menu_Padre_Id == (localStorage.Get("Parent") ?? "")).AsParallel().ToList().ForEach(menu =>
            {
                TableRow row = new TableRow(context);
                View line    = new View(context);
                line.SetBackgroundColor(Color.LightGray);
                line.SetMinimumWidth(context.Resources.DisplayMetrics.WidthPixels);
                line.SetMinimumHeight(2);
                row.AddView(line);
                menuLayout.AddView(row);
                row = new TableRow(context);

                /*Drawable icon = ContextCompat.GetDrawable(context, context.Resources.GetIdentifier(menu.Image, "mipmap", context.PackageName));
                 * if ((int)Build.VERSION.SdkInt > 22)
                 *  icon.SetTintList(context.GetColorStateList(Resource.Color.comment_pressed));
                 * else
                 *  DrawableCompat.SetTint(icon, ContextCompat.GetColor(context, Resource.Color.comment_pressed));
                 * icon.SetBounds(0, 0, 30, 30);*/
                Button btnMenu = new Button(context)
                {
                    Text          = menu.Label,
                    TextAlignment = TextAlignment.ViewStart
                };
                btnMenu.SetTextColor(Color.White);
                btnMenu.Gravity = GravityFlags.CenterVertical | GravityFlags.Left;
                btnMenu.SetBackgroundColor(Color.Transparent);
                //btnMenu.SetCompoundDrawables(icon, null, null, null);
                btnMenu.Click += delegate
                {
                    Intent intent;
                    switch (menu.Controller)
                    {
                    case "SubMenuActivity":
                        localStorage.Put("Parent", menu.Menu_Id);
                        FillMenu();
                        break;

                    case "LogoutActivity":
                        localStorage.Delete("Usuario_Id"); localStorage.Delete("Usuario_Tipo");
                        context.StartActivity(new Intent(context, typeof(LoginActivity)));
                        context.Finish();
                        break;

                    case "DirectorioActivity":
                        intent = new Intent(context, typeof(DirectorioActivity));
                        intent.PutExtra("Titulo", menu.Label);
                        context.StartActivity(intent); break;

                    case "ComprasActivity":
                        intent = new Intent(context, typeof(ComprasActivity));
                        intent.PutExtra("Titulo", menu.Label);
                        context.StartActivity(intent); break;

                    case "ReservaSalaJuntasActivity":
                        if (new SalasJuntasController().CountReservaciones(localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo")) > 0)
                        {
                            intent = new Intent(context, typeof(SalaReunionesProgramaActivity));
                        }
                        else
                        {
                            intent = new Intent(context, typeof(ReservacionReunionActivity));
                        }
                        intent.PutExtra("Titulo", menu.Label);
                        context.StartActivity(intent); break;

                    case "RegistroInvitadosActivity":
                        //intent = new Intent(context, typeof(InvitadosActivity));
                        //intent.PutExtra("Titulo", menu.Label);
                        //context.StartActivity(intent);
                        break;

                    case "PerfilActivity":
                        intent = new Intent(context, typeof(PerfilCardActivity));
                        intent.PutExtra("Titulo", menu.Label);
                        intent.PutExtra("Miembro", JsonConvert.SerializeObject(new UsuariosController().GetMemberData(localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"))));
                        context.StartActivity(intent);
                        context.Finish();
                        break;

                    case "DatosFacturacionActivity":
                        intent = new Intent(context, typeof(DatosFacturacionActivity));
                        intent.PutExtra("Titulo", menu.Label);
                        context.StartActivity(intent); break;

                    case "AccesoActivity":
                        intent = new Intent(context, typeof(AccesoActivity));
                        intent.PutExtra("Titulo", menu.Label);
                        context.StartActivity(intent); break;

                    case "AboutUsActivity":
                        intent = new Intent(context, typeof(AboutUsActivity));
                        intent.PutExtra("Titulo", menu.Label);
                        context.StartActivity(intent); break;

                    default: break;
                    }
                };
                row.AddView(btnMenu);
                menuLayout.AddView(row);
            });
        }
コード例 #15
0
ファイル: MatAppAdapter.cs プロジェクト: PoweredByME/MatApp
        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);
        }
コード例 #16
0
        /// <summary>
        /// Add a String[] as titles
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="titles">The titles.</param>
        private void setTitles(TableLayout table, string[] titles)
        {
            int rowSize = titles.Length;

            if (table == null)
            {
                return;
            }
            table.RemoveAllViews();
            TableRow row = new TableRow(this);

            row.SetBackgroundColor(Color.Blue);
            for (int i = 0; i < rowSize; i++)
            {
                TextView c = new TextView(this);
                c.TextSize = _fontSize;
                c.Typeface = Typeface.DefaultBold;
                c.SetTextColor(Color.White);
                string title = titles[i];
                if (!string.IsNullOrWhiteSpace(_order) && title.Equals(FieldDisplayNames[FieldNames.IndexOf(_order)]))
                {
                    if (_increasing)
                    {
                        title += " ↓";
                    }
                    else
                    {
                        title += " ↑";
                    }
                }
                c.Text = title;
                c.SetPadding(3, 5, 3, 5);
                if (!_fieldMode)
                {
                    c.Click += (sender, e) =>
                    {
                        string newOrder = c.Text.ToString();
                        if (newOrder.EndsWith("↑") || newOrder.EndsWith("↓"))
                        {
                            newOrder = newOrder.Substring(0, newOrder.Length - 2);
                        }
                        newOrder = FieldNames[FieldDisplayNames.IndexOf(newOrder)];
                        // if same field clicked twice reverse sorting
                        if (newOrder.Equals(_order))
                        {
                            _increasing = !_increasing;
                        }
                        else
                        {
                            _order      = newOrder;
                            _increasing = true;
                        }
                        fillDataTableWithArgs();
                        updateData();
                    };
                }
                row.AddView(c);
            }
            TextView cS = new TextView(this);

            cS.TextSize = _fontSize;
            cS.Typeface = Typeface.DefaultBold;
            cS.SetPadding(5, 5, 5, 5);
            row.AddView(cS);
            table.AddView(row, new TableLayout.LayoutParams());
        }
コード例 #17
0
 private void UpdateLastKitchenInfo(Object sender, EventArgs args)
 {
     table.RemoveAllViews();
     AddLastKitchenInformation(userName);
 }
コード例 #18
0
 void ClearMap()
 {
     tableLayout1.RemoveAllViews();
     textView1.SetBackgroundColor(Color.Gray);
 }
コード例 #19
0
        public void drawTable(View view)
        {
            //Console.WriteLine ("inside drawable");
            TableLayout tl = (TableLayout)view.FindViewById(Resource.Id.table);
            //TableRow headers = (TableRow)view.FindViewById (Resource.Id.tableHeaders);
            TableLayout tb = (TableLayout)view.FindViewById(Resource.Id.tableHeaders);
            ScrollView  ts = (ScrollView)view.FindViewById(Resource.Id.tableScroll);

            string canvass = NetworkCalls.getJobs(DataController.token);

            if (DataController.canvassID != null)
            {
                string response = NetworkCalls.getProperties(DataController.token);
                //Console.WriteLine ("response got");
                addresses = DataController.addresses;
                //addresses = MockingController.getProperties();
            }
            else
            {
                Toast newProperties = new Toast(this.Activity);
                newProperties = Toast.MakeText(Activity.ApplicationContext, "There isn't an assined canvass!", ToastLength.Short);
                //Console.WriteLine("assigning canvass");
                newProperties.Show();
                return;
            }
            addresses = DataController.addresses;
            //Console.WriteLine("sharedPreference1");
            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(this.Activity);
            ISharedPreferencesEditor editor = prefs.Edit();


            if (prefs.Contains("properties"))
            {
                int currProperties = prefs.GetInt("properties", 0);
                if (currProperties < addresses.Count)
                {
                    //Console.WriteLine("prefs2");
                    int difference = addresses.Count - currProperties;
                    editor.PutInt("properties", addresses.Count);
                    Toast newProperties = new Toast(this.Activity);
                    //Console.WriteLine("prefs3");
                    newProperties = Toast.MakeText(Activity.ApplicationContext, "New Properties, You have " + difference + " new properties!", ToastLength.Short);
                    newProperties.Show();
                }
                else
                {
                    editor.PutInt("properties", addresses.Count);
                    //Console.WriteLine("prefsElse");
                }
            }
            else
            {
                //Console.WriteLine("prefs4");


                if (addresses != null)
                {
                    editor.PutInt("properties", addresses.Count);

                    Toast newProperties = new Toast(this.Activity);
                    newProperties = Toast.MakeText(Activity.ApplicationContext, "New Properties, You have " + addresses.Count + " new properties!", ToastLength.Short);
                    //Console.WriteLine("prefs5");
                    newProperties.Show();
                }
            }
            editor.Apply();



            if (addresses != null && addresses.Count > 0)
            {
                //tl = (TableLayout)view.FindViewById (Resource.Id.table);
                tl.StretchAllColumns = true;
                tl.BringToFront();
                TableRow headings = new TableRow(this.Activity);
                headings.SetBackgroundColor(Resources.GetColor(Resource.Color.headers));
                headings.Tag = "headers";
                TextView heading1 = new TextView(this.Activity);
                heading1.Text = " Address";
                heading1.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading1.TextSize = 15.0f;
                float density = this.Activity.Resources.DisplayMetrics.Density;
                heading1.SetWidth((int)(350 * density));
                TextView heading2 = new TextView(this.Activity);
                heading2.Text = "No Ans";
                heading2.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading2.TextSize = 15.0f;
                TextView heading3 = new TextView(this.Activity);
                heading3.Text = "Empty";
                heading3.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading3.TextSize = 15.0f;
                TextView heading4 = new TextView(this.Activity);
                heading4.Text = "Derelict";
                heading4.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading4.TextSize = 15.0f;
                TextView heading5 = new TextView(this.Activity);
                heading5.Text = "HEF R";
                heading5.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading5.TextSize = 15.0f;
                TextView heading7 = new TextView(this.Activity);
                heading7.Text = "HEF D";
                heading7.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading7.TextSize = 15.0f;

                TextView heading8 = new TextView(this.Activity);
                heading8.Text = "ITR";
                heading8.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading8.TextSize = 15.0f;

                TextView heading6 = new TextView(this.Activity);
                heading6.Text = "Residents";
                heading6.SetTextColor(Resources.GetColor(Resource.Color.odd));
                heading6.TextSize = 15.0f;


                headings.AddView(heading1);
                headings.AddView(heading2);
                headings.AddView(heading3);
                headings.AddView(heading4);
                headings.AddView(heading5);
                headings.AddView(heading7);
                headings.AddView(heading8);
                headings.AddView(heading6);
                tl.AddView(headings);

                for (int i = 0; i < addresses.Count; i++)
                {
                    //Dictionary<string, object> propertyDict = new Dictionary<string, object> ();

                    propertyDict = addresses [i];
                    //Console.WriteLine("for");

                    TableRow tr = new TableRow(this.Activity);

                    tr.Tag = propertyDict ["uprn"].ToString();
                    tr.Id  = i;

//					if (propertyDict ["status"].ToString () != "NV" && propertyDict ["status"].ToString () != "VNA") {
//						tr.SetBackgroundColor (Resources.GetColor (Resource.Color.highlight));
//						rowToLock = tr;
//					} else
                    if (propertyDict ["visitCount"].ToString() == "3")
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.highlight));
                    }
                    else
                    if (i % 2 == 0)
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.even));
                    }
                    else
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.odd));
                    }

                    TextView address = new TextView(this.Activity);
                    //Console.WriteLine("assign1");

                    address.Text = propertyDict ["fullAddress"].ToString();
                    address.Tag  = propertyDict ["canvassID"].ToString();
                    //Console.WriteLine("assign 2");
                    address.TextSize = 18.0f;
                    address.SetTextColor(Resources.GetColor(Resource.Color.tableText));
                    float density1 = this.Activity.Resources.DisplayMetrics.Density;
                    address.SetWidth((int)(350 * density1));
                    address.SetPadding(5, 5, 0, 5);
                    address.LongClick += (object sender, View.LongClickEventArgs e) =>
                    {
                        unlockRow(tr.Tag.ToString());
                    };

                    CheckBox noAnswer = new CheckBox(this.Activity);
                    noAnswer.Tag = propertyDict ["uprn"].ToString();
                    noAnswer.Id  = 0;
                    string visitCount = propertyDict ["visitCount"].ToString();
                    noAnswer.Text = propertyDict ["visitCount"].ToString();
                    if (Convert.ToInt32(noAnswer.Text) == 0)
                    {
                        noAnswer.Text = "";
                    }
                    else if (Convert.ToInt32(noAnswer.Text) == 2)
                    {
                        noAnswer.SetTextColor(Resources.GetColor(Resource.Color.secondVisit));
                    }
                    else if (Convert.ToInt32(noAnswer.Text) == 3)
                    {
                        noAnswer.Checked = true;
                        noAnswer.Enabled = false;
                        noAnswer.SetTextColor(Resources.GetColor(Resource.Color.thirdVisit));
                    }
                    else
                    {
                        noAnswer.SetTextColor(Resources.GetColor(Resource.Color.tableText));
                    }
                    noAnswer.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkNoAnswer(noAnswer);
                    };

                    CheckBox empty = new CheckBox(this.Activity);
                    empty.Tag = propertyDict ["uprn"].ToString();
                    empty.Id  = 1;
                    if (propertyDict ["status"].ToString() == "E")
                    {
                        empty.Checked = true;
                    }
                    if (noAnswer.Text == "3")
                    {
                        empty.Enabled = false;
                    }
                    empty.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkEmpty(empty);
                    };

                    CheckBox derelict = new CheckBox(this.Activity);
                    derelict.Tag = propertyDict ["uprn"].ToString();
                    derelict.Id  = 2;
                    if (propertyDict ["status"].ToString() == "D")
                    {
                        derelict.Checked = true;
                    }
                    if (noAnswer.Text == "3")
                    {
                        derelict.Enabled = false;
                    }
                    derelict.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkDerelict(derelict);
                    };

                    CheckBox postalRequest = new CheckBox(this.Activity);
                    postalRequest.Tag = propertyDict ["uprn"].ToString();
                    postalRequest.Id  = 3;

                    if (propertyDict ["status"].ToString() == "HEF-R")
                    {
                        postalRequest.Checked = true;
                    }
                    if (noAnswer.Text == "3")
                    {
                        postalRequest.Enabled = false;
                    }
                    postalRequest.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkRequestPostal(postalRequest);
                    };

                    CheckBox DeliveredRequest = new CheckBox(this.Activity);
                    DeliveredRequest.Tag = propertyDict ["uprn"].ToString();
                    DeliveredRequest.Id  = 4;

                    if (propertyDict ["status"].ToString() == "HEF-D")
                    {
                        DeliveredRequest.Checked = true;
                    }
                    if (noAnswer.Text == "3")
                    {
                        DeliveredRequest.Enabled = false;
                    }
                    DeliveredRequest.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                        checkDeliveredRequest(DeliveredRequest);
                    };


                    ImageView itr = new ImageView(this.Activity);
                    itr.Tag = propertyDict ["canvassID"].ToString();
                    itr.SetPadding(5, 5, 0, 5);

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



                    ImageButton residents = new ImageButton(this.Activity);
                    residents.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.residents));
                    residents.Background = null;
                    residents.Tag        = propertyDict ["uprn"].ToString();
                    if (DataController.fileType == "HALAROSE")
                    {
                        residents.Id = Convert.ToInt32(propertyDict ["houseID"].ToString());
                    }

                    //residents.Id = i;
                    if (noAnswer.Text == "3")
                    {
                        //residents.Enabled = false;
                    }
                    residents.Click += (object sender, EventArgs e) => {
                        showResidents(residents);
                    };



                    tr.AddView(address);
                    tr.AddView(noAnswer);
                    tr.AddView(empty);
                    tr.AddView(derelict);
                    tr.AddView(postalRequest);
                    tr.AddView(DeliveredRequest);
                    tr.AddView(itr);
                    tr.AddView(residents);
                    tl.AddView(tr);
                    if (rowToLock != null)
                    {
                        lockRow(rowToLock);
                        rowToLock = null;
                    }
                }
                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);
                //tb.AddView(tl);
                //tb.AddView (tl);
            }
            else
            {
                Toast changed = new Toast(this.Activity);
                changed = Toast.MakeText(Activity.ApplicationContext, "No Properties, You have not been assigned any properties.", ToastLength.Long);
                changed.Show();
            }
        }
コード例 #20
0
        async void FillComments()
        {
            AndHUD.Shared.Show(this, null, -1, MaskType.Black);
            await Task.Delay(500);

            comentarios.Skip(page * sizePage).Take(sizePage).AsParallel().ToList().ForEach(comentario =>
            {
                LayoutInflater liView = LayoutInflater;
                View CommentView      = liView.Inflate(Resource.Layout.PostLayout, null, true);
                CommentView.SetMinimumWidth(Resources.DisplayMetrics.WidthPixels);
                //string Usuario_Id = !string.IsNullOrEmpty(comentario.Miembro_Id) ? comentario.Miembro_Id : comentario.Colaborador_Empresa_Id;
                KeyValuePair <string, string> current = new KeyValuePair <string, string>(comentario.Usuario.Usuario_Id, comentario.Usuario.Usuario_Tipo);
                ImageButton imgPerfil = CommentView.FindViewById <ImageButton>(Resource.Id.imgPerfil);

                if (Usuario_Fotos_Perfil.ContainsKey(current))
                {
                    if (Usuario_Fotos_Perfil[current] != null)
                    {
                        imgPerfil.SetImageBitmap(BitmapFactory.DecodeByteArray(Usuario_Fotos_Perfil[current], 0, Usuario_Fotos_Perfil[current].Length));
                    }
                    else
                    {
                        imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
                    }
                }
                else
                {
                    comentario.Usuario.Usuario_Fotografia_Perfil = new UploadImages().DownloadFileFTP(comentario.Usuario.Usuario_Fotografia, usuario_imagen_path);
                    Usuario_Fotos_Perfil.Add(current, comentario.Usuario.Usuario_Fotografia_Perfil);
                    if (comentario.Usuario.Usuario_Fotografia_Perfil != null)
                    {
                        imgPerfil.SetImageBitmap(BitmapFactory.DecodeByteArray(comentario.Usuario.Usuario_Fotografia_Perfil, 0, comentario.Usuario.Usuario_Fotografia_Perfil.Length));
                    }
                    else
                    {
                        imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
                    }
                }

                /*if (comentario.Usuario.Usuario_Fotografia_Perfil != null)
                 *  imgPerfil.SetImageBitmap(BitmapFactory.DecodeByteArray(comentario.Usuario.Usuario_Fotografia_Perfil, 0, comentario.Usuario.Usuario_Fotografia_Perfil.Length));
                 * else
                 *  imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
                 * imgPerfil.Click += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo));*/

                TextView lblNombre = CommentView.FindViewById <TextView>(Resource.Id.lblNombre);
                lblNombre.Text     = comentario.Usuario.Usuario_Nombre;
                lblNombre.Click   += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo));

                TextView lblPuesto = CommentView.FindViewById <TextView>(Resource.Id.lblPuesto);
                lblPuesto.Text     = comentario.Usuario.Usuario_Puesto;

                TextView lblFecha = CommentView.FindViewById <TextView>(Resource.Id.lblFecha);
                lblFecha.Text     = comentario.Comentario_Fecha;

                TextView lblPost = CommentView.FindViewById <TextView>(Resource.Id.lblPost);
                lblPost.SetMaxWidth(Convert.ToInt32(Resources.DisplayMetrics.WidthPixels * .911));
                lblPost.Text = comentario.Comentario_Contenido;

                TextView lblLike  = CommentView.FindViewById <TextView>(Resource.Id.lblLikeText);
                lblLike.Text      = comentario.Comentario_Me_Gustan_Cantidad + " " + Resources.GetString(Resource.String.str_dashboard_likes);
                ImageView imgLike = CommentView.FindViewById <ImageView>(Resource.Id.imgLikes);
                lblLike.Click    += delegate
                {
                    string transaccion = "ALTA";
                    if (post.Publicacion_Me_Gusta_Usuario == ((int)TiposMeGusta.Activo).ToString())
                    {
                        transaccion = "BAJA";
                    }
                    else if (post.Publicacion_Me_Gusta_Usuario == ((int)TiposMeGusta.Baja).ToString())
                    {
                        transaccion = "MODIFICAR";
                    }
                    if (new EscritorioController().CommentLike(comentario.Comentario_Id, localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"), transaccion))
                    {
                        lblLike.Text = new EscritorioController().GetLikesComments(comentario.Comentario_Id) + " " + Resources.GetString(Resource.String.str_dashboard_likes);
                        if (transaccion == "BAJA")
                        {
                            post.Publicacion_Me_Gusta_Usuario = "0";
                            lblLike.SetTextColor(Color.Black);
                            imgLike.SetColorFilter(Resources.GetColor(Resource.Color.button_unpressed));
                        }
                        else
                        {
                            post.Publicacion_Me_Gusta_Usuario = "1";
                            lblLike.SetTextColor(Color.Rgb(57, 87, 217));
                            imgLike.SetColorFilter(Resources.GetColor(Resource.Color.like_heart_pressed));
                        }
                    }
                };
                if (comentario.Comentario_Me_Gusta_Usuario == ((int)TiposMeGusta.Activo).ToString())
                {
                    lblLike.SetTextColor(Color.Rgb(57, 87, 217));
                    imgLike.SetColorFilter(Resources.GetColor(Resource.Color.like_heart_pressed));
                }
                CommentView.FindViewById <TextView>(Resource.Id.lblComentariosText).Visibility = ViewStates.Invisible;

                CommentView.FindViewById <ImageView>(Resource.Id.imgMore).Click += delegate
                {
                    using (PopupMenu menuPost = new PopupMenu(this, CommentView.FindViewById <ImageView>(Resource.Id.imgMore)))
                    {
                        menuPost.Inflate(Resource.Menu.post_reporte_menu);
                        menuPost.MenuItemClick += delegate
                        {
                            if (DashboardController.OcultarComment(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo, comentario.Publicacion_Id, comentario.Comentario_Id))
                            {
                                Toast.MakeText(this, "Comentario eliminado", ToastLength.Short).Show();
                                page        = 0;
                                comentarios = DashboardController.GetComentariosPost(post_id, localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"), page, sizePage);
                                if (comentarios.Count != 0)
                                {
                                    tlComentarios.RemoveAllViews();
                                    FillComments();
                                }
                            }
                            else
                            {
                                Toast.MakeText(this, "Existió un error al eliminar el comentario", ToastLength.Short).Show();
                            }
                        };
                        menuPost.Show();
                    }
                };

                TableRow row = new TableRow(this);
                row.AddView(CommentView);

                tlComentarios.AddView(row);
            });
            AndHUD.Shared.Dismiss(this);
        }
コード例 #21
0
        private void AutoComplete_ItemClick(object sender, EventArgs eventArgs)
        {
            var itemView = sender as TextView;

            if (itemView.Text == limitRows.limValueText)
            {
                autocomplete.SetText("", TextView.BufferType.Normal);
                return;
            }

            if (хdoc == null)
            {
                хdoc = XDocument.Load(Resources.GetXml(Resource.Xml.codes));
            }

            var search = itemView.Text.Split('|').Select(p => p.Trim()).ToList();

            var item  = хdoc.Root.Elements("item").Where(x => (string)x.Attribute("order") == search[0] && (string)x.Attribute("type") == search[1]).FirstOrDefault();
            var brend = item.FirstAttribute.Value;

            textView2.SetText(Html.FromHtml("<b>Бренд:</b> " + brend), TextView.BufferType.Editable);

            tableLayout.RemoveAllViewsInLayout();
            tableLayout.RemoveAllViews();

            TableLayout.LayoutParams par = new TableLayout.LayoutParams(TableLayout.LayoutParams.WrapContent, TableLayout.LayoutParams.MatchParent);
            par.SetMargins(20, 0, 20, 0);
            tableLayout.LayoutParameters = par;

            if (item != null)
            {
                var codeData = new List <string>()
                {
                    item.Attribute("series").Value,
                    item.Attribute("custom").Value,
                    item.Attribute("model").Value
                };

                var isVacon = (brend == "Vacon" ? true : false);

                txtView = new TextView(this);
                txtView.SetText(Html.FromHtml("<b>Аналог марки VLT</b>"), TextView.BufferType.Editable);
                txtView.Gravity = GravityFlags.Left;
                txtView.SetPadding(25, 25, 25, 25);
                txtView.SetTextColor(Color.Black);
                txtView.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);

                var tableRow = new TableRow(this);
                tableRow.AddView(txtView);
                tableLayout.AddView(tableRow);

                for (int i = 0; i < codeData.Count; i++)
                {
                    var txt = "<b>";
                    if (i == 0)
                    {
                        txt += "Серия:";
                    }
                    else if (i == 1)
                    {
                        txt += "Заказной код:";
                    }
                    else if (i == 2)
                    {
                        txt += "Типовой код:";
                    }
                    txt += "</b> ";

                    txtView = new TextView(this);
                    txtView.SetText(Html.FromHtml(txt + (i == 0 && isVacon ? "Micro Drive" : codeData[i])), TextView.BufferType.Editable);
                    txtView.SetBackgroundResource(Resource.Layout.finded);
                    txtView.Gravity = GravityFlags.Left;
                    txtView.SetPadding(25, 25, 25, 25);
                    txtView.SetTextColor(Color.Black);

                    tableRow = new TableRow(this);
                    tableRow.LayoutParameters = new TableRow.LayoutParams(TableRow.LayoutParams.WrapContent, TableRow.LayoutParams.MatchParent);
                    tableRow.AddView(txtView);
                    tableLayout.AddView(tableRow);
                }

                if (!isVacon)
                {
                    var items = хdoc.Root.Elements("item")
                                .Where(x => (string)x.Attribute("brend") == "Vacon" &&
                                       (string)x.Attribute("custom") == item.Attribute("custom").Value &&
                                       (string)x.Attribute("series") != "VACON 10" && (string)x.Attribute("series") != "VACON NXL")
                                .ToList();

                    if (items != null && items.Count > 0)
                    {
                        txtView = new TextView(this);
                        txtView.SetText(Html.FromHtml("<b>Аналог марки Vacon</b>"), TextView.BufferType.Editable);
                        txtView.Gravity = GravityFlags.Left;
                        txtView.SetPadding(25, 50, 25, 25);
                        txtView.SetTextColor(Color.Black);
                        txtView.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);

                        tableRow = new TableRow(this);
                        tableRow.AddView(txtView);

                        tableLayout.AddView(tableRow);

                        drawItems(items, tableLayout, tableRow);
                    }
                }

                Toast.MakeText(this, "Поиск завершен", ToastLength.Short).Show();

                hideKeyBoard();

                bntSendFromMain.Visibility = ViewStates.Visible;
            }
        }
コード例 #22
0
        async Task FillPosts()
        {
            AndHUD.Shared.Show(this, null, -1, MaskType.Black);
            if (page == 0)
            {
                tlPost.RemoveAllViews();
            }
            await Task.Delay(500);

            posts.AsParallel().ToList().ForEach(post =>
            {
                LayoutInflater liView = LayoutInflater;
                View PostView         = liView.Inflate(Resource.Layout.PostLayout, null, true);

                KeyValuePair <string, string> current = new KeyValuePair <string, string>(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo);

                PostView.SetMinimumWidth(Resources.DisplayMetrics.WidthPixels);

                ImageButton imgPerfil = PostView.FindViewById <ImageButton>(Resource.Id.imgPerfil);

                if (Usuario_Fotos_Perfil.ContainsKey(current))
                {
                    if (Usuario_Fotos_Perfil[current] != null && Usuario_Fotos_Perfil[current].Length != 0)
                    {
                        imgPerfil.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(Usuario_Fotos_Perfil[current], 0, Usuario_Fotos_Perfil[current].Length)));
                    }
                    else
                    {
                        imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
                    }
                }
                else
                {
                    post.Usuario.Usuario_Fotografia_Perfil = new UploadImages().DownloadFileFTP(post.Usuario.Usuario_Fotografia, usuario_imagen_path);
                    Usuario_Fotos_Perfil.Add(current, post.Usuario.Usuario_Fotografia_Perfil);
                    if (post.Usuario.Usuario_Fotografia_Perfil != null && post.Usuario.Usuario_Fotografia_Perfil.Length != 0)
                    {
                        imgPerfil.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(post.Usuario.Usuario_Fotografia_Perfil, 0, post.Usuario.Usuario_Fotografia_Perfil.Length)));
                    }
                    else
                    {
                        imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
                    }
                }
                imgPerfil.Click += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo));

                TextView lblNombre = PostView.FindViewById <TextView>(Resource.Id.lblNombre);
                lblNombre.Text     = post.Usuario.Usuario_Nombre;
                lblNombre.Click   += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo));

                TextView lblPuesto = PostView.FindViewById <TextView>(Resource.Id.lblPuesto);
                lblPuesto.Text     = post.Usuario.Usuario_Puesto;
                lblPuesto.Click   += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo));

                TextView lblFecha = PostView.FindViewById <TextView>(Resource.Id.lblFecha);
                lblFecha.Text     = post.Publicacion_Fecha;
                lblFecha.Click   += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo));

                TextView lblPost = PostView.FindViewById <TextView>(Resource.Id.lblPost);
                lblPost.Text     = post.Publicacion_Contenido;

                TextView lblLike = PostView.FindViewById <TextView>(Resource.Id.lblLikeText);
                lblLike.Text     = post.Publicacion_Me_Gustan_Cantidad + " " + Resources.GetString(Resource.String.str_dashboard_likes);
                lblLike.Click   += (sender, e) => ShowMeGusta(lblLike.Text, post.Publicacion_Id);

                ImageView imgLike = PostView.FindViewById <ImageView>(Resource.Id.imgLikes);
                imgLike.SetColorFilter(new Color(ContextCompat.GetColor(this, Resource.Color.button_unpressed)));
                imgLike.Click += delegate
                {
                    string transaccion = "ALTA";
                    if (post.Publicacion_Me_Gusta_Usuario == ((int)TiposMeGusta.Activo).ToString())
                    {
                        transaccion = "BAJA";
                    }
                    else if (post.Publicacion_Me_Gusta_Usuario == ((int)TiposMeGusta.Baja).ToString())
                    {
                        transaccion = "MODIFICAR";
                    }
                    if (new EscritorioController().PostLike(post.Publicacion_Id, localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"), transaccion))
                    {
                        lblLike.Text = new EscritorioController().GetLikesPublish(post.Publicacion_Id) + " " + Resources.GetString(Resource.String.str_dashboard_likes);
                        if (transaccion == "BAJA")
                        {
                            post.Publicacion_Me_Gusta_Usuario = "0";
                            lblLike.SetTextColor(Color.Black);
                            imgLike.SetColorFilter(Resources.GetColor(Resource.Color.button_unpressed));
                        }
                        else
                        {
                            post.Publicacion_Me_Gusta_Usuario = "1";
                            imgLike.SetColorFilter(Resources.GetColor(Resource.Color.like_heart_pressed));
                            lblLike.SetTextColor(Color.Rgb(57, 87, 217));
                        }
                    }
                };
                if (post.Publicacion_Me_Gusta_Usuario == ((int)TiposMeGusta.Activo).ToString())
                {
                    imgLike.SetColorFilter(new Color(ContextCompat.GetColor(this, Resource.Color.like_heart_pressed)));
                }

                ImageView imgPost = PostView.FindViewById <ImageView>(Resource.Id.imgPost);

                if (!string.IsNullOrEmpty(post.Publicacion_Imagen))
                {
                    post.Publicacion_Imagen_Post = new UploadImages().DownloadFileFTP(post.Publicacion_Imagen, publicaciones_imagen_path);
                    if (post.Publicacion_Imagen_Post != null && post.Publicacion_Imagen_Post.Length != 0)
                    {
                        imgPost.Visibility = ViewStates.Visible;
                        Bitmap img         = BitmapFactory.DecodeByteArray(post.Publicacion_Imagen_Post, 0, post.Publicacion_Imagen_Post.Length);
                        imgPost.SetImageBitmap(Bitmap.CreateScaledBitmap(img, Resources.DisplayMetrics.WidthPixels, img.Height * Resources.DisplayMetrics.WidthPixels / img.Width, true));
                        imgPost.Click += delegate
                        {
                            //AndHUD.Shared.ShowImage(this, Drawable.CreateFromStream());
                        };
                    }
                }
                TextView lblComentario = PostView.FindViewById <TextView>(Resource.Id.lblComentariosText);
                lblComentario.Text     = post.Publicacion_Comentarios_Cantidad + " " + Resources.GetString(Resource.String.str_social_network_comments);

                ImageView imgComentario = PostView.FindViewById <ImageView>(Resource.Id.imgComments);
                imgComentario.SetColorFilter(Resources.GetColor(Resource.Color.button_unpressed));

                imgComentario.Click += delegate
                {
                    Intent intent = new Intent(this, typeof(CommentsActivity));
                    intent.PutExtra("post_id", post.Publicacion_Id);
                    intent.PutExtra("comments_total", post.Publicacion_Comentarios_Cantidad);
                    StartActivity(intent);
                };
                if (post.Publicacion_Comentarios_Cantidad != "0")
                {
                    imgComentario.SetColorFilter(Resources.GetColor(Resource.Color.comment_pressed));
                }
                if (localStorage.Get("Usuario_id") == post.Usuario.Usuario_Id && localStorage.Get("Usuario_Tipo") == post.Usuario.Usuario_Tipo)
                {
                    PostView.FindViewById <ImageView>(Resource.Id.imgMore).Click += delegate
                    {
                        using (PopupMenu menuPost = new PopupMenu(this, PostView.FindViewById <ImageView>(Resource.Id.imgMore), GravityFlags.Center))
                        {
                            menuPost.Inflate(Resource.Menu.post_reporte_menu);
                            menuPost.MenuItemClick += async delegate
                            {
                                if (DashboardController.OcultarPost(post.Usuario.Usuario_Id, post.Usuario.Usuario_Tipo, post.Publicacion_Id))
                                {
                                    Toast.MakeText(this, "Publicación eliminada", ToastLength.Short).Show();
                                    page  = 0;
                                    posts = DashboardController.GetMuroPosts(localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"), page, sizePage);
                                    await FillPosts();
                                }
                                else
                                {
                                    Toast.MakeText(this, "Existió un error al eliminar la publicación", ToastLength.Short).Show();
                                }
                            };
                            menuPost.Show();
                        }
                    };
                }
                else
                {
                    PostView.FindViewById <ImageView>(Resource.Id.imgMore).Visibility = ViewStates.Gone;
                }
                TableRow row = new TableRow(this);
                row.AddView(PostView);
                tlPost.AddView(row);
            });
            AndHUD.Shared.Dismiss(this);
        }
コード例 #23
0
        public async void OnClick(Android.Views.View view)
        {
            int    rowIndex      = view.Id;
            String recipientName = null;

            Android.Views.View nextChild = ((ViewGroup)view).GetChildAt(1);

            recipientName = ((TextView)nextChild).Text;

            User selectedReceiver = null;

            foreach (User receiver in organ.topReceivers)
            {
                if (receiver.FullName.ToLower().Equals(recipientName.ToLower()))
                {
                    selectedReceiver = receiver;
                }
            }
            ClinicianMapPage clinicianMapPage = new ClinicianMapPage();

            bool canArrive = await clinicianMapPage.CheckGetToReceiverInTime(organ, selectedReceiver);

            if (!canArrive)
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Cannot Transfer");
                alert.SetMessage("Cannot transfer " + organ.organType + " to " + selectedReceiver.FullName + " as it will expire before it arrives.");
                alert.SetPositiveButton("confirm", (senderAlert, args) => {});

                Dialog dialog = alert.Create();
                dialog.Show();
            }
            else
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Confirm Transfer");
                alert.SetMessage("Are you sure you want to transfer " + organ.organType + " to " + selectedReceiver.FullName + "?");
                alert.SetPositiveButton("Yes", async(senderAlert, args) =>
                {
                    Toast.MakeText(this, "Transfer process started.", ToastLength.Short).Show();
                    Console.WriteLine("LET US BEGIN");

                    //Update bottom sheet to show In transfer - empty table and update countdown

                    organTimerText.Text = "IN TRANSIT";
                    organTimerText.SetTextColor(Android.Graphics.Color.Orange);

                    transferText.Text = "This organ is currently in transit.";
                    receiverTable.RemoveAllViews();

                    //Update map to get rid of overlays and recipients
                    timer.Dispose();
                    timer            = null;
                    organ.inTransfer = 1;

                    //Insert transfer into database and add new helicopter.

                    double donorLat  = Convert.ToDouble(Intent.GetStringExtra("donorLat"));
                    double donorLong = Convert.ToDouble(Intent.GetStringExtra("donorLong"));
                    Position pos     = new Position(donorLat, donorLong);
                    clinicianMapPage.NewTransferWithoutAddingHelicpoter(organ, selectedReceiver, pos);
                    Intent dummy = new Intent();
                    SetResult(Result.Ok);
                    //SetResult(RESULT_OK, dummy);
                    Finish();
                });

                alert.SetNegativeButton("No", (senderAlert, args) =>
                {
                    Toast.MakeText(this, "Transfer Cancelled!", ToastLength.Short).Show();
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
コード例 #24
0
        //the way to list all directories, with folders first and files second.
        private void listDirectory()
        {
            TableLayout table = FindViewById <TableLayout>(Resource.Id.table);

            table.RemoveAllViews();


            //trying to list files and folders
            try{
                //Adding back button
                var directories = Directory.EnumerateDirectories(currentDir);
                if (currentDir != "/")
                {
                    TableRow  row   = new TableRow(this);
                    TextView  text  = new TextView(this);
                    ImageView image = new ImageView(this);
                    image.SetImageResource(Resource.Drawable.folder2);
                    text.Text = "Back";
                    //listener for clicking on back button
                    row.Click += (object sender, EventArgs e) => {
                        backDir();
                    };
                    //add everything to the table view
                    row.AddView(image);
                    row.AddView(text);
                    table.AddView(row);
                }

                //listing folders
                foreach (var directory in directories)
                {
                    TableRow  row   = new TableRow(this);
                    TextView  text  = new TextView(this);
                    ImageView image = new ImageView(this);
                    image.SetImageResource(Resource.Drawable.folder2);

                    text.Text = directory;
                    text.SetTextColor(Android.Graphics.Color.Black);
                    text.SetPadding(0, 50, 0, 50);
                    text.SetTextSize(Android.Util.ComplexUnitType.Px, 50);
                    row.SetBackgroundColor(Color.LightCyan);
                    //listening for a click on a folder
                    row.Click += (object sender, EventArgs e) => {
                        currentDir = directory;
                        listDirectory();
                    };
                    //add everything to the table layout
                    row.AddView(image);
                    row.AddView(text);
                    table.AddView(row);
                }

                //listing files
                var files = Directory.GetFiles(currentDir);
                foreach (var file in files)
                {
                    TableRow  row   = new TableRow(this);
                    TextView  text  = new TextView(this);
                    ImageView image = new ImageView(this);
                    image.SetImageResource(Resource.Drawable.File);

                    text.Text = file;
                    text.SetTextColor(Android.Graphics.Color.Black);
                    text.SetPadding(0, 50, 0, 50);
                    text.SetTextSize(Android.Util.ComplexUnitType.Px, 50);
                    //listen for a click on a file, open a file chooser with a list of possible programs.
                    row.Click += (object sender, EventArgs e) => {
                        Intent intent = new Intent(Intent.ActionSend);
                        String title  = "How would you like to open this file?";
                        //						IList<ResolveInfo> availableActivities = PackageManager.QueryIntentActivities(intent, PackageInfoFlags.MatchDefaultOnly);
                        //create an intent to show chooser
                        Intent chooser = Intent.CreateChooser(intent, title);
                        //if (availableActivities.Count > 0){
                        StartActivity(chooser);
                        //}
                    };
                    //add more things to the table layout!
                    row.AddView(image);
                    row.AddView(text);
                    table.AddView(row);
                }
                //if you don't have permissions, go back a folder and give an error message!
            }catch (Exception) {
                backDir();
                AlertDialog alertMessage = new AlertDialog.Builder(this).Create();
                alertMessage.SetTitle("Permissions Error");
                alertMessage.SetMessage("You do not have permissions to access this folder");
                alertMessage.Show();
            }
        }
コード例 #25
0
ファイル: DrugInfoFragment.cs プロジェクト: pafik13/SBL-CRM
        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));
            }
        }