Esempio n. 1
0
        public HowToRenderer(Context context) : base(context)
        {
            mainActivity = Context as MainActivity;

            _androidLinearLayout = new LinearLayout(Context)
            {
                LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
            };

            _androidAppBarLayout = (AppBarLayout)LayoutInflater.FromContext(context).Inflate(Resource.Layout.Toolbar, null);

            toolbar = (Toolbar)_androidAppBarLayout.FindViewById(Resource.Id.toolbar);
            toolbar.FindViewById <TextView>(Resource.Id.cycles_text).Text = "How To Cycle";
            toolbar.FindViewById <Android.Widget.ImageButton>(Resource.Id.gift_button).Visibility = ViewStates.Invisible;

            _androidLinearLayout.AddView(_androidAppBarLayout);

            _androidAppBarLayout.LayoutParameters =
                new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);

            AddView(_androidLinearLayout);

            mainActivity.SetSupportActionBar(toolbar);
            ActionBar actionBar = mainActivity.SupportActionBar;

            actionBar.SetDisplayHomeAsUpEnabled(true);
            actionBar.Title = "How To Cycle";
            actionBar.SetDisplayShowHomeEnabled(true);
            actionBar.SetDisplayShowTitleEnabled(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Method Name     : FindAlertControl
 /// Author          : Sanket Prajapati
 /// Creation Date   : 23 jan 2018
 /// Purpose         : Set Find Alert control id
 /// Revision        :
 /// </summary>
 private void FindAlertControl()
 {
     toolbar.FindViewById(Resource.Id.item2).Click += delegate
     {
         replaceFragment(new FragmentAlerts(), StringResource.msgAlert, StringResource.msgAlert, 0);
         SetInActiveImageAndColor();
     };
 }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _backButton = toolbar.FindViewById(Resource.Id.button_back);
            _picture    = toolbar.FindViewById <ImageView>(Resource.Id.image_picture);
        }
Esempio n. 4
0
 protected void SetActionBar(string title = "Davinci")
 {
     ToolBar = FindViewById <Toolbar>(Resource.Id.actionBar);
     ToolBar.FindViewById <TextView>(Resource.Id.actionBarTitle).Text = title;
     SetSupportActionBar(ToolBar);
     SupportActionBar.SetDisplayShowTitleEnabled(false);
 }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Preferencias);

            toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            TextView mTitle = (TextView)toolbar.FindViewById(Resource.Id.toolbar_title);

            mTitle.SetText("Editar preferências", TextView.BufferType.Normal);

            listaIngr = Facade.GetIngredientes();
            listaPref = Facade.GetPreferencias();
            ListView listview = FindViewById <ListView>(Resource.Id.listview);

            listview.Adapter    = new HomeScreenAdapter(this, listaIngr, listaPref);
            listview.ItemClick += OnListItemClick;

            selecionados = new List <string>();
            Button            guardarButtom = FindViewById <Button>(Resource.Id.guardar);
            HomeScreenAdapter adapter       = (HomeScreenAdapter)listview.Adapter;

            guardarButtom.Click += (sender, e) => {
                foreach (Model m in adapter.items)
                {
                    if (m.isSelected())
                    {
                        selecionados.Add(m.getName());
                    }
                }

                Facade.EditarPreferencias(selecionados);
                this.Finish();
            };
        }
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            try
            {
                Android.Support.V7.Widget.Toolbar bar = ((Activity)Context).FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

                if (((NavigationPage)sender).CurrentPage is MainPage)
                {
                    bar.FindViewById <ImageView>(Resource.Id.logoImageView).Visibility = ViewStates.Visible;
                }
                else
                {
                    bar.FindViewById <ImageView>(Resource.Id.logoImageView).Visibility = ViewStates.Gone;
                }
            }
            catch { }
        }
