public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup)inflater.Inflate(Resource.Layout.layout_main, null); //return base.OnCreateView (inflater, container, savedInstanceState); mFragment4Container = root.FindViewById <FrameLayout> (Resource.Id.layout_contentMain); var btnBoletin = root.FindViewById <Button> (Resource.Id.btnBoletin); var btnTicket = root.FindViewById <Button> (Resource.Id.btnAsesoria); var btnSeguimiento = root.FindViewById <Button> (Resource.Id.btnSeguimiento); Typeface font = Typeface.CreateFromAsset(Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); btnSeguimiento.SetTypeface(font, TypefaceStyle.Normal); btnBoletin.SetTypeface(font, TypefaceStyle.Normal); btnTicket.SetTypeface(font, TypefaceStyle.Normal); var ToolBar = Activity.FindViewById <Android.Support.V7.Widget.Toolbar> (Resource.Id.ToolBar); var ToolBarTitle = Activity.FindViewById <TextView> (Resource.Id.toolbar_title); ToolBar.Visibility = ViewStates.Gone; ToolBar.SetTitle(Resource.String.app_name); news = new NewsFragment(); TicketJuridico = new TicketJuridicoFragment(); seguimiento = new SeguimientoFragment(); mStackFragments = new Stack <SupportFragment>(); var trans = Activity.SupportFragmentManager.BeginTransaction(); trans.Add(mFragment4Container.Id, news, "News"); trans.Add(mFragment4Container.Id, TicketJuridico, "Juridico"); trans.Add(mFragment4Container.Id, seguimiento, "Seguimiento"); trans.Hide(news); trans.Hide(TicketJuridico); trans.Hide(seguimiento); mCurrentFragment = this; trans.Commit(); btnBoletin.Click += (object sender, EventArgs e) => { ToolBar.Visibility = ViewStates.Visible; //ToolBar.SetTitle (Resource.String.boletin); ToolBarTitle.SetText(Resource.String.boletin); Android.Support.V4.App.Fragment fragment = null; fragment = new NewsFragment(); Activity.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.layout_content, fragment).Commit(); }; btnTicket.Click += (object sender, EventArgs e) => { var accounts = AccountStore.Create(root.Context).FindAccountsForService("consumidor"); if (accounts.Count() == 0) { Intent intentRegistro = new Intent(this.Context, typeof(RegisterActivity)); this.Context.StartActivity(intentRegistro); } else { foreach (var account in accounts) { Email = account.Properties ["Email"]; Nombre = account.Properties["FName"]; } ToolBar.Visibility = ViewStates.Visible; ToolBarTitle.SetText(Resource.String.QuejasDenuncias); Android.Support.V4.App.Fragment fragment = null; fragment = new TicketJuridicoFragment(); Activity.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.layout_content, fragment).Commit(); } }; btnSeguimiento.Click += (object sender, EventArgs e) => { ToolBar.Visibility = ViewStates.Visible; ToolBarTitle.SetText(Resource.String.Seguimiento); Android.Support.V4.App.Fragment fragment = null; fragment = new SeguimientoFragment(); Activity.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.layout_content, fragment).Commit(); }; return(root); }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup)inflater.Inflate (Resource.Layout.layout_main,null); //return base.OnCreateView (inflater, container, savedInstanceState); mFragment4Container = root.FindViewById<FrameLayout> (Resource.Id.layout_contentMain); var btnBoletin = root.FindViewById<Button> (Resource.Id.btnBoletin); var btnTicket = root.FindViewById<Button> (Resource.Id.btnAsesoria); var btnSeguimiento = root.FindViewById<Button> (Resource.Id.btnSeguimiento); Typeface font = Typeface.CreateFromAsset (Application.Context.Assets, "Fonts/HelveticaNeue-Thin.otf"); btnSeguimiento.SetTypeface (font, TypefaceStyle.Normal); btnBoletin.SetTypeface (font, TypefaceStyle.Normal); btnTicket.SetTypeface (font, TypefaceStyle.Normal); var ToolBar = Activity.FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.ToolBar); var ToolBarTitle = Activity.FindViewById<TextView> (Resource.Id.toolbar_title); ToolBar.Visibility = ViewStates.Gone; ToolBar.SetTitle (Resource.String.app_name); news = new NewsFragment (); TicketJuridico = new TicketJuridicoFragment (); seguimiento = new SeguimientoFragment (); mStackFragments = new Stack<SupportFragment>(); var trans = Activity.SupportFragmentManager.BeginTransaction (); trans.Add (mFragment4Container.Id, news, "News"); trans.Add (mFragment4Container.Id, TicketJuridico, "Juridico"); trans.Add (mFragment4Container.Id, seguimiento, "Seguimiento"); trans.Hide (news); trans.Hide (TicketJuridico); trans.Hide (seguimiento); mCurrentFragment = this; trans.Commit (); btnBoletin.Click += (object sender, EventArgs e) => { ToolBar.Visibility = ViewStates.Visible; //ToolBar.SetTitle (Resource.String.boletin); ToolBarTitle.SetText (Resource.String.boletin); Android.Support.V4.App.Fragment fragment = null; fragment = new NewsFragment (); Activity.SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_content, fragment).Commit (); }; btnTicket.Click += (object sender, EventArgs e) => { var accounts = AccountStore.Create (root.Context).FindAccountsForService ("consumidor"); if (accounts.Count () == 0) { Intent intentRegistro = new Intent (this.Context, typeof(RegisterActivity)); this.Context.StartActivity (intentRegistro); } else { foreach (var account in accounts) { Email = account.Properties ["Email"]; Nombre = account.Properties["FName"]; } ToolBar.Visibility = ViewStates.Visible; ToolBarTitle.SetText (Resource.String.QuejasDenuncias); Android.Support.V4.App.Fragment fragment = null; fragment = new TicketJuridicoFragment (); Activity.SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_content, fragment).Commit (); } }; btnSeguimiento.Click += (object sender, EventArgs e) => { ToolBar.Visibility = ViewStates.Visible; ToolBarTitle.SetText (Resource.String.Seguimiento); Android.Support.V4.App.Fragment fragment = null; fragment = new SeguimientoFragment(); Activity.SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_content, fragment).Commit (); }; return root; }
public static Android.Support.V4.App.Fragment newInstance(Context context) { NewsFragment news = new NewsFragment(); return(news); }
public static Android.Support.V4.App.Fragment newInstance(Context context) { NewsFragment news = new NewsFragment (); return news; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); string parameterValue = this.Intent.GetStringExtra ("message"); if (!string.IsNullOrEmpty (parameterValue)) { } #region Re-defining Variables _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar); _supporttoolbar.SetTitle(Resource.String.boletin); SetSupportActionBar(_supporttoolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); _supporttoolbar.Visibility = ViewStates.Gone; // _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout); // // _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view); // Button btnBoletin = FindViewById<Button>(Resource.Id.btnBoletin); // Button btnAsesoria = FindViewById<Button>(Resource.Id.btnAsesoria); // Button btnSeguimiento = FindViewById<Button>(Resource.Id.btnSeguimiento); news = new NewsFragment(); tips = new TipsFragment(); ticket = new TicketFragment(); ticketJuridico = new TicketJuridicoFragment(); seguimiento = new SeguimientoFragment(); mStackFragments = new Stack<SupportFragment>(); #endregion Android.Support.V4.App.FragmentTransaction tx = SupportFragmentManager.BeginTransaction(); tx.Add(Resource.Id.layout_content, news); tx.Add(Resource.Id.layout_content, tips); tx.Add (Resource.Id.layout_content, ticket); tx.Add (Resource.Id.layout_content, ticketJuridico); tx.Add (Resource.Id.layout_content, seguimiento); tx.Hide(news); tx.Hide (ticket); tx.Hide (ticketJuridico); tx.Hide (seguimiento); mCurrentFragment = tips; tx.Commit(); _supporttoolbar.Click += (object sender, EventArgs e) => { StartActivity (typeof(MainActivity)); }; #region CommentCode // btnBoletin.Click += (object sender, EventArgs e) => // { // Android.Support.V4.App.Fragment fragment = null; // _supporttoolbar.SetTitle(Resource.String.boletin); // fragment = new NewsFragment (); // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_contentMain, fragment).Commit (); // }; // // btnAsesoria.Click += (object sender, EventArgs e) => // { // Android.Support.V4.App.Fragment fragment = null; // _supporttoolbar.SetTitle(Resource.String.QuejasDenuncias); // fragment = new TicketFragment (); // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_contentMain, fragment).Commit (); // }; // // btnSeguimiento.Click += (object sender, EventArgs e) => // { // Android.Support.V4.App.Fragment fragment = null; // _supporttoolbar.SetTitle(Resource.String.Seguimiento); // fragment = new SeguimientoFragment (); // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_contentMain, fragment).Commit (); // }; // _navigationview.NavigationItemSelected += (sender, e) => { // Android.Support.V4.App.Fragment fragment = null; // switch (e.MenuItem.ItemId) { // case Resource.Id.nav_news: // _supporttoolbar.SetTitle(Resource.String.boletin); // fragment = new NewsFragment (); // break; // case Resource.Id.nav_monedero: // _supporttoolbar.SetTitle(Resource.String.monedero); // fragment = new TipsFragment (); // break; // case Resource.Id.nav_ticket: // _supporttoolbar.SetTitle(Resource.String.QuejasDenuncias); // fragment = new TicketFragment (); // break; // case Resource.Id.nav_ticket_juridico: // _supporttoolbar.SetTitle(Resource.String.Apoyo_Juridico); // fragment = new TicketJuridicoFragment (); // break; // case Resource.Id.nav_seguimiento: // _supporttoolbar.SetTitle(Resource.String.Seguimiento); // fragment = new SeguimientoFragment (); // break; // } // // // // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_content, fragment).Commit (); // _drawer.CloseDrawers (); // // }; #endregion }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); string parameterValue = this.Intent.GetStringExtra("message"); if (!string.IsNullOrEmpty(parameterValue)) { } #region Re-defining Variables _supporttoolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar); _supporttoolbar.SetTitle(Resource.String.boletin); SetSupportActionBar(_supporttoolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); _supporttoolbar.Visibility = ViewStates.Gone; // _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout); // // _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view); // Button btnBoletin = FindViewById<Button>(Resource.Id.btnBoletin); // Button btnAsesoria = FindViewById<Button>(Resource.Id.btnAsesoria); // Button btnSeguimiento = FindViewById<Button>(Resource.Id.btnSeguimiento); news = new NewsFragment(); tips = new TipsFragment(); ticket = new TicketFragment(); ticketJuridico = new TicketJuridicoFragment(); seguimiento = new SeguimientoFragment(); mStackFragments = new Stack <SupportFragment>(); #endregion Android.Support.V4.App.FragmentTransaction tx = SupportFragmentManager.BeginTransaction(); tx.Add(Resource.Id.layout_content, news); tx.Add(Resource.Id.layout_content, tips); tx.Add(Resource.Id.layout_content, ticket); tx.Add(Resource.Id.layout_content, ticketJuridico); tx.Add(Resource.Id.layout_content, seguimiento); tx.Hide(news); tx.Hide(ticket); tx.Hide(ticketJuridico); tx.Hide(seguimiento); mCurrentFragment = tips; tx.Commit(); _supporttoolbar.Click += (object sender, EventArgs e) => { StartActivity(typeof(MainActivity)); }; #region CommentCode // btnBoletin.Click += (object sender, EventArgs e) => // { // Android.Support.V4.App.Fragment fragment = null; // _supporttoolbar.SetTitle(Resource.String.boletin); // fragment = new NewsFragment (); // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_contentMain, fragment).Commit (); // }; // // btnAsesoria.Click += (object sender, EventArgs e) => // { // Android.Support.V4.App.Fragment fragment = null; // _supporttoolbar.SetTitle(Resource.String.QuejasDenuncias); // fragment = new TicketFragment (); // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_contentMain, fragment).Commit (); // }; // // btnSeguimiento.Click += (object sender, EventArgs e) => // { // Android.Support.V4.App.Fragment fragment = null; // _supporttoolbar.SetTitle(Resource.String.Seguimiento); // fragment = new SeguimientoFragment (); // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_contentMain, fragment).Commit (); // }; // _navigationview.NavigationItemSelected += (sender, e) => { // Android.Support.V4.App.Fragment fragment = null; // switch (e.MenuItem.ItemId) { // case Resource.Id.nav_news: // _supporttoolbar.SetTitle(Resource.String.boletin); // fragment = new NewsFragment (); // break; // case Resource.Id.nav_monedero: // _supporttoolbar.SetTitle(Resource.String.monedero); // fragment = new TipsFragment (); // break; // case Resource.Id.nav_ticket: // _supporttoolbar.SetTitle(Resource.String.QuejasDenuncias); // fragment = new TicketFragment (); // break; // case Resource.Id.nav_ticket_juridico: // _supporttoolbar.SetTitle(Resource.String.Apoyo_Juridico); // fragment = new TicketJuridicoFragment (); // break; // case Resource.Id.nav_seguimiento: // _supporttoolbar.SetTitle(Resource.String.Seguimiento); // fragment = new SeguimientoFragment (); // break; // } // // // // SupportFragmentManager.BeginTransaction ().Replace (Resource.Id.layout_content, fragment).Commit (); // _drawer.CloseDrawers (); // // }; #endregion }