Пример #1
0
        protected override void OnLocationReceived(Context context, Android.Locations.Location loc)
        {
            //base.OnLocationReceived(context, loc);
            RunManager rm        = RunManager.Get(mRunLocationListFragment.Activity);
            Run        activeRun = rm.GetActiveRun();

            if (activeRun != null && activeRun.Id == mRunLocationListFragment.mRunId)
            {
                RunLocationListAdapter adapter      = ((RunLocationListAdapter)mRunLocationListFragment.ListAdapter);
                List <RunLocation>     runLocations = rm.GetLocationsForRun(activeRun.Id);
                RunLocation            runLocation  = runLocations[runLocations.Count - 1];
                adapter.Add(runLocation);
                adapter.NotifyDataSetChanged();
                mRunLocationListFragment.ListView.SmoothScrollToPosition(runLocations.Count);
            }
        }
Пример #2
0
        public override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            mRunId = Activity.Intent.Extras.GetInt(RunListFragment.RUN_ID, -1);

            mRunManager = RunManager.Get(Activity);

            if (mRunId != -1)
            {
                RunLocationListAdapter adapter = new RunLocationListAdapter(Activity, mRunManager.GetLocationsForRun(mRunId));
                ListAdapter = adapter;
            }

            CurrentLocationReceiver = new RunLocationListReceiver(this);
            Activity.RegisterReceiver(CurrentLocationReceiver, new IntentFilter(RunManager.ACTION_LOCATION));
        }