Esempio n. 7
0
        public static void UpdateMenuItems(this AToolbar toolbar,
                                           IEnumerable <ToolbarItem> toolbarItems,
                                           Context context,
                                           Color?tintColor,
                                           PropertyChangedEventHandler toolbarItemChanged
                                           )
        {
            if (toolbarItems == null)
            {
                return;
            }

            var menu = toolbar.Menu;

            menu.Clear();

            foreach (var item in toolbarItems)
            {
                item.PropertyChanged -= toolbarItemChanged;
                item.PropertyChanged += toolbarItemChanged;

                using (var title = new Java.Lang.String(item.Text))
                {
                    var menuitem = menu.Add(global::Android.Views.Menu.None, 0, item.Priority, title);
                    menuitem.SetEnabled(item.IsEnabled);
                    menuitem.SetTitleOrContentDescription(item);
                    UpdateMenuItemIcon(context, menuitem, item, tintColor);

                    if (item.Order != ToolbarItemOrder.Secondary)
                    {
                        menuitem.SetShowAsAction(ShowAsAction.Always);
                    }

                    menuitem.SetOnMenuItemClickListener(new GenericMenuClickListener(((IMenuItemController)item).Activate));

                    if (tintColor != null && tintColor != Color.Default)
                    {
                        var view = toolbar.FindViewById(menuitem.ItemId);
                        if (view is ATextView textView)
                        {
                            if (item.IsEnabled)
                            {
                                textView.SetTextColor(tintColor.Value.ToAndroid());
                            }
                            else
                            {
                                textView.SetTextColor(tintColor.Value.MultiplyAlpha(0.302).ToAndroid());
                            }
                        }
                    }

                    menuitem.Dispose();
                }
            }
        }
Esempio n. 8
0
 // <summary>
 /// Method Name      : UIReference
 /// Author          : Sanket Prajapati
 /// Creation Date   : 15 Dec 2017
 /// Purpose         : For find all control
 /// Revision        :
 /// </summary>
 private void UIReference()
 {
     // Find control
     toolbar = FindViewById <Toolbar>(Resource.Id.tool_bar);
     tvTitle = (TextView)toolbar.FindViewById(Resource.Id.toolbar_title);
     SetSupportActionBar(toolbar);
     frameLayout     = FindViewById <FrameLayout>(Resource.Id.framlayInfo);
     frmFloatingMenu = FindViewById <FrameLayout>(Resource.Id.frmFloatingMenu);
     tvCenterClose   = FindViewById <TextView>(Resource.Id.btnCenterClose);
     FindImageView();
     FindLinerLayout();
     FindFloatingActionButton();
     FindViews();
 }
Esempio n. 9
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.Main);
                mToolBar.FindViewById <SupportToolBar>(Resource.Id.toolbar);

                SetSupportActionBar(mToolBar);
            }
            catch (System.Exception ex)
            {
                string temp = "temp";
            }
        }
Esempio n. 10
0
        private void UpdateBottomBar(string tag)
        {
            int resId = 0;

            switch (tag)
            {
            case Tags.SETTINGS:
                //resId = Resource.Menu.menu_bottom_filters;
                //resId = Resource.Menu.menu_bottom_notifications;
                resId = Resource.Menu.menu_bottom_logout;
                break;

            /*case Tags.ODL_FILTERS:
             *      resId = Resource.Menu.menu_bottom_filters;
             *      break;
             * case Tags.ODL_DETAIL:
             *      resId=Resource.Menu.menu_bottom_logout;
             *      break;
             * case Tags.MATERIAL_LIST:
             *      //resId = Resource.Menu.menu_bottom_add;
             *      break;
             * case Tags.COST_LIST:
             *      //resId = Resource.Menu.menu_bottom_add;
             *      break;
             * case Tags.HOUR_LIST:
             *      //resId = Resource.Menu.menu_bottom_add;
             *      break;
             *      case Tags.ACTIVITY_LIST:
             *      //resId = Resource.Menu.menu_bottom_add;
             *      break;*/
            default:
                resId = Resource.Menu.menu_bottom_logout;
                break;
            }

            if (resId != 0)
            {
                _bottomBar.Menu.Clear();
                MenuInflater.Inflate(resId, _bottomBar.Menu);

                View btn = _bottomBar.FindViewById(Resource.Id.logout);

                if (btn != null)
                {
                    btn.Selected = (tag == Tags.LOGOUT);
                }
            }
        }
