예제 #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_add_log, container, false);

            _exercise = ExerciseManager.GetExerciseById(Arguments.GetInt(ParamKeys.EXERCISE_ID));
            var log = _exercise.TodaysLog;

            if (log != null)
            {
                LogManager.AddExerciseForToday(_exercise);
                log = _exercise.TodaysLog;
            }


            /*bind log list*/
            var listViewLogs = view.FindViewById <ListView>(Resource.Id.listViewLogs);

            log.AddNewSetIfEmpty();
            _addLogListAdapter   = new AddSetAdapter(base.Activity, log.Sets);
            listViewLogs.Adapter = _addLogListAdapter;

            /*remove set button click */
            _addLogListAdapter.RemoveSetClick += (s, position) =>
            {
                if (log.Sets.Count > position)
                {
                    log.DeleteSet(position);
                    _addLogListAdapter.NotifyDataSetChanged();
                }
            };


            /*bind Plus button*/
            var fab = view.FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += (sender, args) =>
            {
                log.AddNewSet();
                _addLogListAdapter.NotifyDataSetChanged();
            };

            return(view);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_set_history, container, false);

            _exercise = ExerciseManager.GetExerciseById(Arguments.GetInt(ParamKeys.EXERCISE_ID));


            var log = _exercise.Logs;

            if (log != null)
            {
                /*bind log list*/
                var listViewLogs = view.FindViewById <ListView>(Resource.Id.listViewLogs);

                _addLogListAdapter   = new ExerciseHistoryListAdapter(base.Activity, log);
                listViewLogs.Adapter = _addLogListAdapter;
            }

            // Use this to return your custom view for this Fragment
            return(view);
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //get args
            _exercise = ExerciseManager.GetExerciseById(Intent.GetIntExtra(ParamKeys.EXERCISE_ID, 0));

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

            _toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(_toolbar);
            this.SupportActionBar.Title = _exercise.Name; //get name of exercise

            //setup sliding tabs
            _slidingTabScrollView = FindViewById <SlidingTabScrollView>(Resource.Id.sliding_tabs);
            _viewPager            = FindViewById <ViewPager>(Resource.Id.viewPager);
            //_viewPager.Adapter = new SlidingTabsAdapter(new List<string>() { "Log", "PB", "History", "Reports" });
            _viewPager.Adapter             = new ExerciseDetailPagerAdapter(base.SupportFragmentManager, _exercise.Id.Value);
            _slidingTabScrollView.ViewPage = _viewPager;
        }
예제 #4
0
        static void Main(string[] args)
        {
            FileManager         fileManager         = new FileManager();
            InformationProvider informationProvider = new InformationProvider();
            MenuActionService   actionService       = new MenuActionService();
            IService <Exercise> exerciseService     = new ExerciseService();
            IService <Routine>  routineService      = new RoutineService();
            ExerciseManager     exerciseManager     = new ExerciseManager(actionService,
                                                                          exerciseService,
                                                                          informationProvider,
                                                                          fileManager);

            RoutineManager routineManager = new RoutineManager(routineService, informationProvider, fileManager);

            Console.WriteLine("Welcome to Gymate app!");

            exerciseManager.GetAddedExercicesFromFile();
            routineManager.GetAddedRoutineFromFile();

            while (true)
            {
                informationProvider.ShowSingleMessage("Please let me know what you want to do:");

                var mainMenu = actionService.GetMenuActionsByMenuName("Main");

                foreach (var menuAction in mainMenu)
                {
                    informationProvider.ShowSingleMessage($"{menuAction.Id}. {menuAction.Name}");
                }

                var operation = informationProvider.GetInputString();
                Console.WriteLine("\n");

                switch (operation)
                {
                case "1":
                    exerciseManager.AddNewExercise();
                    break;

                case "2":
                    exerciseManager.RemoveExercise();
                    break;

                case "3":
                    exerciseManager.ShowAllExercises();
                    break;

                case "4":
                    exerciseManager.ViewExerciseDetails();
                    break;

                case "5":
                    exerciseManager.ViewExercisesByTypeId();
                    break;

                case "6":
                    var dayOfWeekId = routineManager.GetRoutineId();
                    exerciseManager.ShowAllExercises();

                    var exerciseToAdd = exerciseManager.GetExerciseById();

                    routineManager.AddSelectedExerciseToRoutineDay(dayOfWeekId, exerciseToAdd);
                    break;

                case "7":
                    routineManager.ShowWholeRoutine();
                    break;

                case "8":
                    exerciseManager.UpdateVolumeInExercise();
                    break;

                case "9":
                    exerciseManager.ExportToXml();
                    break;

                case "10":
                    routineManager.ExportToXml();
                    break;

                default:
                    Console.WriteLine("Action you entered does not exist");
                    break;
                }

                Console.WriteLine("\n");
            }
        }