예제 #1
0
        private void CreateCustomAnimation()
        {
            FloatingActionMenu menu3 = FindViewById <FloatingActionMenu>(Resource.Id.menu3);

            AnimatorSet set = new AnimatorSet();

            ObjectAnimator scaleOutX = ObjectAnimator.OfFloat(menu3.MenuIconView, "scaleX", 1.0f, 0.2f);
            ObjectAnimator scaleOutY = ObjectAnimator.OfFloat(menu3.MenuIconView, "scaleY", 1.0f, 0.2f);

            ObjectAnimator scaleInX = ObjectAnimator.OfFloat(menu3.MenuIconView, "scaleX", 0.2f, 1.0f);
            ObjectAnimator scaleInY = ObjectAnimator.OfFloat(menu3.MenuIconView, "scaleY", 0.2f, 1.0f);

            scaleOutX.SetDuration(50);
            scaleOutY.SetDuration(50);

            scaleInX.SetDuration(150);
            scaleInY.SetDuration(150);

            scaleInX.AnimationStart += (object sender, EventArgs e) =>
            {
                menu3.MenuIconView.SetImageResource(menu3.IsOpened ? Resource.Drawable.ic_close : Resource.Drawable.ic_star);
            };

            set.Play(scaleOutX).With(scaleOutY);
            set.Play(scaleInX).With(scaleInY).After(scaleOutX);
            set.SetInterpolator(new OvershootInterpolator(2));

            menu3.IconToggleAnimatorSet = set;
        }
예제 #2
0
        private void InitActionMenu()
        {
            _actionMenu?.Close(true);
            _actionMenu?.Dispose();
            var param   = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(45), DimensionsHelper.DpToPx(45));
            var builder = new FloatingActionMenu.Builder(Activity)
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_filter))
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_sort))
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_shuffle));

            switch (ViewModel.WorkMode)
            {
            case AnimeListWorkModes.SeasonalAnime:
                builder.AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_calendar));
                builder.SetRadius(DimensionsHelper.DpToPx(95));
                break;

            case AnimeListWorkModes.TopAnime:
                builder.AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_fav_outline));
                builder.SetRadius(DimensionsHelper.DpToPx(95));
                break;

            default:
                builder.SetRadius(DimensionsHelper.DpToPx(75));
                break;
            }
            _actionMenu = builder.AttachTo(AnimeListPageActionButton).Build();
        }
예제 #3
0
        public void OnClick(View v)
        {
            FloatingActionMenu menu = (FloatingActionMenu)v.Parent;

            if (menu.Id == Resource.Id.menu1 && menu.IsOpened)
            {
                Toast.MakeText(this, menu.MenuButtonLabelText, ToastLength.Short).Show();
            }

            menu.Toggle(animate: true);
        }
예제 #4
0
        private void InitActionMenu()
        {
            _actionMenu?.Close(true);
            _actionMenu?.Dispose();
            var param   = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(45), DimensionsHelper.DpToPx(45));
            var builder = new FloatingActionMenu.Builder(Activity)
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_filter))
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_linear_blur))
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_sort));

            builder.SetRadius(DimensionsHelper.DpToPx(75));
            _actionMenu = builder.AttachTo(ComparisonPageActionButton).Build();
        }
예제 #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);
        }
예제 #6
0
 protected override void OnDestroy()
 {
     if (_binding != null)
     {
         _binding.Detach();
         _binding = null;
     }
     _image           = null;
     _menu            = null;
     _rotateButton    = null;
     _grayscaleButton = null;
     _blurButton      = null;
     base.OnDestroy();
 }