Esempio n. 11
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignore = base.OnCreateView(inflater, container, savedInstanceState);

            _view = this.BindingInflate(FragmentLayoutId, null);

            _toolbar = _view.FindViewById <Toolbar>(Resource.Id.toolbar);
            if (_toolbar != null && ParentActivity != null)
            {
                ParentActivity.SetSupportActionBar(_toolbar);
                ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                if (ShowHamburgerMenu)
                {
                    _drawerToggle = new MvxActionBarDrawerToggle(
                        ParentActivity,                                 // host Activity
                        (ParentActivity as INavigationActivity).Drawer, // DrawerLayout object
                        _toolbar,                                       // nav drawer icon to replace 'Up' caret
                        Resource.String.drawer_open,                    // "open drawer" description
                        Resource.String.drawer_close                    // "close drawer" description
                        );
                    _drawerToggle.DrawerOpened +=
                        (object sender, ActionBarDrawerEventArgs e) => (ParentActivity as INavigationActivity).HideSoftKeyboard();
                    (ParentActivity as INavigationActivity).Drawer.AddDrawerListener(_drawerToggle);
                }

                if (!string.IsNullOrEmpty(Title))
                {
                    ParentActivity.SupportActionBar.Title = Title;
                }

                ParentActivity.SupportActionBar.SetDisplayShowTitleEnabled(false);
                var titleTextView = (TextView)_toolbar.FindViewById(Resource.Id.toolbar_title);
                if (titleTextView != null)
                {
                    if (!string.IsNullOrEmpty(Title))
                    {
                        titleTextView.Text = Title;
                    }
                }
            }

            return(_view);
        }
Esempio n. 12
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            //toolbar
            Android.Support.V7.Widget.Toolbar toolbar = (Android.Support.V7.Widget.Toolbar)((DashboardActivity)Activity).FindViewById(Resource.Id.toolbar);
            TextView mTitle = (TextView)toolbar.FindViewById(Resource.Id.toolbar_title);

            if (mTitle != null)
            {
                mTitle.Text = "Summary";
            }


            DetailModel detailModel = (FirebaseAppDemo.DetailModel)Arguments.GetSerializable("SomeTag");

            if (detailModel != null)
            {
                onInit(view, detailModel);
            }
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.MyLocationLayout);

            sharedPreferences = this.GetSharedPreferences("sharedprefrences", 0);

            this.AddMapFragmentToLayout(Resource.Id.map_container);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            refresh        = toolbar.FindViewById <Button>(Resource.Id.refresh);
            refresh.Click += delegate
            {
                theMap.Clear();

                LatLng       latlng = new LatLng(System.Convert.ToDouble(sharedPreferences.GetString("lat", null)), System.Convert.ToDouble(sharedPreferences.GetString("lon", null)));
                CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlng, theMap.CameraPosition.Zoom);
                theMap.MoveCamera(camera);
                MarkerOptions options = new MarkerOptions().SetPosition(latlng).SetTitle("Waiting Location Update");
                Marker        marker  = theMap.AddMarker(options);
                marker.ShowInfoWindow();
                if (this.PerformRuntimePermissionCheckForLocation(REQUEST_PERMISSIONS_LOCATION))
                {
                    InitializeUiSettingsOnMap();
                }

                DataTable dt = new DataTable();

                var appid    = "AAAAIS9WtFE:APA91bF_EYn_n1l50-PUDfn9RIjZhj7TT4e_02aB15eKc-mlSCZCLU-Q7NQDFH21Wflg-rIQ1WNlZoIhT94hwxrAvLKAkFg6_KjF1Gv2UcIeJ94Q93HHJC9JMANbl5BUjpaFtXca0_yb";
                var senderid = "142528132177";

                WebReference.BasicHttpBinding_IService1 notif = new WebReference.BasicHttpBinding_IService1();

                var a = sharedPreferences.GetString("keyfcm", null);
                var b = sharedPreferences.GetString("userid", null);

                notif.PushNotification(appid, senderid, sharedPreferences.GetString("keyfcm", null), "start", sharedPreferences.GetString("userid", null));
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.EscolherIngredientes);

            toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            TextView mTitle = (TextView)toolbar.FindViewById(Resource.Id.toolbar_title);

            mTitle.SetText("Inserir ingredientes", TextView.BufferType.Normal);

            List <string> listastrings = Facade.GetIngredientes();

            listview         = FindViewById <ListView>(Resource.Id.listview);
            listview.Adapter = new IngredientesPratoAdapter(this, listastrings);

            Button addingre = FindViewById <Button>(Resource.Id.addingrediente);

            addingre.Click += (sender, e) => {
                var dialog = new AdicionarIngrediente();
                dialog.Show(FragmentManager, "dialog");
            };

            Button guardarButtom = FindViewById <Button>(Resource.Id.guardar);

            listaIngr = new List <Ingrediente>();
            IngredientesPratoAdapter adapter = (IngredientesPratoAdapter)listview.Adapter;

            guardarButtom.Click += (sender, e) => {
                foreach (Model2 m in adapter.items)
                {
                    if (m.isSelected())
                    {
                        Ingrediente i = new Ingrediente(m.getName(), m.isCostume());
                        listaIngr.Add(i);
                    }
                }
                Finish();
            };
        }
