void LoadPagesDataSource() { bool is_main = true; int space = Configuration.getWidth(30); var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList; int indice = 0; if (s_listp != null) { int j = vm._currentSection; // for (int j = 0; j < s_listp.Count; j++) { for (int k = 0; k < s_listp [j].PagesList.Count; k++) { // if (j == vm._currentSection) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this); scrollPager.setOnScrollViewListener(this); LinearLayout linearScroll = new LinearLayout(this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearScroll.Orientation = Orientation.Vertical; var content = s_listp [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager(this); front.Tag = "pager"; front.ImageChapter = s_listp [j].PagesList [k].page.url_img; front.Title = s_listp [j].PagesList [k].page.title; front.Description = s_listp [j].PagesList [k].page.description; var slides = s_listp [j].PagesList [k].content.lopage.loslide; front.setBack(drBack); linearScroll.AddView(front); LinearLayout descriptionLayout = new LinearLayout(this); descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); descriptionLayout.SetPadding(space, 0, space, space); descriptionLayout.Orientation = Orientation.Vertical; TextView titulo_detalle = new TextView(this); titulo_detalle.Text = "Descripción"; titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf"); titulo_detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38)); titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6])); titulo_detalle.SetPadding(0, 0, 0, space); descriptionLayout.AddView(titulo_detalle); TextView detalle = new TextView(this); detalle.TextFormatted = Html.FromHtml(slides [0].loparagraph); detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf"); detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32)); descriptionLayout.AddView(detalle); ViewTreeObserver vto = detalle.ViewTreeObserver; int H = 0; vto.GlobalLayout += (sender, args) => { H = detalle.Height; Console.WriteLine("TAM:::1:" + H); detalle.LayoutParameters.Height = H - Configuration.getHeight(60); }; LinearLayout separationLinear = new LinearLayout(this); separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5); separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8")); separationLinear.Orientation = Orientation.Horizontal; //separationLinear.SetPadding (0,0,0,50); //Añadir mis-Favoritos----------------------------------------------------------- iconFavorito = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/notas.png"), Configuration.getWidth(40), Configuration.getWidth(30), true); //Colocando icono de Favoritos ImageView favorit_ = new ImageView(this); favorit_.Tag = j; favorit_.SetImageBitmap(iconFavorito); favorit_.SetX(Configuration.getWidth(20)); favorit_.SetY(Configuration.getHeight(0)); favorit_.Click += delegate { funcFavoritos(favorit_); }; TextView tomar_notas = new TextView(this); tomar_notas.Text = "Tomar notas"; tomar_notas.SetTextColor(Color.ParseColor("#E65100")); tomar_notas.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(21)); tomar_notas.SetX(Configuration.getWidth(60)); tomar_notas.SetY(Configuration.getHeight(0)); tomar_notas.Click += delegate { Bundle bundle = new Bundle(); bundle.PutString("Titulo", front.Title); bundle.PutInt("TaskID", isListNotas(front.Title)); //Intent nos permite enlazar dos actividades Intent intent = new Intent(this, typeof(NotasItemScreen)); //añadir parametros intent.PutExtras(bundle); //ejuta intent StartActivity(intent); }; RelativeLayout misFavoritos = new RelativeLayout(this); misFavoritos.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(60)); misFavoritos.SetX(Configuration.getWidth(0)); misFavoritos.SetY(Configuration.getHeight(0)); misFavoritos.AddView(tomar_notas); misFavoritos.AddView(favorit_); linearScroll.AddView(misFavoritos); //FIN FAVoritos----------------------------------------------------------- linearScroll.AddView(descriptionLayout); linearScroll.AddView(separationLinear); listFrontPager.Add(front); var currentpage = s_listp [j].PagesList [k]; for (int m = 1; m < slides.Count; m++) { LOSlideSource slidesource = new LOSlideSource(this); var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id; is_main = !is_main; slidesource.ColorS = Configuration.ListaColores [indice % 6]; slidesource.Type = slides [m].lotype; if (slides [m].lotitle != null) { slidesource.Title = slides [m].lotitle; } if (slides [m].loparagraph != null) { slidesource.Paragraph = slides [m].loparagraph; } if (slides [m].loimage != null) { slidesource.ImageUrl = slides [m].loimage; } if (slides [m].lotext != null) { slidesource.Paragraph = slides [m].lotext; } if (slides [m].loauthor != null) { slidesource.Author = slides [m].loauthor; } if (slides [m].lovideo != null) { slidesource.VideoUrl = slides [m].lovideo; } var c_slide = slides [m]; if (c_slide.loitemize != null) { slidesource.Itemize = new ObservableCollection <LOItemSource> (); var items = c_slide.loitemize.loitem; for (int n = 0; n < items.Count; n++) { LOItemSource item = new LOItemSource(); if (items [n].loimage != null) { item.ImageUrl = items [n].loimage; } if (items [n].lotext != null) { item.Text = items [n].lotext; } var c_item_ize = items [n]; slidesource.Itemize.Add(item); } } slidesource.title_page = front.Title; linearScroll.AddView(slidesource.getViewSlide()); //Toda la info menos la descripcion } scrollPager.VerticalScrollBarEnabled = false; if (k == 0) { scrollPager.AddView(linearScroll); listaScroll.Add(scrollPager); indice++; } // } } //} } else { Console.WriteLine("ERROR"); } mainLayoutPages.RemoveAllViews(); mainLayoutPages.AddView(viewPager); mainLayoutPages.SetX(0); mainLayoutPages.SetY(0); _mainLayout.AddView(mainLayoutPages); _publicidadLayout = new LinearLayout(this); _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85)); Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg")); _publicidadLayout.SetBackgroundDrawable(drp); _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)); } }; LOViewAdapter adapter = new LOViewAdapter(this, listaScroll); viewPager.Adapter = adapter; //viewPager.CurrentItem = IndiceSection; //viewPager.SetCurrentItem (vm._currentSection, true); }
void Vm_LOsInCircle_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { //loadLOsInCircle (e.NewStartingIndex); if (e.NewItems != null) { int i = 0; foreach (LOViewModel.lo_by_circle_wrapper lobycircle in e.NewItems) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this); scrollPager.setOnScrollViewListener(this); LinearLayout linearScroll = new LinearLayout(this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearScroll.Orientation = Orientation.Vertical; // if(Configuration.IndiceActual==i){ FrontContainerView front = new FrontContainerView(this); front.Tag = "indice"; front.Author = lobycircle.lo.name + " " + vm.LOsInCircle [i].lo.lastname; front.Chapter = lobycircle.lo.description; front.NameLO = lobycircle.lo.title; front.Like = "10"; front.ImageChapter = lobycircle.lo.url_background; listFront.Add(front); listFront [i].setBack(drBack, bmLike); lobycircle.PropertyChanged += (s1, e1) => { if (e1.PropertyName == "background_bytes") { front.ImageChapter = lobycircle.lo.url_background; } }; linearScroll.AddView(front); if (lobycircle.stack.IsLoaded) { var s_list = lobycircle.stack.StacksList; int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { ChapterContainerView section = new ChapterContainerView(this); section.Author = lobycircle.lo.name + " " + lobycircle.lo.lastname; section.Title = s_list [j].PagesList [k].page.title; section.Container = s_list [j].PagesList [k].page.description; section.ColorText = Configuration.ListaColores [indice % 6]; section.setDefaultProfileUserBitmap(bm_user); section.Image = s_list [j].PagesList [k].page.url_img; section.Indice = indice; section.Click += delegate { IndiceSection = section.Indice; mainLayoutIndice.Visibility = ViewStates.Invisible; if (ISLOADED == false) { LoadPagesDataSource(); } else { viewPager.CurrentItem = IndiceSection; mainLayoutPages.Visibility = ViewStates.Visible; mainLayoutIndice.Visibility = ViewStates.Invisible; } }; linearScroll.AddView(section); indice++; } } } scrollPager.VerticalScrollBarEnabled = false; scrollPager.AddView(linearScroll); listaScrollIni.Add(scrollPager); i++; } mainLayoutIndice.RemoveAllViews(); //_progresD.Hide (); mainLayoutIndice.AddView(viewPagerIni); mainLayoutIndice.SetX(0); mainLayoutIndice.SetY(0); //mainLayout.AddView (mainLayoutIndice); LOViewAdapter adapter = new LOViewAdapter(this, listaScrollIni); viewPagerIni.Adapter = adapter; } }
void loadLOsInCircle(int index) { //var vm = this.ViewModel as LOViewModel; if (vm.LOsInCircle != null) { for (int i = 0; i < vm.LOsInCircle.Count; i++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this); scrollPager.setOnScrollViewListener(this); LinearLayout linearScroll = new LinearLayout(this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearScroll.Orientation = Orientation.Vertical; // if(Configuration.IndiceActual==i){ FrontContainerView front = new FrontContainerView(this); front.Tag = "indice"; front.Author = vm.LOsInCircle [i].lo.name + " " + vm.LOsInCircle [i].lo.lastname; front.Chapter = vm.LOsInCircle [i].lo.description; front.NameLO = vm.LOsInCircle [i].lo.title; front.Like = "10"; front.ImageChapter = vm.LOsInCircle [i].lo.url_background; listFront.Add(front); listFront [i].setBack(drBack, bmLike); /* * if (vm.LOsInCircle [i].background_bytes != null) { * Bitmap bm = BitmapFactory.DecodeByteArray (vm.LOsInCircle [i].background_bytes, 0, vm.LOsInCircle [i].background_bytes.Length); * * front.ImageChapterBitmap = bm; * bm = null; * } */ vm.LOsInCircle[i].PropertyChanged += (s1, e1) => { if (e1.PropertyName == "background_bytes") { /* * Bitmap bm = BitmapFactory.DecodeByteArray (vm.LOsInCircle [i].background_bytes, 0, vm.LOsInCircle [i].background_bytes.Length); * front.ImageChapterBitmap = bm; * bm = null; */ front.ImageChapter = vm.LOsInCircle [i].lo.url_background; } }; linearScroll.AddView(front); if (vm.LOsInCircle [i].stack.IsLoaded) { var s_list = vm.LOsInCircle [i].stack.StacksList; int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { ChapterContainerView section = new ChapterContainerView(this); section.Author = vm.LOsInCircle [i].lo.name + " " + vm.LOsInCircle [i].lo.lastname; section.Title = s_list [j].PagesList [k].page.title; section.Container = s_list [j].PagesList [k].page.description; section.ColorText = Configuration.ListaColores [indice % 6]; section.setDefaultProfileUserBitmap(bm_user); section.Image = s_list [j].PagesList [k].page.url_img; /* * if (s_list [j].PagesList [k].cover_bytes != null) { * Bitmap bm = BitmapFactory.DecodeByteArray (s_list [j].PagesList [k].cover_bytes, 0, s_list [j].PagesList[k].cover_bytes.Length); * section.ImageBitmap = bm; * bm = null; * } */ section.Indice = indice; section.Click += delegate { IndiceSection = section.Indice; mainLayoutIndice.Visibility = ViewStates.Invisible; if (ISLOADED == false) { LoadPagesDataSource(); } else { viewPager.CurrentItem = IndiceSection; mainLayoutPages.Visibility = ViewStates.Visible; mainLayoutIndice.Visibility = ViewStates.Invisible; } }; linearScroll.AddView(section); indice++; } } } else { vm.LOsInCircle [i].stack.PropertyChanged += (s3, e3) => { var s_list = vm.LOsInCircle [i].stack.StacksList; int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { ChapterContainerView section = new ChapterContainerView(this); section.Author = vm.LOsInCircle [i].lo.name + " " + vm.LOsInCircle [i].lo.lastname; section.Title = s_list [j].PagesList [k].page.title; section.Container = s_list [j].PagesList [k].page.description; section.ColorText = Configuration.ListaColores [indice % 6]; section.setDefaultProfileUserBitmap(bm_user); section.Image = s_list [j].PagesList [k].page.url_img; section.Indice = indice; section.Click += delegate { IndiceSection = section.Indice; mainLayoutIndice.Visibility = ViewStates.Invisible; if (ISLOADED == false) { LoadPagesDataSource(); } else { viewPager.CurrentItem = IndiceSection; mainLayoutPages.Visibility = ViewStates.Visible; mainLayoutIndice.Visibility = ViewStates.Invisible; } }; linearScroll.AddView(section); indice++; } } }; } scrollPager.VerticalScrollBarEnabled = false; scrollPager.AddView(linearScroll); listaScrollIni.Add(scrollPager); } mainLayoutIndice.RemoveAllViews(); //_progresD.Hide (); mainLayoutIndice.AddView(viewPagerIni); mainLayoutIndice.SetX(0); mainLayoutIndice.SetY(0); //mainLayout.AddView (mainLayoutIndice); LOViewAdapter adapter = new LOViewAdapter(this, listaScrollIni); viewPagerIni.Adapter = adapter; //viewPager.CurrentItem = IndiceSection; } }
void loadLOsInCircle(int index){ //var vm = this.ViewModel as LOViewModel; if (vm.LOsInCircle != null) { for (int i = 0; i < vm.LOsInCircle.Count; i++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager (this); scrollPager.setOnScrollViewListener (this); LinearLayout linearScroll = new LinearLayout (this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearScroll.Orientation = Orientation.Vertical; // if(Configuration.IndiceActual==i){ FrontContainerView front = new FrontContainerView (this); front.Tag = "indice"; front.Author = vm.LOsInCircle [i].lo.name + " " + vm.LOsInCircle [i].lo.lastname; front.Chapter = vm.LOsInCircle [i].lo.description; front.NameLO = vm.LOsInCircle [i].lo.title; front.Like = "10"; front.ImageChapter = vm.LOsInCircle [i].lo.url_background; listFront.Add (front); listFront [i].setBack (drBack,bmLike); /* if (vm.LOsInCircle [i].background_bytes != null) { Bitmap bm = BitmapFactory.DecodeByteArray (vm.LOsInCircle [i].background_bytes, 0, vm.LOsInCircle [i].background_bytes.Length); front.ImageChapterBitmap = bm; bm = null; } */ vm.LOsInCircle[i].PropertyChanged += (s1, e1) => { if (e1.PropertyName == "background_bytes") { /* Bitmap bm = BitmapFactory.DecodeByteArray (vm.LOsInCircle [i].background_bytes, 0, vm.LOsInCircle [i].background_bytes.Length); front.ImageChapterBitmap = bm; bm = null; */ front.ImageChapter = vm.LOsInCircle [i].lo.url_background; } }; linearScroll.AddView (front); if (vm.LOsInCircle [i].stack.IsLoaded) { var s_list = vm.LOsInCircle [i].stack.StacksList; int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { ChapterContainerView section = new ChapterContainerView (this); section.Author = vm.LOsInCircle [i].lo.name + " " + vm.LOsInCircle [i].lo.lastname; section.Title = s_list [j].PagesList [k].page.title; section.Container = s_list [j].PagesList [k].page.description; section.ColorText = Configuration.ListaColores [indice % 6]; section.setDefaultProfileUserBitmap (bm_user); section.Image = s_list [j].PagesList [k].page.url_img; /* if (s_list [j].PagesList [k].cover_bytes != null) { Bitmap bm = BitmapFactory.DecodeByteArray (s_list [j].PagesList [k].cover_bytes, 0, s_list [j].PagesList[k].cover_bytes.Length); section.ImageBitmap = bm; bm = null; } */ section.Indice = indice; section.Click += delegate { IndiceSection = section.Indice; mainLayoutIndice.Visibility = ViewStates.Invisible; if (ISLOADED == false) { LoadPagesDataSource(); } else { viewPager.CurrentItem= IndiceSection; mainLayoutPages.Visibility = ViewStates.Visible; mainLayoutIndice.Visibility = ViewStates.Invisible; } }; linearScroll.AddView (section); indice++; } } } else { vm.LOsInCircle [i].stack.PropertyChanged+= (s3, e3) => { var s_list = vm.LOsInCircle [i].stack.StacksList; int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { ChapterContainerView section = new ChapterContainerView (this); section.Author = vm.LOsInCircle [i].lo.name + " " + vm.LOsInCircle [i].lo.lastname; section.Title = s_list [j].PagesList [k].page.title; section.Container = s_list [j].PagesList [k].page.description; section.ColorText = Configuration.ListaColores [indice % 6]; section.setDefaultProfileUserBitmap (bm_user); section.Image = s_list [j].PagesList [k].page.url_img; section.Indice = indice; section.Click += delegate { IndiceSection = section.Indice; mainLayoutIndice.Visibility = ViewStates.Invisible; if (ISLOADED == false) { LoadPagesDataSource(); } else { viewPager.CurrentItem= IndiceSection; mainLayoutPages.Visibility = ViewStates.Visible; mainLayoutIndice.Visibility = ViewStates.Invisible; } }; linearScroll.AddView (section); indice++; } } }; } scrollPager.VerticalScrollBarEnabled = false; scrollPager.AddView (linearScroll); listaScrollIni.Add (scrollPager); } mainLayoutIndice.RemoveAllViews (); //_progresD.Hide (); mainLayoutIndice.AddView (viewPagerIni); mainLayoutIndice.SetX (0); mainLayoutIndice.SetY (0); //mainLayout.AddView (mainLayoutIndice); LOViewAdapter adapter = new LOViewAdapter (this, listaScrollIni); viewPagerIni.Adapter = adapter; //viewPager.CurrentItem = IndiceSection; } }
void LoadPagesDataSource() { //LOViewModel vm = ViewModel as LOViewModel; //var styles = new StyleConstants(); //vm.IsLoading.Execute(null); bool is_main = true; int space = Configuration.getWidth (30); // for (int i = 0; i < 3; i++) // { var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList; int indice = 0; if (s_listp != null) { for (int j = 0; j < s_listp.Count; j++) { for (int k = 0; k < s_listp [j].PagesList.Count; k++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager (this); scrollPager.setOnScrollViewListener (this); LinearLayout linearScroll = new LinearLayout (this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearScroll.Orientation = Orientation.Vertical; var content = s_listp [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager (this); front.Tag = "pager"; front.ImageChapter = s_listp [j].PagesList [k].page.url_img; front.Title = s_listp [j].PagesList [k].page.title; front.Description = s_listp [j].PagesList [k].page.description; var slides = s_listp [j].PagesList [k].content.lopage.loslide; front.setBack (drBack); linearScroll.AddView (front); LinearLayout descriptionLayout = new LinearLayout (this); descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); descriptionLayout.Orientation = Orientation.Vertical; int padW = Configuration.getWidth(30); int padH = Configuration.getHeight (30); descriptionLayout.SetPadding (padW, 0, padW, 0); TextView titulo_detalle = new TextView (this); titulo_detalle.Text = "Descripción"; titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf"); titulo_detalle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38)); titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6])); descriptionLayout.AddView (titulo_detalle); TextView detalle = new TextView (this); detalle.TextFormatted = Html.FromHtml (slides[0].loparagraph); detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf"); detalle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32)); descriptionLayout.AddView (detalle); ViewTreeObserver vto = detalle.ViewTreeObserver; int H = 0; vto.GlobalLayout += (sender, args) => { H = detalle.Height; detalle.LayoutParameters.Height = H - Configuration.getHeight (50); }; LinearLayout separationLinear = new LinearLayout (this); separationLinear.LayoutParameters = new LinearLayout.LayoutParams (-1, 5); separationLinear.SetBackgroundColor (Color.ParseColor ("#D8D8D8")); separationLinear.Orientation = Orientation.Horizontal; linearScroll.AddView (descriptionLayout); linearScroll.AddView (separationLinear); separationLinear.SetPadding (0,padH,0,padH); listFrontPager.Add (front); var currentpage = s_listp [j].PagesList [k]; for (int m = 1; m < slides.Count; m++) { LOSlideSource slidesource = new LOSlideSource (this); var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id; is_main = !is_main; slidesource.ColorS = Configuration.ListaColores [indice % 6]; slidesource.Type = slides [m].lotype; if (slides [m].lotitle != null) slidesource.Title = slides [m].lotitle; if (slides [m].loparagraph != null) slidesource.Paragraph = slides [m].loparagraph; if (slides [m].loimage != null) slidesource.ImageUrl = slides [m].loimage; if (slides [m].lotext != null) slidesource.Paragraph = slides [m].lotext; if (slides [m].loauthor != null) slidesource.Author = slides [m].loauthor; if (slides [m].lovideo != null) slidesource.VideoUrl = slides [m].lovideo; var c_slide = slides [m]; if (c_slide.loitemize != null) { slidesource.Itemize = new ObservableCollection<LOItemSource> (); var items = c_slide.loitemize.loitem; for (int n = 0; n < items.Count; n++) { LOItemSource item = new LOItemSource (); if (items [n].loimage != null) item.ImageUrl = items [n].loimage; if (items [n].lotext != null) item.Text = items [n].lotext; var c_item_ize = items [n]; slidesource.Itemize.Add (item); } } linearScroll.AddView (slidesource.getViewSlide ()); } //linearScroll.SetPadding (padW,padH,padW,padH); scrollPager.VerticalScrollBarEnabled = false; if (k == 0) { scrollPager.AddView (linearScroll); listaScroll.Add (scrollPager); indice++; } } } } else { Console.WriteLine ("ERROR"); } // } mainLayoutPages.RemoveAllViews (); //_progresD.Hide (); mainLayoutPages.AddView (viewPager); mainLayoutPages.SetX (0); mainLayoutPages.SetY (0); _mainLayout.AddView (mainLayoutPages); _publicidadLayout = new LinearLayout (this); _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (85)); Drawable drp = new BitmapDrawable (getBitmapFromAsset ("images/footerad.jpg")); _publicidadLayout.SetBackgroundDrawable (drp); _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)); } }; LOViewAdapter adapter = new LOViewAdapter (this, listaScroll); viewPager.Adapter = adapter; //viewPager.CurrentItem = IndiceSection; viewPager.SetCurrentItem (vm._currentSection, true); }
void Vm_LOsInCircle_CollectionChanged (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { //loadLOsInCircle (e.NewStartingIndex); if (e.NewItems != null) { int i = 0; foreach (LOViewModel.lo_by_circle_wrapper lobycircle in e.NewItems) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager (this); scrollPager.setOnScrollViewListener (this); LinearLayout linearScroll = new LinearLayout (this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearScroll.Orientation = Orientation.Vertical; // if(Configuration.IndiceActual==i){ FrontContainerView front = new FrontContainerView (this); front.Tag = "indice"; front.Author = lobycircle.lo.name + " " + vm.LOsInCircle [i].lo.lastname; front.Chapter = lobycircle.lo.description; front.NameLO = lobycircle.lo.title; front.Like = "10"; front.ImageChapter = lobycircle.lo.url_background; listFront.Add (front); listFront [i].setBack (drBack,bmLike); lobycircle.PropertyChanged += (s1, e1) => { if (e1.PropertyName == "background_bytes") { front.ImageChapter = lobycircle.lo.url_background; } }; linearScroll.AddView (front); if (lobycircle.stack.IsLoaded) { var s_list = lobycircle.stack.StacksList; int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { ChapterContainerView section = new ChapterContainerView (this); section.Author = lobycircle.lo.name + " " + lobycircle.lo.lastname; section.Title = s_list [j].PagesList [k].page.title; section.Container = s_list [j].PagesList [k].page.description; section.ColorText = Configuration.ListaColores [indice % 6]; section.setDefaultProfileUserBitmap (bm_user); section.Image = s_list [j].PagesList [k].page.url_img; section.Indice = indice; section.Click += delegate { IndiceSection = section.Indice; mainLayoutIndice.Visibility = ViewStates.Invisible; if (ISLOADED == false) { LoadPagesDataSource(); } else { viewPager.CurrentItem= IndiceSection; mainLayoutPages.Visibility = ViewStates.Visible; mainLayoutIndice.Visibility = ViewStates.Invisible; } }; linearScroll.AddView (section); indice++; } } } scrollPager.VerticalScrollBarEnabled = false; scrollPager.AddView (linearScroll); listaScrollIni.Add (scrollPager); i++; } mainLayoutIndice.RemoveAllViews (); //_progresD.Hide (); mainLayoutIndice.AddView (viewPagerIni); mainLayoutIndice.SetX (0); mainLayoutIndice.SetY (0); //mainLayout.AddView (mainLayoutIndice); LOViewAdapter adapter = new LOViewAdapter (this, listaScrollIni); viewPagerIni.Adapter = adapter; } }
void LoadPagesDataSource() { //LOViewModel vm = ViewModel as LOViewModel; //var styles = new StyleConstants(); //vm.IsLoading.Execute(null); bool is_main = true; int space = Configuration.getWidth(30); // for (int i = 0; i < 3; i++) // { var s_listp = vm.LOsInCircle[vm._currentUnidad].stack.StacksList; int indice = 0; if (s_listp != null) { for (int j = 0; j < s_listp.Count; j++) { for (int k = 0; k < s_listp [j].PagesList.Count; k++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this); scrollPager.setOnScrollViewListener(this); LinearLayout linearScroll = new LinearLayout(this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearScroll.Orientation = Orientation.Vertical; var content = s_listp [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager(this); front.Tag = "pager"; front.ImageChapter = s_listp [j].PagesList [k].page.url_img; front.Title = s_listp [j].PagesList [k].page.title; front.Description = s_listp [j].PagesList [k].page.description; var slides = s_listp [j].PagesList [k].content.lopage.loslide; front.setBack(drBack); linearScroll.AddView(front); LinearLayout descriptionLayout = new LinearLayout(this); descriptionLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); descriptionLayout.Orientation = Orientation.Vertical; int padW = Configuration.getWidth(30); int padH = Configuration.getHeight(30); descriptionLayout.SetPadding(padW, 0, padW, 0); TextView titulo_detalle = new TextView(this); titulo_detalle.Text = "Descripción"; titulo_detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf"); titulo_detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38)); titulo_detalle.SetTextColor(Color.ParseColor(Configuration.ListaColores [indice % 6])); descriptionLayout.AddView(titulo_detalle); TextView detalle = new TextView(this); detalle.TextFormatted = Html.FromHtml(slides[0].loparagraph); detalle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/ArcherMediumPro.otf"); detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32)); descriptionLayout.AddView(detalle); ViewTreeObserver vto = detalle.ViewTreeObserver; int H = 0; vto.GlobalLayout += (sender, args) => { H = detalle.Height; detalle.LayoutParameters.Height = H - Configuration.getHeight(50); }; LinearLayout separationLinear = new LinearLayout(this); separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5); separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8")); separationLinear.Orientation = Orientation.Horizontal; linearScroll.AddView(descriptionLayout); linearScroll.AddView(separationLinear); separationLinear.SetPadding(0, padH, 0, padH); listFrontPager.Add(front); var currentpage = s_listp [j].PagesList [k]; for (int m = 1; m < slides.Count; m++) { LOSlideSource slidesource = new LOSlideSource(this); var _id_ = vm.LOsInCircle [vm._currentUnidad].lo.color_id; is_main = !is_main; slidesource.ColorS = Configuration.ListaColores [indice % 6]; slidesource.Type = slides [m].lotype; if (slides [m].lotitle != null) { slidesource.Title = slides [m].lotitle; } if (slides [m].loparagraph != null) { slidesource.Paragraph = slides [m].loparagraph; } if (slides [m].loimage != null) { slidesource.ImageUrl = slides [m].loimage; } if (slides [m].lotext != null) { slidesource.Paragraph = slides [m].lotext; } if (slides [m].loauthor != null) { slidesource.Author = slides [m].loauthor; } if (slides [m].lovideo != null) { slidesource.VideoUrl = slides [m].lovideo; } var c_slide = slides [m]; if (c_slide.loitemize != null) { slidesource.Itemize = new ObservableCollection <LOItemSource> (); var items = c_slide.loitemize.loitem; for (int n = 0; n < items.Count; n++) { LOItemSource item = new LOItemSource(); if (items [n].loimage != null) { item.ImageUrl = items [n].loimage; } if (items [n].lotext != null) { item.Text = items [n].lotext; } var c_item_ize = items [n]; slidesource.Itemize.Add(item); } } linearScroll.AddView(slidesource.getViewSlide()); } //linearScroll.SetPadding (padW,padH,padW,padH); scrollPager.VerticalScrollBarEnabled = false; if (k == 0) { scrollPager.AddView(linearScroll); listaScroll.Add(scrollPager); indice++; } } } } else { Console.WriteLine("ERROR"); } // } mainLayoutPages.RemoveAllViews(); //_progresD.Hide (); mainLayoutPages.AddView(viewPager); mainLayoutPages.SetX(0); mainLayoutPages.SetY(0); _mainLayout.AddView(mainLayoutPages); _publicidadLayout = new LinearLayout(this); _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85)); Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg")); _publicidadLayout.SetBackgroundDrawable(drp); _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)); } }; LOViewAdapter adapter = new LOViewAdapter(this, listaScroll); viewPager.Adapter = adapter; //viewPager.CurrentItem = IndiceSection; viewPager.SetCurrentItem(vm._currentSection, true); }
void LoadPagesDataSource() { //LOViewModel vm = ViewModel as LOViewModel; //var styles = new StyleConstants(); //vm.IsLoading.Execute(null); bool is_main = true; for (int i = 0; i < vm.LOsInCircle.Count; i++) { var s_list = vm.LOsInCircle[i].stack.StacksList; //if (Configuration.IndiceActual == i) { int indice = 0; for (int j = 0; j < s_list.Count; j++) { for (int k = 0; k < s_list [j].PagesList.Count; k++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager (this); scrollPager.setOnScrollViewListener (this); LinearLayout linearScroll = new LinearLayout (this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearScroll.Orientation = Orientation.Vertical; //LOPageSource page = new LOPageSource(); var content = s_list [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager (this); front.Tag = "pager"; //front.ImageChapter = vm.LOsInCircle [i].lo.url_background; front.ImageChapter = s_list [j].PagesList[k].page.url_img; /* Bitmap bm = BitmapFactory.DecodeByteArray (s_list [j].PagesList [k].cover_bytes, 0, s_list [j].PagesList [k].cover_bytes.Length); front.ImageChapterBitmap = bm; bm = null; */ front.Title = s_list [j].PagesList [k].page.title; front.Description = s_list [j].PagesList [k].page.description; var slides = s_list [j].PagesList [k].content.lopage.loslide; front.setBack (drBack); //revisar si slides == null; //vm.OpenPageCommand.Execute (s_list [j].PagesList [k]); //var slides2 = s_list [j].PagesList [k].content.lopage.loslide. linearScroll.AddView (front); listFrontPager.Add (front); //listFrontPager [i].setBack (drBack); //vm.OpenPageCommand.Execute(s_list[j].PagesList[k]); var currentpage = s_list [j].PagesList [k]; //var pagerr = s_list[j].PagesList[k].content.lopage.loslide for (int m = 1; m < slides.Count; m++) { LOSlideSource slidesource = new LOSlideSource(this); var _id_ = vm.LOsInCircle [i].lo.color_id; is_main = !is_main; //Console.WriteLine ("TIPOOOOOOOOOO = " + slides [m].lotype); slidesource.ColorS = Configuration.ListaColores [indice % 6]; slidesource.Type = slides[m].lotype; if (slides[m].lotitle != null) slidesource.Title = slides[m].lotitle; if (slides[m].loparagraph != null) slidesource.Paragraph = slides[m].loparagraph; if (slides[m].loimage != null) slidesource.ImageUrl = slides[m].loimage; if (slides[m].lotext != null) slidesource.Paragraph = slides[m].lotext; if (slides[m].loauthor != null) slidesource.Author = slides[m].loauthor; if (slides[m].lovideo != null) slidesource.VideoUrl = slides[m].lovideo; //if (slides[m].image_bytes != null) slidesource.ImageBytes = slides[m].image_bytes; var c_slide = slides[m]; /* c_slide.PropertyChanged+=(s,e)=>{ if (e.PropertyName == "image_bytes" && c_slide.image_bytes != null) slidesource.ImageBytes = c_slide.image_bytes; }; */ if (c_slide.loitemize != null){ slidesource.Itemize = new ObservableCollection<LOItemSource>(); var items = c_slide.loitemize.loitem; for (int n = 0; n < items.Count; n++){ LOItemSource item = new LOItemSource(); if (items[n].loimage != null) item.ImageUrl = items[n].loimage; if (items[n].lotext!= null) item.Text = items[n].lotext; //imagebytes //if (items[n].image_bytes != null) item.ImageBytes = items[n].image_bytes; var c_item_ize = items[n]; /* c_item_ize.PropertyChanged += (s1, e1) =>{ if (e1.PropertyName == "image_bytes" && c_item_ize.image_bytes != null) item.ImageBytes = c_item_ize.image_bytes; }; */ slidesource.Itemize.Add(item); } } linearScroll.AddView (slidesource.getViewSlide()); } scrollPager.VerticalScrollBarEnabled = false; scrollPager.AddView (linearScroll); listaScroll.Add (scrollPager); indice++; } //} } //} } mainLayoutPages.RemoveAllViews (); //_progresD.Hide (); mainLayoutPages.AddView (viewPager); mainLayoutPages.SetX (0); mainLayoutPages.SetY (0); mainLayout.AddView (mainLayoutPages); LOViewAdapter adapter = new LOViewAdapter (this, listaScroll); viewPager.Adapter = adapter; viewPager.CurrentItem = IndiceSection; }
void LoadPagesDataSource() { //LOViewModel vm = ViewModel as LOViewModel; //var styles = new StyleConstants(); //vm.IsLoading.Execute(null); bool is_main = true; for (int i = 0; i < vm.LOsInCircle.Count; i++) { var s_listp = vm.LOsInCircle[i].stack.StacksList; int indice = 0; if (s_listp != null) { for (int j = 0; j < s_listp.Count; j++) { for (int k = 0; k < s_listp [j].PagesList.Count; k++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager(this); scrollPager.setOnScrollViewListener(this); LinearLayout linearScroll = new LinearLayout(this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearScroll.Orientation = Orientation.Vertical; var content = s_listp [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager(this); front.Tag = "pager"; front.ImageChapter = s_listp [j].PagesList [k].page.url_img; front.Title = s_listp [j].PagesList [k].page.title; front.Description = s_listp [j].PagesList [k].page.description; var slides = s_listp [j].PagesList [k].content.lopage.loslide; front.setBack(drBack); linearScroll.AddView(front); listFrontPager.Add(front); var currentpage = s_listp [j].PagesList [k]; for (int m = 1; m < slides.Count; m++) { LOSlideSource slidesource = new LOSlideSource(this); var _id_ = vm.LOsInCircle [i].lo.color_id; is_main = !is_main; slidesource.ColorS = Configuration.ListaColores [indice % 6]; slidesource.Type = slides [m].lotype; if (slides [m].lotitle != null) { slidesource.Title = slides [m].lotitle; } if (slides [m].loparagraph != null) { slidesource.Paragraph = slides [m].loparagraph; } if (slides [m].loimage != null) { slidesource.ImageUrl = slides [m].loimage; } if (slides [m].lotext != null) { slidesource.Paragraph = slides [m].lotext; } if (slides [m].loauthor != null) { slidesource.Author = slides [m].loauthor; } if (slides [m].lovideo != null) { slidesource.VideoUrl = slides [m].lovideo; } var c_slide = slides [m]; if (c_slide.loitemize != null) { slidesource.Itemize = new ObservableCollection <LOItemSource> (); var items = c_slide.loitemize.loitem; for (int n = 0; n < items.Count; n++) { LOItemSource item = new LOItemSource(); if (items [n].loimage != null) { item.ImageUrl = items [n].loimage; } if (items [n].lotext != null) { item.Text = items [n].lotext; } var c_item_ize = items [n]; slidesource.Itemize.Add(item); } } linearScroll.AddView(slidesource.getViewSlide()); } scrollPager.VerticalScrollBarEnabled = false; if (k == 0) { scrollPager.AddView(linearScroll); listaScroll.Add(scrollPager); indice++; } } } } else { Console.WriteLine("ERROR"); } } mainLayoutPages.RemoveAllViews(); //_progresD.Hide (); mainLayoutPages.AddView(viewPager); mainLayoutPages.SetX(0); mainLayoutPages.SetY(0); _mainLayout.AddView(mainLayoutPages); LOViewAdapter adapter = new LOViewAdapter(this, listaScroll); viewPager.Adapter = adapter; viewPager.CurrentItem = IndiceSection; }
void LoadPagesDataSource() { //LOViewModel vm = ViewModel as LOViewModel; //var styles = new StyleConstants(); //vm.IsLoading.Execute(null); bool is_main = true; for (int i = 0; i < vm.LOsInCircle.Count; i++) { var s_listp = vm.LOsInCircle[i].stack.StacksList; int indice = 0; if (s_listp != null) { for (int j = 0; j < s_listp.Count; j++) { for (int k = 0; k < s_listp [j].PagesList.Count; k++) { VerticalScrollViewPager scrollPager = new VerticalScrollViewPager (this); scrollPager.setOnScrollViewListener (this); LinearLayout linearScroll = new LinearLayout (this); linearScroll.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearScroll.Orientation = Orientation.Vertical; var content = s_listp [j].PagesList [k].content; FrontContainerViewPager front = new FrontContainerViewPager (this); front.Tag = "pager"; front.ImageChapter = s_listp [j].PagesList [k].page.url_img; front.Title = s_listp [j].PagesList [k].page.title; front.Description = s_listp [j].PagesList [k].page.description; var slides = s_listp [j].PagesList [k].content.lopage.loslide; front.setBack (drBack); linearScroll.AddView (front); listFrontPager.Add (front); var currentpage = s_listp [j].PagesList [k]; for (int m = 1; m < slides.Count; m++) { LOSlideSource slidesource = new LOSlideSource (this); var _id_ = vm.LOsInCircle [i].lo.color_id; is_main = !is_main; slidesource.ColorS = Configuration.ListaColores [indice % 6]; slidesource.Type = slides [m].lotype; if (slides [m].lotitle != null) slidesource.Title = slides [m].lotitle; if (slides [m].loparagraph != null) slidesource.Paragraph = slides [m].loparagraph; if (slides [m].loimage != null) slidesource.ImageUrl = slides [m].loimage; if (slides [m].lotext != null) slidesource.Paragraph = slides [m].lotext; if (slides [m].loauthor != null) slidesource.Author = slides [m].loauthor; if (slides [m].lovideo != null) slidesource.VideoUrl = slides [m].lovideo; var c_slide = slides [m]; if (c_slide.loitemize != null) { slidesource.Itemize = new ObservableCollection<LOItemSource> (); var items = c_slide.loitemize.loitem; for (int n = 0; n < items.Count; n++) { LOItemSource item = new LOItemSource (); if (items [n].loimage != null) item.ImageUrl = items [n].loimage; if (items [n].lotext != null) item.Text = items [n].lotext; var c_item_ize = items [n]; slidesource.Itemize.Add (item); } } linearScroll.AddView (slidesource.getViewSlide ()); } scrollPager.VerticalScrollBarEnabled = false; if (k == 0) { scrollPager.AddView (linearScroll); listaScroll.Add (scrollPager); indice++; } } } } else { Console.WriteLine ("ERROR"); } } mainLayoutPages.RemoveAllViews (); //_progresD.Hide (); mainLayoutPages.AddView (viewPager); mainLayoutPages.SetX (0); mainLayoutPages.SetY (0); _mainLayout.AddView (mainLayoutPages); LOViewAdapter adapter = new LOViewAdapter (this, listaScroll); viewPager.Adapter = adapter; viewPager.CurrentItem = IndiceSection; }