예제 #7
0
        /** Method Declarations **/
        /** Route Selection Screen **/
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.MapLayout);
            mapView = FindViewById <MapView>(Resource.Id.mapview);

            //Registers the device if it's not already in the database, puts it on another thread
            registerDeviceAsync();

            //Loads the map background
            await loadMap(bundle);

            //Binds layout elements to a set of variables
            AutoCompleteTextView destinationBox   = FindViewById <AutoCompleteTextView>(Resource.Id.destinationSearchView);
            AutoCompleteTextView originBox        = FindViewById <AutoCompleteTextView>(Resource.Id.originSearchView);
            FrameLayout          originFrame      = FindViewById <FrameLayout>(Resource.Id.originFrame);
            FrameLayout          destinationFrame = FindViewById <FrameLayout>(Resource.Id.destinationFrame);
            Button routeButton               = FindViewById <Button>(Resource.Id.routeButton);
            Button originClear               = FindViewById <Button>(Resource.Id.originClearButton);
            Button destinationClear          = FindViewById <Button>(Resource.Id.destinationClearButton);
            SlidingUpPanelLayout view        = FindViewById <SlidingUpPanelLayout>(Resource.Id.sliding_layout);
            Button               startButton = FindViewById <Button>(Resource.Id.startButton);
            FloatingActionMenu   fam         = FindViewById <FloatingActionMenu>(Resource.Id.fabMenu);
            FloatingActionButton delayFab    = FindViewById <FloatingActionButton>(Resource.Id.delayFab);
            FloatingActionButton closureFab  = FindViewById <FloatingActionButton>(Resource.Id.closureFab);

            //Configures the autocomplete text views
            configureActv(destinationBox, originBox, destinationFrame, destinationClear, routeButton);
            configureActv(originBox, destinationBox, originFrame, originClear, routeButton);

            //Turns the originBox green if it already contains a valid value
            makeActvTurnGreenWhenAddressesAreValid(originBox, originFrame);

            //Sets up the sliding panel on the bottom
            var manager = initializeSlidingPanel();

            initializeSlidingPanelDelegates(view, manager);

            //Sets up delegates for the stawrt and select buttons
            bindStartSelectButtonDelegates(startButton, routeButton, originBox, destinationBox);

            //Sets focus on the destination box so the user can immediately begin typing there
            destinationBox.RequestFocus();

            //Binds the delegates to each floating action menu option
            bindFloatingActionMenuOptionDelegates(fam, delayFab, closureFab);
        }
예제 #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);

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

                Toolbar toolBar = FindViewById <Toolbar>(Resource.Id.toolbar);

                if (AppSettings.Show_Title_Username)
                {
                    toolBar.Title = UserDetails.Username;
                }
                else
                {
                    toolBar.Title = AppSettings.Application_Name;
                }

                SetSupportActionBar(toolBar);

                ActionBar ab = SupportActionBar;

                tabs      = FindViewById <TabLayout>(Resource.Id.tabs);
                viewPager = FindViewById <ViewPager>(Resource.Id.viewpager);
                FloatingActionButtonView     = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButtonView);
                StoryMultiButtons            = FindViewById <FloatingActionMenu>(Resource.Id.multistroybutton);
                StoryMultiButtons.Visibility = ViewStates.Invisible;

                StoryMultiButtons.GetChildAt(0).Click += OnImage_Button_Click;
                StoryMultiButtons.GetChildAt(1).Click += OnVideo_Button_Click;
                viewPager.PageScrolled         += ViewPager_PageScrolled;
                viewPager.PageSelected         += ViewPager_OnPageSelected;
                FloatingActionButtonView.Click += FloatingActionButtonView_Click;

                viewPager.OffscreenPageLimit = 3;
                SetUpViewPager(viewPager);
                tabs.SetupWithViewPager(viewPager);
                FloatingActionButtonView.Tag = "LastMessages";
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        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);
        }