Esempio n. 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.DescricaoPrato);

            toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            TextView mTitle = (TextView)toolbar.FindViewById(Resource.Id.toolbar_title);

            mTitle.SetText("Resultado " + pratosel.Designacao, TextView.BufferType.Normal);

            ImageView foto          = FindViewById <ImageView>(Resource.Id.foto);
            RatingBar classificacao = FindViewById <RatingBar>(Resource.Id.classificacao);
            TextView  prato         = FindViewById <TextView>(Resource.Id.prato);
            TextView  restaurante   = FindViewById <TextView>(Resource.Id.restaurante);
            TextView  morada        = FindViewById <TextView>(Resource.Id.morada);
            TextView  telefone      = FindViewById <TextView>(Resource.Id.telefone);
            TextView  preco         = FindViewById <TextView>(Resource.Id.preco);

            byte[] a = Convert.FromBase64String(pratosel.Fotografia);
            Bitmap b = BitmapFactory.DecodeByteArray(a, 0, a.Length);

            foto.SetImageBitmap(b);

            classificacao.Rating = (float)pratosel.Classificacao;
            prato.Text           = pratosel.Designacao;
            restaurante.Text     = pratosel.Restaurante.Nome;
            morada.Text          = pratosel.Restaurante.Localizacao;
            telefone.Text        = "Contacto: " + pratosel.Restaurante.Telefone;
            preco.Text           = "Preço: " + pratosel.Preco.ToString() + " €";

            List <Classificacao> classificacoes = pratosel.Classificacoes;

            ListView listview = FindViewById <ListView>(Resource.Id.listview);

            listview.Adapter = new ComentariosAdapter(this, classificacoes);

            ImageView addComment = FindViewById <ImageView>(Resource.Id.addBo);

            addComment.Click += (sender, e) => {
                Console.WriteLine("\n\n\nBOTAOCOMENTARIOS");
                var dialog = new AdicionarComentario();
                Console.WriteLine("\n\n\nAdicionaComentario");
                dialog.Show(FragmentManager, "dialog");
            };

            Button guardarbuttom = FindViewById <Button>(Resource.Id.guardar);

            guardarbuttom.Click += (sender, e) => {
                Facade.GuardarPrato(pratosel);
                new AlertDialog.Builder(this).
                SetPositiveButton("OK", (senderAlert, args) => { }).
                SetMessage("Prato guardado nas seleções!").
                SetTitle("Sucesso").
                Show();
            };

            Button mapabuttom = FindViewById <Button>(Resource.Id.mapa);

            mapabuttom.Click += (sender, e) => {
                var geoUri    = Android.Net.Uri.Parse("geo:0,0?q=" + pratosel.Restaurante.Localizacao);
                var mapIntent = new Intent(Intent.ActionView, geoUri);
                StartActivity(mapIntent);
            };
        }
