// int all in dp public Tap5050MenuBuilder(Context context,int backgroundresource=Resource.Color.soarnix_bg_gray,int containerpadding=5,int containerspacing=1) { nn_containerspacing = containerspacing; nn_containterpadding=containerpadding; nn_context = context; nn_menucontainer = new LinearLayout (context); nn_menucontainer.SetBackgroundResource (backgroundresource); nn_menucontainer.SetPadding (TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding),TapUtil.dptodx(containerpadding)); nn_menucontainer.Orientation = Orientation.Vertical; nn_itemlist = new List<RelativeLayout>(); }
void UpdateTitleViewLayoutBackground(LinearLayout titleViewLayout, string backgroundResource, Android.Graphics.Drawables.Drawable defaultBackground) { if (!string.IsNullOrEmpty(backgroundResource)) { titleViewLayout?.SetBackgroundResource(this.Context.Resources.GetIdentifier(backgroundResource, "drawable", Android.App.Application.Context.PackageName)); } else { titleViewLayout?.SetBackground(defaultBackground); } }
public void ini(){ var textFormat = Android.Util.ComplexUnitType.Px; mainLayout = new RelativeLayout (context); mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1); contenLayout = new LinearLayout (context); contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2); contenLayout.Orientation = Orientation.Vertical; //LIST contentListLayout = new LinearLayout (context); contentListLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(583),Configuration.getHeight(300)); contentListLayout.Orientation = Orientation.Vertical; titleHeaderList = new TextView (context); contentList = new ListView (context); //titleHeaderList.Text = "Tipos de Aves"; titleHeaderList.SetTextColor (Color.ParseColor ("#FF0080")); titleHeaderList.SetTextSize (textFormat, Configuration.getHeight (38)); titleHeaderList.SetMaxWidth (Configuration.getWidth (510)); contentListLayout.SetBackgroundResource (Resource.Drawable.border); contentListLayout.AddView (titleHeaderList); contentListLayout.AddView (contentList); contentListLayout.SetX (Configuration.getHeight (25)); //contentListLayout.SetY (Configuration.getWidth (450)); //ENDLIST imBorderList = new ImageView (context); mainLayout.AddView (contentListLayout); }
public override View GetPropertyWindowLayout(Context context) { LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layoutParams.TopMargin = (int)(25 * currentDensity); gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density) / 3; LinearLayout linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Vertical; linearLayout4.SetMinimumHeight((int)(70 * currentDensity)); linearLayout4.SetMinimumWidth(width); TextView selectText = new TextView(context) { Text = "Grid Color", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; selectText.SetMinimumHeight((int)(20 * currentDensity)); selectText.SetWidth((int)(width * 0.4 * currentDensity)); HorizontalScrollView horizontalScroll = new HorizontalScrollView(context); horizontalScroll.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); horizontalScroll.FillViewport = true; horizontalScroll.HorizontalScrollBarEnabled = true; horizontalScroll.SetMinimumHeight((int)(60 * currentDensity)); horizontalScroll.Layout(0, (int)(20 * currentDensity), (int)(80 * currentDensity * 14), (int)(60 * currentDensity)); scrollLayout = new LinearLayout(context); scrollLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); horizontalScroll.AddView(scrollLayout); AddColors(); linearLayout4.AddView(selectText); linearLayout4.AddView(horizontalScroll); LinearLayout linearLayout1 = new LinearLayout(context); linearLayout1.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); linearLayout1.SetMinimumHeight((int)(30 * currentDensity)); TextView showGrid = new TextView(context) { Text = "Show Grid", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; showGrid.SetMinimumHeight((int)(20 * currentDensity)); showGrid.SetWidth((int)(width * 0.4 * currentDensity)); Switch showGridSwitch = new Switch(context); showGridSwitch.CheckedChange += ShowGridSwitch_CheckedChange; showGridSwitch.Gravity = GravityFlags.Right; showGridSwitch.SetMinimumHeight((int)(20 * currentDensity)); showGridSwitch.SetWidth((int)(width * 0.4 * currentDensity)); linearLayout1.AddView(showGrid); linearLayout1.AddView(showGridSwitch); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); linearLayout2.SetMinimumHeight((int)(30 * currentDensity)); TextView snapToGrid = new TextView(context) { Text = "Snap To Grid", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; snapToGrid.SetMinimumHeight((int)(20 * currentDensity)); snapToGrid.SetWidth((int)(width * 0.4 * currentDensity)); snapToGridSwitch = new Switch(context); snapToGridSwitch.Enabled = false; snapToGridSwitch.CheckedChange += SnapToGridSwitch_CheckedChange; snapToGridSwitch.Gravity = GravityFlags.Right; snapToGridSwitch.SetMinimumHeight((int)(20 * currentDensity)); snapToGridSwitch.SetWidth((int)(width * 0.4 * currentDensity)); linearLayout2.AddView(snapToGrid); linearLayout2.AddView(snapToGridSwitch); LinearLayout linearLayout3 = new LinearLayout(context); linearLayout3.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); linearLayout3.SetMinimumHeight((int)(60 * currentDensity)); TextView connectorSize = new TextView(context) { Text = "Size", Gravity = GravityFlags.CenterVertical, TextSize = 5 * currentDensity }; connectorSize.SetMinimumHeight((int)(20 * currentDensity)); connectorSize.SetWidth((int)(width * 0.4 * currentDensity)); LinearLayout plusMinus = new LinearLayout(context); plusMinus.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent); plusMinus.SetMinimumHeight((int)(40 * currentDensity)); plusMinus.SetMinimumWidth((int)((width - (int)(width * 0.4)) * currentDensity)); ImageButton minusButton = new ImageButton(context); minusButton.SetMinimumHeight((int)(20 * currentDensity)); minusButton.Click += MinusButton_Click; string imageId = "diagramsub.png"; if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); minusButton.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } plusMinus.AddView(minusButton); label = new TextView(context); label.Text = "12"; label.TextAlignment = TextAlignment.Center; label.Gravity = GravityFlags.Center; label.SetMinimumHeight((int)(60 * currentDensity)); label.SetWidth((int)(50 * currentDensity)); plusMinus.AddView(label); ImageButton plusButton = new ImageButton(context); imageId = "diagramplus.png"; plusButton.Click += PlusButton_Click; plusButton.TextAlignment = TextAlignment.ViewEnd; if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); plusButton.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } plusMinus.AddView(plusButton); linearLayout3.AddView(connectorSize); linearLayout3.AddView(plusMinus); gridLinearLayout.AddView(linearLayout4); gridLinearLayout.AddView(linearLayout1); gridLinearLayout.AddView(linearLayout2); gridLinearLayout.AddView(linearLayout3); return(gridLinearLayout); }
private LinearLayout GenerateStationSelectionBox(StationSelectionBoxType StationSelectionBoxType) { //From Back LinearLayout FromBack = new LinearLayout(this); FromBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 400); FromBack.Orientation = Orientation.Vertical; FromBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox); //FromBack.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); //From Station LinearLayout FromStationBack = new LinearLayout(this); FromStationBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromStationBack.Orientation = Orientation.Vertical; FromStationBack.Visibility = ViewStates.Gone; FromBack.AddView(FromStationBack); LinearLayout FromStationBar = new LinearLayout(this); FromStationBar.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 100); FromStationBar.SetDpPadding(RtGraphicsLayouts, 10, 10, 10, 10); FromStationBack.AddView(FromStationBar); TextView FromStationText = new TextView(this); FromStationText.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(10 + 10 + SMALLPADDING + SMALLPADDING + 80), RtGraphicsLayouts.EXPAND); FromStationText.Format(RtGraphicsExt.TextFormats.Paragraph2); FromStationText.SetDpPadding(RtGraphicsLayouts, 25, 0, 0, 0); FromStationText.Gravity = GravityFlags.CenterVertical; FromStationText.Text = "Not Set"; FromStationBar.AddView(FromStationText); ImageView FromStationIcon = new ImageView(this); FromStationIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(80, 80); FromStationIcon.SetImageResource(Resource.Drawable.IconCancel); FromStationBar.AddView(FromStationIcon); LinearLayout FromStationBarSeperator = new LinearLayout(this); FromStationBarSeperator.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 2); FromStationBarSeperator.SetBackgroundColor(RtGraphicsColours.GreyLightest); FromStationBack.AddView(FromStationBarSeperator); TextView FromStationNoNav = new TextView(this); FromStationNoNav.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromStationNoNav.Gravity = GravityFlags.Center; FromStationNoNav.Format(RtGraphicsExt.TextFormats.Paragraph1); FromStationNoNav.Text = "This station doesn't support navigation."; FromStationBack.AddView(FromStationNoNav); StationFacilitiesView StationFacilitiesView = new StationFacilitiesView(this); StationFacilitiesView.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromStationBack.AddView(StationFacilitiesView); //From Search LinearLayout FromSearchBack = new LinearLayout(this); FromSearchBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchBack.Orientation = Orientation.Vertical; FromBack.AddView(FromSearchBack); RelativeLayout FromSearchBar = new RelativeLayout(this); FromSearchBar.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 100); FromSearchBar.SetDpPadding(RtGraphicsLayouts, 10, 10, 10, 10); FromSearchBack.AddView(FromSearchBar); ImageView FromSearchbarIcon = new ImageView(this); FromSearchbarIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(80, 80); FromSearchbarIcon.SetImageResource(Resource.Drawable.IconSearch); FromSearchBar.AddView(FromSearchbarIcon); EditText FromSearchBox = new EditText(this); FromSearchBox.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchBox.SetDpPadding(RtGraphicsLayouts, 80 + SMALLPADDING, 0, 0, 0); FromSearchBox.Background.SetColorFilter(Android.Graphics.Color.White, Android.Graphics.PorterDuff.Mode.SrcIn); FromSearchBox.Format(RtGraphicsExt.TextFormats.Paragraph2); FromSearchBox.Hint = (StationSelectionBoxType == StationSelectionBoxType.From) ? "From" : "To"; FromSearchBar.AddView(FromSearchBox); LinearLayout FromSearchBarSeperator = new LinearLayout(this); FromSearchBarSeperator.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 2); FromSearchBarSeperator.SetBackgroundColor(RtGraphicsColours.GreyLightest); FromSearchBack.AddView(FromSearchBarSeperator); TextView FromSearchEmpty = new TextView(this); FromSearchEmpty.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchEmpty.Gravity = GravityFlags.Center; FromSearchEmpty.Format(RtGraphicsExt.TextFormats.Paragraph1); FromSearchEmpty.Text = "Search above for a station."; FromSearchBack.AddView(FromSearchEmpty); ScrollView FromSearchResultsScroll = new ScrollView(this); FromSearchResultsScroll.Visibility = ViewStates.Gone; FromSearchBack.AddView(FromSearchResultsScroll); LinearLayout FromSearchResultsBack = new LinearLayout(this); FromSearchResultsBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); FromSearchResultsBack.Orientation = Orientation.Vertical; FromSearchResultsScroll.AddView(FromSearchResultsBack); //Event Handlers FromStationIcon.Click += delegate { FromStationBack.Visibility = ViewStates.Gone; FromSearchBack.Visibility = ViewStates.Visible; if (StationSelectionBoxType == StationSelectionBoxType.From) { FromStationCode = ""; FromStationname = ""; } else { ToStationCode = ""; ToStationname = ""; } StationSelectionChanged(); }; FromSearchBox.AfterTextChanged += delegate { if (FromSearchBox.Length() > 1) { DrawSearchResults(FromSearchResultsBack, FromSearchBox, FromSearchBack, FromStationBack, FromStationText, FromStationNoNav, FromSearchBox.Text, StationSelectionBoxType, StationFacilitiesView); FromSearchResultsScroll.Visibility = ViewStates.Visible; FromSearchEmpty.Visibility = ViewStates.Gone; } else { FromSearchResultsScroll.Visibility = ViewStates.Gone; FromSearchEmpty.Visibility = ViewStates.Visible; } if (StationSelectionBoxType == StationSelectionBoxType.From) { ContentScrollerRoot.SmoothScrollTo(0, 0); } else { ContentScrollerRoot.SmoothScrollTo(0, 1000000); } }; return(FromBack); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //declaring mainLayout mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout); CalligraphyConfig.InitDefault(new CalligraphyConfig.Builder() .SetDefaultFontPath("fonts/HelveticaNeueLight") .SetFontAttrId(Resource.Attribute.fontPath) .Build()); //declaring mainLayout mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); TextView experienceTitleTV = FindViewById <TextView>(Resource.Id.experienceTitleTV); activityIndicator.Visibility = Android.Views.ViewStates.Gone; layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); experienceTitleTV.Typeface = tf; experienceTitleTV.Text = "Search results"; //here we create DB dbr.CreateDB(); //here we create table dbr.CreateUsersTable(); //declaring path for RETRIEVING DATA string dbPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLiteConnection(dbPath); var user_table = db.Table <ORM.UsersDataTable>(); MainActivity.isLogined = false; //clearing table foreach (var item in user_table) { MainActivity.isLogined = true; } //left drawer mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolBar); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById <ListView>(Resource.Id.left_drawer); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Profile")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Experiences")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Map")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Wishlist")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Shopping Cart")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("My Experiences")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Help & Contact")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("About")); ListView leftDrawerLV = FindViewById <ListView>(Resource.Id.left_drawer); leftDrawerLV.Adapter = new Resources.LeftMenuFolder.LeftMenuAdapter(this, leftDrawerList); leftDrawerLV.ItemClick += LeftDrawerLV_ItemClick; //button to open/close Left Drawer FindViewById <Button>(Resource.Id.leftDrawerBN).Click += delegate { if (mDrawerLayout.IsDrawerOpen(mLeftDrawer)) { mDrawerLayout.CloseDrawer(mLeftDrawer); } else { mDrawerLayout.OpenDrawer(mLeftDrawer); } }; //left drawer ENDED //button to show context menu FindViewById <Button>(Resource.Id.contextMenuBn).Click += MainActivity_Click; //button to show context menu ENDED var responseSearch = JsonConvert.DeserializeObject <RootObjectSearchByWord>(Fragments.SearchFragment.content); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE List <Experience> tmpReverseList = new List <Experience>(); for (int i = responseSearch.experiences.Count - 1; i >= 0; i--) { tmpReverseList.Add(new Experience { id = responseSearch.experiences[i].id, title = responseSearch.experiences[i].title, description = responseSearch.experiences[i].description, owner_id = responseSearch.experiences[i].owner_id, price = responseSearch.experiences[i].price, min_capacity = responseSearch.experiences[i].min_capacity, max_capacity = responseSearch.experiences[i].max_capacity, location = responseSearch.experiences[i].location, created_at = responseSearch.experiences[i].created_at, updated_at = responseSearch.experiences[i].updated_at, price_rate = responseSearch.experiences[i].price_rate, duration = responseSearch.experiences[i].duration, duration_type = responseSearch.experiences[i].duration_type, video_url = responseSearch.experiences[i].video_url, alien_video_id = responseSearch.experiences[i].alien_video_id, video_source = responseSearch.experiences[i].video_source, has_cover = responseSearch.experiences[i].has_cover, status = responseSearch.experiences[i].status, publish_date = responseSearch.experiences[i].publish_date, meet_place_address = responseSearch.experiences[i].meet_place_address, meet_place_city = responseSearch.experiences[i].meet_place_city, meet_place_country = responseSearch.experiences[i].meet_place_country, nearby_landmarks = responseSearch.experiences[i].nearby_landmarks, must_have = responseSearch.experiences[i].must_have, instructions = responseSearch.experiences[i].instructions, approved = responseSearch.experiences[i].approved, approved_by = responseSearch.experiences[i].approved_by, approve_date = responseSearch.experiences[i].approve_date, lat = responseSearch.experiences[i].lat, lng = responseSearch.experiences[i].lng, cover_image = responseSearch.experiences[i].cover_image }); } var searchAdapter = new SearchAdapter(tmpReverseList, this); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE ENDED recyclerView.SetAdapter(searchAdapter); fragmentManager = this.FragmentManager; loginOrRegFragment = new Fragments.LoginOrRegistrationFragment(); searchFragment = new Fragments.SearchFragment(); loadingMapFragment = new Fragments.LoadingMyExperiencesAndGettingWishlistFrom_DB_ForMapFragment(); FindViewById <Button>(Resource.Id.searchBn).Click += delegate { searchFragment.Show(fragmentManager, "fragmentManager"); }; mainLayout.SetBackgroundResource(Resource.Drawable.NoTours); }
public void list() { linearLayout1.RemoveAllViews(); try { using (var client = new WebClient()) { string id = Library.ControlID.userID; var json = client.DownloadString("http://joremtongwebsite.000webhostapp.com/sectionList.php?profuserID=" + id); dynamic jsonData = JsonConvert.DeserializeObject(json); foreach (dynamic jsonDatas in jsonData) { var layout2 = new LinearLayout(this); layout2.Orientation = Orientation.Horizontal; var layoutParams2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams2.SetMargins(0, 0, 0, 20); layout2.SetBackgroundResource(Resource.Drawable.layout_bg); layout2.SetPadding(0, 0, 0, 0); layout2.LayoutParameters = layoutParams2; var Image = new ImageView(this); var param = new LayoutParams(150, 150); Image.LayoutParameters = param; Image.SetPadding(30, 50, 0, 0); Image.SetImageResource(Resource.Drawable.exclamation); var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams.SetMargins(0, 0, 0, 20); layout.SetBackgroundResource(Resource.Drawable.layout_bg); layout.SetPadding(0, 0, 0, 0); layout.LayoutParameters = layoutParams; layout.Click += async delegate { UserDialogs.Instance.ShowLoading("Loading", MaskType.Black); await Task.Delay(1000); Intent activity = new Intent(this, typeof(studentSectionAction)); activity.PutExtra("ID", jsonDatas["sectionID"].ToString()); StartActivity(activity); UserDialogs.Instance.HideLoading(); }; var username = new TextView(this); username.SetTextColor(Color.White); username.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); username.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 20); username.Text = jsonDatas["subject"].ToString(); username.SetPadding(20, 20, 20, 0); var Title = new TextView(this); Title.SetTextColor(Color.White); Title.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); Title.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 15); Title.Text = jsonDatas["course"].ToString(); Title.SetPadding(20, 0, 20, 8); var content = new TextView(this); content.SetTextColor(Color.DimGray); content.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 15); content.Text = jsonDatas["section"].ToString(); content.SetPadding(20, 0, 20, 0); layout.AddView(username); layout.AddView(Title); layout.AddView(content); layout2.AddView(Image); layout2.AddView(layout); linearLayout1.AddView(layout2); } } } catch (Exception i) { var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; LayoutParams layoutParams = new LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); layoutParams.SetMargins(5, 5, 5, 5); layout.SetBackgroundColor(Color.White); layout.SetPadding(0, 0, 0, 0); var username = new TextView(this); username.SetTextColor(Color.Red); username.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); username.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 20); username.Text = "NO DATA YET"; username.SetPadding(20, 20, 20, 0); layout.AddView(username); linearLayout1.AddView(layout); } }
private LinearLayout createConfigPicker() { LinearLayout holder = new LinearLayout (context); holder.Orientation = Orientation.Horizontal; holder.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); holder.SetBackgroundResource (Resource.Drawable.footerback); LinearLayout level2 = new LinearLayout (context); level2.Orientation = Orientation.Vertical; level2.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), LinearLayout.LayoutParams.FillParent); LinearLayout topSeekHolder = new LinearLayout (context); topSeekHolder.Orientation = Orientation.Horizontal; LinearLayout.LayoutParams viewParams; viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0, 0); topSeekHolder.LayoutParameters = viewParams; SeekBar topSeek = new SeekBar (context); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, (int)ImageHelper.convertDpToPixel (10f, context)); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (15f, context), 0, (int)ImageHelper.convertDpToPixel (15f, context), 0); topSeek.LayoutParameters = viewParams; topSeekHolder.AddView (topSeek); LinearLayout set1 = new LinearLayout (context); set1.Orientation = Orientation.Horizontal; set1.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context)); TextView set1Text = new TextView (context); set1Text.SetTextColor (Color.Black); set1Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent); set1Text.Gravity = GravityFlags.CenterHorizontal; set1Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f); set1Text.Text = "1"; HorizontalScrollView set1HSV = new HorizontalScrollView (context); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); set1HSV.LayoutParameters = viewParams; set1.AddView (set1Text); set1.AddView (set1HSV); LinearLayout gap1 = new LinearLayout (context); gap1.Orientation = Orientation.Vertical; gap1.SetBackgroundColor (Color.Brown); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context)); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0); gap1.LayoutParameters = viewParams; set1.AddView (gap1); LinearLayout set2 = new LinearLayout (context); set2.Orientation = Orientation.Horizontal; set2.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context)); TextView set2Text = new TextView (context); set2Text.SetTextColor (Color.Black); set2Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent); set2Text.Gravity = GravityFlags.CenterHorizontal; set2Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f); set2Text.Text = "2"; HorizontalScrollView set2HSV = new HorizontalScrollView (context); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); set2HSV.LayoutParameters = viewParams; set2.AddView (set2Text); set2.AddView (set2HSV); LinearLayout gap2 = new LinearLayout (context); gap2.Orientation = Orientation.Vertical; viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context)); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0); gap2.LayoutParameters = viewParams; gap2.SetBackgroundColor (Color.Brown); set2.AddView (gap2); LinearLayout set3 = new LinearLayout (context); set3.Orientation = Orientation.Horizontal; set3.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context)); TextView set3Text = new TextView (context); set3Text.SetTextColor (Color.Black); set3Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent); set3Text.Gravity = GravityFlags.CenterHorizontal; set3Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f); set3Text.Text = "3"; HorizontalScrollView set3HSV = new HorizontalScrollView (context); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); set3HSV.LayoutParameters = viewParams; set3.AddView (set3Text); set3.AddView (set3HSV); LinearLayout gap3 = new LinearLayout (context); gap3.Orientation = Orientation.Vertical; viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context)); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0); gap3.LayoutParameters = viewParams; gap3.SetBackgroundColor (Color.Brown); set3.AddView (gap3); LinearLayout set4 = new LinearLayout (context); set4.Orientation = Orientation.Horizontal; set4.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context)); TextView set4Text = new TextView (context); set4Text.SetTextColor (Color.Black); set4Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent); set4Text.Gravity = GravityFlags.CenterHorizontal; set4Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f); set4Text.Text = "4"; HorizontalScrollView set4HSV = new HorizontalScrollView (context); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); set4HSV.LayoutParameters = viewParams; set4.AddView (set4Text); set4.AddView (set4HSV); level2.AddView (topSeekHolder); level2.AddView (set1); level2.AddView (set2); level2.AddView (set3); level2.AddView (set4); LinearLayout level3 = new LinearLayout (context); level3.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (25f, context), LinearLayout.LayoutParams.FillParent); level3.SetBackgroundColor (Color.Brown); level3.Orientation = Orientation.Vertical; ImageView addThing = new ImageView (context); addThing.SetBackgroundResource (Resource.Drawable.add); viewParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (23f, context), (int)ImageHelper.convertDpToPixel (23f, context)); viewParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (15f, context), 0, 0); addThing.LayoutParameters = viewParams; ImageView wipeThing = new ImageView (context); wipeThing.SetBackgroundResource (Resource.Drawable.delete); viewParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (23f, context), (int)ImageHelper.convertDpToPixel (23f, context)); viewParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (10f, context), 0, 0); wipeThing.LayoutParameters = viewParams; level3.AddView (addThing); level3.AddView (wipeThing); LinearLayout level4 = new LinearLayout (context); level4.Orientation = Orientation.Vertical; level4.SetBackgroundColor (Color.Brown); level4.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); SeekBar scroller = new SeekBar (context); viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.MatchParent); viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (15f, context), 0, (int)ImageHelper.convertDpToPixel (20.8f, context)); scroller.LayoutParameters = viewParams; level4.AddView (scroller); holder.AddView (level2); holder.AddView (level3); holder.AddView (level4); return holder; }
public IXFPopupCtrl CreateDialog(Page page, Xamarin.Forms.View content,bool cancelable) { CustomDialog dlg = null; //first try to get the PopupHolderRenderer if (content != null) { var render = Convert(content, page); if (render != null) { var size = content.GetSizeRequest(XFPopupConst.SCREEN_WIDTH, XFPopupConst.SCREEN_HEIGHT); var width = (int)size.Request.Width; var height = (int)size.Request.Height; if (width > XFPopupConst.SCREEN_WIDTH) { width = (int)(XFPopupConst.SCREEN_WIDTH * 3 / 4); } if (height > (XFPopupConst.SCREEN_HEIGHT * 3/ 4)) { height = (int)(XFPopupConst.SCREEN_HEIGHT * 3/ 4); } //important content.Layout(new Rectangle(0, 0, width, height)); float density = Forms.Context.Resources.DisplayMetrics.Density; width = (int)(width * density); height = (int)(height * density); var native = render as Android.Views.View; native.LayoutParameters = new ViewGroup.LayoutParams(width, height); LinearLayout ll = new LinearLayout(Forms.Context); ll.SetBackgroundResource(Resource.Layout.rounded_rectangle_bgr); ll.LayoutParameters = new ViewGroup.LayoutParams(width + 4, height + 4); ll.AddView(native); dlg = new CustomDialog(ll,cancelable); } } return dlg; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var dlg = inflater.Inflate(Resource.Layout.layoutcaptioncultural, container, false); var font = Typeface.CreateFromAsset(ctx.Assets, "Estedad.ttf"); LinearLayout lnaboutus = dlg.FindViewById <LinearLayout>(Resource.Id.LinearlayoutfragmentCaptioncultrual); lnaboutus.SetBackgroundResource(Resource.Drawable.dialog_fragment_round); captioncultrualtxtviewheader = dlg.FindViewById <TextView>(Resource.Id.captioncultrualtxtviewheader); captioncultrualtxtviewheader.Typeface = font; captioncultrualtxtviewheader.Text = "انتخاب رویداد"; captioncultralchkboxsiminar = dlg.FindViewById <CheckBox>(Resource.Id.captioncultralchkboxsiminar); captioncultralchkboxsiminar.Typeface = font; captioncultralchkboxsiminar.Click += delegate { captioncultralchkboxcinema.Checked = false; captioncultralchkboxcocert.Checked = false; captioncultralchkboxgallery.Checked = false; captioncultralchkboxcongrees.Checked = false; captioncultralchkbxattractions.Checked = false; // captioncultralchkboxlearning.Checked = false; OnGetCaptionCultrual.Invoke(this, new GetCaptionCultrual(value + "-" + captioncultralchkboxsiminar.Text)); Dismiss(); }; captioncultralchkboxcinema = dlg.FindViewById <CheckBox>(Resource.Id.captioncultralchkboxcinema); captioncultralchkboxcinema.Typeface = font; captioncultralchkboxcinema.Click += delegate { captioncultralchkboxsiminar.Checked = false; captioncultralchkboxcocert.Checked = false; captioncultralchkboxgallery.Checked = false; captioncultralchkboxcongrees.Checked = false; captioncultralchkbxattractions.Checked = false; // captioncultralchkboxlearning.Checked = false; OnGetCaptionCultrual.Invoke(this, new GetCaptionCultrual(value + "-" + captioncultralchkboxcinema.Text)); Dismiss(); }; captioncultralchkboxcocert = dlg.FindViewById <CheckBox>(Resource.Id.captioncultralchkboxcocert); captioncultralchkboxcocert.Typeface = font; captioncultralchkboxcocert.Click += delegate { captioncultralchkboxsiminar.Checked = false; captioncultralchkboxcinema.Checked = false; captioncultralchkboxgallery.Checked = false; captioncultralchkboxcongrees.Checked = false; captioncultralchkbxattractions.Checked = false; // captioncultralchkboxlearning.Checked = false; OnGetCaptionCultrual.Invoke(this, new GetCaptionCultrual(value + "-" + captioncultralchkboxcocert.Text)); Dismiss(); }; captioncultralchkboxgallery = dlg.FindViewById <CheckBox>(Resource.Id.captioncultralchkboxgallery); captioncultralchkboxgallery.Typeface = font; captioncultralchkboxgallery.Click += delegate { captioncultralchkboxsiminar.Checked = false; captioncultralchkboxcinema.Checked = false; captioncultralchkboxcocert.Checked = false; captioncultralchkboxcongrees.Checked = false; captioncultralchkbxattractions.Checked = false; // captioncultralchkboxlearning.Checked = false; OnGetCaptionCultrual.Invoke(this, new GetCaptionCultrual(value + "-" + captioncultralchkboxgallery.Text)); Dismiss(); }; captioncultralchkboxcongrees = dlg.FindViewById <CheckBox>(Resource.Id.captioncultralchkboxcongrees); captioncultralchkboxcongrees.Typeface = font; captioncultralchkboxcongrees.Click += delegate { captioncultralchkboxsiminar.Checked = false; captioncultralchkboxcinema.Checked = false; captioncultralchkboxcocert.Checked = false; captioncultralchkboxgallery.Checked = false; captioncultralchkbxattractions.Checked = false; // captioncultralchkboxlearning.Checked = false; OnGetCaptionCultrual.Invoke(this, new GetCaptionCultrual(value + "-" + captioncultralchkboxcongrees.Text)); Dismiss(); }; captioncultralchkbxattractions = dlg.FindViewById <CheckBox>(Resource.Id.captioncultralchkbxattractions); captioncultralchkbxattractions.Typeface = font; captioncultralchkbxattractions.Click += delegate { captioncultralchkboxsiminar.Checked = false; captioncultralchkboxcinema.Checked = false; captioncultralchkboxcocert.Checked = false; captioncultralchkboxgallery.Checked = false; captioncultralchkboxcongrees.Checked = false; // captioncultralchkboxlearning.Checked = false; OnGetCaptionCultrual.Invoke(this, new GetCaptionCultrual(value + "-" + captioncultralchkbxattractions.Text)); Dismiss(); }; captioneventbtncancelll = dlg.FindViewById <Button>(Resource.Id.captioneventbtncancell); captioneventbtncancelll.Typeface = font; captioneventbtncancelll.Click += delegate { Dismiss(); }; return(dlg); }
public void ini(){ var textFormat = Android.Util.ComplexUnitType.Px; var textFormatdip = Android.Util.ComplexUnitType.Dip; mainLayout = new RelativeLayout (context); mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1); mainLinearLayout = new LinearLayout (context); headerLinearLayout = new LinearLayout (context); contentLinearLayout = new LinearLayout (context); mainHeaderLinearLayout = new LinearLayout (context); imHeader = new ImageView (context); titleHeader = new TextView (context); AutorHeader = new TextView (context); content = new TextView (context); titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); AutorHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(125)); contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1); mainLinearLayout.Orientation = Orientation.Vertical; mainHeaderLinearLayout.Orientation = Orientation.Horizontal; headerLinearLayout.Orientation = Orientation.Vertical; contentLinearLayout.Orientation = Orientation.Vertical; mainLinearLayout.AddView (mainHeaderLinearLayout); mainLinearLayout.AddView (contentLinearLayout); mainHeaderLinearLayout.AddView (imHeader); mainHeaderLinearLayout.AddView (headerLinearLayout); headerLinearLayout.AddView (titleHeader); headerLinearLayout.AddView (AutorHeader); headerLinearLayout.SetPadding (15, 0, 0, 10); AutorHeader.SetPadding (0, 15, 0, 0); contentLinearLayout.AddView (content); contentLinearLayout.SetPadding (0, 15, 0, 0); mainLinearLayout.SetBackgroundResource (Resource.Drawable.border); // mainLinearLayout.SetX (Configuration.getHeight (45)); //mainLinearLayout.SetY (Configuration.getWidth (500)); //titleHeader.Text = "Diferentes tipos de aves en Perú"; titleHeader.SetTextColor (Color.ParseColor ("#FF0080")); //titleHeader.SetTextSize (textFormat, Configuration.getHeight (38)); titleHeader.SetTextSize (textFormatdip, 16.0f); titleHeader.SetMaxWidth (Configuration.getWidth (274)); titleHeader.SetMaxHeight (Configuration.getHeight (80)); //titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion)); titleHeader.Ellipsize = TextUtils.TruncateAt.End; titleHeader.SetMaxLines(2); //AutorHeader.Text = "Autor del Articulo"; AutorHeader.SetTextColor(Color.ParseColor ("#424242")); AutorHeader.SetTextSize (textFormat, Configuration.getHeight (23)); AutorHeader.SetMaxWidth (Configuration.getWidth (274)); //AutorHeader.SetMaxHeight (Configuration.getHeight (25)); //AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion)); AutorHeader.Ellipsize = TextUtils.TruncateAt.End; AutorHeader.SetMaxLines(1); //content.Text = "Los factores geográficos, climáticos y evolutivos convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de"; //content.SetTextSize (textFormat, Configuration.getHeight (24)); content.SetTextSize (textFormatdip, 12.0f); content.SetMaxWidth (Configuration.getWidth(501)); //content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion)); //content.Ellipsize = TextUtils.TruncateAt.End; //content.SetMaxLines(4); //imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true)); //imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion)); imHeader.SetMaxWidth (Configuration.getWidth (124)); imHeader.SetMaxHeight (Configuration.getWidth (124)); int padW = Configuration.getWidth(45); int padH = Configuration.getHeight (15); mainLayout.SetPadding (padW,padH,padW,padH); mainLayout.AddView (mainLinearLayout); /* mainLayout.AddView (titleHeader); mainLayout.AddView (AutorHeader); mainLayout.AddView (content); mainLayout.AddView (imHeader); */ }
public void ini(){ _txtCursoN = new TextView (context); _txtCursoN.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _txtUnidadN = new TextView (context); _mainLayout = new RelativeLayout (context); linearGradiente = new LinearLayout (context); linearGradiente.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (310)); linearGradiente.SetBackgroundResource (Resource.Drawable.gradiente); var textFormat = Android.Util.ComplexUnitType.Px; _mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1); _scrollSpace = new VerticalScrollView (context); _scrollSpace.LayoutParameters = new VerticalScrollView.LayoutParams (-1, Configuration.getHeight(1015-85)); _scrollSpace.SetY (Configuration.getHeight (125)); //_scrollSpace.SetBackgroundColor (Color.ParseColor ("#FF0000")); _mainLayout.AddView (_scrollSpace); _publicidadLayout = new LinearLayout (context); _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (85)); Drawable dr = new BitmapDrawable (getBitmapFromAsset ("images/footerad.jpg")); _publicidadLayout.SetBackgroundDrawable (dr); _publicidadLayout.SetY (Configuration.getHeight(1136-85)); _mainLayout.AddView (_publicidadLayout); _publicidadLayout.Click += delegate { if (adOpen) { hideAd (); } else { Random rnd = new Random(); showAd (rnd.Next(adsImagesPath.Count)); } }; _mapSpace = new LinearLayout (context); _mapSpace.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (1015)); _mapSpace.SetY(Configuration.getHeight (125)); _mainLayout.AddView (_mapSpace); _mainSpace = new LinearLayout (context); _mainSpace.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _mainSpace.Orientation = Orientation.Vertical; _scrollSpace.AddView (_mainSpace); _fondo2 = new RelativeLayout (context); _fondo2.LayoutParameters = new RelativeLayout.LayoutParams (-1, Configuration.getWidth (640)); _fondo2.SetY (Configuration.getHeight (0)); Drawable dr1 = new BitmapDrawable (getBitmapFromAsset("icons/fondoselec.png")); _fondo2.SetBackgroundDrawable (dr1); dr1 = null; _mainSpace.AddView (_fondo2); infoCursoUnidad = new LinearLayout (context); infoCursoUnidad.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(250)); infoCursoUnidad.Orientation = Orientation.Vertical; infoCursoUnidad.SetGravity(Android.Views.GravityFlags.Right); infoCursoUnidad.SetPadding (Configuration.getWidth(30), Configuration.getWidth (25), Configuration.getWidth(30), Configuration.getWidth (25)); infoCursoUnidad.SetBackgroundColor (Color.ParseColor ("#40000000")); TextView _txtCurso = new TextView (context); _txtCurso.Text = Resource.String.THE_ROUTES.ToString ();; _txtCurso.SetY (-100); //section1----------------------------------------------- _contentRLayout_S1 = new RelativeLayout(context); _txtTitle_S1 = new TextView (context); _txtAuthor_S1 = new TextView (context); _imAuthor_S1 = new ImageView (context); _txtChapter_S1 = new TextView (context); _itemsLayout_S1 = new LinearLayout (context);//not used _imItem_S1 = new List<ImageView> (); _txtItem_S1 = new List<TextView>(); _contentRLayout_S1.LayoutParameters = new RelativeLayout.LayoutParams (-1, Configuration.getHeight (480)); LinearLayout _linearTitle = new LinearLayout (context); _linearTitle.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _linearTitle.SetGravity (Android.Views.GravityFlags.Center); _linearTitle.AddView (_txtTitle_S1); _linearTitle.SetY (Configuration.getHeight (60)); linearGradiente.SetX (0); linearGradiente.SetY (Configuration.getHeight(860)); //_mainLayout.AddView (linearGradiente); //_mainLayout.AddView (_linearTitle); //_txtTitle_S1.SetX (Configuration.getWidth (245));_txtTitle_S1.SetY (Configuration.getHeight (60)); //Bitmap newbm = Configuration.getRoundedShape(Bitmap.CreateScaledBitmap( getBitmapFromAsset("icons/imgautor.png"), Configuration.getWidth(170), Configuration.getWidth(170), true),Configuration.getWidth(170),Configuration.getHeight(170)); //_imAuthor_S1.SetImageBitmap (newbm); // newbm.Recycle (); //newbm = null; //_imAuthor_S1.SetX (Configuration.getWidth (240));_imAuthor_S1.SetY (Configuration.getHeight (189)); LinearLayout _linearAuthor = new LinearLayout (context); _linearAuthor.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _linearAuthor.SetGravity (Android.Views.GravityFlags.Center); _linearAuthor.AddView (_txtAuthor_S1); _linearAuthor.SetY (Configuration.getHeight (378)); //_mainLayout.AddView (_linearAuthor); //_txtAuthor_S1.SetX (Configuration.getWidth (228));_txtAuthor_S1.SetY (Configuration.getHeight (378)); LinearLayout _linearChapter = new LinearLayout (context); _linearChapter.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _linearChapter.SetGravity (Android.Views.GravityFlags.Center); //_linearChapter.AddView (_txtChapter_S1); _linearChapter.SetY (Configuration.getHeight (502)); //_mainLayout.AddView (_linearChapter); //_txtChapter_S1.SetX (Configuration.getWidth (191));_txtChapter_S1.SetY (Configuration.getHeight (502)); _txtTitle_S1.Text = "Camino Inca"; _txtTitle_S1.SetTextColor (Color.White); _txtTitle_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtTitle_S1.SetTextSize (textFormat,Configuration.getHeight(30)); _txtAuthor_S1.Text = "David Spencer"; _txtAuthor_S1.SetTextColor (Color.White); _txtAuthor_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtAuthor_S1.SetTextSize (textFormat,Configuration.getHeight(30)); //_txtAuthor_S1.SetBackgroundColor (Color.ParseColor ("#60000000")); _txtAuthor_S1.SetShadowLayer (50.8f, 0.0f, 0.0f, Color.ParseColor ("#000000")); _txtChapter_S1.Text = "FLORA Y FAUNA"; _txtChapter_S1.SetTextColor (Color.White); _txtChapter_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtChapter_S1.SetTextSize (textFormat,Configuration.getHeight(35)); List<string> item_path = new List<string> (); item_path.Add ("icons/icona.png"); item_path.Add ("icons/iconb.png"); item_path.Add ("icons/iconc.png"); item_path.Add ("icons/icond.png"); item_path.Add ("icons/icone.png"); item_path.Add ("icons/iconf.png"); item_path.Add ("icons/icong.png"); int inixItemIM = Configuration.getWidth (33); int crecIM = Configuration.getWidth (90); int inixItemTXT = Configuration.getWidth (42); int crecTXT = Configuration.getWidth (90); int inixLinea = Configuration.getWidth (93); for (int i = 0; i < item_path.Count; i++) { _imItem_S1.Add(new ImageView(context)); //_imItem_S1[i].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(item_path[i]), Configuration.getWidth (30), Configuration.getWidth (30), true)); //_mainLayout.AddView (_imItem_S1 [i]); _imItem_S1 [i].SetX (inixItemIM+(i*crecIM));_imItem_S1 [i].SetY (Configuration.getHeight(602)); if (i != item_path.Count - 1) { ImageView linea = new ImageView (context); //linea.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/lineatareas.png"), 1, Configuration.getHeight (68), true)); //_mainLayout.AddView (linea); linea.SetX (inixLinea + (i * crecIM)); linea.SetY (Configuration.getHeight (605)); linea = null; } _txtItem_S1.Add (new TextView (context)); _txtItem_S1 [i].Text = "0"; _txtItem_S1 [i].SetTextColor (Color.ParseColor ("#2E9AFE")); _txtItem_S1[i].Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtItem_S1[i].SetTextSize (textFormat,Configuration.getHeight(30)); //_mainLayout.AddView (_txtItem_S1 [i]); _txtItem_S1 [i].SetX (inixItemTXT+(i*crecTXT));_txtItem_S1 [i].SetY (Configuration.getHeight(640)); _imItem_S1 [i] = null; } _imItem_S1 = null; //------------------------------------------------------- //section2------------------------------------------------ _contentScrollView_S2 = new HorizontalScrollView (context); _contentScrollView_S2.LayoutParameters = new HorizontalScrollView.LayoutParams (-1, Configuration.getWidth(160)); _contentScrollView_S2.HorizontalScrollBarEnabled = false; _images_S2 = new LinearLayout (context); _images_S2.Orientation = Orientation.Horizontal; _images_S2.LayoutParameters = new LinearLayout.LayoutParams(-2,-1); _contentScrollView_S2.SetX (0); _contentScrollView_S2.AddView (_images_S2); //---------------------------------------------------------- //section3------------------------------------------------ _contentLLayout_S3 = new LinearLayout (context); _contentLLayout_S3.Orientation = Orientation.Vertical; _contentLLayout_S3.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (160)); _contentLLayout_S3.SetX (0);_contentLLayout_S3.SetY (Configuration.getHeight(875)); _contentLLayout_S3.SetGravity (Android.Views.GravityFlags.Center); _txtInfo1_S3 = new TextView (context); _txtInfo2_S3 = new TextView (context); _txtInfo3_S3 = new TextView (context); _txtInfo1_S3.Text = "Duración: 05 dias / 04 noches "; _txtInfo2_S3.Text = "Distancia: 65km"; _txtInfo3_S3.Text = "Punto mas elevado: 4,6386 msnm (Salkantay)"; _txtInfo1_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo2_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo3_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo1_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo2_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo3_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo1_S3.SetTextSize (textFormat,Configuration.getHeight(30)); _txtInfo2_S3.SetTextSize (textFormat,Configuration.getHeight(30)); _txtInfo3_S3.SetTextSize (textFormat,Configuration.getHeight(30)); _txtInfo1_S3.SetTextColor (Color.White); _txtInfo2_S3.SetTextColor (Color.White); _txtInfo3_S3.SetTextColor (Color.White); _contentLLayout_S3.AddView (_txtInfo1_S3); _contentLLayout_S3.AddView (_txtInfo2_S3); _contentLLayout_S3.AddView (_txtInfo3_S3); //Drawable dr3 = new BitmapDrawable (getBitmapFromAsset("icons/fondonotif.png")); //_contentLLayout_S3.SetBackgroundDrawable(dr3); //_contentLLayout_S3.SetBackgroundColor(Color.ParseColor("#80000000")); //_mainLayout.AddView (_contentLLayout_S3); //_mainLayout.AddView (_contentScrollView_S2); _mainSpace.AddView (_contentScrollView_S2); //---------------------------------------------------------- /* _listUnidades.Add(new UnidadItem{ Title = "Dia 1", Description = "Piscacucho-Wayllabamba" }); _listUnidades.Add(new UnidadItem{ Title = "Dia 2", Description = "Wayllabamba-Pacaymayo" }); _listUnidades.Add(new UnidadItem{ Title = "Dia 3", Description = "Pacaymayo-Wiñay Wayna" }); _listUnidades.Add(new UnidadItem{ Title = "Dia 4", Description = "WIñay Wayna-Machu PIcchu"}); */ /* _listViewUnidades = new ListView(context); _listViewUnidades.Adapter = new UnidadAdapter (context, _listUnidades); _mainSpace.AddView (_listViewUnidades); */ _spaceUnidades = new LinearLayout (context); _spaceUnidades.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _spaceUnidades.Orientation = Orientation.Vertical; _spaceUnidades.SetBackgroundColor (Color.White); _mainSpace.AddView (_spaceUnidades); //section4------------------------------------------------ _imItems_S4 = new List<ImageView>(); List<string> botton_icon_path = new List<string> (); botton_icon_path.Add ("icons/btnhome.png"); botton_icon_path.Add ("icons/btncomentariosazul.png"); botton_icon_path.Add ("icons/btncontenido.png"); botton_icon_path.Add ("icons/btnchatazul.png"); botton_icon_path.Add ("icons/btnmap.png"); _imItems_S4.Add (new ImageView (context)); //_imItems_S4[0].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[0]), Configuration.getWidth (40), Configuration.getWidth (40), true)); //_mainLayout.AddView (_imItems_S4[0]); _imItems_S4[0].SetX (Configuration.getWidth(58));_imItems_S4[0].SetY (Configuration.getHeight(1069)); _imItems_S4 [0].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add (new ImageView (context)); //_imItems_S4[1].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[1]), Configuration.getWidth (78), Configuration.getWidth (55), true)); //_mainLayout.AddView (_imItems_S4[1]); _imItems_S4[1].SetX (Configuration.getWidth(169));_imItems_S4[1].SetY (Configuration.getHeight(1069)); _imItems_S4 [1].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add (new ImageView (context)); //_imItems_S4[2].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[2]), Configuration.getWidth (80), Configuration.getWidth (80), true)); //_mainLayout.AddView (_imItems_S4 [2]); _imItems_S4[2].SetX (Configuration.getWidth(297));_imItems_S4[2].SetY (Configuration.getHeight(1050)); _imItems_S4 [2].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add (new ImageView (context)); //_imItems_S4[3].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[3]), Configuration.getWidth (30), Configuration.getWidth (51), true)); //_mainLayout.AddView (_imItems_S4[3]); _imItems_S4[3].SetX (Configuration.getWidth(421));_imItems_S4[3].SetY (Configuration.getHeight(1069)); _imItems_S4 [3].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add (new ImageView (context)); //_imItems_S4[4].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[4]), Configuration.getWidth (30), Configuration.getWidth (40), true)); //_mainLayout.AddView (_imItems_S4 [4]); _imItems_S4[4].SetX (Configuration.getWidth(540));_imItems_S4[4].SetY (Configuration.getHeight(1069)); _imItems_S4 [4].Visibility = Android.Views.ViewStates.Invisible; //---------------------------------------------------------- //Drawable dr = new BitmapDrawable (getBitmapFromAsset("images/header1.png")); header = new LinearLayout(context); header.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(125)); header.Orientation = Orientation.Vertical; //header.SetBackgroundDrawable (dr); //_mainLayout.SetBackgroundDrawable (dr); _mainLayout.AddView(header); //dr = null; _workspace = new LinearLayout (context); _workspace.LayoutParameters = new LinearLayout.LayoutParams (-1, -1); //_workspace.SetBackgroundColor (Color.ParseColor ("#ffffff")); //_workspace.SetY (Configuration.getHeight (110)); _mainLayout.AddView (_workspace); //_mainLayout.SetBackgroundColor (Color.ParseColor ("#ffffff")); //_workspace.AddView (_foro); //_workspace.Visibility = Android.Views.ViewStates.Invisible; }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.SearchBar> e) { base.OnElementChanged(e); var element = (MvvmAspire.Controls.SearchBar)Element; // Get native control (background set in shared code, but can use SetBackgroundColor here) Android.Widget.SearchView searchView = (base.Control as Android.Widget.SearchView); searchView.SetInputType(InputTypes.ClassText | InputTypes.TextVariationNormal); int textViewId = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null); editText = (searchView.FindViewById(textViewId) as EditText); editText.SetTextColor(element.TextColor.ToAndroid()); //editText.TextAlignment = Android.Views.TextAlignment. editText.Gravity = GravityFlags.CenterVertical | GravityFlags.Start; if (element.PlaceholderColor != Xamarin.Forms.Color.Default) { editText.SetHintTextColor(element.PlaceholderColor.ToAndroid()); } //if (element.ShowSearchIconAsPlaceHolder) // editText.SetCompoundDrawablesRelativeWithIntrinsicBounds(Android.Resource.Drawable.IcMenuSearch, 0, 0, 0); //editText.TextChanged += editText_TextChanged; int searchPlateId = searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null); LinearLayout searchPlateLayout = (searchView.FindViewById(searchPlateId) as LinearLayout); //searchPlateLayout.SetBackgroundColor(Android.Graphics.Color.Red); if (element.Background != null && element.Background.File != null) { searchPlateLayout.SetBackgroundResource(UIHelper.GetDrawableResource(element.Background)); } else { if (element.BackgroundColor != Xamarin.Forms.Color.Default) { searchPlateLayout.SetBackgroundColor(element.BackgroundColor.ToAndroid()); } } int frameId = searchView.Context.Resources.GetIdentifier("android:id/search_edit_frame", null, null); //Android.Views.View frameView = (searchView.FindViewById(frameId) as Android.Views.View); LinearLayout frameView = (searchView.FindViewById(frameId) as LinearLayout); if (element.Background != null && element.Background.File != null) { frameView.SetBackgroundResource(UIHelper.GetDrawableResource(element.Background)); } int searchIconId = searchView.Context.Resources.GetIdentifier("android:id/search_mag_icon", null, null); ImageView searchIcon = (searchView.FindViewById(searchIconId) as ImageView); if (element.SearchIcon != null && element.SearchIcon.File != null) { searchIcon.SetImageResource(UIHelper.GetDrawableResource(element.SearchIcon)); } else { searchIcon.SetImageResource(Android.Resource.Drawable.IcMenuSearch); } if (element.AlignSearchIconRight) { searchIcon.LayoutParameters = new LinearLayout.LayoutParams(0, 0); var iv = new ImageView(this.Context); iv.Click += (s, ev) => { if (Element.SearchCommand != null && Element.SearchCommand.CanExecute(Element.SearchCommandParameter)) { Element.SearchCommand.Execute(Element.SearchCommandParameter); } }; if (searchIcon.Drawable != null) { iv.SetImageDrawable(searchIcon.Drawable); } frameView.AddView(iv); this.SetBackgroundColor(Android.Graphics.Color.Transparent); } int search_close_btnID = searchView.Context.Resources.GetIdentifier("android:id/search_close_btn", null, null); ImageView search_close_btn = (searchView.FindViewById(search_close_btnID) as ImageView); search_close_btn.Click += search_close_btn_Click; SetTextInputTypes(element); search_close_btn.SetImageResource(Android.Resource.Drawable.IcMenuCloseClearCancel); //if (GetThemeName() == Android.Resource.Style.ThemeMaterialLightDarkActionBar) //{ //} CreateShapeDrawable(element); SetTypeface(); //if (element.HeightRequest > 0) //{ // editText.SetHeight(BaseUIHelper.ConvertDPToPixels(element.HeightRequest)); //} }
private void createUI(MessageDB message, UserDB contact) { #if DEBUG System.Diagnostics.Debug.WriteLine ("AccoundID (MC) = {0}", AndroidData.CurrentUser.AccountID.ToString ()); #endif int m = 0; string messager = ""; if (message != null && contact != null) { RunOnUiThread (delegate { ImageView random = null; LinearLayout layout = new LinearLayout (context); layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity (GravityFlags.CenterVertical); layout.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context)); ImageView profilepic = new ImageView (context); profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (60f, context), (int)ImageHelper.convertDpToPixel (100f, context)); profilepic.Tag = new Java.Lang.String ("profilepic_" + m.ToString ()); if (contact == null) profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); else { if (contact.Picture.Length > 0) { //profilepic.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromStream(new MemoryStream(eachContact.ContactUser.Picture), "Profile")); loadProfilePicture (contact.AccountID); } else { profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); } //layout.AddView(profilepic); LinearLayout layout2 = new LinearLayout (context); layout2.Orientation = Orientation.Vertical; layout2.SetGravity (GravityFlags.Center); TextView name = new TextView (context); name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), (int)ImageHelper.convertDpToPixel (40f, context)); name.Gravity = GravityFlags.Center; name.SetTextColor (Color.White); name.TextSize = 16f; name.Text = contact.FirstName + " " + contact.LastName; layout2.AddView (name); TextView text = new TextView (context); text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (60f, context)); text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); text.Gravity = GravityFlags.CenterVertical; if (name.Text == isMe) text.SetBackgroundResource (Resource.Drawable.bubblesolidright); else text.SetBackgroundResource (Resource.Drawable.bubblesolidleft); text.TextSize = 16f; for (int e = 0; e < message.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (message.MessageStepDBList [e].MessageText)) { messager = message.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = messager.Length / 27; text.SetHeight ((nolines + 1) * 20); text.SetTextColor (Android.Graphics.Color.Black); text.Text = messager; layout2.Clickable = true; layout2.AddView (text); if (message.MessageStepDBList.Count > 1) { LinearLayout layout3 = new LinearLayout (context); layout3.Orientation = Orientation.Horizontal; if (name.Text == isMe) layout3.SetGravity (GravityFlags.Right); else layout3.SetGravity (GravityFlags.Left); layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); layout3.SetVerticalGravity (GravityFlags.CenterVertical); layout3.SetMinimumHeight (30); layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); if (name.Text != isMe) { random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); //random.Click += delegate { PlayMessage(message); }; layout3.AddView (random); } for (int i = 1; i < message.MessageStepDBList.Count; ++i) { switch (message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Animation: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.drawicon); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.comicon); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.comicmsgs); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.emoticonmsg); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.pollmsg); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.soundfxmsg); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.Video: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.videomsg); layout3.AddView (random); break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.voicemsg); layout3.AddView (random); break; } } if (name.Text == isMe) { random = new ImageView (context); random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); //random.Click += delegate { PlayMessage(message); }; layout3.AddView (random); } layout2.AddView (layout3); } if (name.Text != isMe) { layout.AddView (profilepic); layout.AddView (layout2); } else { layout.AddView (layout2); layout.AddView (profilepic); } converse.AddView (layout); m++; } }); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); // Save ScreenController for later use ctrl = ((GameController)this.Activity); if (container == null) return null; var view = inflater.Inflate(Resource.Layout.GameDialogScreen, container, false); imageView = view.FindViewById<ImageView> (Resource.Id.imageView); textDescription = view.FindViewById<TextView> (Resource.Id.textDescription); spinnerInput = view.FindViewById<Spinner> (Resource.Id.spinnerMulti); editInput = view.FindViewById<EditText> (Resource.Id.editInput); layoutDialog = view.FindViewById<LinearLayout> (Resource.Id.layoutDialog); layoutInput = view.FindViewById<LinearLayout> (Resource.Id.layoutInput); layoutButton = view.FindViewById<LinearLayout> (Resource.Id.layoutButton); // Don't know a better way layoutDialog.SetBackgroundResource(Main.BottomBackground); layoutButton.SetBackgroundResource(Main.BottomBackground); if (input == null) { // Normal dialog layoutDialog.Visibility = ViewStates.Visible; layoutInput.Visibility = ViewStates.Gone; btnView1 = view.FindViewById<Button> (Resource.Id.button1); btnView1.SetTextColor(Color.White); btnView1.SetBackgroundResource(Main.ButtonBackground); btnView1.Click += OnButtonClicked; btnView2 = view.FindViewById<Button> (Resource.Id.button2); btnView2.SetTextColor(Color.White); btnView2.SetBackgroundResource(Main.ButtonBackground); btnView2.Click += OnButtonClicked; } else { if (input.InputType == InputType.MultipleChoice) { // Multiple choice dialog layoutDialog.Visibility = ViewStates.Gone; layoutInput.Visibility = ViewStates.Visible; spinnerInput.Visibility = ViewStates.Visible; editInput.Visibility = ViewStates.Gone; } else { // Input dialog layoutDialog.Visibility = ViewStates.Gone; layoutInput.Visibility = ViewStates.Visible; spinnerInput.Visibility = ViewStates.Gone; editInput.Visibility = ViewStates.Visible; editInput.Text = ""; editInput.EditorAction += HandleEditorAction; } btnInput = view.FindViewById<Button> (Resource.Id.buttonInput); btnInput.Text = ctrl.Resources.GetString(Resource.String.done); btnInput.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light); btnInput.Click += OnInputClicked; } return view; }
void AddSubCategories() { ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); var index = 0; foreach (var item in items) { LinearLayout row = new LinearLayout(context); row.Orientation = Orientation.Horizontal; row.LayoutParameters = p; TextView subCategory = new TextView(context); subCategory.LayoutParameters = p; subCategory.Gravity = GravityFlags.CenterVertical; subCategory.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.40f); subCategory.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15)); subCategory.Text = item.Value; row.AddView(subCategory); row.Click += (object sender, EventArgs e) => { row.SetBackgroundResource(Android.Resource.Color.HoloBlueLight); if (this.CategorySelected != null) this.CategorySelected(this, new CategorySelectedEventArgs { Selected = item }); }; row.LongClick += (sender, e) => { if (this.CategoryLongClick != null) CategoryLongClick(this, new CategorySelectedEventArgs { Selected = item, SelectedView = row }); }; AddView(row); index++; } }
public void ini() { _txtCursoN = new TextView(context); _txtCursoN.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _txtUnidadN = new TextView(context); _mainLayout = new RelativeLayout(context); linearGradiente = new LinearLayout(context); linearGradiente.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(310)); linearGradiente.SetBackgroundResource(Resource.Drawable.gradiente); var textFormat = Android.Util.ComplexUnitType.Px; _mainLayout.LayoutParameters = new RelativeLayout.LayoutParams(-1, -1); _scrollSpace = new VerticalScrollView(context); _scrollSpace.LayoutParameters = new VerticalScrollView.LayoutParams(-1, Configuration.getHeight(1015 - 85)); _scrollSpace.SetY(Configuration.getHeight(125)); //_scrollSpace.SetBackgroundColor (Color.ParseColor ("#FF0000")); _mainLayout.AddView(_scrollSpace); _publicidadLayout = new LinearLayout(context); _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85)); Drawable dr = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg")); _publicidadLayout.SetBackgroundDrawable(dr); _publicidadLayout.SetY(Configuration.getHeight(1136 - 85)); _mainLayout.AddView(_publicidadLayout); _publicidadLayout.Click += delegate { if (adOpen) { hideAd(); } else { Random rnd = new Random(); showAd(rnd.Next(adsImagesPath.Count)); } }; _mapSpace = new LinearLayout(context); _mapSpace.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(1015)); _mapSpace.SetY(Configuration.getHeight(125)); _mainLayout.AddView(_mapSpace); _mainSpace = new LinearLayout(context); _mainSpace.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _mainSpace.Orientation = Orientation.Vertical; _scrollSpace.AddView(_mainSpace); _fondo2 = new RelativeLayout(context); _fondo2.LayoutParameters = new RelativeLayout.LayoutParams(-1, Configuration.getWidth(640)); _fondo2.SetY(Configuration.getHeight(0)); Drawable dr1 = new BitmapDrawable(getBitmapFromAsset("icons/fondoselec.png")); _fondo2.SetBackgroundDrawable(dr1); dr1 = null; _mainSpace.AddView(_fondo2); infoCursoUnidad = new LinearLayout(context); infoCursoUnidad.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(250)); infoCursoUnidad.Orientation = Orientation.Vertical; infoCursoUnidad.SetGravity(Android.Views.GravityFlags.Right); infoCursoUnidad.SetPadding(Configuration.getWidth(30), Configuration.getWidth(25), Configuration.getWidth(30), Configuration.getWidth(25)); infoCursoUnidad.SetBackgroundColor(Color.ParseColor("#40000000")); TextView _txtCurso = new TextView(context); _txtCurso.Text = Resource.String.THE_ROUTES.ToString();; _txtCurso.SetY(-100); //section1----------------------------------------------- _contentRLayout_S1 = new RelativeLayout(context); _txtTitle_S1 = new TextView(context); _txtAuthor_S1 = new TextView(context); _imAuthor_S1 = new ImageView(context); _txtChapter_S1 = new TextView(context); _itemsLayout_S1 = new LinearLayout(context); //not used _imItem_S1 = new List <ImageView> (); _txtItem_S1 = new List <TextView>(); _contentRLayout_S1.LayoutParameters = new RelativeLayout.LayoutParams(-1, Configuration.getHeight(480)); LinearLayout _linearTitle = new LinearLayout(context); _linearTitle.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _linearTitle.SetGravity(Android.Views.GravityFlags.Center); _linearTitle.AddView(_txtTitle_S1); _linearTitle.SetY(Configuration.getHeight(60)); linearGradiente.SetX(0); linearGradiente.SetY(Configuration.getHeight(860)); //_mainLayout.AddView (linearGradiente); //_mainLayout.AddView (_linearTitle); //_txtTitle_S1.SetX (Configuration.getWidth (245));_txtTitle_S1.SetY (Configuration.getHeight (60)); //Bitmap newbm = Configuration.getRoundedShape(Bitmap.CreateScaledBitmap( getBitmapFromAsset("icons/imgautor.png"), Configuration.getWidth(170), Configuration.getWidth(170), true),Configuration.getWidth(170),Configuration.getHeight(170)); //_imAuthor_S1.SetImageBitmap (newbm); // newbm.Recycle (); //newbm = null; //_imAuthor_S1.SetX (Configuration.getWidth (240));_imAuthor_S1.SetY (Configuration.getHeight (189)); LinearLayout _linearAuthor = new LinearLayout(context); _linearAuthor.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _linearAuthor.SetGravity(Android.Views.GravityFlags.Center); _linearAuthor.AddView(_txtAuthor_S1); _linearAuthor.SetY(Configuration.getHeight(378)); //_mainLayout.AddView (_linearAuthor); //_txtAuthor_S1.SetX (Configuration.getWidth (228));_txtAuthor_S1.SetY (Configuration.getHeight (378)); LinearLayout _linearChapter = new LinearLayout(context); _linearChapter.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _linearChapter.SetGravity(Android.Views.GravityFlags.Center); //_linearChapter.AddView (_txtChapter_S1); _linearChapter.SetY(Configuration.getHeight(502)); //_mainLayout.AddView (_linearChapter); //_txtChapter_S1.SetX (Configuration.getWidth (191));_txtChapter_S1.SetY (Configuration.getHeight (502)); _txtTitle_S1.Text = "Camino Inca"; _txtTitle_S1.SetTextColor(Color.White); _txtTitle_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtTitle_S1.SetTextSize(textFormat, Configuration.getHeight(30)); _txtAuthor_S1.Text = "David Spencer"; _txtAuthor_S1.SetTextColor(Color.White); _txtAuthor_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtAuthor_S1.SetTextSize(textFormat, Configuration.getHeight(30)); //_txtAuthor_S1.SetBackgroundColor (Color.ParseColor ("#60000000")); _txtAuthor_S1.SetShadowLayer(50.8f, 0.0f, 0.0f, Color.ParseColor("#000000")); _txtChapter_S1.Text = "FLORA Y FAUNA"; _txtChapter_S1.SetTextColor(Color.White); _txtChapter_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtChapter_S1.SetTextSize(textFormat, Configuration.getHeight(35)); List <string> item_path = new List <string> (); item_path.Add("icons/icona.png"); item_path.Add("icons/iconb.png"); item_path.Add("icons/iconc.png"); item_path.Add("icons/icond.png"); item_path.Add("icons/icone.png"); item_path.Add("icons/iconf.png"); item_path.Add("icons/icong.png"); int inixItemIM = Configuration.getWidth(33); int crecIM = Configuration.getWidth(90); int inixItemTXT = Configuration.getWidth(42); int crecTXT = Configuration.getWidth(90); int inixLinea = Configuration.getWidth(93); for (int i = 0; i < item_path.Count; i++) { _imItem_S1.Add(new ImageView(context)); //_imItem_S1[i].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(item_path[i]), Configuration.getWidth (30), Configuration.getWidth (30), true)); //_mainLayout.AddView (_imItem_S1 [i]); _imItem_S1 [i].SetX(inixItemIM + (i * crecIM)); _imItem_S1 [i].SetY(Configuration.getHeight(602)); if (i != item_path.Count - 1) { ImageView linea = new ImageView(context); //linea.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/lineatareas.png"), 1, Configuration.getHeight (68), true)); //_mainLayout.AddView (linea); linea.SetX(inixLinea + (i * crecIM)); linea.SetY(Configuration.getHeight(605)); linea = null; } _txtItem_S1.Add(new TextView(context)); _txtItem_S1 [i].Text = "0"; _txtItem_S1 [i].SetTextColor(Color.ParseColor("#2E9AFE")); _txtItem_S1[i].Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtItem_S1[i].SetTextSize(textFormat, Configuration.getHeight(30)); //_mainLayout.AddView (_txtItem_S1 [i]); _txtItem_S1 [i].SetX(inixItemTXT + (i * crecTXT)); _txtItem_S1 [i].SetY(Configuration.getHeight(640)); _imItem_S1 [i] = null; } _imItem_S1 = null; //------------------------------------------------------- //section2------------------------------------------------ _contentScrollView_S2 = new HorizontalScrollView(context); _contentScrollView_S2.LayoutParameters = new HorizontalScrollView.LayoutParams(-1, Configuration.getWidth(160)); _contentScrollView_S2.HorizontalScrollBarEnabled = false; _images_S2 = new LinearLayout(context); _images_S2.Orientation = Orientation.Horizontal; _images_S2.LayoutParameters = new LinearLayout.LayoutParams(-2, -1); _contentScrollView_S2.SetX(0); _contentScrollView_S2.AddView(_images_S2); //---------------------------------------------------------- //section3------------------------------------------------ _contentLLayout_S3 = new LinearLayout(context); _contentLLayout_S3.Orientation = Orientation.Vertical; _contentLLayout_S3.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(160)); _contentLLayout_S3.SetX(0); _contentLLayout_S3.SetY(Configuration.getHeight(875)); _contentLLayout_S3.SetGravity(Android.Views.GravityFlags.Center); _txtInfo1_S3 = new TextView(context); _txtInfo2_S3 = new TextView(context); _txtInfo3_S3 = new TextView(context); _txtInfo1_S3.Text = "Duración: 05 dias / 04 noches "; _txtInfo2_S3.Text = "Distancia: 65km"; _txtInfo3_S3.Text = "Punto mas elevado: 4,6386 msnm (Salkantay)"; _txtInfo1_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo2_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo3_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo1_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo2_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo3_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo1_S3.SetTextSize(textFormat, Configuration.getHeight(30)); _txtInfo2_S3.SetTextSize(textFormat, Configuration.getHeight(30)); _txtInfo3_S3.SetTextSize(textFormat, Configuration.getHeight(30)); _txtInfo1_S3.SetTextColor(Color.White); _txtInfo2_S3.SetTextColor(Color.White); _txtInfo3_S3.SetTextColor(Color.White); _contentLLayout_S3.AddView(_txtInfo1_S3); _contentLLayout_S3.AddView(_txtInfo2_S3); _contentLLayout_S3.AddView(_txtInfo3_S3); //Drawable dr3 = new BitmapDrawable (getBitmapFromAsset("icons/fondonotif.png")); //_contentLLayout_S3.SetBackgroundDrawable(dr3); //_contentLLayout_S3.SetBackgroundColor(Color.ParseColor("#80000000")); //_mainLayout.AddView (_contentLLayout_S3); //_mainLayout.AddView (_contentScrollView_S2); _mainSpace.AddView(_contentScrollView_S2); //---------------------------------------------------------- /* * _listUnidades.Add(new UnidadItem{ Title = "Dia 1", Description = "Piscacucho-Wayllabamba" }); * _listUnidades.Add(new UnidadItem{ Title = "Dia 2", Description = "Wayllabamba-Pacaymayo" }); * _listUnidades.Add(new UnidadItem{ Title = "Dia 3", Description = "Pacaymayo-Wiñay Wayna" }); * _listUnidades.Add(new UnidadItem{ Title = "Dia 4", Description = "WIñay Wayna-Machu PIcchu"}); */ /* * _listViewUnidades = new ListView(context); * _listViewUnidades.Adapter = new UnidadAdapter (context, _listUnidades); * * _mainSpace.AddView (_listViewUnidades); */ _spaceUnidades = new LinearLayout(context); _spaceUnidades.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); _spaceUnidades.Orientation = Orientation.Vertical; _spaceUnidades.SetBackgroundColor(Color.White); _mainSpace.AddView(_spaceUnidades); //section4------------------------------------------------ _imItems_S4 = new List <ImageView>(); List <string> botton_icon_path = new List <string> (); botton_icon_path.Add("icons/btnhome.png"); botton_icon_path.Add("icons/btncomentariosazul.png"); botton_icon_path.Add("icons/btncontenido.png"); botton_icon_path.Add("icons/btnchatazul.png"); botton_icon_path.Add("icons/btnmap.png"); _imItems_S4.Add(new ImageView(context)); //_imItems_S4[0].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[0]), Configuration.getWidth (40), Configuration.getWidth (40), true)); //_mainLayout.AddView (_imItems_S4[0]); _imItems_S4[0].SetX(Configuration.getWidth(58)); _imItems_S4[0].SetY(Configuration.getHeight(1069)); _imItems_S4 [0].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add(new ImageView(context)); //_imItems_S4[1].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[1]), Configuration.getWidth (78), Configuration.getWidth (55), true)); //_mainLayout.AddView (_imItems_S4[1]); _imItems_S4[1].SetX(Configuration.getWidth(169)); _imItems_S4[1].SetY(Configuration.getHeight(1069)); _imItems_S4 [1].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add(new ImageView(context)); //_imItems_S4[2].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[2]), Configuration.getWidth (80), Configuration.getWidth (80), true)); //_mainLayout.AddView (_imItems_S4 [2]); _imItems_S4[2].SetX(Configuration.getWidth(297)); _imItems_S4[2].SetY(Configuration.getHeight(1050)); _imItems_S4 [2].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add(new ImageView(context)); //_imItems_S4[3].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[3]), Configuration.getWidth (30), Configuration.getWidth (51), true)); //_mainLayout.AddView (_imItems_S4[3]); _imItems_S4[3].SetX(Configuration.getWidth(421)); _imItems_S4[3].SetY(Configuration.getHeight(1069)); _imItems_S4 [3].Visibility = Android.Views.ViewStates.Invisible; _imItems_S4.Add(new ImageView(context)); //_imItems_S4[4].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[4]), Configuration.getWidth (30), Configuration.getWidth (40), true)); //_mainLayout.AddView (_imItems_S4 [4]); _imItems_S4[4].SetX(Configuration.getWidth(540)); _imItems_S4[4].SetY(Configuration.getHeight(1069)); _imItems_S4 [4].Visibility = Android.Views.ViewStates.Invisible; //---------------------------------------------------------- //Drawable dr = new BitmapDrawable (getBitmapFromAsset("images/header1.png")); header = new LinearLayout(context); header.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(125)); header.Orientation = Orientation.Vertical; //header.SetBackgroundDrawable (dr); //_mainLayout.SetBackgroundDrawable (dr); _mainLayout.AddView(header); //dr = null; _workspace = new LinearLayout(context); _workspace.LayoutParameters = new LinearLayout.LayoutParams(-1, -1); //_workspace.SetBackgroundColor (Color.ParseColor ("#ffffff")); //_workspace.SetY (Configuration.getHeight (110)); _mainLayout.AddView(_workspace); //_mainLayout.SetBackgroundColor (Color.ParseColor ("#ffffff")); //_workspace.AddView (_foro); //_workspace.Visibility = Android.Views.ViewStates.Invisible; }
public void setImage(string imageString) { int index = Convert.ToInt32(imageString); mainLL.SetBackgroundResource(imageId[index]); }
void Initialize() { ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); this.Orientation = Orientation.Vertical; LinearLayout row = new LinearLayout(context); row.Orientation = Orientation.Horizontal; row.LayoutParameters = p; row.SetBackgroundResource(Resource.Color.headerColor); headerLabel = new TextView(context); headerLabel.LayoutParameters = p; //headerLabel.SetTextSize(ComplexUnitType.Dip, 20); headerLabel.Gravity = GravityFlags.CenterVertical; headerLabel.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.50f); headerLabel.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15)); row.AddView(headerLabel); AddView(row); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.modificaNotaLayout); //prendiamo il titolo dall'intent e lo settiamo nell'EditText String t = Intent.GetStringExtra("titolo"); EditText titolo = (EditText)FindViewById(Resource.Id.titoloMod); titolo.Text += t; //prendiamo il contenuto dall'intent e lo settiamo nell'EditText String c = Intent.GetStringExtra("contenuto"); EditText contenuto = (EditText)FindViewById(Resource.Id.contenutoMod); contenuto.Text += c; start = 0; //listener sulla edit text che controlla ogni volta che c'è un cambiamento di testo contenuto.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { //prendiamo il testo inserito, lo convertiamo in stringa e ne controlliamo l'ultimo carattere inserito. //Se questo è un "." allora indica che la frase/periodo è finita e deve farne il Sentiment Analysis. string s = contenuto.Text.ToString(); int finish = 0; int i = s.Length; if (i <= 1) { if (s.Equals(".")) { } } else { string a = s.Substring(i - 1); if (a.Equals(".")) { finish = i - 1; String pezzoText = s.Substring(start, finish - start); double score = FaceUnlockVocalNode.Resources.MyCognitive.getSentimentText(pezzoText); String emoji = ""; if (score >= 0.60) { emoji = Emoji(0x1f600); } else if (score <= 40) { emoji = Emoji(0x1F608); } else { emoji = Emoji(0x1F610); } contenuto.Text += emoji; contenuto.SetSelection(finish + 3); start = finish; } } }; Button b = (Button)FindViewById(Resource.Id.modifica); //prendiamo l'id della nota dall'intent e creiamo un nuovo oggetto Nota, passandogli tutte le informazioni dall'intent int id = int.Parse(Intent.GetStringExtra("id")); n.setId_nota(id); n.setUsername(Intent.GetStringExtra("username")); b.Click += modificaOnClick; img = (Button)FindViewById(Resource.Id.mfoto); img.Click += CamptureButton_Click; l = FindViewById <LinearLayout>(Resource.Id.m); foto = FindViewById <Button>(Resource.Id.mfoto); Salva = FindViewById <Button>(Resource.Id.modifica); ù // a seconda dell'emozione cambiamo colore interfaccia emozione = Intent.GetStringExtra("emozione"); switch (emozione) { case "happines": l.SetBackgroundResource(Resource.Color.colorBackgroudnHappiness); foto.SetBackgroundResource(Resource.Color.colorPrimaryHappiness); Salva.SetBackgroundResource(Resource.Color.colorPrimaryHappiness); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkHappiness))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "sadness": l.SetBackgroundResource(Resource.Color.colorBackgroudnSadness); foto.SetBackgroundResource(Resource.Color.colorPrimarySadness); Salva.SetBackgroundResource(Resource.Color.colorPrimarySadness); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkSadness))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "fear": l.SetBackgroundResource(Resource.Color.colorBackgroudnFear); foto.SetBackgroundResource(Resource.Color.colorPrimaryFear); Salva.SetBackgroundResource(Resource.Color.colorPrimaryFear); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkFear))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "anger": l.SetBackgroundResource(Resource.Color.colorBackgroudnAngry); foto.SetBackgroundResource(Resource.Color.colorPrimaryAngry); Salva.SetBackgroundResource(Resource.Color.colorPrimaryAngry); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkAngry))); break; ; case "contempt": l.SetBackgroundResource(Resource.Color.colorBackgroudnContempt); foto.SetBackgroundResource(Resource.Color.colorPrimaryContempt); Salva.SetBackgroundResource(Resource.Color.colorPrimaryContempt); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkContempt))); break; ; case "surprise": l.SetBackgroundResource(Resource.Color.colorBackgroudnSurprise); foto.SetBackgroundResource(Resource.Color.colorPrimarySurprise); Salva.SetBackgroundResource(Resource.Color.colorPrimarySurprise); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkSurprise))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "disgust": l.SetBackgroundResource(Resource.Color.colorBackgroudnDisgust); foto.SetBackgroundResource(Resource.Color.colorPrimaryDisgust); Salva.SetBackgroundResource(Resource.Color.colorPrimaryDisgust); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkDisgust))); break; ; case "neutral": l.SetBackgroundResource(Resource.Color.colorBackgroudnNeutral); foto.SetBackgroundResource(Resource.Color.colorPrimaryNeutral); Salva.SetBackgroundResource(Resource.Color.colorPrimaryNeutral); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkNeutral))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; default: break; ; } }
private void CreatePreviewUI() { int m = 0; isConversation = false; header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader); Header.headertext = Application.Context.Resources.GetString (Resource.String.messageListHeaderViewTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo (header.Context); header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; listWrapper.RemoveAllViewsInLayout (); Dictionary<string, MessageInfo> latestMessages = new Dictionary<string, MessageInfo> (); Dictionary<string, string> unreadMessageCounts = new Dictionary<string, string> (); string ownerAccountId = AndroidData.CurrentUser.AccountID.ToString (); foreach (ConversationInfo eachConversationInfo in this.conversationItems.Values) { MessageInfo latestMessage = eachConversationInfo.GetLatestMessage (); string messageCountStr = eachConversationInfo.Messages .Count (s => s.Value.Message.MessageRecipientDBList.Count (t => t.AccountGuid == ownerAccountId && !t.IsRead) > 0) .ToString (); latestMessages.Add (eachConversationInfo.ConversationID, latestMessage); unreadMessageCounts.Add (eachConversationInfo.ConversationID, messageCountStr); } if (getGuid != null) getGuid.Clear (); RunOnUiThread (delegate { foreach (KeyValuePair<string, MessageInfo> eachMessage in latestMessages) { eachMessage.Value.Message.MessageRecipientDBList = eachMessage.Value.Message.MessageRecipientDBList.Where (x => x != null).ToList (); string messager = string.Empty; string tmpName = string.Empty; ImageView random = null; LinearLayout.LayoutParams randomParams = null; LinearLayout layout = new LinearLayout (context); LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); layoutparams.SetMargins (0, 0, 0, (int)ImageHelper.convertDpToPixel (10f, context)); layout.LayoutParameters = layoutparams; layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity (GravityFlags.Center); layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context)); ImageView profilepic = new ImageView (context); profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context)); if (eachMessage.Key != null) { UserDB who = null; if (eachMessage.Value.MessageUser != null) who = eachMessage.Value.MessageUser; else who = null; if (who.AccountGuid == AndroidData.CurrentUser.AccountID.ToString ()) who = dbm.GetUserWithAccountID (eachMessage.Value.Message.MessageRecipientDBList [0].AccountGuid); if (who == null) { #if DEBUG System.Diagnostics.Debug.WriteLine ("UserDB = null for {0}, bugging out", latestMessages); #endif m++; } else { profilepic.Tag = new Java.Lang.String ("profilepic_" + who.AccountID); profilepic.SetImageResource (Resource.Drawable.defaultuserimage); layout.AddView (profilepic); if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) { List<UserDB> imageList = new List<UserDB> (); foreach (MessageRecipientDB human in eachMessage.Value.Message.MessageRecipientDBList) { imageList.Add (dbm.GetUserWithAccountID (human.AccountGuid)); } RunOnUiThread (delegate { createMultipleForContact (imageList); if (multipleContact != null) profilepic.SetImageBitmap (multipleContact); else profilepic.SetImageResource (Resource.Drawable.defaultuserimage); }); } else { if (who.Picture.Length == 0 && who.HasProfileImage) getGuid.Add (who.AccountID); else { if (who.Picture.Length > 0) this.LoadUserImage (who, profilepic); else profilepic.SetImageResource (Resource.Drawable.defaultuserimage); } } LinearLayout layout2 = new LinearLayout (context); layout2.Orientation = Orientation.Vertical; layout2.SetGravity (GravityFlags.Left); using (TextView name = new TextView (context)) { name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (25f, context)); name.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (20f, context), 0); name.Gravity = GravityFlags.Left; name.SetTextColor (Color.White); name.TextSize = 16f; tmpName = who.FirstName + " " + who.LastName; if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) { if (eachMessage.Value.Message.MessageRecipientDBList.Count == 1 || eachMessage.Value.Message.MessageRecipientDBList.Count - 1 == 1) tmpName += " 1 other"; else tmpName += " " + string.Format ("{0} others", eachMessage.Value.Message.MessageRecipientDBList.Count - 1); } name.Text = tmpName; layout2.AddView (name); } if (eachMessage.Value.Message.MessageStepDBList.Count == 1 && eachMessage.Value.Message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) { using (TextView txtMessage = new TextView (context)) { using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context))) { txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0); txtMessage.LayoutParameters = txtMessageParams; } txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context)); txtMessage.Gravity = GravityFlags.CenterVertical; if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID) txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright); else txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft); txtMessage.TextSize = 16f; for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) { messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = ""; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); txtMessage.SetHeight (nolines); txtMessage.SetTextColor (Android.Graphics.Color.Black); txtMessage.Text = messager; txtMessage.ContentDescription = eachMessage.Key; txtMessage.Click += ConversationItem_Clicked; layout2.AddView (txtMessage); } } else { int text = 0; for (int tt = 0; tt < eachMessage.Value.Message.MessageStepDBList.Count; ++tt) { if (eachMessage.Value.Message.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text) text++; } LinearLayout layout3 = new LinearLayout (context); LinearLayout.LayoutParams layout3params = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); layout3params.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context)); layout3.LayoutParameters = layout3params; layout3.Orientation = Orientation.Horizontal; layout3.SetGravity (GravityFlags.Left); layout3.ContentDescription = eachMessage.Key; layout3.Click += ConversationLayItem_Clicked; layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); layout3.SetVerticalGravity (GravityFlags.CenterVertical); layout3.SetMinimumHeight (30); layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); int end = eachMessage.Value.Message.MessageStepDBList.Count > 3 ? 3 : eachMessage.Value.Message.MessageStepDBList.Count; for (int i = 0; i < end; ++i) { switch (eachMessage.Value.Message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: if (text == 1) { using (TextView txtMessage = new TextView (context)) { using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context))) { txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0); txtMessage.LayoutParameters = txtMessageParams; } txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context)); txtMessage.Gravity = GravityFlags.CenterVertical; if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID) txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright); else txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft); txtMessage.TextSize = 16f; for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) { messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); txtMessage.SetHeight (nolines); txtMessage.SetTextColor (Android.Graphics.Color.Black); txtMessage.Text = messager; txtMessage.ContentDescription = eachMessage.Key; txtMessage.Click += ConversationItem_Clicked; layout2.AddView (txtMessage); } } else { if (text > 1) { using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icotext); layout3.AddView (random); } } } break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icoanimation); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icocomicons); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icocomix); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icoemoticons); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icopolls); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icosoundfx); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Video: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icovideo); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icovoice); layout3.AddView (random); } break; } } using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); random.ContentDescription = eachMessage.Value.Message.MessageGuid; random.Click += PlayButton_Clicked; layout3.AddView (random); } layout2.AddView (layout3); } LinearLayout layout4 = new LinearLayout (context); layout4.Orientation = Orientation.Vertical; layout4.SetGravity (GravityFlags.Right); using (TextView noMessages = new TextView (context)) { noMessages.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (20f, context)); noMessages.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); noMessages.SetTextColor (Color.White); noMessages.TextSize = 12f; noMessages.Text = unreadMessageCounts [eachMessage.Key] + " messages unread"; noMessages.Gravity = GravityFlags.Right; layout4.AddView (noMessages); } layout2.AddView (layout4); layout.AddView (layout2); listWrapper.AddView (layout); m++; } } } }); if (getGuid.Count > 0) { cpUI = 0; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken)); } }
public override View GetPropertyWindowLayout(Context context) { LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layoutParams.TopMargin = (int)(25 * currentDensity); gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density) / 3; LinearLayout linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Vertical; linearLayout4.SetMinimumHeight((int)(190 * currentDensity)); linearLayout4.SetMinimumWidth(width); TextView selectText = new TextView(context) { Text = "Layout Schema", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; selectText.SetMinimumHeight((int)(50 * currentDensity)); selectText.SetWidth((int)(width * 0.4 * currentDensity)); //Here theme styles starts HorizontalScrollView horizontalScroll = new HorizontalScrollView(context); //horizontalScroll.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); horizontalScroll.FillViewport = true; horizontalScroll.HorizontalScrollBarEnabled = true; horizontalScroll.SetMinimumHeight((int)(205 * currentDensity)); horizontalScroll.Layout(0, (int)(30 * currentDensity), (int)(175 * currentDensity * 4), (int)(180 * currentDensity)); scrollLayout = new LinearLayout(context); scrollLayout.SetPadding((int)(10 * currentDensity), (int)(10 * currentDensity), (int)(10 * currentDensity), (int)(10 * currentDensity)); scrollLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); horizontalScroll.AddView(scrollLayout); LinearLayout freeFormLinearLayout = new LinearLayout(context); freeFormLinearLayout.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); freeFormLinearLayout.SetMinimumHeight((int)(30 * currentDensity)); TextView freeFormLayout = new TextView(context) { Text = "Free Form", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; freeFormLayout.SetMinimumHeight((int)(25 * currentDensity)); freeFormLayout.SetWidth((int)(width * 0.4 * currentDensity)); Switch freeFormSwitch = new Switch(context); freeFormSwitch.CheckedChange += FreeFormSwitch_CheckedChange; freeFormSwitch.Gravity = GravityFlags.Right; freeFormSwitch.SetMinimumHeight((int)(25 * currentDensity)); freeFormSwitch.SetWidth((int)(width * 0.4 * currentDensity)); freeFormLinearLayout.AddView(freeFormLayout); freeFormLinearLayout.AddView(freeFormSwitch); linearLayout4.AddView(freeFormLinearLayout); linearLayout4.AddView(selectText); linearLayout4.AddView(horizontalScroll); AddThemes(); gridLinearLayout.AddView(linearLayout4); return(gridLinearLayout); }
private void CreateUI() { if (MessageConversations.clearView) { RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ()); MessageConversations.clearView = false; } int c = 0; List<int> unreadMessages = new List<int> (); int numberInConversation = 0; foreach (LOLMessageConversation conversation in MessageConversations.conversationsList) { unreadMessages.Add (conversation.MessageIDs.Count - conversation.ReadMessageIDs.Count); int t = 0; } if (unknownUsers == null) unknownUsers = new List<Guid> (); else unknownUsers.Clear (); List<Guid> unknownMessages = new List<Guid> (); foreach (MessageDB latestMessage in MessageConversations.initialMessages) { UserDB whoFrom = new UserDB (); whoFrom = dbm.GetUserWithAccountID (MessageConversations.conversationsList [c].Recipients [0].ToString ()); if (latestMessage.MessageRecipientDBList.Count != 0) { if (whoFrom == null && latestMessage.MessageRecipientDBList [0].AccountGuid == AndroidData.CurrentUser.AccountID.ToString ()) whoFrom = UserDB.ConvertFromUser (AndroidData.CurrentUser); if (whoFrom != null) { #if DEBUG System.Diagnostics.Debug.WriteLine ("c = {0}, Recipient[0] Guid = {1}, whoFrom name = {2} {3}", c, MessageConversations.conversationsList [c].Recipients [0], whoFrom.FirstName, whoFrom.LastName); #endif List<UserDB> users = new List<UserDB> (); numberInConversation = latestMessage.MessageRecipientDBList.Count; for (int i = 0; i < (numberInConversation > 3 ? 3 : numberInConversation); ++i) { if (latestMessage.MessageRecipientDBList [i] != null) { UserDB current = dbm.GetUserWithAccountID (latestMessage.MessageRecipientDBList [i].AccountGuid.ToString ()); if (current == null && latestMessage.MessageRecipientDBList [i].AccountGuid != AndroidData.CurrentUser.AccountID.ToString ()) unknownUsers.Add (new Guid (latestMessage.MessageRecipientDBList [i].AccountGuid)); else users.Add (current); } } int leftOver = (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth - (int)ImageHelper.convertDpToPixel (imageSize [0] + 30f, context); LinearLayout shell = new LinearLayout (context); shell.Orientation = Orientation.Horizontal; shell.SetGravity (GravityFlags.CenterVertical); shell.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (imageSize [1] + 40f, context)); shell.SetPadding (0, 0, 0, (int)ImageHelper.convertDpToPixel (5f, context)); ImageView imageLayout = new ImageView (context); using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent)) { layParams.SetMargins (3, 3, 3, 3); imageLayout.LayoutParameters = layParams; } imageLayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context)); imageLayout = generateUserImage (users); RunOnUiThread (() => shell.AddView (imageLayout)); LinearLayout information = new LinearLayout (context); information.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); information.Orientation = Orientation.Vertical; LinearLayout topLayout = new LinearLayout (context); topLayout.Orientation = Orientation.Vertical; using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(28f, context))) { layParams.Weight = 10f; layParams.SetMargins (0, 0, 0, (int)ImageHelper.convertDpToPixel (3f, context)); topLayout.LayoutParameters = layParams; } TextView whoAmI = new TextView (context); using (LinearLayout.LayoutParams layParams= new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)) { layParams.SetMargins (10, 0, 10, 5); whoAmI.LayoutParameters = layParams; } string myName = whoFrom.FirstName + " " + whoFrom.LastName; if (numberInConversation != 1) { myName += string.Format (" and {0} other{1}", numberInConversation == 2 ? "1" : (numberInConversation - 1).ToString (), numberInConversation == 2 ? "." : "s."); } whoAmI.SetTextColor (Android.Graphics.Color.Black); whoAmI.Text = myName; whoAmI.SetTextSize (Android.Util.ComplexUnitType.Dip, 12f); RunOnUiThread (() => topLayout.AddView (whoAmI)); LinearLayout messageLayout = new LinearLayout (context); using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent)) { linParams.Weight = 80f; messageLayout.LayoutParameters = linParams; } messageLayout.Orientation = Orientation.Horizontal; TextView txtMessage = new TextView (context); using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(70f, context))) { linParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (8f, context), 0); txtMessage.LayoutParameters = linParams; } txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context)); if (latestMessage.MessageStepDBList.Count == 1 && latestMessage.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) { txtMessage = messageTextBox (latestMessage, 0, leftOver); } else { for (int n = 0; n < latestMessage.MessageStepDBList.Count; ++n) { if (latestMessage.MessageStepDBList [n].StepType == MessageStep.StepTypes.Text) { txtMessage = messageTextBox (latestMessage, n, leftOver); break; } } } txtMessage.ContentDescription = latestMessage.MessageID.ToString (); #if DEBUG System.Diagnostics.Debug.WriteLine ("ContentDesctription = {0}, ID = {1}", txtMessage.ContentDescription, latestMessage.ID); #endif txtMessage.Click += textMessage_Click; RunOnUiThread (() => messageLayout.AddView (txtMessage)); LinearLayout bottomLayout = new LinearLayout (context); using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)) { linParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (3f, context), 0, 0); bottomLayout.LayoutParameters = linParams; } bottomLayout.SetGravity (GravityFlags.Right); TextView txtMessageUnread = new TextView (context); using (LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(12f, context))) { layoutParams.SetMargins (10, 0, 10, 0); txtMessageUnread.LayoutParameters = layoutParams; } txtMessageUnread.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); txtMessageUnread.SetTextColor (Color.Black); txtMessageUnread.SetTextSize (Android.Util.ComplexUnitType.Dip, 10f); if (unreadMessages [c] == 0) txtMessageUnread.Text = "0 unread messages."; else txtMessageUnread.Text = string.Format ("({0}) unread message{1}", unreadMessages [c], unreadMessages [c] == 1 ? "." : "s."); txtMessageUnread.Gravity = GravityFlags.Right; RunOnUiThread (() => bottomLayout.AddView (txtMessageUnread)); LinearLayout messageItems = new LinearLayout (context); if (latestMessage.MessageStepDBList.Count > 0) { messageItems.Orientation = Orientation.Horizontal; float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((55f * imageSize [0]) / 100), context) : ImageHelper.convertDpToPixel (40f, context); using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) { layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context)); messageItems.LayoutParameters = layParams; } messageItems.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0); messageItems.SetGravity (GravityFlags.Left); messageItems.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); messageItems = createMessageBar (messageItems, latestMessage, leftOver); messageItems.ContentDescription = latestMessage.MessageGuid; messageItems.Click += messageBar_Click; } else { messageItems.Orientation = Orientation.Horizontal; float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((55f * imageSize [0]) / 100), context) : ImageHelper.convertDpToPixel (40f, context); using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) { layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context)); messageItems.LayoutParameters = layParams; messageItems.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); } } RunOnUiThread (delegate { information.AddView (topLayout); if (!string.IsNullOrEmpty (txtMessage.Text)) information.AddView (messageLayout); if (latestMessage.MessageStepDBList.Count > 1) information.AddView (messageItems); information.AddView (bottomLayout); shell.AddView (information); listWrapper.AddView (shell); }); #if DEBUG System.Diagnostics.Debug.WriteLine ("done a loop"); #endif } } if (c < MessageConversations.initialMessages.Count - 2) c++; } //}); if (unknownUsers.Count != 0) { Contacts.AddUnknownUser auu = new Contacts.AddUnknownUser (unknownUsers, context); } if (progress != null) RunOnUiThread (() => progress.Dismiss ()); }
void BuildAddStudentScreen() { //Defining the parent layout OverAllAddStudentLayout = (LinearLayout)FindViewById(Resource.Id.AddStudentl); OverAllAddStudentLayout.Orientation = Orientation.Vertical; OverAllAddStudentLayout.SetGravity(GravityFlags.CenterHorizontal); //======================================================================================================================================= //======================================================================================================================================= //Defining the Label AddStudent Layout LabelAddStudentLayout = new LinearLayout(this); LabelAddStudentLayout.LayoutParameters = WrapContParams; LabelAddStudentLayout.Orientation = Orientation.Vertical; LabelAddStudentLayout.SetGravity(Android.Views.GravityFlags.Center); //Defining the Label AddStudent TextView LabelAddStudentTV = new TextView(this); LabelAddStudentTV.LayoutParameters = WrapContParams; LabelAddStudentTV.Text = "New Student"; LabelAddStudentTV.TextSize = 60; LabelAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); LabelAddStudentTV.SetTextColor(Android.Graphics.Color.DarkRed); LabelAddStudentLayout.AddView(LabelAddStudentTV); OverAllAddStudentLayout.AddView(LabelAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining the Name AddStudent layout NameAddStudentLayout = new LinearLayout(this); NameAddStudentLayout.LayoutParameters = WrapContParams; NameAddStudentLayout.Orientation = Orientation.Horizontal; //Defining the Name AddStudent TextView NameAddStudentTV = new TextView(this); NameAddStudentTV.LayoutParameters = WrapContParams; NameAddStudentTV.Text = "Name: "; NameAddStudentTV.TextSize = 30; NameAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); //Defining the Name AddStudent TextInputEditText TextInputLayout nameLayout = new TextInputLayout(this) { LayoutParameters = WrapContParams, Orientation = Orientation.Horizontal, }; NameAddStudentET = new TextInputEditText(this); NameAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground); NameAddStudentET.LayoutParameters = OneTwentyParams; NameAddStudentET.Hint = "Full Name"; NameAddStudentET.TextSize = 30; NameAddStudentET.FirstBaselineToTopHeight = 10; //Adding views to layout NameAddStudentLayout.AddView(NameAddStudentTV); nameLayout.AddView(NameAddStudentET); NameAddStudentLayout.AddView(nameLayout); OverAllAddStudentLayout.AddView(NameAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining PhoneNum AddStudent Layout PhoneNumAddStudentLayout = new LinearLayout(this); PhoneNumAddStudentLayout.LayoutParameters = WrapContParams; PhoneNumAddStudentLayout.Orientation = Orientation.Horizontal; //Defining the PhoneNum AddStudent TextView PhoneNumAddStudentTV = new TextView(this); PhoneNumAddStudentTV.LayoutParameters = WrapContParams; PhoneNumAddStudentTV.Text = "Phone # "; PhoneNumAddStudentTV.TextSize = 30; PhoneNumAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center); PhoneNumAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); //Defining the PhoneNum AddStudent TextInputEditText TextInputLayout phone = new TextInputLayout(this) { LayoutParameters = WrapContParams, Orientation = Orientation.Horizontal, }; PhoneNumAddStudentET = new TextInputEditText(this); PhoneNumAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground); PhoneNumAddStudentET.LayoutParameters = OneTwentyParams; PhoneNumAddStudentET.Text = "05"; PhoneNumAddStudentET.TextSize = 30; PhoneNumAddStudentET.SetSingleLine(); PhoneNumAddStudentET.InputType = InputTypes.ClassPhone; //Adding views to layout PhoneNumAddStudentLayout.AddView(PhoneNumAddStudentTV); phone.AddView(PhoneNumAddStudentET); PhoneNumAddStudentLayout.AddView(phone); OverAllAddStudentLayout.AddView(PhoneNumAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= // Defining Email AddStudentLayout EmailAddStudentLayout = new LinearLayout(this); EmailAddStudentLayout.LayoutParameters = WrapContParams; EmailAddStudentLayout.Orientation = Orientation.Horizontal; //Defining the Email AddStudent TextView EmailAddStudentTV = new TextView(this); EmailAddStudentTV.LayoutParameters = WrapContParams; EmailAddStudentTV.Text = "Enter Email: "; EmailAddStudentTV.TextSize = 30; EmailAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center); EmailAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); //Defining the Email AddStudent TextInputEditText TextInputLayout Email = new TextInputLayout(this) { LayoutParameters = WrapContParams, Orientation = Orientation.Horizontal, }; EmailAddStudentET = new TextInputEditText(this); EmailAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground); EmailAddStudentET.LayoutParameters = OneTwentyParams; EmailAddStudentET.Hint = "Email"; EmailAddStudentET.InputType = InputTypes.TextVariationEmailAddress; EmailAddStudentET.TextSize = 30; EmailAddStudentET.SetSingleLine(); //Adding views to layout EmailAddStudentLayout.AddView(EmailAddStudentTV); Email.AddView(EmailAddStudentET); EmailAddStudentLayout.AddView(Email); OverAllAddStudentLayout.AddView(EmailAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining Parent1NameAddStudentLayout Parent1NameAddStudentLayout = new LinearLayout(this); Parent1NameAddStudentLayout.LayoutParameters = WrapContParams; Parent1NameAddStudentLayout.Orientation = Orientation.Horizontal; //Defining the Parent1Name AddStudent TextView Parent1NameAddStudentTV = new TextView(this); Parent1NameAddStudentTV.LayoutParameters = WrapContParams; Parent1NameAddStudentTV.Text = "Parent1 Name: "; Parent1NameAddStudentTV.TextSize = 30; Parent1NameAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center); Parent1NameAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); //Defining the Parent1Name AddStudent TextInputEditText TextInputLayout p1 = new TextInputLayout(this) { LayoutParameters = WrapContParams, Orientation = Orientation.Horizontal, }; Parent1NameAddStudentET = new TextInputEditText(this); Parent1NameAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground); Parent1NameAddStudentET.LayoutParameters = OneTwentyParams; Parent1NameAddStudentET.Hint = "Parent1"; Parent1NameAddStudentET.TextSize = 30; //Adding views to layout Parent1NameAddStudentLayout.AddView(Parent1NameAddStudentTV); p1.AddView(Parent1NameAddStudentET); Parent1NameAddStudentLayout.AddView(p1); OverAllAddStudentLayout.AddView(Parent1NameAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining Parent2NameAddStudentLayout Parent2NameAddStudentLayout = new LinearLayout(this); Parent2NameAddStudentLayout.LayoutParameters = WrapContParams; Parent2NameAddStudentLayout.Orientation = Orientation.Horizontal; //Defining the Parent2Name AddStudent TextView Parent2NameAddStudentTV = new TextView(this); Parent2NameAddStudentTV.LayoutParameters = WrapContParams; Parent2NameAddStudentTV.Text = "Parent2 Name: "; Parent2NameAddStudentTV.TextSize = 30; Parent2NameAddStudentTV.SetForegroundGravity(Android.Views.GravityFlags.Center); Parent2NameAddStudentTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); //Defining the Parent2Name AddStudent TextInputEditText TextInputLayout p2 = new TextInputLayout(this) { LayoutParameters = WrapContParams, Orientation = Orientation.Horizontal, }; Parent2NameAddStudentET = new TextInputEditText(this); Parent2NameAddStudentET.LayoutParameters = OneTwentyParams; Parent2NameAddStudentET.SetBackgroundResource(Resource.Drawable.MyBackground); Parent2NameAddStudentET.Hint = "Parent2"; Parent2NameAddStudentET.TextSize = 30; //Adding views to layout Parent2NameAddStudentLayout.AddView(Parent2NameAddStudentTV); p2.AddView(Parent2NameAddStudentET); Parent2NameAddStudentLayout.AddView(p2); OverAllAddStudentLayout.AddView(Parent2NameAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining the AddStudent Explenation layout AddStudentExplenationLayout = new LinearLayout(this); AddStudentExplenationLayout.LayoutParameters = WrapContParams; AddStudentExplenationLayout.Orientation = Orientation.Vertical; //Defining the Explenation AddStudent TextView AddStudentExplenationTV = new TextView(this); AddStudentExplenationTV.LayoutParameters = WrapContParams; AddStudentExplenationTV.Text = "Student Notes: "; AddStudentExplenationTV.TextSize = 30; AddStudentExplenationTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); //Adding views to layout AddStudentExplenationLayout.AddView(AddStudentExplenationTV); OverAllAddStudentLayout.AddView(AddStudentExplenationLayout); //Defining The AddStudent notes ET layout AddStudentExplenationETLayout = new LinearLayout(this); AddStudentExplenationETLayout.LayoutParameters = new LinearLayout.LayoutParams(1100, 400); AddStudentExplenationETLayout.Orientation = Orientation.Vertical; AddStudentExplenationETLayout.SetBackgroundResource(Resource.Drawable.BlackOutLine); AddStudentExplenationETLayout.Click += this.AddStudentExplenationETLayout_Click; //Defining the Explenation AddStudent TextInputEditText AddStudentExplenationET = new TextInputEditText(this); AddStudentExplenationET.SetWidth(LinearLayout.LayoutParams.MatchParent); AddStudentExplenationET.Hint = "Notes"; AddStudentExplenationET.TextSize = 25; AddStudentExplenationET.SetTextIsSelectable(true); AddStudentExplenationET.InputType = InputTypes.TextFlagMultiLine; AddStudentExplenationET.Gravity = GravityFlags.Top; AddStudentExplenationET.SetSingleLine(false); AddStudentExplenationET.SetBackgroundColor(Color.Transparent); //Adding viwes to overall layout AddStudentExplenationETLayout.AddView(AddStudentExplenationET); OverAllAddStudentLayout.AddView(AddStudentExplenationETLayout); //======================================================================================================================================= //======================================================================================================================================= //Declare Spinner spin = new Spinner(this); spin.LayoutParameters = OneTwentyParams; spin.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); var adapter = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleSpinnerItem, groups); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spin.Adapter = adapter; //Defining Spinner Layout SpinnerLayout = new LinearLayout(this); SpinnerLayout.LayoutParameters = WrapContParams; SpinnerLayout.Orientation = Orientation.Horizontal; //Adding Views SpinnerLayout.AddView(spin); OverAllAddStudentLayout.AddView(SpinnerLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining AddStudent Button Layout ButtonAddStudentLayout = new LinearLayout(this); ButtonAddStudentLayout.LayoutParameters = WrapContParams; ButtonAddStudentLayout.Orientation = Orientation.Horizontal; //Defining AddStudent Button AddStudentButton = new Button(this); AddStudentButton.LayoutParameters = WrapContParams; AddStudentButton.Text = "Add Student"; AddStudentButton.TextSize = 40; AddStudentButton.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); AddStudentButton.Click += this.AddStudentButton_Click; //Adding views ButtonAddStudentLayout.AddView(AddStudentButton); OverAllAddStudentLayout.AddView(ButtonAddStudentLayout); //======================================================================================================================================= //======================================================================================================================================= //Defining AddStudent Button Layout ButtonSendToMainPageLayout = new LinearLayout(this); ButtonSendToMainPageLayout.LayoutParameters = WrapContParams; ButtonSendToMainPageLayout.Orientation = Orientation.Horizontal; //Defining AddStudent Button SendBackToMainButton = new Button(this); SendBackToMainButton.LayoutParameters = WrapContParams; SendBackToMainButton.Text = "Send Back To\nMain Page"; SendBackToMainButton.TextSize = 40; SendBackToMainButton.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); SendBackToMainButton.SetTextColor(Color.DarkRed); SendBackToMainButton.Click += this.SendBackToMainButton_Click; //Adding views ButtonSendToMainPageLayout.AddView(SendBackToMainButton); OverAllAddStudentLayout.AddView(ButtonSendToMainPageLayout); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var dlg = inflater.Inflate(Resource.Layout.layoutstore, container, false); // LinearLayout lnaboutus = dlg.FindViewById <LinearLayout>(Resource.Id.fragmentstorelinearlayout); lnaboutus.SetBackgroundResource(Resource.Drawable.dialog_fragment_round); var font = Typeface.CreateFromAsset(ctx.Assets, "Estedad.ttf"); fragmentstoretxtviewheader = dlg.FindViewById <TextView>(Resource.Id.fragmentstoretxtviewheader); fragmentstoreclothing = dlg.FindViewById <CheckBox>(Resource.Id.fragmentstoreclothing); fragmentstorechkother = dlg.FindViewById <CheckBox>(Resource.Id.fragmentstorechkother); fragmentstorechkother.Typeface = font; // CheckBox fragmentstoreclothing; fragmentstoretxtviewheader.Text = "انتخاب رویداد"; fragmentstoretxtviewheader.Typeface = font; fragmentstoreclothing.Typeface = font; fragmentstorechkother.Click += delegate { OnGetCaptionStore.Invoke(this, new GetStore(value + "-" + fragmentstorechkother.Text)); Dismiss(); }; fragmentstoreclothing.Click += delegate { OnGetCaptionStore.Invoke(this, new GetStore(value + "-" + fragmentstoreclothing.Text)); Dismiss(); }; // CheckBox fragmentstorechkcommodity; fragmentstorechkcommodity = dlg.FindViewById <CheckBox>(Resource.Id.fragmentstorechkcommodity); fragmentstorechkcommodity.Typeface = font; fragmentstorechkcommodity.Click += delegate { OnGetCaptionStore.Invoke(this, new GetStore(value + "-" + fragmentstorechkcommodity.Text)); Dismiss(); }; fragmentstorechkfood = dlg.FindViewById <CheckBox>(Resource.Id.fragmentstorechkfood); fragmentstorechkfood.Typeface = font; fragmentstorechkfood.Click += delegate { OnGetCaptionStore.Invoke(this, new GetStore(value + "-" + fragmentstorechkfood.Text)); Dismiss(); }; fragmentstorechkhealth = dlg.FindViewById <CheckBox>(Resource.Id.fragmentstorechkhealth); fragmentstorechkhealth.Typeface = font; fragmentstorechkhealth.Click += delegate { OnGetCaptionStore.Invoke(this, new GetStore(value + "-" + fragmentstorechkhealth.Text)); Dismiss(); }; fragmentstorebtncancell = dlg.FindViewById <Button>(Resource.Id.fragmentstorebtncancell); fragmentstorebtncancell.Typeface = font; fragmentstorebtncancell.Click += delegate { Dismiss(); }; return(dlg); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initialisation RtGraphicsLayouts RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; SetContentView(RootLayout); //Navbar LinearLayout NavbarLayout = new LinearLayout(this); NavbarLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavbarLayout.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavbarLayout); LinearLayout NavbarBack = new LinearLayout(this); NavbarBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(NAVBARHEIGHT, NAVBARHEIGHT); NavbarBack.SetBackgroundResource(Resource.Drawable.IconBack); NavbarBack.Click += NavbarBack_Click;; NavbarLayout.AddView(NavbarBack); TextView NavBarTitle = new TextView(this); NavBarTitle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-140, RtGraphicsLayouts.EXPAND); NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, NAVBARPADDING, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING); NavBarTitle.Gravity = GravityFlags.Center; NavBarTitle.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitle.Text = NAVBARTEXT; NavbarLayout.AddView(NavBarTitle); //Content ScrollView ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollRoot.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentScrollerRoot.AddView(ContentScrollRoot); //Settings Panel 1 LinearLayout SettingsBack = new LinearLayout(this); SettingsBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); SettingsBack.Orientation = Orientation.Vertical; SettingsBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox); SettingsBack.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(SettingsBack); SettingsCheckbox = new RtCheckboxView(this); SettingsCheckbox.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox.Callback += SettingsCheckbox_Callback; SettingsCheckbox.Checked = (RtSettings.ReadSetting("RRINT") == ONE); SettingsCheckbox.Text = SETTINGTEXT; SettingsCheckbox.Description = SETTINGDESC; SettingsBack.AddView(SettingsCheckbox); SettingsCheckbox1 = new RtCheckboxView(this); SettingsCheckbox1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox1.Callback += SettingsCheckbox_Callback; SettingsCheckbox1.Checked = (RtSettings.ReadSetting("RRAAM") == ONE); SettingsCheckbox1.Text = SETTINGTEXT1; SettingsBack.AddView(SettingsCheckbox1); LinearLayout SettingsBackSpacer = new LinearLayout(this); SettingsBackSpacer.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, SMALLPADDING); ContentScrollRoot.AddView(SettingsBackSpacer); //Settings Panel 2 LinearLayout SettingsBack1 = new LinearLayout(this); SettingsBack1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); SettingsBack1.Orientation = Orientation.Vertical; SettingsBack1.SetBackgroundResource(Resource.Drawable.StyleCornerBox); SettingsBack1.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(SettingsBack1); SettingsCheckbox2 = new RtCheckboxView(this); SettingsCheckbox2.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox2.Callback += SettingsCheckbox_Callback; SettingsCheckbox2.Checked = (RtSettings.ReadSetting("SSO") == ONE); SettingsCheckbox2.Text = SETTINGTEXT2; SettingsCheckbox2.Description = SETTINGDESC2; SettingsBack1.AddView(SettingsCheckbox2); SettingsCheckbox3 = new RtCheckboxView(this); SettingsCheckbox3.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox3.Callback += SettingsCheckbox_Callback; SettingsCheckbox3.Checked = (RtSettings.ReadSetting("SSBD") == ONE); SettingsCheckbox3.Text = SETTINGTEXT3; SettingsCheckbox3.Description = SETTINGDESC3; SettingsBack1.AddView(SettingsCheckbox3); LinearLayout SettingsBackSpacer1 = new LinearLayout(this); SettingsBackSpacer1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, SMALLPADDING); ContentScrollRoot.AddView(SettingsBackSpacer1); //Settings Panel 3 LinearLayout SettingsBack2 = new LinearLayout(this); SettingsBack2.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); SettingsBack2.Orientation = Orientation.Vertical; SettingsBack2.SetBackgroundResource(Resource.Drawable.StyleCornerBox); SettingsBack2.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(SettingsBack2); SettingsCheckbox4 = new RtCheckboxView(this); SettingsCheckbox4.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox4.Callback += SettingsCheckbox_Callback; SettingsCheckbox4.Checked = (RtSettings.ReadSetting("CN") == ONE); SettingsCheckbox4.Text = SETTINGTEXT4; SettingsCheckbox4.Description = SETTINGDESC4; SettingsBack2.AddView(SettingsCheckbox4); SettingsCheckbox5 = new RtCheckboxView(this); SettingsCheckbox5.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox5.Callback += SettingsCheckbox_Callback; SettingsCheckbox5.Checked = (RtSettings.ReadSetting("SSDI") == ONE); SettingsCheckbox5.Text = SETTINGTEXT5; SettingsBack2.AddView(SettingsCheckbox5); }
public void iniPlancesList() { //_currentPlaces.Clear (); _listLinearPlaces.Clear(); placeSpace.RemoveAllViews(); placesContainer.RemoveAllViews(); VerticalScrollView listScrollPlaces = new VerticalScrollView(context); listScrollPlaces.LayoutParameters = new VerticalScrollView.LayoutParams(-1, Configuration.getHeight(345)); listScrollPlaces.VerticalScrollBarEnabled = false; LinearLayout listSpaceLayout = new LinearLayout(context); listSpaceLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); listSpaceLayout.Orientation = Orientation.Vertical; for (int i = 0; i < _currentPlaces.Count; i++) { var item = _currentPlaces [i]; LinearLayoutLO linearItem = new LinearLayoutLO(context); linearItem.index = i; TextView txtName = new TextView(context); ImageView imgIcon = new ImageView(context); txtName.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(420), -1); txtName.Gravity = GravityFlags.CenterVertical; txtName.Text = item.titulo; //txtName.SetTextColor (Color.ParseColor ("#ffffff")); txtName.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); txtName.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32)); //imgIcon.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset (item.Asset), Configuration.getWidth (30), Configuration.getWidth (30), true)); int H = 80; int W = 120; linearItem.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(H)); //linearItem.SetBackgroundDrawable (background_row); linearItem.Orientation = Orientation.Horizontal; linearItem.SetGravity(Android.Views.GravityFlags.CenterVertical); //linearItem.AddView (imgIcon); RelativeLayout imageLayout = new RelativeLayout(context); imageLayout.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H)); ImageView iconImage = new ImageView(context); Picasso.With(context).Load(item.pathIcon).Resize(Configuration.getWidth(W), Configuration.getHeight(H)).CenterCrop().Into(iconImage); imageLayout.AddView(iconImage); LinearLayout gradiente = new LinearLayout(context); gradiente.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H)); imageLayout.AddView(gradiente); ImageIconMap icon = new ImageIconMap(context); icon.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(60), Configuration.getWidth(60)); icon.index = 0; icon.SetImageBitmap(_leyendaIcon[item.tipoIndex]); //icon.SetPadding (Configuration.getWidth (20), ,0,0); icon.SetX(Configuration.getWidth(30)); icon.SetY(Configuration.getHeight(10)); RelativeLayout iconLayout = new RelativeLayout(context); iconLayout.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H)); iconLayout.SetGravity(GravityFlags.Center); LinearLayout gradiente2 = new LinearLayout(context); gradiente2.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H)); iconLayout.AddView(icon); iconLayout.AddView(gradiente2); linearItem.AddView(imageLayout); linearItem.AddView(txtName); linearItem.AddView(iconLayout); int space = Configuration.getWidth(30); //linearItem.SetPadding (space,0,space,0); //imgIcon.SetPadding (Configuration.getWidth(68), 0, 0, 0); txtName.SetPadding(Configuration.getWidth(10), 0, 0, 0); if (i % 2 == 0) { gradiente.SetBackgroundResource(Resource.Drawable.gradiente2); gradiente2.SetBackgroundResource(Resource.Drawable.gradiente22); linearItem.SetBackgroundColor(Color.ParseColor("#F0AE11")); txtName.SetTextColor(Color.White); } else { gradiente.SetBackgroundResource(Resource.Drawable.gradiente1); gradiente2.SetBackgroundResource(Resource.Drawable.gradiente11); txtName.SetTextColor(Color.ParseColor("#F0AE11")); } _listLinearPlaces.Add(linearItem); _listLinearPositonPlaces.Add(icon); listSpaceLayout.AddView(linearItem); } /* * listPlaces = new ListView (context); * listPlaces.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(345)); * * listPlaces.Adapter = new PlaceAdapter (context, _currentPlaces); * listPlaces.DividerHeight = 0; * * placesContainer.AddView (listPlaces); */ placesContainer.AddView(listSpaceLayout); placeSpace.AddView(placesContainer); titulo_header.Text = titulo_map_header; header.AddView(titulo_header); header.AddView(_leyendaMap); }
public void list() { try { using (var client = new WebClient()) { string userID = Library.ControlID.userID; var json = client.DownloadString("http://joremtongwebsite.000webhostapp.com/historystudent.php?userID=" + userID); dynamic jsonData = JsonConvert.DeserializeObject(json); foreach (dynamic jsonDatas in jsonData) { var layout2 = new LinearLayout(this); layout2.Orientation = Orientation.Horizontal; var layoutParams2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams2.SetMargins(0, 0, 0, 20); layout2.SetBackgroundResource(Resource.Drawable.layout_bg); layout2.SetPadding(0, 0, 0, 0); layout2.LayoutParameters = layoutParams2; var Image = new ImageView(this); var param = new LayoutParams(150, 150); Image.LayoutParameters = param; Image.SetPadding(30, 10, 0, 0); Image.SetImageResource(Resource.Drawable.reading); var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams.SetMargins(0, 0, 0, 20); layout.SetBackgroundResource(Resource.Drawable.layout_bg); layout.SetPadding(0, 0, 0, 0); layout.LayoutParameters = layoutParams; var username = new TextView(this); username.SetTextColor(Color.White); username.SetTypeface(Typeface.Default, TypefaceStyle.Bold); username.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 20); username.Text = jsonDatas["activity"].ToString(); username.SetPadding(20, 20, 20, 0); var score = new TextView(this); score.SetTextColor(Color.White); score.SetTypeface(Typeface.Default, TypefaceStyle.Bold); score.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 15); score.Text = "Score : " + jsonDatas["score"].ToString(); score.SetPadding(20, 20, 20, 0); layout.AddView(username); layout.AddView(score); layout2.AddView(Image); layout2.AddView(layout); linearLayout1.AddView(layout2); } } } catch (Exception i) { var layout2 = new LinearLayout(this); layout2.Orientation = Orientation.Horizontal; var layoutParams2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams2.SetMargins(0, 0, 0, 20); layout2.SetBackgroundResource(Resource.Drawable.layout_bg); layout2.SetPadding(0, 0, 0, 0); layout2.LayoutParameters = layoutParams2; var Image = new ImageView(this); var param = new LayoutParams(120, 120); Image.LayoutParameters = param; Image.SetPadding(20, 30, 0, 0); Image.SetImageResource(Resource.Drawable.reading); var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);; layoutParams.SetMargins(0, 0, 0, 20); layout.SetBackgroundResource(Resource.Drawable.layout_bg); layout.SetPadding(10, 10, 10, 50); layout.LayoutParameters = layoutParams; var username = new TextView(this); username.SetTextColor(Color.White); username.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); username.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 20); username.Text = "NO DATA YET"; username.SetPadding(20, 20, 20, 0); layout.AddView(username); layout2.AddView(Image); layout2.AddView(layout); linearLayout1.AddView(layout2); } }
void Initialize() { this.WeightSum = 1; this.Orientation = Orientation.Vertical; LayoutParams p = new LayoutParams(0, ViewGroup.LayoutParams.MatchParent, 0.5f); AvailableLocations locations = new AvailableLocations(); state = locations.States.ElementAt(0); LinearLayout headerHolder = new LinearLayout(context); headerHolder.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); headerHolder.Orientation = Orientation.Horizontal; headerHolder.SetBackgroundResource(Resource.Color.headerColor); TextView stateHeader = new TextView(context) { Text = "State" }; stateHeader.LayoutParameters = p; stateHeader.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.50f); stateHeader.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15)); headerHolder.AddView(stateHeader); TextView cityHeader = new TextView(context) { Text = "City" }; cityHeader.LayoutParameters = p; cityHeader.SetTextSize(Android.Util.ComplexUnitType.Px, rowHeight * 0.50f); cityHeader.SetPadding((int)(rowHeight * 0.1), (int)(rowHeight * 0.15), (int)(rowHeight * 0.1), (int)(rowHeight * 0.15)); headerHolder.AddView(cityHeader); AddView(headerHolder); LinearLayout pickerHolder = new LinearLayout(context); pickerHolder.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); pickerHolder.Orientation = Orientation.Horizontal; state_picker = new ListView(context); state_picker.LayoutParameters = p; state_picker.Adapter = new StateListAdapter(context, locations.States); pickerHolder.AddView(state_picker); city_picker = new ListView(context); city_picker.LayoutParameters = p; cityAdapter = new CityListAdapter(context, locations.PotentialLocations.Where(loc => loc.State == state).OrderBy(x => x.SiteName)); city_picker.Adapter = cityAdapter; pickerHolder.AddView(city_picker); AddView(pickerHolder); state_picker.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { state = locations.States.ElementAt(e.Position); cityAdapter.Cities = locations.PotentialLocations.Where(l => l.State.Equals(state)); cityAdapter.NotifyDataSetChanged(); }; city_picker.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { Location selected = locations.PotentialLocations.Where(loc => loc.State == state).ElementAt(e.Position); var transaction = ((AppCompatActivity)context).SupportFragmentManager.BeginTransaction(); CategoryPickerFragment categoryFragment = new CategoryPickerFragment(); categoryFragment.SelectedLocation = selected; transaction.Replace(Resource.Id.frameLayout, categoryFragment) .AddToBackStack(null) .Commit(); Task.Run(async() => { await MainActivity.databaseConnection.AddNewRecentCityAsync(selected.SiteName, selected.Url).ConfigureAwait(true); if (MainActivity.databaseConnection.GetAllRecentCitiesAsync().Result.Count > 5) { await MainActivity.databaseConnection.DeleteOldestCityAsync().ConfigureAwait(true); } }); }; }
public void UpdateMapView() { RunOnUiThread(() => { if (topText != null) { mainPanel.RemoveView(topText); } if (bottomText != null) { mainPanel.RemoveView(bottomText); } if (leftText != null) { mainPanel.RemoveView(leftText); } if (rightText != null) { mainPanel.RemoveView(rightText); } if (panelContents != null) { mainPanel.RemoveView(panelContents); } panelContents = new LinearLayout(this); panelContents.Orientation = Android.Widget.Orientation.Vertical; panelContents.SetGravity(GravityFlags.Center); mainPanel.SetGravity(GravityFlags.Center); var panelLayout = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); panelLayout.AddRule(LayoutRules.CenterInParent); //panelLayout.TopMargin = panelLayout.BottomMargin = panelLayout.LeftMargin = panelLayout.RightMargin = 50; //panelContents.SetPadding(50, 50, 50, 50); // Doesn't work properly var label = new TextView(this); label.Text = Map.CurrentNode.Longname; label.TextSize = 40; panelContents.AddView(label); foreach (var action in Map.CurrentNode.Actions) { var promptLabel = new LinearLayout(this); promptLabel.Orientation = Android.Widget.Orientation.Horizontal; promptLabel.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); promptLabel.SetBackgroundResource(Android.Resource.Drawable.AlertDarkFrame); var promptIcon = new ImageView(this); promptIcon.SetBackgroundResource(action.Gesture.IconID); promptIcon.ScaleX = promptIcon.ScaleY = 0.3f; promptLabel.AddView(promptIcon); var promptText = new TextView(this); promptText.Text = action.Name + " "; promptText.TextSize = 30; promptLabel.AddView(promptText); panelContents.AddView(promptLabel); } if (Map.CurrentAbove != null) { topText = SetUpMapNavTextView(Map.CurrentAbove.Shortname, false, false, LayoutRules.AlignParentTop, LayoutRules.CenterHorizontal); panelLayout.AddRule(LayoutRules.Below, topText.Id); } if (Map.CurrentBelow != null) { bottomText = SetUpMapNavTextView(Map.CurrentBelow.Shortname, false, false, LayoutRules.AlignParentBottom, LayoutRules.CenterHorizontal); panelLayout.AddRule(LayoutRules.Above, bottomText.Id); } if (Map.CurrentLeft != null) { leftText = SetUpMapNavTextView(Map.CurrentLeft.Shortname, true, true, LayoutRules.AlignParentLeft, LayoutRules.CenterVertical); panelLayout.AddRule(LayoutRules.RightOf, leftText.Id); } if (Map.CurrentRight != null) { rightText = SetUpMapNavTextView(Map.CurrentRight.Shortname, true, false, LayoutRules.AlignParentRight, LayoutRules.CenterVertical); if (Map.CurrentNode.IsBlocking) { rightText.SetTextColor(Android.Graphics.Color.Red); } panelLayout.AddRule(LayoutRules.LeftOf, rightText.Id); } panelContents.LayoutParameters = panelLayout; mainPanel.AddView(panelContents); }); }
public void CreateElements() { ViewElement ve; string request = String.Format("select * from Items where price >={0} AND price <={1}", minMoney, maxMoney); var res = SQLite_Android.GetDBItems(request); number_of_elements = res.Count; ve.imgbttn = new ImageButton[number_of_elements]; ScrollView sw = FindViewById <ScrollView>(Resource.Id.scrollView); LinearLayout ll = FindViewById <LinearLayout>(Resource.Id.linearLayout); Toast.MakeText(this, "Количество мероприятий: " + res.Count.ToString(), ToastLength.Long).Show(); for (int index = 0; index < number_of_elements; index++) { Android.Net.Uri uri = Android.Net.Uri.Parse($"{res[index].Image}"); //var imageBitmap = GetImageBitmapFromUrl($"{res[index].Image}"); ve.imgbttn[index] = new ImageButton(this); //ve.imgbttn[index].SetImageBitmap(uri); LinearLayout weblin = new LinearLayout(this); LinearLayout.LayoutParams lp1 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 500); weblin.LayoutParameters = lp1; CardView cardview = new CardView(this); ve.cardimage = new WebView(this); ve.cardimage.LoadUrl(uri.ToString()); weblin.AddView(ve.cardimage); ve.title = new TextView(this); ve.title.Text = res[index].Title; ve.title.TextSize = 20; ve.local = new TextView(this); ve.local.Text = res[index].Location; ve.local.Gravity = GravityFlags.Left; ve.price = new TextView(this); if (res[index].Price == 0) { ve.price.Text = "бесплатно"; } else { ve.price.Text = res[index].Price.ToString() + "грн."; } ve.price.Gravity = GravityFlags.Right; /*cardview.AddView(cardimage); * cardview.AddView(Title); * cardview.AddView(Description);*/ LinearLayout llnner = new LinearLayout(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent); lp.SetMargins(40, 40, 40, 10); llnner.LayoutParameters = lp; llnner.SetBackgroundColor(Android.Graphics.Color.ParseColor("#D8D8D8")); llnner.Orientation = Orientation.Vertical; llnner.WeightSum = 1; llnner.AddView(weblin); llnner.AddView(ve.title); llnner.AddView(ve.local); llnner.AddView(ve.price); llnner.SetBackgroundResource(Resource.Drawable.abc_btn_default_mtrl_shape); ll.AddView(llnner); /*LinearLayout llInner = new LinearLayout(this); * LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); * llInner.Orientation = Orientation.Horizontal; * llInner.WeightSum = 1; * * ImageView iv = new ImageView(this); * llInner.AddView(iv); * * TextView title = new TextView(this); * title.Text = "Some title"; * * llInner.AddView(title); * * TextView someDescr = new TextView(this); * someDescr.Text = "some Description"; * llInner.AddView(someDescr);*/ } //sw.AddView(ll); //ll.AddView(cardview); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.FuelEntry); loader = FindViewById <ProgressBar>(Resource.Id.loader); layFuelEntry = FindViewById <LinearLayout>(Resource.Id.layFuelEntry); try { VehicleList = FuelDB.Singleton.GetValue().ToList(); var allVal = FuelDB.Singleton.GetBillDetails().ToList(); billDetailsList = allVal.FirstOrDefault(); billEntryList = FuelDB.Singleton.GetFuelValues()?.ToList(); } catch (Exception ex) { //Console.WriteLine(w.Message); ExceptionLog.LogDetails(this, "Error in loading vehicle List or GetbillDetails --" + ex.Message); } if (VehicleList != null) { myVehiclelist = VehicleList.Select(I => I.RegNo).Distinct().ToArray(); } lblTitle = FindViewById <TextView>(Resource.Id.lblTittle); btnClear = FindViewById <Button>(Resource.Id.btnClear); vehicleNumber = FindViewById <AutoCompleteTextView>(Resource.Id.vehicleNumber); if (myVehiclelist != null) { var adapter = new ArrayAdapter <string>(this, Resource.Layout.select_dialog_item_material, myVehiclelist); vehicleNumber.Adapter = adapter; vehicleNumber.Threshold = 1; vehicleNumber.ItemClick += VehicleNumber_ItemClick; vehicleNumber.TextChanged += VehicleNumber_TextChanged; } billNumber = FindViewById <TextView>(Resource.Id.txtBillNumber); billNumber.Text = billDetailsList?.BillPrefix + billDetailsList?.BillCurrentNumber; dateTimeNow = FindViewById <TextView>(Resource.Id.lbldateTime).Text = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); fuelTypeSpinner = FindViewById <Spinner>(Resource.Id.fuelSpinner); fuelTypeSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, new string[] { ConstantValues.OUTWARD, ConstantValues.INWARD //ConstantValues.EXCESS, ConstantValues.SHORTAGE }); fuelFormSpinner = FindViewById <Spinner>(Resource.Id.fuelFormSpinner); fuelFormSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, StockList); var bunkDetailsLayout = FindViewById <LinearLayout>(Resource.Id.layBunkDetails); cashModeSpinner = FindViewById <Spinner>(Resource.Id.paymentMode); cashModeSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, new string[] { ConstantValues.CASH, ConstantValues.CREDIT }); vehicleTypeSpinner = FindViewById <Spinner>(Resource.Id.vehicleType); vehicleTypeSpinner.ItemSelected += VehicleTypeSpinner_ItemSelected; btnClear.Click += BtnClear_Click; var layMeterFault = FindViewById <LinearLayout>(Resource.Id.layMeterFault); checkBox = FindViewById <CheckBox>(Resource.Id.chckMeterFault); checkBox.CheckedChange += (s, e) => { if (fuelTypeSpinner.SelectedItem.ToString() == ConstantValues.OUTWARD) { layMeterFault.Visibility = checkBox.Checked ? Android.Views.ViewStates.Gone : Android.Views.ViewStates.Visible; } txtClosingKMS.Text = string.Empty; lblkmpl.Text = ConstantValues.KMPL; }; driverNameSpinner = FindViewById <Spinner>(Resource.Id.driverName); fuelToFill = FindViewById <EditText>(Resource.Id.fuelToFill); fuelAvailable = FindViewById <TextView>(Resource.Id.fuelAvailable); txtOpeningKMS = FindViewById <TextView>(Resource.Id.txtOpeningKMS); txtClosingKMS = FindViewById <EditText>(Resource.Id.txtClosingKMS); lblkmpl = FindViewById <TextView>(Resource.Id.lblkmpl); txtFilledBy = FindViewById <EditText>(Resource.Id.txtFilledBy); txtRate = FindViewById <EditText>(Resource.Id.txtRate); lblTotalPrice = FindViewById <TextView>(Resource.Id.lblTotalPrice); txtRemarks = FindViewById <EditText>(Resource.Id.txtRemarks); imgFuel = FindViewById <ImageView>(Resource.Id.imgFuel); lblButtonStore = FindViewById <TextView>(Resource.Id.lblButtonStore); fuelToFill.TextChanged += (s, e) => CheckFuelAvailbility(); txtRate.TextChanged += (s, e) => CalculateFuelTotalAmount(); driverNameSpinner.ItemSelected += (s, ev) => { if (!isDriverNameSpinnerSelected) { isDriverNameSpinnerSelected = true; driverNameSpinner.PerformClick(); } else { txtOpeningKMS.Text = VehicleList.Where((a => a.DriverName == driverNameSpinner.SelectedItem.ToString())) .Distinct().Select(i => i.OpeningKM).Distinct().First(); fuelToFill.RequestFocus(); } }; if (billDetailsList != null) { fuelAvailable.Text = $"{billDetailsList.AvailableLiters}"; } txtClosingKMS.TextChanged += (s, e) => { if (txtOpeningKMS.Text.Equals(ConstantValues.ZERO)) { return; } if (!string.IsNullOrEmpty(txtOpeningKMS.Text) && !string.IsNullOrEmpty(txtClosingKMS.Text) && !string.IsNullOrEmpty(fuelToFill.Text)) { if (Convert.ToDecimal(txtClosingKMS.Text) > Convert.ToDecimal(txtOpeningKMS.Text) && Convert.ToDecimal(fuelToFill.Text) > 0) { GetKMPL(); } else { lblkmpl.Text = ConstantValues.KMPL; } } }; btnStore = FindViewById <LinearLayout>(Resource.Id.btnStore); btnStore.Click += (s, e) => { btnStore.Clickable = false; try { ShowLoader(true); //if (FuelDB.Singleton.GetBillDetails().LastOrDefault() + //FuelDB.Singleton.GetBillDetails().LastOrDefault().BillCurrentNumber == billNumber.Text) //{ // Console.WriteLine(); //} if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.OUTWARD) && !fuelToFill.Text.Equals(".") && fuelFormSpinner.SelectedItem.Equals(ConstantValues.STOCK)) { if (float.Parse(fuelToFill.Text) > float.Parse(billDetailsList.AvailableLiters)) { var alertDialog = new Android.App.AlertDialog.Builder(this); alertDialog.SetTitle("Fuel exceeds stock"); //alertDialog.SetMessage($"Do you want add " + // $"{float.Parse(fuelToFill.Text) - float.Parse(billDetailsList.AvailableLiters)} ltrs. to excess fuel"); alertDialog.SetMessage("No Fuel Available..."); alertDialog.SetCancelable(false); alertDialog.SetPositiveButton(ConstantValues.OK, (ss, es) => { ExcessLiter = float.Parse(fuelToFill.Text) - float.Parse(billDetailsList.AvailableLiters); isExcess = true; fuelToFill.Text = string.Empty; ExcessLiter = 0f; btnStore.Clickable = true; ShowLoader(false); //StoreDetils(); }); //alertDialog.SetNegativeButton(ConstantValues.CANCEL, (ss, se) => //{ // fuelToFill.Text = string.Empty; // ExcessLiter = 0f; // btnStore.Clickable = true; // isExcess = false; // alertDialog.Dispose(); // ShowLoader(false); //}); alertDialog.Show(); var totalLtrs = (float.Parse(billDetailsList?.AvailableLiters) - float.Parse(fuelToFill.Text)); availableFuel = totalLtrs < 1 ? 0f : totalLtrs; return; } else { var totalLtrs = (float.Parse(billDetailsList?.AvailableLiters) - float.Parse(fuelToFill.Text)); availableFuel = totalLtrs < 1 ? 0f : totalLtrs; } } /* if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.SHORTAGE)) * { * var alertDialog = new Android.App.AlertDialog.Builder(this); * alertDialog.SetTitle($"Shortage {availableFuel} ltrs."); * alertDialog.SetMessage(ConstantValues.PROCEED); * alertDialog.SetCancelable(false); * alertDialog.SetPositiveButton(ConstantValues.YES, (ss, se) => * { * UpdateShortageAndRefreshCurrentActivity(); * fuelAvailable.Text = string.Empty; * availableFuel = 0; * * }); * alertDialog.SetNegativeButton(ConstantValues.NO, (ss, se) => * { * alertDialog.Dispose(); * btnStore.Clickable = true; * ShowLoader(false); * }); * alertDialog.Show(); * return; * } */ if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.INWARD)) //|| fuelTypeSpinner.SelectedItem.Equals(ConstantValues.EXCESS)) { if (!fuelAvailable.Text.Equals(ConstantValues.ZERO)) { var alertDialog = new Android.App.AlertDialog.Builder(this); alertDialog.SetTitle("Adding fuel"); alertDialog.SetMessage("Do you need to add fuel to existing"); alertDialog.SetCancelable(false); alertDialog.SetPositiveButton(ConstantValues.YES, (ss, se) => { fuelAvailable.Text = (Convert.ToInt32(fuelAvailable.Text) + Convert.ToInt32(fuelToFill.Text)).ToString(); availableFuel = float.Parse(billDetailsList?.AvailableLiters) + float.Parse(fuelToFill.Text); StoreDetils(); }); alertDialog.SetNegativeButton(ConstantValues.NO, (ss, se) => { alertDialog.Dispose(); ShowLoader(false); btnStore.Clickable = true; }); alertDialog.Show(); return; } else { fuelAvailable.Text = (Convert.ToInt32(fuelAvailable.Text) + Convert.ToInt32(fuelToFill.Text)).ToString(); availableFuel = float.Parse(billDetailsList?.AvailableLiters) + float.Parse(fuelToFill.Text); } } if (fuelFormSpinner.SelectedItem.Equals(ConstantValues.BUNK) && !fuelTypeSpinner.SelectedItem.Equals(ConstantValues.INWARD)) { var alertDialog = new Android.App.AlertDialog.Builder(this); alertDialog.SetTitle("Fuel is from petrol bunk"); alertDialog.SetMessage(ConstantValues.PROCEED); alertDialog.SetPositiveButton(ConstantValues.OK, (ss, se) => { StoreDetils(); }); alertDialog.SetNegativeButton(ConstantValues.CANCEL, (ss, se) => { btnStore.Clickable = true; }); alertDialog.Show(); } else { StoreDetils(); } ShowLoader(false); } catch { Toast.MakeText(this, "Check all fields are filled...", ToastLength.Short).Show(); ShowLoader(false); btnStore.Clickable = true; } }; fuelTypeSpinner.ItemSelected += (s, e) => { ClearAllFields(); fuelFormSpinner.Adapter = null; fuelToFill.Enabled = true; vehicleNumber.Enabled = true; vehicleNumber.Focusable = true; fuelToFill.Focusable = true; fuelToFill.FocusableInTouchMode = true; if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.INWARD)) //|| fuelTypeSpinner.SelectedItem.Equals(ConstantValues.EXCESS)) { vehicleNumber.Text = string.Empty; if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.INWARD)) { fuelFormSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, new string[] { ConstantValues.BUNK }); } else { fuelFormSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, new string[] { ConstantValues.STOCK }); } layMeterFault.Visibility = Android.Views.ViewStates.Gone; FindViewById <LinearLayout>(Resource.Id.layFuelEntry).SetBackgroundResource(Resource.Color.backgroundInward); lblTitle.SetBackgroundResource(Resource.Color.btnAndTitleBackgroundGreen); btnStore.SetBackgroundResource(Resource.Color.btnAndTitleBackgroundGreen); btnClear.SetBackgroundResource(Resource.Color.btnAndTitleBackgroundGreen); layMeterFault.Visibility = Android.Views.ViewStates.Gone; checkBox.Visibility = Android.Views.ViewStates.Gone; lblButtonStore.Text = ConstantValues.STORE; isInward = true; } /* else if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.SHORTAGE)) * { * lblButtonStore.Text = ConstantValues.UPDATE; * fuelFormSpinner.Adapter = null; * vehicleTypeSpinner.Adapter = null; * driverNameSpinner.Adapter = null; * vehicleNumber.Enabled = false; * fuelToFill.Focusable = false; * fuelToFill.Text = availableFuel.ToString(); * vehicleNumber.Text = ConstantValues.ZERO; * lblTitle.SetBackgroundResource(Resource.Color.borderColor); * FindViewById<LinearLayout>(Resource.Id.layFuelEntry).SetBackgroundResource(Resource.Color.borderColor); * btnStore.SetBackgroundColor(Color.White); * btnClear.SetBackgroundColor(Color.White); * layMeterFault.Visibility = Android.Views.ViewStates.Gone; * checkBox.Visibility = Android.Views.ViewStates.Gone; * imgFuel.Visibility = Android.Views.ViewStates.Gone; * isInward = false; * } */ else { fuelFormSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, new string[] { ConstantValues.STOCK, ConstantValues.BUNK }); layMeterFault.Visibility = Android.Views.ViewStates.Visible; lblButtonStore.Text = ConstantValues.STORE; vehicleNumber.Text = string.Empty; FindViewById <LinearLayout>(Resource.Id.layFuelEntry).SetBackgroundResource(Resource.Color.borderColor); lblTitle.SetBackgroundResource(Resource.Color.borderColor); lblTitle.SetTextColor(Color.Black); btnStore.SetBackgroundColor(Color.White); btnClear.SetBackgroundColor(Color.White); layMeterFault.Visibility = Android.Views.ViewStates.Visible; checkBox.Visibility = Android.Views.ViewStates.Visible; isInward = false; } }; fuelFormSpinner.ItemSelected += (s, e) => { if (fuelFormSpinner.SelectedItem.Equals(ConstantValues.STOCK)) { bunkDetailsLayout.Visibility = Android.Views.ViewStates.Gone; lblTitle.SetTextColor(Color.Black); btnStore.SetBackgroundColor(Color.White); btnClear.SetBackgroundColor(Color.White); lblTitle.SetBackgroundResource(Resource.Color.borderColor); FindViewById <LinearLayout>(Resource.Id.layFuelEntry).SetBackgroundResource(Resource.Color.borderColor); imgFuel.Visibility = Android.Views.ViewStates.Gone; } else { bunkDetailsLayout.Visibility = Android.Views.ViewStates.Visible; if (fuelTypeSpinner.SelectedItem.Equals(ConstantValues.OUTWARD)) { FindViewById <LinearLayout>(Resource.Id.layFuelEntry).SetBackgroundResource(Resource.Color.backgroundBunk); btnStore.SetBackgroundColor(Color.Brown); btnClear.SetBackgroundColor(Color.Brown); lblTitle.SetBackgroundResource(Resource.Color.btnAndTitleBackgroundRed); } imgFuel.Visibility = Android.Views.ViewStates.Visible; } }; ShowLoader(false); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initialisation RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; SetContentView(RootLayout); //Navbar Root LinearLayout NavbarLayout = new LinearLayout(this); NavbarLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavbarLayout.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavbarLayout); //Navbar Back Icon LinearLayout NavbarBack = new LinearLayout(this); NavbarBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(NAVBARHEIGHT, NAVBARHEIGHT); NavbarBack.SetBackgroundResource(Resource.Drawable.IconBack); NavbarBack.Click += NavbarBack_Click;; NavbarLayout.AddView(NavbarBack); //Navbar Title TextView NavBarTitle = new TextView(this); NavBarTitle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-140, RtGraphicsLayouts.EXPAND); NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, NAVBARPADDING, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING); NavBarTitle.Gravity = GravityFlags.Center; NavBarTitle.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitle.Text = NAVBARTEXT; NavbarLayout.AddView(NavBarTitle); //Screen Content Scroller ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); //Screen Content LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollRoot.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentScrollerRoot.AddView(ContentScrollRoot); //From Station Box ContentScrollRoot.AddView(GenerateStationSelectionBox(StationSelectionBoxType.From)); ContentScrollRoot.AddView(GenerateSpacer()); //Train Results Box TrainDepartures = new RtTrainDeparturesView(this, this); TrainDepartures.Callback += TrainDepartures_Callback; ContentScrollRoot.AddView(TrainDepartures); ContentScrollRoot.AddView(GenerateSpacer()); //To Station Box ContentScrollRoot.AddView(GenerateStationSelectionBox(StationSelectionBoxType.To)); }
public void ini() { var textFormat = Android.Util.ComplexUnitType.Px; var textFormatdip = Android.Util.ComplexUnitType.Dip; mainLayout = new RelativeLayout(context); mainLayout.LayoutParameters = new RelativeLayout.LayoutParams(-1, -1); mainLinearLayout = new LinearLayout(context); headerLinearLayout = new LinearLayout(context); contentLinearLayout = new LinearLayout(context); mainHeaderLinearLayout = new LinearLayout(context); imHeader = new ImageView(context); titleHeader = new TextView(context); AutorHeader = new TextView(context); content = new TextView(context); titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); AutorHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(125)); contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -1); mainLinearLayout.Orientation = Orientation.Vertical; mainHeaderLinearLayout.Orientation = Orientation.Horizontal; headerLinearLayout.Orientation = Orientation.Vertical; contentLinearLayout.Orientation = Orientation.Vertical; mainLinearLayout.AddView(mainHeaderLinearLayout); mainLinearLayout.AddView(contentLinearLayout); mainHeaderLinearLayout.AddView(imHeader); mainHeaderLinearLayout.AddView(headerLinearLayout); headerLinearLayout.AddView(titleHeader); headerLinearLayout.AddView(AutorHeader); headerLinearLayout.SetPadding(15, 0, 0, 10); AutorHeader.SetPadding(0, 15, 0, 0); contentLinearLayout.AddView(content); contentLinearLayout.SetPadding(0, 15, 0, 0); mainLinearLayout.SetBackgroundResource(Resource.Drawable.border); // mainLinearLayout.SetX (Configuration.getHeight (45)); //mainLinearLayout.SetY (Configuration.getWidth (500)); //titleHeader.Text = "Diferentes tipos de aves en Perú"; titleHeader.SetTextColor(Color.ParseColor("#FF0080")); //titleHeader.SetTextSize (textFormat, Configuration.getHeight (38)); titleHeader.SetTextSize(textFormatdip, 16.0f); titleHeader.SetMaxWidth(Configuration.getWidth(274)); titleHeader.SetMaxHeight(Configuration.getHeight(80)); //titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion)); titleHeader.Ellipsize = TextUtils.TruncateAt.End; titleHeader.SetMaxLines(2); //AutorHeader.Text = "Autor del Articulo"; AutorHeader.SetTextColor(Color.ParseColor("#424242")); AutorHeader.SetTextSize(textFormat, Configuration.getHeight(23)); AutorHeader.SetMaxWidth(Configuration.getWidth(274)); //AutorHeader.SetMaxHeight (Configuration.getHeight (25)); //AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion)); AutorHeader.Ellipsize = TextUtils.TruncateAt.End; AutorHeader.SetMaxLines(1); //content.Text = "Los factores geográficos, climáticos y evolutivos convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de"; //content.SetTextSize (textFormat, Configuration.getHeight (24)); content.SetTextSize(textFormatdip, 12.0f); content.SetMaxWidth(Configuration.getWidth(501)); //content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion)); //content.Ellipsize = TextUtils.TruncateAt.End; //content.SetMaxLines(4); //imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true)); //imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion)); imHeader.SetMaxWidth(Configuration.getWidth(124)); imHeader.SetMaxHeight(Configuration.getWidth(124)); int padW = Configuration.getWidth(45); int padH = Configuration.getHeight(0); mainLayout.SetPadding(padW, padH, padW, padH); mainLayout.AddView(mainLinearLayout); /* * mainLayout.AddView (titleHeader); * mainLayout.AddView (AutorHeader); * mainLayout.AddView (content); * mainLayout.AddView (imHeader); */ }
public void list() { linearLayout1.RemoveAllViews(); try { using (var client = new WebClient()) { string userID = Library.ControlID.userID; var json = client.DownloadString("http://joremtongwebsite.000webhostapp.com/news.php?userID=" + userID); dynamic jsonData = JsonConvert.DeserializeObject(json); foreach (dynamic jsonDatas in jsonData) { var layout2 = new LinearLayout(this); layout2.Orientation = Orientation.Horizontal; var layoutParams2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams2.SetMargins(0, 0, 0, 20); layout2.SetBackgroundResource(Resource.Drawable.layout_bg); layout2.SetPadding(0, 0, 0, 0); layout2.LayoutParameters = layoutParams2; var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams.SetMargins(0, 0, 0, 20); layout.SetBackgroundResource(Resource.Drawable.layout_bg); layout.SetPadding(0, 0, 0, 0); layout.LayoutParameters = layoutParams; var username = new TextView(this); username.SetTextColor(Color.White); username.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); username.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 20); username.Text = jsonDatas["title"].ToString(); username.SetPadding(20, 20, 20, 0); var timedate = new TextView(this); timedate.SetTextColor(Color.LightGray); timedate.SetTypeface(Typeface.Default, TypefaceStyle.Normal); timedate.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 8); timedate.Text = jsonDatas["createdOn"].ToString(); timedate.SetPadding(20, 0, 20, 20); var Title = new TextView(this); Title.SetTextColor(Color.DimGray); Title.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); Title.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 15); Title.Text = jsonDatas["content"].ToString(); Title.SetPadding(20, 0, 20, 8); layout.AddView(username); layout.AddView(timedate); layout.AddView(Title); layout2.AddView(layout); linearLayout1.AddView(layout2); } } } catch (Exception i) { var layout2 = new LinearLayout(this); layout2.Orientation = Orientation.Horizontal; var layoutParams2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams2.SetMargins(0, 0, 0, 20); layout2.SetBackgroundResource(Resource.Drawable.layout_bg); layout2.SetPadding(0, 0, 0, 0); layout2.LayoutParameters = layoutParams2; var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);; layoutParams.SetMargins(0, 0, 0, 20); layout.SetBackgroundResource(Resource.Drawable.layout_bg); layout.SetPadding(10, 10, 10, 50); layout.LayoutParameters = layoutParams; var username = new TextView(this); username.SetTextColor(Color.White); username.SetTypeface(Typeface.Default, TypefaceStyle.BoldItalic); username.SetTextSize(global::Android.Util.ComplexUnitType.Dip, 20); username.Text = "NO POST YET"; username.SetPadding(20, 20, 20, 0); layout.AddView(username); layout2.AddView(layout); linearLayout1.AddView(layout2); } }
public void ini(){ //creating comment List commentLayout = new LinearLayout(context); commentLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (934)); commentList = new ListView (context); //commentList.AddView (commentList); //end comment List _mainLayout = new RelativeLayout (context); linearGradiente = new LinearLayout (context); linearGradiente.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (541)); linearGradiente.SetBackgroundResource (Resource.Drawable.gradiente); var textFormat = Android.Util.ComplexUnitType.Px; _mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1); _fondo2 = new LinearLayout (context); _fondo2.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getWidth (640)); _fondo2.SetY (Configuration.getHeight (109)); Drawable dr1 = new BitmapDrawable (getBitmapFromAsset("icons/fondoselec.png")); _fondo2.SetBackgroundDrawable (dr1); dr1 = null; _mainLayout.AddView (_fondo2); //section1----------------------------------------------- _contentRLayout_S1 = new RelativeLayout(context); _txtTitle_S1 = new TextView (context); _txtAuthor_S1 = new TextView (context); _imAuthor_S1 = new ImageView (context); _txtChapter_S1 = new TextView (context); _itemsLayout_S1 = new LinearLayout (context);//not used _imItem_S1 = new List<ImageView> (); _txtItem_S1 = new List<TextView>(); //_mainLayout.AddView (_txtTitle_S1); //_mainLayout.AddView (_txtAuthor_S1); _mainLayout.AddView (_imAuthor_S1); //_mainLayout.AddView (_txtChapter_S1); _contentRLayout_S1.LayoutParameters = new RelativeLayout.LayoutParams (-1, Configuration.getHeight (480)); LinearLayout _linearTitle = new LinearLayout (context); _linearTitle.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _linearTitle.SetGravity (Android.Views.GravityFlags.Center); _linearTitle.AddView (_txtTitle_S1); _linearTitle.SetY (Configuration.getHeight (60)); linearGradiente.SetX (0); linearGradiente.SetY (Configuration.getHeight(502)); _mainLayout.AddView (linearGradiente); _mainLayout.AddView (_linearTitle); //_txtTitle_S1.SetX (Configuration.getWidth (245));_txtTitle_S1.SetY (Configuration.getHeight (60)); Bitmap newbm = Configuration.getRoundedShape(Bitmap.CreateScaledBitmap( getBitmapFromAsset("icons/imgautor.png"), Configuration.getWidth(170), Configuration.getWidth(170), true),Configuration.getWidth(170),Configuration.getHeight(170)); _imAuthor_S1.SetImageBitmap (newbm); // newbm.Recycle (); newbm = null; _imAuthor_S1.SetX (Configuration.getWidth (240));_imAuthor_S1.SetY (Configuration.getHeight (189)); LinearLayout _linearAuthor = new LinearLayout (context); _linearAuthor.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _linearAuthor.SetGravity (Android.Views.GravityFlags.Center); _linearAuthor.AddView (_txtAuthor_S1); _linearAuthor.SetY (Configuration.getHeight (378)); _mainLayout.AddView (_linearAuthor); //_txtAuthor_S1.SetX (Configuration.getWidth (228));_txtAuthor_S1.SetY (Configuration.getHeight (378)); LinearLayout _linearChapter = new LinearLayout (context); _linearChapter.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); _linearChapter.SetGravity (Android.Views.GravityFlags.Center); _linearChapter.AddView (_txtChapter_S1); _linearChapter.SetY (Configuration.getHeight (502)); _mainLayout.AddView (_linearChapter); //_txtChapter_S1.SetX (Configuration.getWidth (191));_txtChapter_S1.SetY (Configuration.getHeight (502)); _txtTitle_S1.Text = "Camino Inca"; _txtTitle_S1.SetTextColor (Color.White); _txtTitle_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtTitle_S1.SetTextSize (textFormat,Configuration.getHeight(30)); _txtAuthor_S1.Text = "David Spencer"; _txtAuthor_S1.SetTextColor (Color.White); _txtAuthor_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtAuthor_S1.SetTextSize (textFormat,Configuration.getHeight(30)); //_txtAuthor_S1.SetBackgroundColor (Color.ParseColor ("#60000000")); _txtAuthor_S1.SetShadowLayer (50.8f, 0.0f, 0.0f, Color.ParseColor ("#000000")); _txtChapter_S1.Text = "FLORA Y FAUNA"; _txtChapter_S1.SetTextColor (Color.White); _txtChapter_S1.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtChapter_S1.SetTextSize (textFormat,Configuration.getHeight(35)); List<string> item_path = new List<string> (); item_path.Add ("icons/icona.png"); item_path.Add ("icons/iconb.png"); item_path.Add ("icons/iconc.png"); item_path.Add ("icons/icond.png"); item_path.Add ("icons/icone.png"); item_path.Add ("icons/iconf.png"); item_path.Add ("icons/icong.png"); int inixItemIM = Configuration.getWidth (33); int crecIM = Configuration.getWidth (90); int inixItemTXT = Configuration.getWidth (42); int crecTXT = Configuration.getWidth (90); int inixLinea = Configuration.getWidth (93); for (int i = 0; i < item_path.Count; i++) { _imItem_S1.Add(new ImageView(context)); _imItem_S1[i].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(item_path[i]), Configuration.getWidth (30), Configuration.getWidth (30), true)); _mainLayout.AddView (_imItem_S1 [i]); _imItem_S1 [i].SetX (inixItemIM+(i*crecIM));_imItem_S1 [i].SetY (Configuration.getHeight(602)); if (i != item_path.Count - 1) { ImageView linea = new ImageView (context); linea.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/lineatareas.png"), 1, Configuration.getHeight (68), true)); _mainLayout.AddView (linea); linea.SetX (inixLinea + (i * crecIM)); linea.SetY (Configuration.getHeight (605)); linea = null; } _txtItem_S1.Add (new TextView (context)); _txtItem_S1 [i].Text = "0"; _txtItem_S1 [i].SetTextColor (Color.ParseColor ("#2E9AFE")); _txtItem_S1[i].Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtItem_S1[i].SetTextSize (textFormat,Configuration.getHeight(30)); _mainLayout.AddView (_txtItem_S1 [i]); _txtItem_S1 [i].SetX (inixItemTXT+(i*crecTXT));_txtItem_S1 [i].SetY (Configuration.getHeight(640)); _imItem_S1 [i] = null; } _imItem_S1 = null; //------------------------------------------------------- //section2------------------------------------------------ _contentScrollView_S2 = new HorizontalScrollView (context); _contentScrollView_S2.LayoutParameters = new HorizontalScrollView.LayoutParams (-1, Configuration.getWidth(160)); _contentScrollView_S2.HorizontalScrollBarEnabled = false; _images_S2 = new LinearLayout (context); _images_S2.Orientation = Orientation.Horizontal; _images_S2.LayoutParameters = new LinearLayout.LayoutParams(-2,-1); _contentScrollView_S2.SetX (0); _contentScrollView_S2.SetY (Configuration.getHeight (700)); _contentScrollView_S2.AddView (_images_S2); //---------------------------------------------------------- //section3------------------------------------------------ _contentLLayout_S3 = new LinearLayout (context); _contentLLayout_S3.Orientation = Orientation.Vertical; _contentLLayout_S3.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (160)); _contentLLayout_S3.SetX (0);_contentLLayout_S3.SetY (Configuration.getHeight(875)); _contentLLayout_S3.SetGravity (Android.Views.GravityFlags.Center); _txtInfo1_S3 = new TextView (context); _txtInfo2_S3 = new TextView (context); _txtInfo3_S3 = new TextView (context); _txtInfo1_S3.Text = "Duración: 05 dias / 04 noches "; _txtInfo2_S3.Text = "Distancia: 65km"; _txtInfo3_S3.Text = "Punto mas elevado: 4,6386 msnm (Salkantay)"; _txtInfo1_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo2_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo3_S3.Gravity = Android.Views.GravityFlags.CenterHorizontal; _txtInfo1_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo2_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo3_S3.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); _txtInfo1_S3.SetTextSize (textFormat,Configuration.getHeight(30)); _txtInfo2_S3.SetTextSize (textFormat,Configuration.getHeight(30)); _txtInfo3_S3.SetTextSize (textFormat,Configuration.getHeight(30)); _txtInfo1_S3.SetTextColor (Color.White); _txtInfo2_S3.SetTextColor (Color.White); _txtInfo3_S3.SetTextColor (Color.White); _contentLLayout_S3.AddView (_txtInfo1_S3); _contentLLayout_S3.AddView (_txtInfo2_S3); _contentLLayout_S3.AddView (_txtInfo3_S3); //Drawable dr3 = new BitmapDrawable (getBitmapFromAsset("icons/fondonotif.png")); //_contentLLayout_S3.SetBackgroundDrawable(dr3); //_contentLLayout_S3.SetBackgroundColor(Color.ParseColor("#80000000")); _mainLayout.AddView (_contentLLayout_S3); _mainLayout.AddView (_contentScrollView_S2); //---------------------------------------------------------- //section4------------------------------------------------ _imItems_S4 = new List<ImageView>(); List<string> botton_icon_path = new List<string> (); botton_icon_path.Add ("icons/btnunidadesazul.png"); botton_icon_path.Add ("icons/btncomentariosazul.png"); botton_icon_path.Add ("icons/btncontenidoazul.png"); botton_icon_path.Add ("icons/btnchatazul.png"); botton_icon_path.Add ("icons/btntareasazul.png"); _imItems_S4.Add (new ImageView (context)); _imItems_S4[0].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[0]), Configuration.getWidth (60), Configuration.getWidth (54), true)); _mainLayout.AddView (_imItems_S4[0]); _imItems_S4[0].SetX (Configuration.getWidth(58));_imItems_S4[0].SetY (Configuration.getHeight(1069)); _imItems_S4.Add (new ImageView (context)); _imItems_S4[1].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[1]), Configuration.getWidth (78), Configuration.getWidth (55), true)); _mainLayout.AddView (_imItems_S4[1]); _imItems_S4[1].SetX (Configuration.getWidth(169));_imItems_S4[1].SetY (Configuration.getHeight(1069)); _imItems_S4.Add (new ImageView (context)); _imItems_S4[2].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[2]), Configuration.getWidth (60), Configuration.getWidth (60), true)); _mainLayout.AddView (_imItems_S4 [2]); _imItems_S4[2].SetX (Configuration.getWidth(297));_imItems_S4[2].SetY (Configuration.getHeight(1069)); _imItems_S4.Add (new ImageView (context)); _imItems_S4[3].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[3]), Configuration.getWidth (30), Configuration.getWidth (51), true)); _mainLayout.AddView (_imItems_S4[3]); _imItems_S4[3].SetX (Configuration.getWidth(421));_imItems_S4[3].SetY (Configuration.getHeight(1069)); _imItems_S4.Add (new ImageView (context)); _imItems_S4[4].SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset(botton_icon_path[4]), Configuration.getWidth (41), Configuration.getWidth (50), true)); _mainLayout.AddView (_imItems_S4 [4]); _imItems_S4[4].SetX (Configuration.getWidth(540));_imItems_S4[4].SetY (Configuration.getHeight(1069)); //---------------------------------------------------------- Drawable dr = new BitmapDrawable (getBitmapFromAsset("icons/fondo.png")); _mainLayout.SetBackgroundDrawable (dr); dr = null; _workspace = new LinearLayout (context); _workspace.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (1045)); //_workspace.SetY (Configuration.getHeight (110)); _mainLayout.AddView (_workspace); //_workspace.AddView (_foro); //_workspace.Visibility = Android.Views.ViewStates.Invisible; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.nuovaNotaLayout); Button b = (Button)FindViewById(Resource.Id.Salva); b.Click += NuovaNotaOnClick; img = (Button)FindViewById(Resource.Id.foto); img.Click += CamptureButton_Click; EditText cont = (EditText)FindViewById(Resource.Id.contenuto); start = 0; //listner sulla EditText che controlla ogni volta che c'è un cambiamento di testo cont.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { //prendiamo il testo inserito lo convertiamo in stringa e ne controlliamo l'ultimo carattere inserito, se questo è un "." allora indica che //la frase/periodo è finita è deve fare il sentiment analysis string s = cont.Text.ToString(); int finish = 0; int i = s.Length; if (i <= 1) { if (s.Equals(".")) { } } else { string a = s.Substring(i - 1); if (a.Equals(".")) { finish = i - 1; String pezzoText = s.Substring(start, finish - start); double score = FaceUnlockVocalNode.Resources.MyCognitive.getSentimentText(pezzoText); String emoji = ""; if (score >= 0.60) { emoji = Emoji(0x1f600); } else if (score <= 40) { emoji = Emoji(0x1F608); } else { emoji = Emoji(0x1F610); } cont.Text += emoji; cont.SetSelection(finish + 3); start = finish; } } }; l = FindViewById <LinearLayout>(Resource.Id.n); foto = FindViewById <Button>(Resource.Id.foto); Salva = FindViewById <Button>(Resource.Id.Salva); emozione = Intent.GetStringExtra("emozione"); switch (emozione) { case "happines": l.SetBackgroundResource(Resource.Color.colorBackgroudnHappiness); foto.SetBackgroundResource(Resource.Color.colorPrimaryHappiness); Salva.SetBackgroundResource(Resource.Color.colorPrimaryHappiness); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkHappiness))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "sadness": l.SetBackgroundResource(Resource.Color.colorBackgroudnSadness); foto.SetBackgroundResource(Resource.Color.colorPrimarySadness); Salva.SetBackgroundResource(Resource.Color.colorPrimarySadness); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkSadness))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "fear": l.SetBackgroundResource(Resource.Color.colorBackgroudnFear); foto.SetBackgroundResource(Resource.Color.colorPrimaryFear); Salva.SetBackgroundResource(Resource.Color.colorPrimaryFear); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkFear))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "anger": l.SetBackgroundResource(Resource.Color.colorBackgroudnAngry); foto.SetBackgroundResource(Resource.Color.colorPrimaryAngry); Salva.SetBackgroundResource(Resource.Color.colorPrimaryAngry); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkAngry))); break; ; case "contempt": l.SetBackgroundResource(Resource.Color.colorBackgroudnContempt); foto.SetBackgroundResource(Resource.Color.colorPrimaryContempt); Salva.SetBackgroundResource(Resource.Color.colorPrimaryContempt); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkContempt))); break; ; case "surprise": l.SetBackgroundResource(Resource.Color.colorBackgroudnSurprise); foto.SetBackgroundResource(Resource.Color.colorPrimarySurprise); Salva.SetBackgroundResource(Resource.Color.colorPrimarySurprise); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkSurprise))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; case "disgust": l.SetBackgroundResource(Resource.Color.colorBackgroudnDisgust); foto.SetBackgroundResource(Resource.Color.colorPrimaryDisgust); Salva.SetBackgroundResource(Resource.Color.colorPrimaryDisgust); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkDisgust))); break; ; case "neutral": l.SetBackgroundResource(Resource.Color.colorBackgroudnNeutral); foto.SetBackgroundResource(Resource.Color.colorPrimaryNeutral); Salva.SetBackgroundResource(Resource.Color.colorPrimaryNeutral); Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorPrimaryDarkNeutral))); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LightStatusBar; break; ; default: break; ; } }
public void iniPlancesList() { //_currentPlaces.Clear (); _listLinearPlaces.Clear(); placeSpace.RemoveAllViews (); placesContainer.RemoveAllViews (); VerticalScrollView listScrollPlaces = new VerticalScrollView (context); listScrollPlaces.LayoutParameters = new VerticalScrollView.LayoutParams (-1, Configuration.getHeight (345)); listScrollPlaces.VerticalScrollBarEnabled = false; LinearLayout listSpaceLayout = new LinearLayout(context); listSpaceLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); listSpaceLayout.Orientation = Orientation.Vertical; for (int i = 0; i < _currentPlaces.Count; i++) { var item = _currentPlaces [i]; LinearLayoutLO linearItem = new LinearLayoutLO (context); linearItem.index = i; TextView txtName = new TextView (context); ImageView imgIcon = new ImageView (context); txtName.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (420), -1); txtName.Gravity = GravityFlags.CenterVertical; txtName.Text = item.titulo; //txtName.SetTextColor (Color.ParseColor ("#ffffff")); txtName.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); txtName.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32)); //imgIcon.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset (item.Asset), Configuration.getWidth (30), Configuration.getWidth (30), true)); int H = 80; int W = 120; linearItem.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (H)); //linearItem.SetBackgroundDrawable (background_row); linearItem.Orientation = Orientation.Horizontal; linearItem.SetGravity (Android.Views.GravityFlags.CenterVertical); //linearItem.AddView (imgIcon); RelativeLayout imageLayout = new RelativeLayout (context); imageLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H)); ImageView iconImage = new ImageView (context); Picasso.With (context).Load (item.pathIcon).Resize(Configuration.getWidth(W),Configuration.getHeight(H)).CenterCrop().Into (iconImage); imageLayout.AddView (iconImage); LinearLayout gradiente = new LinearLayout (context); gradiente.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H)); imageLayout.AddView (gradiente); ImageIconMap icon = new ImageIconMap (context); icon.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (60), Configuration.getWidth (60)); icon.index = 0; icon.SetImageBitmap(_leyendaIcon[item.tipoIndex]); //icon.SetPadding (Configuration.getWidth (20), ,0,0); icon.SetX(Configuration.getWidth (30)); icon.SetY(Configuration.getHeight (10)); RelativeLayout iconLayout = new RelativeLayout (context); iconLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H)); iconLayout.SetGravity (GravityFlags.Center); LinearLayout gradiente2 = new LinearLayout (context); gradiente2.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H)); iconLayout.AddView (icon); iconLayout.AddView (gradiente2); linearItem.AddView (imageLayout); linearItem.AddView (txtName); linearItem.AddView (iconLayout); int space = Configuration.getWidth (30); //linearItem.SetPadding (space,0,space,0); //imgIcon.SetPadding (Configuration.getWidth(68), 0, 0, 0); txtName.SetPadding (Configuration.getWidth(10), 0, 0, 0); if (i % 2 == 0) { gradiente.SetBackgroundResource (Resource.Drawable.gradiente2); gradiente2.SetBackgroundResource (Resource.Drawable.gradiente22); linearItem.SetBackgroundColor (Color.ParseColor ("#F0AE11")); txtName.SetTextColor (Color.White); } else { gradiente.SetBackgroundResource (Resource.Drawable.gradiente1); gradiente2.SetBackgroundResource (Resource.Drawable.gradiente11); txtName.SetTextColor (Color.ParseColor("#F0AE11")); } _listLinearPlaces.Add (linearItem); _listLinearPositonPlaces.Add (icon); listSpaceLayout.AddView (linearItem); } /* listPlaces = new ListView (context); listPlaces.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(345)); listPlaces.Adapter = new PlaceAdapter (context, _currentPlaces); listPlaces.DividerHeight = 0; placesContainer.AddView (listPlaces); */ placesContainer.AddView (listSpaceLayout); placeSpace.AddView(placesContainer); titulo_header.Text = titulo_map_header; header.AddView (titulo_header); header.AddView (_leyendaMap); }
private async Task <bool> AddProfile(SpannableStringBuilder builder, TagNode node, IDictionary <int, Bitmap> inlines, LinearLayout parent, GravityFlags gravity) { if (!layoutTags.Contains(node.Tag.Name)) { return(false); } AddTextView(builder, parent, gravity); var parameter = node.AttributeValues.Count > 0 ? node.AttributeValues.Values.First() : null; LinearLayout newParent; switch (node.Tag.Name) { case "collapse": newParent = new CollapsingView(Activity) { LayoutParameters = defaultLayoutParams, Title = parameter }; break; case "indent": newParent = new LinearLayout(Activity) { LayoutParameters = defaultLayoutParams, Orientation = Orientation.Vertical }; newParent.SetPaddingRelative(MLHelpers.DpToPixelsInt(10), 0, 0, 0); break; case "left": case "center": case "right": newParent = new LinearLayout(Activity) { LayoutParameters = defaultLayoutParams, Orientation = Orientation.Vertical }; gravity = node.Tag.Name == "center" ? GravityFlags.Center : node.Tag.Name == "right" ? GravityFlags.End : GravityFlags.Start; newParent.SetHorizontalGravity(gravity); break; case "hr": var value = new TypedValue(); Activity.Theme.ResolveAttribute(Resource.Attribute.colorAccent, value, true); var hr = new View(Activity) { LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, MLHelpers.DpToPixelsInt(2)) }; hr.SetBackgroundColor(new Color(value.Data)); parent.AddView(hr); return(true); case "heading": var heading = new TextView(Activity) { LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { BottomMargin = MLHelpers.DpToPixelsInt(5) }, Text = node.ToText() }; heading.SetTextSize(ComplexUnitType.Sp, 22); parent.AddView(heading); return(true); case "img": var image = new ImageView(Activity) { LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) }; image.SetImageBitmap(inlines[int.Parse(parameter)]); parent.AddView(image); return(true); case "quote": newParent = new LinearLayout(Activity) { LayoutParameters = defaultLayoutParams, Orientation = Orientation.Vertical }; var padding = MLHelpers.DpToPixelsInt(5); newParent.SetPadding(padding, padding, padding, padding); newParent.SetBackgroundResource(Resource.Drawable.background_quote); var text = new TextView(Activity) { LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { BottomMargin = MLHelpers.DpToPixelsInt(5) }, Text = Strings.Profile_Quote }; text.SetTypeface(null, TypefaceStyle.Bold); newParent.AddView(text); return(true); default: return(false); } parent.AddView(newParent); var remaining = await BBCodeBinding.GetFormatted(node, (n, b) => AddProfile(b, n, inlines, newParent, gravity)); AddTextView(remaining, newParent, gravity); return(true); }
public override View GetPropertyWindowLayout(Android.Content.Context context) { LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); layoutParams.TopMargin = 25; gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density); LinearLayout linearLayout1 = new LinearLayout(context); linearLayout1.Orientation = Android.Widget.Orientation.Vertical; TextView titleText = new TextView(context) { Text = "Orientation and ChartType", TextAlignment = TextAlignment.Center, Gravity = GravityFlags.Center, TextSize = 30 }; titleText.SetTypeface(null, TypefaceStyle.Bold); titleText.SetWidth(width); TextView descText = new TextView(context) { Text = "Please select the orientation and chart type.", TextAlignment = TextAlignment.TextStart, Gravity = GravityFlags.FillHorizontal, TextSize = 12 }; descText.SetPadding(0, 10, 0, 0); descText.SetWidth(width); linearLayout1.AddView(titleText); linearLayout1.AddView(descText); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.SetPadding(0, 5, 0, 0); horizontal = new Button(context); horizontal.Text = "Horizontal"; horizontal.Click += ComputeHorizontal_Click; horizontal.SetWidth(width); linearLayout2.AddView(horizontal); LinearLayout linearLayout3 = new LinearLayout(context); linearLayout3.SetPadding(0, 5, 0, 0); vertical = new Button(context); vertical.Text = "Vertical"; vertical.Click += ComputeVertical_Click; vertical.SetWidth(width); linearLayout3.AddView(vertical); LinearLayout linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Horizontal; linearLayout4.SetPadding(0, 10, 0, 0); TextView selectText = new TextView(context) { Text = "Select a chart type", Gravity = GravityFlags.Start, TextSize = 15 }; selectText.SetWidth((int)(width * 0.4)); Spinner spinner = new Spinner(context, SpinnerMode.Dialog); spinner.SetMinimumHeight(60); spinner.SetBackgroundColor(Color.Gray); spinner.DropDownWidth = 600; List <String> list = new List <String>(); list.Add("Alternate"); list.Add("Right"); list.Add("Left"); ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; spinner.ItemSelected += sType_spinner_ItemSelected; spinner.SetGravity(GravityFlags.Start); spinner.SetMinimumWidth(width - (int)(width * 0.4)); linearLayout4.AddView(selectText); linearLayout4.AddView(spinner); gridLinearLayout.AddView(linearLayout1); gridLinearLayout.AddView(linearLayout2); gridLinearLayout.AddView(linearLayout3); gridLinearLayout.AddView(linearLayout4); return(gridLinearLayout); }
void AddGridView() { InitializeChildGrid(); mainGrid = new FrameLayout(sampleContext); mainGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mainGrid.AddView(childGrid); maps = new SfMaps(sampleContext); maps.ZoomLevel = 4; maps.MinZoom = 4; maps.MaxZoom = 10; maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent); layer = new ImageryLayer(); layer.GeoCoordinates = new PointF(27.1751f, 78.0421f); PopulationMarker marker1 = new PopulationMarker(sampleContext); marker1.Latitude = 20.6843f; marker1.Longitude = -88.5678f; layer.Markers.Add(marker1); PopulationMarker marker2 = new PopulationMarker(sampleContext); marker2.Latitude = -13.1631f; marker2.Longitude = -72.5450f; layer.Markers.Add(marker2); PopulationMarker marker3 = new PopulationMarker(sampleContext); marker3.Latitude = -22.9519f; marker3.Longitude = -43.2106f; layer.Markers.Add(marker3); PopulationMarker marker4 = new PopulationMarker(sampleContext); marker4.Latitude = 41.8902; marker4.Longitude = 12.4922; layer.Markers.Add(marker4); PopulationMarker marker5 = new PopulationMarker(sampleContext); marker5.Latitude = 30.3285; marker5.Longitude = 35.4444; layer.Markers.Add(marker5); PopulationMarker marker6 = new PopulationMarker(sampleContext); marker6.Latitude = 27.1751; marker6.Longitude = 78.0421; layer.Markers.Add(marker6); PopulationMarker marker7 = new PopulationMarker(sampleContext); marker7.Latitude = 40.4319; marker7.Longitude = 116.5704; layer.Markers.Add(marker7); maps.Adapter = new MarkerAdapter(sampleContext); maps.Layers.Add(layer); mainGrid.AddView(maps); mainGrid.SetClipChildren(false); List <int> arrayList = new List <int>(); arrayList.Add(Resource.Drawable.Mexico); arrayList.Add(Resource.Drawable.Peru); arrayList.Add(Resource.Drawable.Christ); arrayList.Add(Resource.Drawable.Colosseum); arrayList.Add(Resource.Drawable.Petra); arrayList.Add(Resource.Drawable.TajMahal); arrayList.Add(Resource.Drawable.China_wall); List <string> descriptionList = new List <string>(); descriptionList.Add("Mayan ruins on Mexico's Yucatan Peninsula. It was one of the largest Maya cities, thriving from around A.D. 600 to 1200."); descriptionList.Add("An inca citadel built in the mid-1400s. It was not widely known until the early 20th century."); descriptionList.Add("An enormous statue of Jesus Christ with open arms. A symbol of Christianity across the world, the statue has also become a cultural icon of both Rio de Janeiro and Brazil."); descriptionList.Add("Built between A.D. 70 and 80. It is one of the most popular touristattractions in Europe."); descriptionList.Add("It is a historic and archaeological city in southern Jordan. Petra lies around Jabal Al-Madbah in a basin surrounded by mountains which form the eastern flank of the Arabah valley that runs from the Dead Sea to the Gulf of Aqaba."); descriptionList.Add("It is an ivory-white marble mausoleum on the southern bank of the river Yamuna in the Indian city of Agra."); descriptionList.Add("The Great Wall of China is a series of fortifications that were built across the historical northern borders of ancient Chinese states and Imperial China as protection against various nomadic groups from the Eurasian Steppe."); List <string> headerList = new List <string>(); headerList.Add("Chichen Itza, Mexico"); headerList.Add("Machu Picchu, Peru"); headerList.Add("Chirst the Redeemer, Brazil"); headerList.Add("Colosseum, Rome"); headerList.Add("Petra, Jordan"); headerList.Add("Taj Mahal, India"); headerList.Add("Great wall of China, China"); DisplayMetrics displayMetrics = sampleContext.Resources.DisplayMetrics; float screenWidth = displayMetrics.WidthPixels; float screenHeight = displayMetrics.HeightPixels; var density = displayMetrics.Density; LinearLayout layout = new LinearLayout(sampleContext); layout.Orientation = Orientation.Horizontal; layout.SetPadding(0, 0, 0, 10); layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layout.SetVerticalGravity(GravityFlags.Bottom); var itemWidth = screenWidth * 0.7; SfCarousel carousel = new SfCarousel(sampleContext); carousel.RotationAngle = 0; carousel.ItemWidth = (int)itemWidth; carousel.ItemHeight = (int)(110 * sampleContext.Resources.DisplayMetrics.Density); carousel.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, carousel.ItemHeight); carousel.SelectedIndex = 5; carousel.SelectedItemOffset = (int)(carousel.ItemWidth / 2) - (int)(carouselGap * density); List <SfCarouselItem> dataSource = new List <SfCarouselItem>(); for (int i = 0; i <= 6; i++) { LinearLayout linearLayout = new LinearLayout(sampleContext); linearLayout.SetBackgroundColor(Color.White); linearLayout.Orientation = Orientation.Horizontal; linearLayout.SetBackgroundResource((Resource.Drawable.carousel_corner_radius)); linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)itemWidth, (int)carousel.ItemHeight); var width = (int)(0.6f * itemWidth); LinearLayout layout1 = new LinearLayout(sampleContext); layout1.Orientation = Orientation.Vertical; layout1.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)width, (int)carousel.ItemHeight); layout1.SetPadding(15, 15, 15, 15); TextView textView = new TextView(sampleContext); textView.Text = headerList[i]; textView.SetTypeface(Typeface.Default, TypefaceStyle.Bold); textView.TextAlignment = TextAlignment.TextStart; textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent); layout1.AddView(textView); textView = new TextView(sampleContext); textView.Text = descriptionList[i]; textView.SetMaxLines(3); textView.Ellipsize = Android.Text.TextUtils.TruncateAt.End; textView.TextAlignment = TextAlignment.TextStart; textView.SetPadding(0, 10, 0, 0); textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent); layout1.AddView(textView); linearLayout.AddView(layout1); SfCarouselItem sfCarouselItem = new SfCarouselItem(sampleContext); width = (int)(0.4f * itemWidth); LinearLayout layout2 = new LinearLayout(sampleContext); layout2.SetPadding(10, 15, 15, 15); layout2.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width, carousel.ItemHeight); ImageView imageView = new ImageView(sampleContext); imageView.SetBackgroundResource((Resource.Drawable.carousel_corner_radius)); imageView.SetImageResource(arrayList[i]); imageView.SetScaleType(ImageView.ScaleType.FitXy); imageView.ClipToOutline = true; layout2.AddView(imageView); linearLayout.AddView(layout2); sfCarouselItem.ContentView = linearLayout; dataSource.Add(sfCarouselItem); } carousel.DataSource = dataSource; carousel.SelectionChanged += Carousel_SelectionChanged; layout.AddView(carousel); mainGrid.AddView(layout); LinearLayout linear = new LinearLayout(sampleContext); linear.Orientation = Orientation.Horizontal; linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linear.SetHorizontalGravity(GravityFlags.End); linear.SetVerticalGravity(GravityFlags.Bottom); TextView textView1 = new TextView(sampleContext); textView1.Text = "©"; textView1.SetBackgroundColor(Color.White); textView1.SetTextColor(Color.Black); textView1.SetPadding(2, 2, 2, 2); linear.AddView(textView1); TextView textView2 = new TextView(sampleContext); textView2.Text = "OpenStreetMap contributors."; textView2.SetTextColor(Color.DeepSkyBlue); textView2.SetPadding(0, 2, 3, 2); textView2.SetBackgroundColor(Color.White); textView2.Clickable = true; textView2.Click += TextView2_Click; linear.AddView(textView2); mainGrid.AddView(linear); }
public override View GetPropertyWindowLayout(Context context) { LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layoutParams.TopMargin = 25; gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density) / 3; LinearLayout linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Horizontal; linearLayout4.SetPadding(0, (int)(10 * currentDensity), 0, 0); TextView selectText = new TextView(context) { Text = "Connector Style", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; selectText.SetWidth((int)(width * 0.4 * currentDensity)); Spinner spinner = new Spinner(context, SpinnerMode.Dialog); spinner.SetMinimumHeight((int)(20 * currentDensity)); spinner.SetBackgroundColor(Color.Gray); spinner.DropDownWidth = (int)(200 * currentDensity); List <string> list = new List <string>(); list.Add("Default"); list.Add("Dashed"); list.Add("Dotted"); ArrayAdapter <string> dataAdapter = new ArrayAdapter <string>(context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; spinner.ItemSelected += sType_spinner_ItemSelected; spinner.SetGravity(GravityFlags.Start); spinner.SetMinimumWidth(width - (int)(width * 0.4)); linearLayout4.AddView(selectText); linearLayout4.AddView(spinner); LinearLayout linearLayout3 = new LinearLayout(context); linearLayout3.SetPadding(0, (int)(10 * currentDensity), 0, 0); linearLayout3.SetMinimumHeight((int)(40 * currentDensity)); TextView connectorSize = new TextView(context) { Text = "Connector Size", Gravity = GravityFlags.CenterVertical, TextSize = 5 * currentDensity }; connectorSize.SetMinimumHeight((int)(40 * currentDensity)); connectorSize.SetWidth((int)(width * 0.4 * currentDensity)); LinearLayout plusMinus = new LinearLayout(context); plusMinus.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent); plusMinus.SetMinimumWidth(width - (int)(width * 0.4)); ImageButton minusButton = new ImageButton(context); minusButton.SetMinimumHeight((int)(40 * currentDensity)); minusButton.Click += MinusButton_Click; string imageId = "diagramsub.png"; if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); minusButton.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } plusMinus.AddView(minusButton); label = new TextView(context); label.Text = "1"; label.TextAlignment = TextAlignment.Center; label.Gravity = GravityFlags.Center; label.SetMinimumHeight((int)(40 * currentDensity)); label.SetWidth((int)(40 * currentDensity)); plusMinus.AddView(label); ImageButton plusButton = new ImageButton(context); imageId = "diagramplus.png"; plusButton.Click += PlusButton_Click; plusButton.SetMinimumHeight((int)(40 * currentDensity)); if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); plusButton.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } plusMinus.AddView(plusButton); linearLayout3.AddView(connectorSize); linearLayout3.AddView(plusMinus); gridLinearLayout.AddView(linearLayout4); gridLinearLayout.AddView(linearLayout3); return(gridLinearLayout); }
private void createUI(List<MessageDB> message, List<UserDB> contact, string nameTitle, bool clear = false) { message.Reverse (); contact.Reverse (); int m = 0; string messager = ""; bool dd = false; if (message != null && contact != null) { if (clear == false) RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ()); string othername = string.Empty; for (int i = 0; i < contact.Count; ++i) { if (string.IsNullOrEmpty (nameTitle)) othername = contact [i].FirstName + " " + contact [i].LastName; else othername = nameTitle; if (isMe != othername) { RunOnUiThread (delegate { Header.headertext = othername; Header.fontsize = 36f; ImageHelper.fontSizeInfo (header.Context); header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; }); break; } } if (contact.Count > 1) { string toReturn = ""; List<UserDB> sortedList = new List<UserDB> (); sortedList = contact.OrderBy (s => s.LastName).OrderBy (s => s.FirstName).ToList (); foreach (UserDB eachItem in sortedList) toReturn += string.Format ("{0} {1}, ", eachItem.FirstName, eachItem.LastName); int last = toReturn.LastIndexOf (", "); toReturn = toReturn.Remove (last); RunOnUiThread (delegate { using (LinearLayout btnlayout = new LinearLayout (context)) { btnlayout.Orientation = Android.Widget.Orientation.Vertical; btnlayout.SetGravity (GravityFlags.Center); btnlayout.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); btnlayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context)); using (TextView name = new TextView(context)) { name.Text = toReturn; name.SetTextSize (Android.Util.ComplexUnitType.Dip, 18f); name.SetTextColor (Color.Black); btnlayout.AddView (name); } using (Button showAll = new Button (context)) { showAll.Gravity = GravityFlags.CenterVertical; showAll.Text = Application.Context.Resources.GetString (Resource.String.messageShowAllInConversation); showAll.Click += (object sender, EventArgs e) => { showParticipants (sender, e, contact); }; showAll.SetWidth ((int)ImageHelper.convertDpToPixel (180f, context)); showAll.SetHeight ((int)ImageHelper.convertDpToPixel (30f, context)); showAll.SetBackgroundResource (Resource.Drawable.button); btnlayout.AddView (showAll); } listWrapper.AddView (btnlayout); } }); } if (getGuid != null) getGuid.Clear (); RunOnUiThread (delegate { foreach (MessageDB messages in message) { string name = contact [m].FirstName + " " + contact [m].LastName; ImageView random = null; LinearLayout layout = new LinearLayout (context); layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity (GravityFlags.CenterVertical); layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context)); LinearLayout layout2 = new LinearLayout (context); layout2.Orientation = Orientation.Vertical; layout2.SetGravity (GravityFlags.Center); if (name == isMe) layout.AddView (contactUserInterface (messages, contact [m], true)); else layout.AddView (contactUserInterface (messages, contact [m], false)); /*ImageView profilepic = new ImageView (context); profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context)); if (contact == null) profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); else { profilepic.Tag = new Java.Lang.String ("profilepic_" + contact [m].AccountID); profilepic.SetImageResource (Resource.Drawable.defaultuserimage); layout.AddView (profilepic); if (contact [m].Picture.Length == 0 && contact [m].HasProfileImage) getGuid.Add (contact [m].AccountID); else { if (contact [m].Picture.Length > 0) LoadUserImage (contact [m], profilepic); else profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); } TextView name = new TextView (context); name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (230f, context), (int)ImageHelper.convertDpToPixel (40f, context)); name.Gravity = GravityFlags.Center; name.SetTextColor (Color.White); name.TextSize = 16f; layout2.AddView (name); if (messages.MessageStepDBList.Count == 1 && messages.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) { TextView text = new TextView (context); text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context)); text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); text.Gravity = GravityFlags.CenterVertical; if (name == isMe) text.SetBackgroundResource (Resource.Drawable.bubblesolidright); else text.SetBackgroundResource (Resource.Drawable.bubblesolidleft); text.TextSize = 16f; for (int e = 0; e < messages.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) { messager = messages.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); text.SetHeight (nolines); text.SetTextColor (Android.Graphics.Color.Black); text.Text = messager; layout2.Clickable = true; layout2.AddView (text); } else {*/ LinearLayout layout3 = new LinearLayout (context); layout3.Orientation = Orientation.Horizontal; if (name == isMe) layout3.SetGravity (GravityFlags.Right); else layout3.SetGravity (GravityFlags.Left); layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); layout3.SetVerticalGravity (GravityFlags.CenterVertical); layout3.SetMinimumHeight (30); layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); if (name != isMe) { using (random = new ImageView (context)) { random.Tag = m; random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); random.ContentDescription = messages.MessageGuid; random.Click += PlayButton_Clicked; layout3.AddView (random); } } int textt = 0; for (int tt = 0; tt < messages.MessageStepDBList.Count; ++tt) { if (messages.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text) textt++; } for (int i = 0; i < messages.MessageStepDBList.Count; ++i) { switch (messages.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: if (textt == 1) { TextView text = new TextView (context); text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context)); text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); text.Gravity = GravityFlags.CenterVertical; if (name == isMe) text.SetBackgroundResource (Resource.Drawable.bubblesolidright); else text.SetBackgroundResource (Resource.Drawable.bubblesolidleft); text.TextSize = 16f; for (int e = 0; e < messages.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) { messager = messages.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); text.SetHeight (nolines); text.SetTextColor (Android.Graphics.Color.Black); text.Text = messager; layout2.Clickable = true; layout2.AddView (text); } else { if (textt > 1) { using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.textmsg); layout3.AddView (random); } } } break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.drawicon); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.comicon); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.comicmsgs); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.emoticonmsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.pollmsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.soundfxmsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Video: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.videomsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.voicemsg); layout3.AddView (random); } break; } } if (name == isMe) { using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); random.Click += (object ss, EventArgs ee) => { random_Click (ss, ee, message); }; layout3.AddView (random); } } layout2.AddView (layout3); layout.AddView (layout2); listWrapper.AddView (layout); if (m + 1 < contact.Count) m++; } //} }); if (getGuid.Count > 0) { cpUI = 0; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken)); } } }
private void CreateFunctionLibraryDesign(Context context) { int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density); scrollView = new ScrollView(context); scrollView.SetPadding(10, 10, 10, 20); LinearLayout linearLayout = new LinearLayout(context); linearLayout.Orientation = Orientation.Vertical; linearLayout.Focusable = true; linearLayout.FocusableInTouchMode = true; linearLayout.SetPadding(10, 10, 10, 10); LinearLayout linearLayout1 = new LinearLayout(context); linearLayout1.Orientation = Orientation.Vertical; TextView titleText = new TextView(context) { Text = "Functions Library", TextAlignment = TextAlignment.Center, Gravity = GravityFlags.Center, TextSize = 30 }; titleText.SetTypeface(null, TypefaceStyle.Bold); titleText.SetWidth(width); TextView descText = new TextView(context) { Text = "This sample demonstrates the calculation using various Excel-like functions.", TextAlignment = TextAlignment.TextStart, Gravity = GravityFlags.FillHorizontal, TextSize = 12 }; descText.SetPadding(0, 10, 0, 0); descText.SetWidth(width); linearLayout1.AddView(titleText); linearLayout1.AddView(descText); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.Orientation = Orientation.Horizontal; linearLayout2.SetPadding(0, 10, 0, 0); TextView functionsText = new TextView(context) { Text = "Select a function", Gravity = GravityFlags.Start, TextSize = 15 }; functionsText.SetWidth((int)(width * 0.4)); Spinner spinner = new Spinner(context, SpinnerMode.Dialog); var functions = GetLibraryFunctions(); var adapter = new ArrayAdapter <string>(context, Resource.Drawable.SpinnerExt, functions); spinner.Adapter = adapter; spinner.SetGravity(GravityFlags.Start); spinner.SetMinimumWidth(width - (int)(width * 0.4)); spinner.ItemSelected += Spinner_ItemSelected; linearLayout2.AddView(functionsText); linearLayout2.AddView(spinner); LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); layoutParams.TopMargin = 25; gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int padding = gridLinearLayout.PaddingLeft + gridLinearLayout.PaddingRight; int firstColWidth = (int)(width * 0.1) - padding; int cellWidth = ((width - firstColWidth) / 3) - padding; // First Row LinearLayout linearLayout3 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout3.SetPadding(0, 10, 0, 0); TextView text00 = new TextView(context); text00.SetWidth((int)(width * 0.1)); TextView text01 = new TextView(context) { Text = "A", Gravity = GravityFlags.Center, TextSize = 15 }; text01.SetWidth(cellWidth); TextView text02 = new TextView(context) { Text = "B", Gravity = GravityFlags.Center, TextSize = 15 }; text02.SetWidth(cellWidth); TextView text03 = new TextView(context) { Text = "C", Gravity = GravityFlags.Center, TextSize = 15 }; text03.SetWidth(cellWidth); linearLayout3.AddView(text00); linearLayout3.AddView(text01); linearLayout3.AddView(text02); linearLayout3.AddView(text03); // Second Row LinearLayout linearLayout4 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout4.SetPadding(0, 10, 0, 0); TextView text10 = new TextView(context) { Text = "1", Gravity = GravityFlags.Center, TextSize = 15 }; text10.SetWidth((int)(width * 0.1)); txtA1 = CreateEditText(context, "32"); txtA1.SetWidth(cellWidth); txtB1 = CreateEditText(context, "50"); txtB1.SetWidth(cellWidth); txtC1 = CreateEditText(context, "10"); txtC1.SetWidth(cellWidth); linearLayout4.AddView(text10); linearLayout4.AddView(txtA1); linearLayout4.AddView(txtB1); linearLayout4.AddView(txtC1); // Third Row LinearLayout linearLayout5 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout5.SetPadding(0, 10, 0, 0); TextView text20 = new TextView(context) { Text = "2", Gravity = GravityFlags.Center, TextSize = 15 }; text20.SetWidth((int)(width * 0.1)); txtA2 = CreateEditText(context, "12"); txtA2.SetWidth(cellWidth); txtB2 = CreateEditText(context, "24"); txtB2.SetWidth(cellWidth); txtC2 = CreateEditText(context, "90"); txtC2.SetWidth(cellWidth); linearLayout5.AddView(text20); linearLayout5.AddView(txtA2); linearLayout5.AddView(txtB2); linearLayout5.AddView(txtC2); // Fourth Row LinearLayout linearLayout6 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout6.SetPadding(0, 10, 0, 0); TextView text30 = new TextView(context) { Text = "3", Gravity = GravityFlags.Center, TextSize = 15 }; text30.SetWidth((int)(width * 0.1)); txtA3 = CreateEditText(context, "88"); txtA3.SetWidth(cellWidth); txtB3 = CreateEditText(context, "-22"); txtB3.SetWidth(cellWidth); txtC3 = CreateEditText(context, "37"); txtC3.SetWidth(cellWidth); linearLayout6.AddView(text30); linearLayout6.AddView(txtA3); linearLayout6.AddView(txtB3); linearLayout6.AddView(txtC3); // Fifth Row LinearLayout linearLayout7 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout7.SetPadding(0, 10, 0, 0); TextView text40 = new TextView(context) { Text = "4", Gravity = GravityFlags.Center, TextSize = 15 }; text40.SetWidth((int)(width * 0.1)); txtA4 = CreateEditText(context, "73"); txtA4.SetWidth(cellWidth); txtB4 = CreateEditText(context, "91"); txtB4.SetWidth(cellWidth); txtC4 = CreateEditText(context, "21"); txtC4.SetWidth(cellWidth); linearLayout7.AddView(text40); linearLayout7.AddView(txtA4); linearLayout7.AddView(txtB4); linearLayout7.AddView(txtC4); // Sixth Row LinearLayout linearLayout11 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout11.SetPadding(0, 10, 0, 0); TextView text50 = new TextView(context) { Text = "5", Gravity = GravityFlags.Center, TextSize = 15 }; text50.SetWidth((int)(width * 0.1)); txtA5 = CreateEditText(context, "63"); txtA5.SetWidth(cellWidth); txtB5 = CreateEditText(context, "29"); txtB5.SetWidth(cellWidth); txtC5 = CreateEditText(context, "44"); txtC5.SetWidth(cellWidth); linearLayout11.AddView(text50); linearLayout11.AddView(txtA5); linearLayout11.AddView(txtB5); linearLayout11.AddView(txtC5); LinearLayout linearLayout8 = new LinearLayout(context); linearLayout8.Orientation = Orientation.Horizontal; linearLayout8.SetPadding(0, 25, 0, 0); TextView formulaText = new TextView(context) { Text = "Formula", Gravity = GravityFlags.Start, TextSize = 15 }; formulaText.SetWidth((int)(width * 0.4)); formulaEdit = new EditText(context) { TextSize = 15 }; formulaEdit.SetWidth(width - (int)(width * 0.4)); formulaEdit.SetSingleLine(true); linearLayout8.AddView(formulaText); linearLayout8.AddView(formulaEdit); LinearLayout linearLayout9 = new LinearLayout(context); linearLayout9.SetPadding(0, 5, 0, 0); Button compute = new Button(context); compute.Text = "Compute"; compute.Click += Compute_Click; compute.SetWidth(width); linearLayout9.AddView(compute); LinearLayout linearLayout10 = new LinearLayout(context); linearLayout10.Orientation = Orientation.Horizontal; linearLayout10.SetPadding(0, 20, 0, 0); TextView computedText = new TextView(context) { Text = "Computed Value", Gravity = GravityFlags.Start, TextSize = 15 }; computedText.SetWidth((int)(width * 0.4)); computedValueEdit = new TextViewExt(context) { TextSize = 15 }; computedValueEdit.SetWidth(width - (int)(width * 0.4)); computedValueEdit.SetSingleLine(true); linearLayout10.AddView(computedText); linearLayout10.AddView(computedValueEdit); gridLinearLayout.AddView(linearLayout3); gridLinearLayout.AddView(linearLayout4); gridLinearLayout.AddView(linearLayout5); gridLinearLayout.AddView(linearLayout6); gridLinearLayout.AddView(linearLayout7); gridLinearLayout.AddView(linearLayout11); linearLayout.AddView(linearLayout1); linearLayout.AddView(linearLayout2); linearLayout.AddView(gridLinearLayout); linearLayout.AddView(linearLayout8); linearLayout.AddView(linearLayout9); linearLayout.AddView(linearLayout10); linearLayout.Touch += (object sender, View.TouchEventArgs e) => { if (e.Event.Action == MotionEventActions.Up) { ClearFocus(); } }; scrollView.AddView(linearLayout); }
public override void SetValue(object value) { var input = (AccountViewModel)value; linearLayout.SetBackgroundResource(input.IsOverdrawn ? Resource.Color.color_warning : Resource.Color.white); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); ctrl = ((GameController)this.Activity); if (container == null) return null; var view = inflater.Inflate(Resource.Layout.GameDetailScreen, container, false); _layoutDefault = view.FindViewById<ScrollView> (Resource.Id.scrollView); _imageView = view.FindViewById<ImageView> (Resource.Id.imageView); _imageDirection = view.FindViewById<ImageView> (Resource.Id.imageDirection); _textDescription = view.FindViewById<TextView> (Resource.Id.textDescription); _textDirection = view.FindViewById<TextView> (Resource.Id.textDirection); _layoutBottom = view.FindViewById<LinearLayout> (Resource.Id.layoutBottom); _layoutButtons = view.FindViewById<LinearLayout> (Resource.Id.layoutButtons); _layoutDirection = view.FindViewById<LinearLayout> (Resource.Id.layoutDirection); // Don't know a better way :( _layoutBottom.SetBackgroundResource(Main.BottomBackground); _layoutButtons.Visibility = ViewStates.Visible; HasOptionsMenu = !(activeObject is Task); return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.Window.AddFlags(WindowManagerFlags.Fullscreen); var metrics = Resources.DisplayMetrics; widthInDp = ((int)metrics.WidthPixels); heightInDp = ((int)metrics.HeightPixels); Configuration.setWidthPixel (widthInDp); Configuration.setHeigthPixel (heightInDp); //START PARA COPIAR LA BASE DE DATOS LOCAL //copyDataBase (); //END LinearLayout test = new LinearLayout (this); test.LayoutParameters = new LinearLayout.LayoutParams (-1, -1); test.SetBackgroundResource (Resource.Drawable.splash); SetContentView (test); var com = ((LoginViewModel)this.DataContext).LoginCommand; com.Execute(null); //init (); //SetContentView (mainLayout); //SetContentView(Resource.Layout.LoginView); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //游戏开始 ImageView imgStart = FindViewById<ImageView>(Resource.Id.imgStart); imgStart.Click += delegate { var intent = new Intent(this, typeof(GameActivity)); intent.PutExtra("game", GameIndex); StartActivityForResult(intent, 0); Finish(); }; //游戏退出 ImageView imgExit = FindViewById<ImageView>(Resource.Id.imgExit); imgExit.Click += delegate { Finish(); }; //绑定关卡列表 glBarriers = FindViewById<GridLayout>(Resource.Id.glBarriers); //BarrierList = _db.QueryAllBarriers(); BarrierList = new List<Barrier>(); var names = Resources.GetStringArray(Resource.Array.barrier_names); var titles = Resources.GetStringArray(Resource.Array.barrier_titles); for (int i = 0; i < names.Length; i++) { var barrier = DB.QueryBarrier(i); if (barrier == null) { barrier = new Barrier() { Id = i, Title = titles[i], Name = names[i], Star = 0, State = (i == 0 ? true : false), NextID = (i == names.Length - 1) ? 0 : (i + 1) }; DB.Insert(barrier); } BarrierList.Add(barrier); LinearLayout linear = new LinearLayout(this); GridLayout.LayoutParams g = new GridLayout.LayoutParams(); g.Width = GridLayout.LayoutParams.WrapContent; g.Height = GridLayout.LayoutParams.WrapContent; if (Resources.DisplayMetrics.Density == 1) { g.SetMargins(17, 20, 17, 20); } else { g.SetMargins(17, 20, 17, 20); } linear.LayoutParameters = g; linear.Orientation = Orientation.Vertical; linear.SetGravity(GravityFlags.Center); linear.Clickable = false; LinearLayout linearLayout = new LinearLayout(this); LinearLayout.LayoutParams m = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); linearLayout.LayoutParameters = m; if (barrier.State) { linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_on); } else if (!barrier.State) { linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_off); } linearLayout.SetGravity(GravityFlags.Bottom); linearLayout.Orientation = Orientation.Vertical; linearLayout.Id = barrier.Id; linearLayout.SetOnClickListener(this); if (barrier.Id == 0) { linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_on_selected); } TextView textView = new TextView(this); LinearLayout.LayoutParams t = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); if (Resources.DisplayMetrics.Density == 1) { t.BottomMargin = 10; textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 15); } else { t.BottomMargin = 5; textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 10); } textView.LayoutParameters = t; textView.Text = barrier.Title; textView.SetTextColor(Android.Graphics.Color.White); textView.Gravity = GravityFlags.Center; linearLayout.AddView(textView); LinearLayout ll = new LinearLayout(this); LinearLayout.LayoutParams l = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); ll.LayoutParameters = l; ll.Orientation = Orientation.Horizontal; ll.SetGravity(GravityFlags.Center); for (int j = 1; j <= 3; j++) { ImageView imageView = new ImageView(this); LinearLayout.LayoutParams imageLayout; if (Resources.DisplayMetrics.Density == 1) { imageLayout = new LinearLayout.LayoutParams(30, 30); } else { imageLayout = new LinearLayout.LayoutParams(30, 30); } imageView.LayoutParameters = imageLayout; if (j <= barrier.Star) { imageView.SetImageResource(Resource.Drawable.game_star_1); } else { imageView.SetImageResource(Resource.Drawable.game_star_2); } if (barrier.Star == 0) { imageView.Visibility = ViewStates.Invisible; } ll.AddView(imageView); } linear.AddView(linearLayout); linear.AddView(ll); glBarriers.AddView(linear); } }