コード例 #1
0
        private void LoadPremadeWorkouts()
        {
            //ArrayAdapter<Workout> adapter = new ArrayAdapter<Workout>(this, Android.Resource.Layout.ListContent, mPremadeWorkoutList);
            if (mPremadeWorkoutList.Count == 0)
            {
                mPremadeWorkoutList.Add(premadeUpperBodyWorkout);
            }
            var adapter = new WorkoutListAdapter(this, mPremadeWorkoutList);

            newWorkoutButton.Visibility = ViewStates.Gone;

            workoutListView.Adapter = adapter;
            mCustomWorkoutList      = new List <Workout>();
        }
コード例 #2
0
        private void LoadCustomWorkouts()
        {
            newWorkoutButton.Visibility = ViewStates.Visible;
            try
            {
                mCustomWorkoutList = db.Table <Workout>().Where(c => c.IsCustom).ToList();
            }
            catch (Exception e)
            {
                return;
            }
            var adapter = new WorkoutListAdapter(this, mCustomWorkoutList);

            workoutListView.Adapter = adapter;
            mPremadeWorkoutList     = new List <Workout>();
        }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: Oompa2/TrainTrackC
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            App.fillAvailableWorkoutsTemp();

            // Instantiate the adapter and pass in its data source:
            workoutListAdapter = new WorkoutListAdapter(App.AvailableWorkouts);

            // Get our RecyclerView layout:
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);

            // Plug the adapter into the RecyclerView:
            recyclerView.SetAdapter(workoutListAdapter);

            //instantiate the layout manager and plug it into the recyclerView object
            layoutManager = new LinearLayoutManager(this);
            recyclerView.SetLayoutManager(layoutManager);
        }
コード例 #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

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

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "My Workouts";

            #region hide

            /*
             #region Fillers for now
             *
             * var pushups = new BodyWeightExercise("Pushups", 5, 20);
             * var pullups = new BodyWeightExercise("Pullups", 3, 8);
             *
             * var exercises = new List<IExercise>
             * {
             *  pushups,
             *  pullups,
             *  new WeightedExercise("Squats", 5, 5, 225),
             *  new TimedExercise(pullups, new TimeSpan(0, 5, 0)),
             *  new SuperSet("The Finisher", 4, pushups, pullups)
             * };
             *
             * var workouts = new List<Workout>
             * {
             *  new Workout("ArmX", "Leonard", DateTime.Now, null),
             *  new Workout("LegX", null, null, null),
             *  new Workout("BackX", "Leonard", null, exercises),
             *  new Workout("Agility", null, DateTime.Now, null),
             *  new Workout("Strength", "Leonard", DateTime.Now, exercises),
             *  new Workout("Body Weight", "Leonard", null, exercises)
             * };
             *
             #endregion
             *  // Create our connection
             * string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
             * var db = new SQLiteConnection(System.IO.Path.Combine(folder, "notes.db"));
             * db.CreateTable<Note>();
             *
             * // Insert note into the database
             * var note = new Note { Message = "Test Note" };
             * db.Insert (note);
             *
             * // Show the automatically set ID and message.
             * Console.WriteLine ("{0}: {1}", note.Id, note.Message);
             */
            #endregion

            _workouts = FileHelper.GetWorkoutList();

            _adapter = new WorkoutListAdapter(this, _workouts);
            var workoutsListView = FindViewById <ListView>(Resource.Id.workout_list);
            workoutsListView.Adapter    = _adapter;
            workoutsListView.ItemClick += (sender, args) =>
            {
                var intent = new Intent(this, typeof(ExercisesActivity));
                intent.PutExtra("selectedWorkoutName", _adapter[args.Position].Name);
                StartActivity(intent);
            };
        }