Esempio n. 16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            IsFirstInitialization = true;
            _persoon = Gegevens.GetPerson();
            _groep = Gegevens.CurrentGroup();

            SetContentView(Resource.Layout.Hoofdscherm);

            _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            _totalDebt = _toolbar.FindViewById<TextView>(Resource.Id.TotalDebt);
            _title = _toolbar.FindViewById<TextView>(Resource.Id.Title);
            _title.Text = _persoon.Id;
            TotalDebt = _persoon.TotaalSchuld();

            SetSupportActionBar(_toolbar);
            SupportActionBar.Title = "";

            _fragments = new HoofdschermFragment[]
            {
                new SessionFragment(),
                new PayFragment(),
                new ContactFragment()
            };

            var titles = CharSequence.ArrayFromStringArray(new[]
                {
                    "Sessions",
                    "Payments",
                    "Contacts"
                });

            _viewPager = FindViewById<ViewPager>(Resource.Id.viewpager);
            _viewPager.Adapter = new TabsFragmentPagerAdapter(SupportFragmentManager, _fragments, titles);
            _viewPager.SetCurrentItem(1, true);

            _tabLayout = FindViewById<TabLayout>(Resource.Id.sliding_tabs);
            _tabLayout.SetupWithViewPager(_viewPager);

            _tabLayout.SetOnTabSelectedListener(this);
        }
Esempio n. 17
0
        /// <summary>
        /// Called when the activity is first displayed
        /// Initialise the main view and the action bar and determine what should be displayed
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ListingScreen);

            // Initialise the action bar
            // TODO Wrap this up in a class
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            toolbarTitle    = toolbar.FindViewById <TextView>(Resource.Id.toolbar_title);
            toolbarSubtitle = toolbar.FindViewById <TextView>(Resource.Id.toolbar_subtitle);

            // Create a toast item to display feedback
            toast = Toast.MakeText(this, "", ToastLength.Short);

            // We are now making a list
            PersistentStorage.IsShopping = false;

            // Create the views that are going to display the data
            ListView availableItemsView = FindViewById <ListView>(Resource.Id.availableItems);
            ListView currentItemsView   = FindViewById <ListView>(Resource.Id.shoppingItems);

            // Wrap up these views to add touch handling
            currentList = new CurrentListWrapper(this, currentItemsView, availableItemsView, CurrentListTitle);

            availableList = new AvailableListWrapper(this, availableItemsView, currentItemsView, AvailableItemsTitle,
                                                     new ItemSort(new ItemSort.SortState[] { ItemSort.SortState.Grouped, ItemSort.SortState.Alphabetic,
                                                                                             ItemSort.SortState.Unsorted }, ItemSort.SortState.Grouped, AvailableItemsTitle));

            // Hook into the available items view being shown event
            currentList.RevealActive += (object sender, EventArgs args) =>
            {
                toolbarTitle.Text    = availableList.ToolbarTitle;
                toolbarSubtitle.Text = "";
            };

            // Handle the swiping of a current item
            currentList.ItemSwiped += (object sender, ListViewWrapper <ListItem> .SwipeItemEventArgs <ListItem> args) =>
            {
                int itemsMoved = ListingController.CurrentItemSwiped(args.Item, args.WasFlung);

                if (itemsMoved > 1)
                {
                    toast.SetText(string.Format("{0} {1} removed from list", itemsMoved, args.Item.Item.Name));
                }
                else
                {
                    toast.SetText(string.Format("{0} removed from list", args.Item.Item.Name));
                }

                toast.Show();

                currentList.DataSetChanged();
            };

            // Hook into the current items view being shown event
            availableList.RevealActive += (object sender, EventArgs args) =>
            {
                // SupportActionBar.Title = currentList.ToolbarTitle;
                toolbarTitle.Text    = currentList.ToolbarTitle;
                toolbarSubtitle.Text = "unnamed list";
            };

            // Handle the swiping of an available item
            availableList.ItemSwiped += (object sender, ListViewWrapper <object> .SwipeItemEventArgs <object> args) =>
            {
                Item itemAdded = ( Item )args.Item;

                int itemsMoved = ListingController.AvailableItemSwiped(itemAdded, args.WasFlung);

                if (itemsMoved > 1)
                {
                    toast.SetText(string.Format("{0} {1} added to list", itemsMoved, itemAdded.Name));
                }
                else
                {
                    toast.SetText(string.Format("{0} added to list", itemAdded.Name));
                }

                toast.Show();

                currentList.DataSetChanged();
            };

