/// <summary>
        /// SetFabImage
        /// </summary>
        /// <param name="fab"></param>
        /// <param name="imageName"></param>
        private void SetFabImage(Clans.Fab.FloatingActionButton fab, string imageName)
        {
            if (!string.IsNullOrWhiteSpace(imageName))
            {
                try
                {
                    Task.Run(async() =>
                    {
                        var drawableNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(imageName);
                        var resources         = _context.Resources;
                        var imageResourceName = resources.GetIdentifier(drawableNameWithoutExtension, "drawable",
                                                                        _context.PackageName);
                        var bitmap = await BitmapFactory.DecodeResourceAsync(_context.Resources,
                                                                             imageResourceName);

                        var activity = Context as Activity;
                        activity?.RunOnUiThread(() =>
                        {
                            fab.SetScaleType(ImageView.ScaleType.FitCenter);
                            fab.SetImageBitmap(bitmap);
                        });
                    });
                }
                catch (Exception ex)
                {
#if DEBUG
                    throw new FileNotFoundException("There was no Android Drawable by that name.", ex);
#else
                    System.Diagnostics.Debug.Write(ex.Message);
#endif
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            CopyDatabase(mDbName);

            // Set our view from the "check_line_layout" layout resource
            SetContentView(Resource.Layout.check_line_layout);

            mToolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);

            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            mNavigationView.SetNavigationItemSelectedListener(this);

            SetUpGoogleMap();

            mDb                    = new Database(System.IO.Path.Combine(mPath, mDbName));
            mGetPositionFAB        = (FloatingActionButton)FindViewById(Resource.Id.to_my_position_fab);
            mGetPositionFAB.Click += MGetPositionFAB_Click;
        }
Ejemplo n.º 3
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            this.listView = view.FindViewById <ListView>(Resource.Id.taskList);
            this.fab      = view.FindViewById <FloatingActionButton>(Resource.Id.addTask);

            TaskManager.CreateDatabase();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

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

            //toolBar.Elevation = 20;
            //toolBar.Menu.Add("teste");
            //toolBar.NavigationIcon;
            //= (Android.Graphics.Drawables.Drawable)Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha;

            SetSupportActionBar(toolBar);


            //toolBar.NavigationIcon = Resource.Drawable.abc_ic_go_search_api_mtrl_alpha;

            TabLayout tab = (TabLayout)FindViewById(Resource.Id.TabLayout);

            tab.SetSelectedTabIndicatorColor(Resource.Color.branco_azulado);
            tab.SetSelectedTabIndicatorHeight(5);
            tab.AddTab(tab.NewTab().SetText(Resource.String.Resume));
            tab.AddTab(tab.NewTab().SetText(Resource.String.Current_Trip));
            tab.AddTab(tab.NewTab().SetText(Resource.String.History));

            ViewPager viewpager = (ViewPager)FindViewById(Resource.Id.viewPager);

            viewpager.Adapter = new MyFragmentAdapter(SupportFragmentManager);


            //Sincroniza a viewpager com as tabs
            viewpager.AddOnPageChangeListener(new TabLayoutOnPageChangeListener(tab));
            tab.SetOnTabSelectedListener(new ViewPagerOnTabSelectedListener(viewpager));

            //Inicia na segunda tab
            viewpager.SetCurrentItem(1, false);

            //Floating Action Menu

            Clans.Fab.FloatingActionButton fab_newtrip = FindViewById <Clans.Fab.FloatingActionButton>(Resource.Id.fab_newtrip);
            Clans.Fab.FloatingActionButton fab_newitem = FindViewById <Clans.Fab.FloatingActionButton>(Resource.Id.fab_newitem);
            Clans.Fab.FloatingActionMenu   fa_menu     = FindViewById <Clans.Fab.FloatingActionMenu>(Resource.Id.fa_menu);

            fab_newtrip.Click += delegate
            {
                fa_menu.Close(false);
                StartActivity(typeof(New_Trip_Activity));
            };

            fab_newitem.Click += delegate
            {
                fa_menu.Close(false);
                StartActivity(typeof(New_Item_Activity));
            };
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.activity_snackbar);
            this.fabSend     = FindViewById <FloatingActionButton>(Resource.Id.fabSend);
            this.fabDelete   = FindViewById <FloatingActionButton>(Resource.Id.fabDelete);
            this.coordinator = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout);

            this.fam = FindViewById <FloatingActionMenu>(Resource.Id.menu);
            this.fam.HideMenuButton(false);
            this.fam.PostDelayed(() => this.fam.ShowMenuButton(true), 200);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.activity_snackbar);
            this.fabSend = FindViewById<FloatingActionButton>(Resource.Id.fabSend);
            this.fabDelete = FindViewById<FloatingActionButton>(Resource.Id.fabDelete);
            this.coordinator = FindViewById<CoordinatorLayout>(Resource.Id.coordinatorLayout);
            this.fab = FindViewById<FloatingActionButton>(Resource.Id.fab);

            this.fam = FindViewById<FloatingActionMenu>(Resource.Id.menu);
            this.fam.HideMenuButton(false);
            this.fam.PostDelayed(() => this.fam.ShowMenuButton(true), 200);

            this.fab.Hide(false);
            this.fab.PostDelayed(() => fab.Show(true), 200);
        }
Ejemplo n.º 7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!CommonHelperClass.FnIsGooglePlayServicesInstalled(this))
            {
                Finish();
            }

            // Set our view from the "closest_stop_layout" layout resource
            SetContentView(Resource.Layout.closest_stop_layout);

            SetUpGoogleMap();

            mToolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);

            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            mNavigationView.SetNavigationItemSelectedListener(this);

            mMenuFAB = (FloatingActionMenu)FindViewById(Resource.Id.menu);

            mMenuFAB.HideMenuButton(false);

            mMenuFAB.PostDelayed(() => mMenuFAB.ShowMenuButton(true), -200);

            mGetPositionFAB = (FloatingActionButton)FindViewById(Resource.Id.position_fab);

            mDrawRouteFAB = (FloatingActionButton)FindViewById(Resource.Id.route_fab);

            mDB = new Database(Path.Combine(mPath, mDbName));

            mListAllStations        = mDB.AllStationsLocations();
            mAllLinesId             = mDB.AllLinesID();
            mListLinesIdFromStation = new List <string>();
        }