// [END mListener_variable_reference] // [START auth_oncreate_setup_beginning] protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Put application specific code here. // [END auth_oncreate_setup_beginning] SetContentView (Resource.Layout.activity_main); logView = FindViewById<TextView> (Resource.Id.sample_logview); logView.SetTextAppearance (this, Resource.Style.Log); logView.SetBackgroundColor (Android.Graphics.Color.White); logView.Append ("\r\n"); // [START auth_oncreate_setup_ending] if (savedInstanceState != null) authInProgress = savedInstanceState.GetBoolean (AUTH_PENDING); buildFitnessClient(); }
TableRow GetRow(string attr, string value) { TableRow row = new TableRow (this.Activity); TextView attrName = new TextView (this.Activity); // attrName.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge attrName.SetTextAppearance(Activity, Resource.Style.text_row); attrName.SetPadding(6, 6, 6, 0); attrName.Text = attr; row.AddView (attrName); TextView attrValue = new TextView (this.Activity); // attrName.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge attrValue.SetTextAppearance(Activity, Resource.Style.text_row); attrValue.SetPadding(6, 6, 6, 0); attrValue.Text = value; row.AddView (attrValue); return row; }
void RefreshTable() { table.RemoveAllViews (); TableRow header = new TableRow (Activity); header.SetMinimumHeight (88); TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams (); hParamsDrug.Height = TableLayout.LayoutParams.WrapContent; hParamsDrug.Width = TableLayout.LayoutParams.WrapContent; hParamsDrug.Gravity = GravityFlags.Center; // hParamsDrug.Span = 2; TextView hDrug = new TextView (Activity); hDrug.Text = @"Препараты"; hDrug.LayoutParameters = hParamsDrug; header.AddView(hDrug); TableRow.LayoutParams p = new TableRow.LayoutParams (); p.Height = TableLayout.LayoutParams.WrapContent; p.Width = TableLayout.LayoutParams.WrapContent; p.Gravity = GravityFlags.Center; TableLayout tlHeader = new TableLayout (Activity); TableRow rAttendance = new TableRow (Activity); foreach (var attendace in currentAttendances) { TextView hAttendace = new TextView (Activity); hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd"); hAttendace.LayoutParameters = p; hAttendace.Rotation = -70; header.AddView (hAttendace); // rAttendance.AddView(hAttendace); } // tlHeader.AddView (rAttendance); // header.AddView (tlHeader); // table.AddView(header); foreach (var info in infos) { TableRow r = new TableRow (Activity); TextView v = new TextView (Activity); v.Gravity = GravityFlags.Center; v.SetSingleLine (false); v.SetMinimumHeight (72); v.SetMinimumWidth (68); v.Rotation = -90; // v.SetBackgroundResource (Resource.Style.text_row); // v.SetB // v.Text = info.infoID.ToString(); // v.Text = GetInfo(info.infoID).name; // v.SetHorizontallyScrolling (false); v.Text = info.name; v.LayoutParameters = p; r.AddView (v); TableLayout tl = new TableLayout (Activity); if (header.Parent == null) { tl.AddView (header); } tl.Id = info.id; foreach (var drug in drugs) { TableRow rr = new TableRow (Activity); rr.Id = drug.id; TextView vv = new TextView (Activity); vv.Gravity = GravityFlags.Center; vv.SetMinimumHeight (42); vv.SetMinimumWidth (76); // vv.Text = drugInfo.drugID.ToString(); // vv.Text = GetDrug(drugInfo.drugID).fullName; vv.Text = drug.fullName; vv.LayoutParameters = p; rr.AddView (vv); foreach (var attendace in currentAttendances) { RelativeLayout rl = new RelativeLayout(Activity); rl.SetGravity (GravityFlags.Center); rl.SetMinimumHeight (68); rl.SetMinimumWidth (68); rl.LayoutParameters = p; rl.Id = attendace.id; string value = string.Empty; if (attendace.id != -1) { value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id); } else { value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id); rl.Click += Rl_Click; } TextView vvv = new TextView (Activity); vvv.Gravity = GravityFlags.Center; if (string.IsNullOrEmpty (value) || value.Equals(@"N")) { vvv.SetTextAppearance (Activity, Resource.Style.text_danger); // rl.SetBa rl.SetBackgroundColor (Android.Graphics.Color.LightPink); // rl.SetBackgroundResource(Resource.Style.alert_success); } else { vvv.SetTextAppearance (Activity, Resource.Style.text_success); // vvv.SetTextSize (ComplexUnitType.Sp, 24); // vvv.SetTextColor(Android.Graphics.Color.Argb); rl.SetBackgroundColor (Android.Graphics.Color.LightGreen); } vvv.Text = AttendanceResult.StringBoolToRussian(value); rl.AddView (vvv); rr.AddView (rl); } tl.AddView (rr); } r.AddView (tl); table.AddView (r); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); user = Common.GetCurrentUser (); merchant = Common.GetMerchant (user.username); // currentRout = GetRout (); // int[] ids = {1,2,3,4,5}; // currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (ids); currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (string.Empty, 20); infos = Common.GetInfos (user.username); // infos = new List<Info>(); // infos.Add (new Info {id = 2, name = @"Кол-во" }); // infos.Add (new Info {id = 4, name = @"Розница" }); // infos.Add (new Info {id = 6, name = @"Заказано" }); drugs = Common.GetDrugs (user.username); // AttendanceResultManager.DeleteAttendanceResult (1); //// var att = new Attendance (1, new DateTime (2015, 10, 28), infos, drugs, @"N"); // var att = new Attendance() { id = 1, date = new DateTime (2015, 10, 28), pharmacy = 1 }; // AttendanceManager.SaveAttendance (att); // // var res = AttendanceResultManager.GenerateResults(infos, drugs, @"N"); // AttendanceResultManager.SaveNewAttendanceResults (att.id, res); View rootView = inflater.Inflate(Resource.Layout.MainFragment, container, false); text = rootView.FindViewById<TextView> (Resource.Id.largeText); text.Text = @"НЕТ ПРЕПАРАТОВ ИЛИ СОБИРАЕМОЙ ИНФОРМАЦИИ"; text.SetTextAppearance (Activity, Resource.Style.text_danger); table = rootView.FindViewById<TableLayout> (Resource.Id.mfFullContent); spnSelectedPharmacy = rootView.FindViewById<Spinner> (Resource.Id.mfSelectedPharmacySpinner); ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, PharmacyManager.ToArray (currentPharmacies)); spnSelectedPharmacy.Adapter = adapter; spnSelectedPharmacy.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { selectedPharmacy = currentPharmacies [e.Position].id; currentAttendances = (List<Attendance>)AttendanceManager.GetAttendances (selectedPharmacy); RefreshTable(); }; spnSelectedPharmacy.SetSelection (0); // RefreshTable (); return rootView; //return base.OnCreateView (inflater, container, savedInstanceState); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View rootView = inflater.Inflate(Resource.Layout.MainFragment, container, false); text = rootView.FindViewById<TextView> (Resource.Id.largeText); user = Common.GetCurrentUser (); if (user == null) { text.Text = @"НЕТ ПРЕПАРАТОВ ИЛИ СОБИРАЕМОЙ ИНФОРМАЦИИ"; text.SetTextAppearance (Activity, Resource.Style.text_danger); miAddAtt.SetEnabled (false); return rootView; } merchant = Common.GetMerchant (user.username); currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (string.Empty, 20); infos = Common.GetInfos (user.username); drugs = Common.GetDrugs (user.username); table = rootView.FindViewById<TableLayout> (Resource.Id.mfFullContent); spnSelectedPharmacy = rootView.FindViewById<Spinner> (Resource.Id.mfSelectedPharmacySpinner); ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, PharmacyManager.ToArray (currentPharmacies)); spnSelectedPharmacy.Adapter = adapter; spnSelectedPharmacy.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { selectedPharmacy = currentPharmacies [e.Position].id; currentAttendances = (List<Attendance>)AttendanceManager.GetAttendances (selectedPharmacy); RefreshTable(); }; spnSelectedPharmacy.SetSelection (0); // RefreshTable (); return rootView; //return base.OnCreateView (inflater, container, savedInstanceState); }
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)); } }
void DisplayNeighborCount(LinearLayout tileLayout, int count) { Flip(tileLayout); var text = new TextView(this); text.SetTextAppearance(this, Resource.Style.CommonText); text.Text = count.ToString(); tileLayout.AddView(text); tileLayout.SetGravity(GravityFlags.Center); }
/// <summary> /// Creates the meal info area in the programmitcally generated by Json. /// </summary> /// <returns>The meal info container for orginal Json calls.</returns> /// <param name="json">Json from original call to be parsed.</param> /// <param name="recipeResult">Recipe result (Json) using info from original Json.</param> /// <param name="count">Count used for creating unique ids.</param> private LinearLayout CreateMealInfo (JsonValue json, JsonValue recipeResult, int count) { LinearLayout mealInfo = new LinearLayout (this); mealInfo.Orientation = Orientation.Horizontal; mealInfo.SetMinimumWidth (25); mealInfo.SetMinimumHeight (25); LinearLayout.LayoutParams mealInfoLL = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); mealInfoLL.SetMargins (5, 5, 5, 5); mealInfo.LayoutParameters = mealInfoLL; mealInfo.Id = count * 20 + 7; // Set image icon ImageView dinerIcon = new ImageView (this); dinerIcon.SetImageResource (Resource.Drawable.gray_person); dinerIcon.LayoutParameters = new LinearLayout.LayoutParams (50, LinearLayout.LayoutParams.MatchParent); // Finish setting the image icon TextView mealSize = new TextView (this); TextView recipeInfo = new TextView (this); recipeInfo.Text = handleRecipeJson (recipeResult); recipeInfo.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall); recipeInfo.SetLines (1); LinearLayout.LayoutParams rill = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); recipeInfo.LayoutParameters = rill; mealSize.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall); LinearLayout.LayoutParams tvll = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); mealSize.LayoutParameters = tvll; mealSize.Text = json ["Mealsize"].ToString (); recipeInfo.SetPadding (10, 0, 0, 0); mealSize.Gravity = GravityFlags.Right; // Add image icon mealInfo.AddView (mealSize); mealInfo.AddView (dinerIcon); mealInfo.AddView (recipeInfo); return mealInfo; }
private void RefreshTableContent2() { if (pfPharmacyTable != null) { int childCount = pfPharmacyTable.ChildCount; // Remove all rows except the first one if (childCount > 1) { pfPharmacyTable.RemoveViews(1, childCount - 1); } pharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (pfSearchEdit.Text, 20); foreach (var pharmacy in pharmacies) { string src = pfSearchEdit.Text; string srcWithCap = UppercaseFirst(pfSearchEdit.Text); string rpl = ""; TableRow row = new TableRow (Activity); row.SetBackgroundResource(Resource.Drawable.bottomline); //View view = layoutInflater.Inflate (Resource.Layout.LeftDrawerItem, null, false);//TextView id = new TextView (this.Activity); TextView id = new TextView (Activity); // id.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge // id.SetTextAppearance(Activity, Resource.Style.rowTextForPharmacy); // id.SetPadding(24, 0, 24, 0); // TableRow.LayoutParams p = // p.RightMargin = 24; // p.LeftMargin = 24; id.LayoutParameters = new TableRow.LayoutParams() {RightMargin = 24, LeftMargin = 24}; id.SetBackgroundResource(Resource.Drawable.bottomline); id.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); id.SetHeight (48); id.Gravity = GravityFlags.Center; id.Text = pharmacy.id.ToString (); row.AddView (id); // CheckBox chk = new CheckBox (Activity); // chk.SetPadding(24, 16, 24, 16); // row.AddView (chk); TextView fullName = new TextView (Activity); // fullName.SetTextAppearance (Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge // fullName.SetPadding(0, 0, 56, 0); // TableRow.LayoutParams fullNameP = new TableRow.LayoutParams(); // fullNameP.RightMargin = 56; fullName.LayoutParameters = new TableRow.LayoutParams() {RightMargin = 56}; // fullName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); // fullName.SetBackgroundResource(Resource.Drawable.bottomline); fullName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); fullName.SetHeight (48); fullName.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { fullName.Text = pharmacy.fullName; } else { rpl = pharmacy.fullName.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); fullName.TextFormatted = Html.FromHtml (rpl); } row.AddView (fullName); TextView shortName = new TextView (Activity); // shortName.SetPadding(0, 0, 56, 0);0 // shortName.SetBackgroundResource(Resource.Drawable.bottomline); shortName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); shortName.SetHeight (48); shortName.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { shortName.Text = pharmacy.shortName; } else { rpl = pharmacy.shortName.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); shortName.TextFormatted = Html.FromHtml (rpl); } row.AddView (shortName); TextView officialName = new TextView (Activity); // officialName.SetPadding(0, 0, 56, 0); // officialName.SetBackgroundResource(Resource.Drawable.bottomline); officialName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); officialName.SetHeight (48); officialName.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { officialName.Text = pharmacy.officialName; } else { rpl = pharmacy.officialName.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); officialName.TextFormatted = Html.FromHtml (rpl); } row.AddView (officialName); TextView address = new TextView (Activity); // address.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge // address.SetPadding(0, 0, 56, 0); // address.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); // address.SetBackgroundResource(Resource.Drawable.bottomline); address.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); address.SetHeight (48); address.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { address.Text = pharmacy.address; } else { rpl = pharmacy.address.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); address.TextFormatted = Html.FromHtml (rpl); } row.AddView (address); TextView subway = new TextView (Activity); // subway.SetPadding(0, 0, 56, 0); // subway.SetBackgroundResource(Resource.Drawable.bottomline); subway.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); subway.SetHeight (48); subway.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { subway.Text = pharmacy.subway; } else { rpl = pharmacy.subway.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); subway.TextFormatted = Html.FromHtml (rpl); } row.AddView (subway); TextView phone = new TextView (Activity); // phone.SetPadding(0, 0, 56, 0); // phone.SetBackgroundResource(Resource.Drawable.bottomline); phone.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); phone.SetHeight (48); phone.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { phone.Text = pharmacy.phone; } else { rpl = pharmacy.phone.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); phone.TextFormatted = Html.FromHtml (rpl); } row.AddView (phone); TextView email = new TextView (Activity); // email.SetPadding(0, 0, 56, 0); // email.SetBackgroundResource(Resource.Drawable.bottomline); email.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); email.SetHeight (48); email.Gravity = GravityFlags.CenterVertical; if (string.IsNullOrEmpty (src)) { email.Text = pharmacy.email; } else { rpl = pharmacy.email.Replace (src, @"<font color='red'>" + src + @"</font>"); rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>"); email.TextFormatted = Html.FromHtml (rpl); } row.AddView (email); // Button delete = new Button (this.Activity); // delete.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge // delete.SetPadding(0, 16, 24, 16); // delete.Text = @"Del"; // delete.Id = pharmacy.id; // delete.Click += PharmacyDelete_Click; // // row.AddView (delete); pfPharmacyTable.AddView(row); } } }
public StationRenderer(Context context, GoogleMap map, ClusterManager clusterManager) : base(context, map, clusterManager) { _context = context; _map = map; _clusterManager = clusterManager; _contractService = SimpleIoc.Default.GetInstance<IContractService>(); _settingsService = SimpleIoc.Default.GetInstance<ISettingsService>(); _iconGenRed = new IconGenerator(_context); _iconGenGreen = new IconGenerator(_context); _iconGenOrange = new IconGenerator(_context); _iconGenGrey = new IconGenerator(_context); _iconGenGreyLowAlpha = new IconGenerator(_context); //// Define the size you want from dimensions file //var shapeDrawable = ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.station, null); //iconGen.SetBackground(shapeDrawable); ////// Create a view container to set the size _iconGenRed.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationRed, null)); _iconGenOrange.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationOrange, null)); _iconGenGreen.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreen, null)); _iconGenGrey.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGrey, null)); _iconGenGreyLowAlpha.SetBackground(ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.stationGreyAlpha, null)); _iconRed = _iconGenRed.MakeIcon(); _iconGreen = _iconGenGreen.MakeIcon(); _iconOrange = _iconGenOrange.MakeIcon(); _iconGrey = _iconGenGrey.MakeIcon(); _iconGreyLowAlpha = _iconGenGreyLowAlpha.MakeIcon(); var textView = new TextView(context); textView.SetTextAppearance(_context, Resource.Style.iconGenText); _textPaint.AntiAlias = true; _textPaint.SetARGB(255, 0, 0, 0); _textPaint.TextSize = textView.TextSize; _textPaint.TextAlign = Paint.Align.Center; //_textPaint.SetTypeface(textView.Typeface); _textPaint.SetTypeface(Typeface.CreateFromAsset(_context.Assets, "fonts/Roboto-Bold.ttf")); }
TextView GetItem(ColumnPosition columnPosition) { TextView textView = new TextView (Activity); textView.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); textView.SetHeight (48); // textView. switch (columnPosition) { case ColumnPosition.cpFirst: textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = 24, LeftMargin = 24 }; break; case ColumnPosition.cpMiddle: textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = 56 }; break; case ColumnPosition.cpLast: textView.LayoutParameters = new TableRow.LayoutParams () { LeftMargin = 24 }; break; default: break; } return textView; }
void RefreshTable() { table.RemoveAllViews (); TableRow header = new TableRow (Activity); header.SetMinimumHeight (70); TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams (); hParamsDrug.Height = TableLayout.LayoutParams.WrapContent; hParamsDrug.Width = TableLayout.LayoutParams.WrapContent; hParamsDrug.Gravity = GravityFlags.Center; // hParamsDrug.Span = 2; TextView hDrug = new TextView (Activity); hDrug.Text = @"Препараты"; hDrug.LayoutParameters = hParamsDrug; header.AddView(hDrug); TableRow.LayoutParams p = new TableRow.LayoutParams (); p.Height = TableLayout.LayoutParams.WrapContent; p.Width = TableLayout.LayoutParams.WrapContent; p.Gravity = GravityFlags.Center; TableLayout tlHeader = new TableLayout (Activity); TableRow rAttendance = new TableRow (Activity); foreach (var attendace in drugInfo.attendaces) { TextView hAttendace = new TextView (Activity); hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd"); hAttendace.LayoutParameters = p; hAttendace.Rotation = -60; header.AddView (hAttendace); // rAttendance.AddView(hAttendace); } // tlHeader.AddView (rAttendance); // header.AddView (tlHeader); // table.AddView(header); foreach (var info in infos) { TableRow r = new TableRow (Activity); TextView v = new TextView (Activity); v.Gravity = GravityFlags.Center; v.SetSingleLine (false); v.SetMinimumHeight (72); v.SetMinimumWidth (68); v.Rotation = -90; // v.SetBackgroundResource (Resource.Style.text_row); // v.SetB // v.Text = info.infoID.ToString(); // v.Text = GetInfo(info.infoID).name; // v.SetHorizontallyScrolling (false); v.Text = info.name; v.LayoutParameters = p; r.AddView (v); TableLayout tl = new TableLayout (Activity); if (header.Parent == null) { tl.AddView (header); } tl.Id = info.id; foreach (var drug in drugs) { TableRow rr = new TableRow (Activity); rr.Id = drug.id; TextView vv = new TextView (Activity); vv.Gravity = GravityFlags.Center; vv.SetMinimumHeight (42); vv.SetMinimumWidth (76); // vv.Text = drugInfo.drugID.ToString(); // vv.Text = GetDrug(drugInfo.drugID).fullName; vv.Text = drug.fullName; vv.LayoutParameters = p; rr.AddView (vv); foreach (var attendace in drugInfo.attendaces) { RelativeLayout rl = new RelativeLayout(Activity); rl.SetGravity (GravityFlags.Center); rl.SetMinimumHeight (68); rl.SetMinimumWidth (68); rl.LayoutParameters = p; rl.Id = attendace.id; rl.Click += (object sender, EventArgs e) => { RelativeLayout rlAttendace = (RelativeLayout) sender; TableRow trDrug = (TableRow) rl.Parent; TableLayout trInfo = (TableLayout) rl.Parent.Parent; string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id); Toast.MakeText(Activity, message, ToastLength.Short).Show(); FragmentTransaction trans = FragmentManager.BeginTransaction (); DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog (); Bundle args = new Bundle(); args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id); args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id); args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id); // args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id)); drugInfoValueDialog.Arguments = args; drugInfoValueDialog.AfterSave += DrugInfoValueDialog_AfterSave; drugInfoValueDialog.Show (trans, "dialog fragment"); Log.Info ("ifSignInButton", "Click"); }; // string value = GetDrugInfoValue (attendace.results, info.id, drug.id); if (string.IsNullOrEmpty (value)) { ImageView iv = new ImageView (Activity); iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp); rl.SetBackgroundColor (Android.Graphics.Color.LightPink); // rl.SetBackgroundResource(Resource.Style.alert_success); rl.AddView (iv); } else { TextView vvv = new TextView (Activity); vvv.Gravity = GravityFlags.Center; vvv.Text = value; vvv.SetTextAppearance (Activity, Resource.Style.text_success); // vvv.SetTextSize (ComplexUnitType.Sp, 24); // vvv.SetTextColor(Android.Graphics.Color.Argb); rl.SetBackgroundColor (Android.Graphics.Color.LightGreen); rl.AddView (vvv); } rr.AddView (rl); } // for (int i = 0; i < 2; i++) { // Values // ImageView iv = new ImageView (Activity); // iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp); // rr.AddView (iv); // } tl.AddView (rr); } r.AddView (tl); table.AddView (r); } }
private void Init() { base.RemoveAllViews(); hintTextView = new EditText(Context); textTextView = new NoCursorMovingEditText(Context, BackKeyPressed); linearLayout = new LinearLayout(Context); linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight()); textLayout = new RelativeLayout(Context); textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1); textLayout.SetGravity(GravityFlags.Center); linearLayout.AddView(textLayout); textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText); hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText); LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); lp.AddRule(LayoutRules.CenterVertical); hintTextView.LayoutParameters = lp; textTextView.LayoutParameters = lp; hintTextView.Enabled = false; hintTextView.Focusable = false; textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions; hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions; hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent)); textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent)); int horizontalPadding = Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding); hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0); textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0); textErrorView = new EditText(Context); RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); errorLP.AddRule(LayoutRules.CenterVertical); int margin = UiUtils.ToPixels(Context, 2); errorLP.SetMargins(margin, 0, margin, 0); textErrorView.LayoutParameters = errorLP; textErrorView.Enabled = false; textErrorView.Focusable = false; textErrorView.Visibility = ViewStates.Gone; textErrorView.SetBackgroundColor(Color.Red); int errorVerticalPadding = Context.Resources.GetDimensionPixelOffset( Resource.Dimension.backgroundhinttextview_error_vertical_padding); textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding); textErrorView.Text = errorText; textErrorView.SetSingleLine(true); textErrorView.Gravity = GravityFlags.Center; textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText); //set courier font Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier); //hintTextView.Typeface = type; hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal); //textTextView.Typeface = type; textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal); textErrorView.Typeface = type; textLayout.AddView(hintTextView); textLayout.AddView(textTextView); AddView(linearLayout); IEnumerable<char> previousCharSequence; EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) => { previousCharSequence = args.Text; }; EventHandler<TextChangedEventArgs> textChanged = (sender, args) => { beforeTextSize = args.BeforeCount; }; EventHandler<AfterTextChangedEventArgs> afterTextChanged = null; Action<string> updateTextView = newText => { textTextView.TextChanged -= textChanged; textTextView.BeforeTextChanged -= beforeTextChanged; textTextView.AfterTextChanged -= afterTextChanged; textTextView.Text = newText; textTextView.TextChanged += textChanged; textTextView.BeforeTextChanged += beforeTextChanged; textTextView.AfterTextChanged += afterTextChanged; }; afterTextChanged = (sender, args) => { var length = args.Editable.ToString().Length; var deleting = beforeTextSize == 1; if (deleting) { nextMustBeDeleted = false; } else { if (nextMustBeDeleted && length > 0) { updateTextView(args.Editable.SubSequence(0, length - 1)); UpdateHintTextForCurrentTextEntry(); return; } } // If we are deleting (we've just removed a space char, so delete another char please: // Or if we've pressed space don't allow it! if ((deleting && skipCharsAtPositions.Contains(length)) || (length > 0 && IsCharInFilter(args.Editable.CharAt(length - 1)) && !skipCharsAtPositions.Contains(length - 1))) { updateTextView(length == 0 ? "" : args.Editable.SubSequence(0, length - 1)); textTextView.SetSelection(length == 0 ? 0 : length - 1); UpdateHintTextForCurrentTextEntry(); return; } // Adds a non numeric char at positions needed for (int i = 0; i < skipCharsAtPositions.Count; ++i) { // We rescan all letters recursively to catch when a users pastes into the edittext int charPosition = skipCharsAtPositions[i]; if (length > charPosition) { if (hintText[charPosition] != args.Editable.ToString()[charPosition]) { updateTextView(args.Editable.SubSequence(0, charPosition) + "" + hintText[charPosition] + args.Editable.SubSequence(charPosition, args.Editable.Length())); UpdateHintTextForCurrentTextEntry(); return; } } else { if (length == charPosition) { updateTextView(textTextView.Text + "" + hintText[charPosition]); } } } UpdateHintTextForCurrentTextEntry(); // We've got all the chars we need, fire off our listener if (length >= LengthToStartValidation()) { try { ValidateInput(args.Editable.ToString()); if (OnEntryComplete != null) { OnEntryComplete(args.Editable.ToString()); } return; } catch (Exception exception) { Log.Error(JudoSDKManager.DEBUG_TAG, exception.Message, exception); } ShowInvalid(); } else { if (OnProgress != null) { OnProgress(length); } } }; textTextView.BeforeTextChanged += beforeTextChanged; textTextView.TextChanged += textChanged; textTextView.AfterTextChanged += afterTextChanged; }
TextView GetItem(ColumnPosition columnPosition) { TextView textView = new TextView (this); textView.SetTextAppearance (this, Resource.Style.rowTextForPharmacy); textView.SetHeight (ToDIP(48)); switch (columnPosition) { case ColumnPosition.cpFirst: textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(24), LeftMargin = ToDIP(24) }; break; case ColumnPosition.cpMiddle: textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(56) }; break; case ColumnPosition.cpLast: textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(24) }; break; default: break; } return textView; }
public void handleMealSize (TextView mealSize, LinearLayout.LayoutParams tvll, JsonValue json, String mealSizeString) { mealSize.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall); mealSize.LayoutParameters = tvll; mealSize.Text = json [mealSizeString].ToString (); mealSize.Gravity = GravityFlags.Right; }
/** * Creates a new view that will be used to display the specified pointer id on the touchpad * view. * * @param pointerId the id of the pointer that this finger trace view will represent; used to * determine its color and text * @return the {@code TextView} that was created */ private TextView createFingerTraceView(int pointerId) { var fingerTraceView = new TextView(Context); fingerTraceView.SetBackgroundResource(FINGER_RES_IDS[pointerId]); fingerTraceView.Text = pointerId.ToString(); fingerTraceView.Gravity = GravityFlags.Center; fingerTraceView.SetTextAppearance(Context, Android.Resource.Style.TextAppearanceDeviceDefaultSmall); fingerTraceView.Alpha = 0; var lp = new RelativeLayout.LayoutParams(FINGER_TRACE_SIZE, FINGER_TRACE_SIZE); lp.AddRule(LayoutRules.AlignParentTop); lp.AddRule(LayoutRules.AlignParentLeft); // The right and bottom margin here are required so that the view doesn't get "squished" // as it touches the right or bottom side of the touchpad view. lp.RightMargin = -2 * FINGER_TRACE_SIZE; lp.BottomMargin = -2 * FINGER_TRACE_SIZE; fingerTraceView.LayoutParameters = lp; return fingerTraceView; }
public void handleRecipeInfo (TextView recipeInfo, LinearLayout.LayoutParams rill, JsonValue recipeResult) { recipeInfo.Text = handleRecipeJson (recipeResult); recipeInfo.SetTextAppearance (this, Android.Resource.Style.TextAppearanceSmall); recipeInfo.SetLines (1); recipeInfo.SetPadding (10, 0, 0, 0); }
void RefreshRout() { llContent.RemoveAllViews (); RelativeLayout rl = null; RelativeLayout.LayoutParams rlParams = null; for (int d = 0; d < rout.Items.Count; d++ ) { var item = rout.Items[d]; LinearLayout ll = new LinearLayout (Activity); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, 1); param.SetMargins (5, 0, 5, 0); ll.LayoutParameters = param; ll.Orientation = Orientation.Vertical; rl = new RelativeLayout (Activity); rl.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 1); rl.SetBackgroundResource (Resource.Drawable.bottomline); TextView head = new TextView (Activity); var culture = new System.Globalization.CultureInfo("ru-RU"); // var day = ; head.Text = UppercaseFirst(culture.DateTimeFormat.GetDayName(item.DayOfWeek)); head.SetTextAppearance (Activity, Resource.Style.headerTextForRout); // head.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1); rlParams = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); rlParams.AddRule (LayoutRules.CenterInParent); head.LayoutParameters = rlParams; rl.AddView (head); ll.AddView (rl); // TextView height = new TextView (Activity); // height.Text = ().ToString(); // height.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1); // ll.AddView (height); // TextView width = new TextView (Activity); // width.Text = ().ToString(); // width.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1); // ll.AddView (width); for (int i = 0; i < Rout.PHARMACIES_COUNT; i++) { rl = new RelativeLayout (Activity); rl.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 2); rl.SetBackgroundResource (Resource.Drawable.bottomline); rl.Click += Rl_Click; rlParams = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); rlParams.AddRule (LayoutRules.CenterInParent); if (rout.Items [d].Pharmacies [i] == 0) { ImageView imgEmpty = new ImageView (Activity); imgEmpty.SetImageResource (Resource.Drawable.ic_add_circle_outline_black_24dp); imgEmpty.LayoutParameters = rlParams; rl.AddView (imgEmpty); } else { // p.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 1); //p.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, // pharmacy.Draw TextView tvPharmacy = new TextView (Activity); tvPharmacy.Text = PharmacyManager.GetPharmacy(rout.Items [d].Pharmacies [i]).fullName; tvPharmacy.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy); tvPharmacy.LayoutParameters = rlParams; rl.AddView (tvPharmacy); } rl.Id = i; ll.AddView (rl); } ll.Id = d; llContent.AddView (ll); } }