//			currentItemsView.LongClickable = true;
            currentItemsView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs args) =>
            {
                toast.SetText("Current items long clicked");
                toast.Show();
            };

            // Always start showing the available items list
            currentItemsView.Visibility     = Android.Views.ViewStates.Gone;
            availableItemsView.TranslationX = 0;
            // SupportActionBar.Title = availableList.ToolbarTitle;
            toolbarTitle.Text = availableList.ToolbarTitle;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            fm = SupportFragmentManager;

            Forms.Init(this, null);

            MobileCenter.Start("d19450d5-6882-4bea-9b6e-0b3f2e4afe02",
                               typeof(Analytics), typeof(Crashes));

            MessagingCenter.Subscribe <NativeNavigation, string>(this, "NativeNav", (sender, arg) =>
            {
                System.Console.WriteLine("Got the message from Xamarin Forms to load Global Search");
                NativeNavigationModel nnm = JsonConvert.DeserializeObject <NativeNavigationModel>(arg);
                NavigateByString nav      = new NavigateByString(nnm);
                nav.NavigateXF();
            }
                                                                 );

            SetContentView(Resource.Layout.Main);

            MainToolBar = FindViewById <V7Toolbar>(Resource.Id.mainToolBar);

            //UpwardFontTextView upwardLogo = ViewUtil.GetUpwardFontTextView(this, "U", 60, Resource.Color.white);
            //MainToolBar.FindViewById<RelativeLayout>(Resource.Id.upwardLogo_container).AddView(upwardLogo);

            ViewUtil.AddUpwardLogoToView(this, MainToolBar.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.upwardLogo_container),
                                         Resources.GetInteger(Resource.Integer.upward_toolbar_logo_size));

            SetSupportActionBar(MainToolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(new IconDrawable(this, "md-menu").SizeDp(28).Color(Android.Graphics.Color.White));

            MainTabLayout = FindViewById <TabLayout>(Resource.Id.mainTabLayout);
            MainViewPager = FindViewById <ViewPager>(Resource.Id.mainViewPager);

            //NOTE: The following group of lines restores the old tab layout. These were removed in favor of the singular home page fragment approach for Upward
            SetUpFragments();
            MainFragAdapter       = new MainAdapter(this, fm, Fragments);
            MainViewPager.Adapter = MainFragAdapter;
            MainTabLayout.SetupWithViewPager(MainViewPager);
            MainViewPager.OffscreenPageLimit = Fragments.Count - 1;
            MainViewPager.AddOnPageChangeListener(this);

            //HomeFeedFragment fragment = new HomeFeedFragment();
            //FragmentUtil.LoadFragment(SupportFragmentManager, Resource.Id.staticFragmentContainer, fragment, Constants.VALUE_TYPE_HOME_FEED);

            NavView = FindViewById <NavigationView>(Resource.Id.nav_view);
            //NavView.NavigationItemSelected += DrawerItemSelected;
            DrawerLayout = FindViewById <FRDrawerLayout>(Resource.Id.drawer_layout);


            //Fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
            ////var icon = new IconDrawable(this, "md-create").Color(Android.Graphics.Color.White).SizeDp(20);
            //Fab.Click += (sender, e) =>
            //{
            //    IntentUtil.GoToCreatePost(this);
            //    //add layout and tint to layout

            //};
            //Fab.SetImageDrawable(icon);
            SetUpFab();

            SetTabIcons();
            SetConnectivityMessage();

            //The following 6 lines of code will set up the drawer for a non-logged in state to start, and change it later as required
            Fab.Visibility = ViewStates.Gone;
            NavView.FindViewById(Resource.Id.drawerLogout).Visibility = ViewStates.Gone;
            NavView.FindViewById(Resource.Id.drawerNonAuthenticatedHeader).Visibility = ViewStates.Visible;
            NavView.FindViewById(Resource.Id.drawerAuthenticatedHeader).Visibility    = ViewStates.Gone;
            NavView.FindViewById <ImageView>(Resource.Id.drawerNonAuthenticatedHeader_Avatar)
            .SetImageDrawable(ViewUtil.GetSVGDrawable(this, "profile_empty", 200, Resource.Color.Upward_dark_grey));
            MainTabLayout.Visibility = ViewStates.Gone;
            FindViewById(Resource.Id.flDrawerNonAuthenticatedHeader_AvatarContainer).SetOnClickListener(this);

            //Setup MainView
            var linear = new LinearLayout(this);

            linear.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);
            linear.Orientation      = Orientation.Vertical;

            var frame = new FrameLayout(this);

            frame.LayoutParameters = linear.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            frame.Id = 100;

            //linear.AddView(frame);

            //SetContentView(linear);

            //Setup navigation
            if (!Forms.IsInitialized)
            {
                Forms.Init(this, savedInstanceState);
            }

            DependencyService.Register <IAppNavigation, AppNavigation>();

            //AppNavigation.Manager = FragmentManager;
            //AppNavigation.ResourceId = 100;

            var appNavigation = DependencyService.Get <IAppNavigation>();

            //appNavigation.Push(App.StartPage);
        }