예제 #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            //FAB BUTTON
            ImageView fabIcon = new ImageView(this);

            fabIcon.SetImageResource(Resource.Drawable.add_green);
            FloatingActionButton fab = new FloatingActionButton.Builder(this).SetContentView(fabIcon).Build();

            //BUILDER AND sub buttons
            SubActionButton.Builder builder = new SubActionButton.Builder(this);

            //BUTTON 1
            ImageView saveIcon = new ImageView(this);

            saveIcon.SetImageResource(Resource.Drawable.add_circle);
            SubActionButton saveBtn = builder.SetContentView(saveIcon).Build();

            //BUTTON 2
            ImageView editIcon = new ImageView(this);

            editIcon.SetImageResource(Resource.Drawable.add_note_blue);
            SubActionButton editBtn = builder.SetContentView(editIcon).Build();

            //BUTTON 1
            ImageView deleteIcon = new ImageView(this);

            deleteIcon.SetImageResource(Resource.Drawable.delete_red);
            SubActionButton deleteBtn = builder.SetContentView(deleteIcon).Build();

            //MENU
            fam = new FloatingActionMenu.Builder(this)
                  .AddSubActionView(saveBtn)
                  .AddSubActionView(editBtn)
                  .AddSubActionView(deleteBtn)
                  .AttachTo(fab)
                  .Build();
            //CLICK EVENTS
            saveBtn.Click   += SaveBtn_Click;
            editBtn.Click   += EditBtn_Click;
            deleteBtn.Click += DeleteBtn_Click;
        }
예제 #11
0
        private void bindFloatingActionMenuOptionDelegates(FloatingActionMenu fam, FloatingActionButton delayFab, FloatingActionButton closureFab)
        {
            //When clicked, the buttons print to the console and display a toast on the screen.
            //Should eventually be replaced with better dialog for user and http put/post request to backend
            delayFab.Click += delegate
            {
                Console.WriteLine("Delay reported");
                Toast.MakeText(this, "Delay reported", ToastLength.Long).Show();
                fam.Close(true);
            };

            closureFab.Click += delegate
            {
                Console.WriteLine("Closure reported");
                Toast.MakeText(this, "Closure reported", ToastLength.Long).Show();
                fam.Close(true);
            };
        }
예제 #12
0
        private void SetupFields()
        {
            _toolbar    = FindViewById <SupportToolbar>(Resource.Id.tbHome);
            _txtWelcome = FindViewById <TextView>(Resource.Id.txtWelcome);
            _txtDevice  = FindViewById <EditText>(Resource.Id.txtDevice);
            _txtCommand = FindViewById <EditText>(Resource.Id.txtCommand);
            _fabConnect = FindViewById <FloatingActionButton>(Resource.Id.fabConnect);
            _fabSend    = FindViewById <FloatingActionButton>(Resource.Id.fabSend);
            _fabLogout  = FindViewById <FloatingActionButton>(Resource.Id.fabLogout);
            _famHome    = FindViewById <FloatingActionMenu>(Resource.Id.famHome);

            _txtWelcome.Text   = $"Olá, {Base.Instance.User.Name}";
            _fabConnect.Click += Connect_Click;
            _fabSend.Click    += Send_Click;
            _fabLogout.Click  += Logout_Click;

            SetSupportActionBar(_toolbar);
        }
예제 #13
0
        protected override void InitBindings()
        {
            _actionMenu?.Close(true);
            var padding = DimensionsHelper.DpToPx(10);
            var param   = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(45), DimensionsHelper.DpToPx(45));
            var builder = new FloatingActionMenu.Builder(Activity)
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_message_new))
                          .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_message_sent));

            builder.SetRadius(DimensionsHelper.DpToPx(75));
            _actionMenu = builder.AttachTo(MessagingPageActionButton).Build();

            Bindings.Add(this.SetBinding(() => ViewModel.DisplaySentMessages).WhenSourceChanges(() =>
            {
                MessagingPageList.Adapter = ViewModel.DisplaySentMessages
                    ? ViewModel.Outbox.GetAdapter(GetMessageTemplateDelegate)
                    : ViewModel.Inbox.GetAdapter(GetMessageTemplateDelegate);
            }));

            Bindings.Add(this.SetBinding(() => ViewModel.LoadingVisibility).WhenSourceChanges(() =>
            {
                if (ViewModel.LoadingVisibility)
                {
                    MessagingPageList.Adapter = null;
                    return;
                }
                MessagingPageList.Adapter = ViewModel.DisplaySentMessages
                    ? ViewModel.Outbox.GetAdapter(GetMessageTemplateDelegate)
                    : ViewModel.Inbox.GetAdapter(GetMessageTemplateDelegate);
            }));



            Bindings.Add(
                this.SetBinding(() => ViewModel.LoadingVisibility,
                                () => MessagingPageProgressSpinner.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            var scrollToRefresh = RootView as ScrollableSwipeToRefreshLayout;

            scrollToRefresh.ScrollingView = MessagingPageList;
            scrollToRefresh.Refresh      += ScrollToRefreshOnRefresh;
        }
예제 #14
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>();
        }