Esempio n. 19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _persoon = Gegevens.GetPerson();
            _groep = Gegevens.CurrentGroup();

            SetContentView(Resource.Layout.Payscherm);

            _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            _totalDebt = _toolbar.FindViewById<TextView>(Resource.Id.Title);
            TotalDebt = _persoon.TotaalSchuldGroep(_groep);

            SetSupportActionBar(_toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.Title = "";

            _fragments = new PaySchermFragment[]
            {
                new InboxFragment(),
                new OutboxFragment(),
            };
            var titles = CharSequence.ArrayFromStringArray(new[]
            {
                "Inbox",
                "Outbox"
            });

            _viewPager = FindViewById<ViewPager>(Resource.Id.viewpager);
            _viewPager.Adapter = new TabsFragmentPagerAdapter(SupportFragmentManager, _fragments, titles);
            _viewPager.SetCurrentItem(0, true);

            _tabLayout = FindViewById<TabLayout>(Resource.Id.sliding_tabs);
            _tabLayout.SetupWithViewPager(_viewPager);

            _tabLayout.SetOnTabSelectedListener(this);

            Button newPaymentButton = FindViewById<Button>(Resource.Id.buttonNewPayment);
            newPaymentButton.Click += (sender, e) =>
            {
                var activity = new Intent(this, typeof(Betaalscherm));
                StartActivity(activity);
            };
        }