예제 #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.floating_menus_activity);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            FloatingActionMenu menu1           = FindViewById <FloatingActionMenu>(Resource.Id.menu1);
            FloatingActionMenu menu2           = FindViewById <FloatingActionMenu>(Resource.Id.menu2);
            FloatingActionMenu menu3           = FindViewById <FloatingActionMenu>(Resource.Id.menu3);
            FloatingActionMenu menu4           = FindViewById <FloatingActionMenu>(Resource.Id.menu4);
            FloatingActionMenu menuDown        = FindViewById <FloatingActionMenu>(Resource.Id.menu_down);
            FloatingActionMenu menuLabelsRight = FindViewById <FloatingActionMenu>(Resource.Id.menu_labels_right);

            FloatingActionButton programFab1 = new FloatingActionButton(this);

            programFab1.ButtonSize = FloatingActionButton.SizeMini;
            programFab1.LabelText  = "Programmatically added button";
            programFab1.SetImageResource(Resource.Drawable.ic_edit);
            menu1.AddMenuButton(programFab1);

            ContextThemeWrapper  context     = new ContextThemeWrapper(this, Resource.Style.MenuButtonsStyle);
            FloatingActionButton programFab2 = new FloatingActionButton(context);

            programFab2.LabelText = "Programmatically added button";
            programFab2.SetImageResource(Resource.Drawable.ic_edit);
            menu2.AddMenuButton(programFab2);

            menus.Add(menuDown);
            menus.Add(menu1);
            menus.Add(menu2);
            menus.Add(menu3);
            menus.Add(menu4);
            menus.Add(menuLabelsRight);

            menuDown.HideMenuButton(false);
            menu1.HideMenuButton(false);
            menu2.HideMenuButton(false);
            menu3.HideMenuButton(false);
            menu4.HideMenuButton(false);
            menuLabelsRight.HideMenuButton(false);


            int delay = 400;

            foreach (var menu in menus)
            {
                mUiHandler.PostDelayed(() => menu.ShowMenuButton(true), delay);
                delay += 150;
            }


            menu1.SetOnMenuButtonClickListener(this);
            menu1.SetClosedOnTouchOutside(true);

            menu4.IconAnimated = false;

            menu2.MenuToggle += (object sender, FloatingActionMenu.MenuToggleEventArgs e) =>
            {
                String text = (e.Opened ? "Menu opened":"Menu closed");
                Toast.MakeText(this, text, ToastLength.Short).Show();
            };

            fab1 = FindViewById <FloatingActionButton>(Resource.Id.fab1);
            fab2 = FindViewById <FloatingActionButton>(Resource.Id.fab2);
            fab3 = FindViewById <FloatingActionButton>(Resource.Id.fab3);

            fab12 = FindViewById <FloatingActionButton>(Resource.Id.fab12);
            fab22 = FindViewById <FloatingActionButton>(Resource.Id.fab22);
            fab32 = FindViewById <FloatingActionButton>(Resource.Id.fab32);

            fab1.Click += ActionButton_Click;
            fab2.Click += ActionButton_Click;
            fab3.Click += ActionButton_Click;

            fab12.Click += ActionButton_Click;
            fab22.Click += ActionButton_Click;
            fab32.Click += ActionButton_Click;

            fab1.Enabled = false;

            FloatingActionButton fabEdit = FindViewById <FloatingActionButton>(Resource.Id.fab_edit);

            fabEdit.SetShowAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.scale_up));
            fabEdit.SetHideAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.scale_down));

            new Handler().PostDelayed(() => fabEdit.Show(true), delay + 150);

            fabEdit.Click += EditButton_Click;

            CreateCustomAnimation();
        }