public AddPersonDemoActivityViewHost(Context context, ViewGroup parent, FragmentManager fragmentManager)
            : base(context, Resource.Layout.AddPersonDemoActivity, parent, false, false)
        {
            this.AddPersonFragment =
                fragmentManager.FindFragmentById<AddPersonFragment>(Resource.Id.AddPersonFragment);

            this.ViewAllPeopleFragment =
                fragmentManager.FindFragmentById<ViewAllPeopleFragment>(Resource.Id.ViewAllPeopleFragment);
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            permissionHelper            = new MappingPermissionsHelper(this);
            getLocationPermissionsAsync = permissionHelper.CheckAndRequestPermissions();

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

            mapFragment = FragmentManager.FindFragmentById(Resource.Id.map) as MapFragment;

            mapFragment.GetMapAsync(this);

            if (GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this) == 0)
            {
                apiClient = new GoogleApiClient.Builder(this)
                            .AddConnectionCallbacks(this)
                            .AddOnConnectionFailedListener(this)
                            .AddApi(LocationServices.API)
                            // Uncomment to test the error recovery code.
                            //.AddApi(PlusClass.API)
                            //.AddScope(PlusClass.ScopePlusLogin)
                            .Build();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_task_list);

            s_order         = FindViewById <EditText>(Resource.Id.s_order);
            s_task          = FindViewById <EditText>(Resource.Id.s_task);
            btn_abort_order = FindViewById <Button>(Resource.Id.btn_abort_order);
            btn_performed   = FindViewById <Button>(Resource.Id.btn_performed);

            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.fragmentMap);

            mapFragment.GetMapAsync(this);

            s_order.Focusable     = false;
            s_order.LongClickable = false;
            s_task.Focusable      = false;
            s_task.LongClickable  = false;

            BuildLocationRequest();
            BuildLocationCallBack();

            fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this);

            //ResetUser();
            fusedLocationProviderClient.RequestLocationUpdates(locationRequest,
                                                               locationCallback, Looper.MyLooper());
        }
        // Initialize the map
        private void SetUpMap()
        {
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            // Call GetMapAsync Method for map deployment in this activity
            mapFragment.GetMapAsync(this);
        }
Beispiel #5
0
        void ShowNotes(int ViewId)
        {
            selectViewId = ViewId;
            if (showingTwoFragments)
            {
                ListView.SetItemChecked(selectViewId, true);

                var NoteFragment = FragmentManager.FindFragmentById(Resource.Id.note_container) as ViewNoteFragment;

                if (NoteFragment == null || NoteFragment.ViewId != ViewId)
                {
                    var container = Activity.FindViewById(Resource.Id.note_container);
                    var NoteFrag  = ViewNoteFragment.NewInstance(selectViewId);

                    FragmentTransaction ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.note_container, NoteFrag);
                    ft.Commit();
                }
            }
            else
            {
                var intent = new Intent(Activity, typeof(ViewNoteActivity));
                intent.PutExtra("current_note_id", ViewId);
                StartActivity(intent);
            }
        }
Beispiel #6
0
 private void SetupMap()
 {
     if (Gmap == null)
     {
         FragmentManager.FindFragmentById <MapFragment>(Resource.Id.googlemap).GetMapAsync(this);
     }
 }
Beispiel #7
0
 void InitMapFragment()
 {
     if (map == null)
     {
         FragmentManager.FindFragmentById <MapFragment>(Resource.Id.map).GetMapAsync(this);
     }
 }
Beispiel #8
0
        public void OnLocationChanged(Location location)
        {
            _currentLocation = location;
            if (_currentLocation == null)
            {
                Toast.MakeText(this, "current location not available", ToastLength.Short).Show();
            }
            else
            {
                _locationText = string.Format("{0:f6},{1:f6}", _currentLocation.Latitude, _currentLocation.Longitude);
                latitude      = _currentLocation.Latitude;
                longitude     = _currentLocation.Longitude;

                MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
                GoogleMap   map     = mapFrag.Map;
                map.Clear();

                map.SetOnInfoWindowClickListener(this);

                mountainsRepository = new MountainsService();
                mMountains          = mountainsRepository.GetAllMountains();

                foreach (Mountain item in mMountains)
                {
                    marker = map.AddMarker(new MarkerOptions()
                                           .SetPosition(new LatLng(item.Lat, item.Lng))
                                           .SetTitle(item.MtName)
                                           .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));
                }
            }
        }
Beispiel #9
0
        public override void OnListItemClick(ListView l, View v, int position, long id)
        {
            string videoId = VIDEO_LIST[position].videoId;

            VideoFragment videoFragment =
                (VideoFragment)FragmentManager.FindFragmentById(Resource.Id.video_fragment_container);

            videoFragment.SetVideoId(videoId);

            // The videoBox is INVISIBLE if no video was previously selected, so we need to show it now.
            if (videoBox.Visibility != ViewStates.Visible)
            {
                if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait)
                {
                    // Initially translate off the screen so that it can be animated in from below.
                    videoBox.TranslationY = (videoBox.Height);
                }
                videoBox.Visibility = ViewStates.Visible;
            }

            // If the fragment is off the screen, we animate it in.
            if (videoBox.TranslationY > 0)
            {
                videoBox.Animate().TranslationY(0).SetDuration(300);//ANIMATION_DURATION_MILLIS
            }
        }
Beispiel #10
0
        private void FillData()
        {
            // Get all of the rows from the database and create the item list
            ICursor filesCursor = _dbHelper.FetchAllFiles();

            StartManagingCursor(filesCursor);

            // Create an array to specify the fields we want to display in the list
            // (only TITLE)
            String[] from = new[] { FileDbHelper.KeyFileFilename };

            // and an array of the fields we want to bind those fields to (in this
            // case just text1)
            int[] to = new[] { Resource.Id.file_filename };

            /*
             * // Now create a simple cursor adapter and set it to display
             * SimpleCursorAdapter recentFilesAdapter = new SimpleCursorAdapter(this,
             *                                                  Resource.Layout.file_row, filesCursor, from, to);
             *
             *
             * recentFilesAdapter.ViewBinder = new MyViewBinder(App.Kp2a);
             */
            FragmentManager.FindFragmentById <RecentFilesFragment>(Resource.Id.recent_files).SetAdapter(new MyCursorAdapter(this, filesCursor, App.Kp2a));
        }
Beispiel #11
0
        protected override void OnStart()
        {
            base.OnStart();
            LogHelper.Debug(Tag, "Activity onStart");

            controlsFragment = FragmentManager.FindFragmentById <PlaybackControlsFragment>(Resource.Id.fragment_playback_controls);
            if (controlsFragment == null)
            {
                throw new Exception("Mising fragment with id 'controls'. Cannot continue.");
            }

            HidePlaybackControls();

            var permissionsList = new List <string>();

            if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) == Permission.Granted)
            {
                mediaBrowser.Connect();
            }
            else
            {
                permissionsList.Add(Manifest.Permission.ReadExternalStorage);
            }

            if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.RecordAudio) != Permission.Granted)
            {
                permissionsList.Add(Manifest.Permission.RecordAudio);
            }

            if (permissionsList.Count > 0)
            {
                ActivityCompat.RequestPermissions(this, permissionsList.ToArray(), RequestCodeAskPermissions);
                return;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            // Load the fragment used by both layouts (landscape and portrait)
            // Note: The fragment has the ID of its container
            FragmentTransaction ft        = FragmentManager.BeginTransaction();
            Fragment            helloFrag = FragmentManager.FindFragmentById(Resource.Id.fragLayout);

            if (helloFrag != null)
            {
                ft.Remove(helloFrag);
            }
            helloFrag = new HelloFrag();
            ft.Add(Resource.Id.fragLayout, helloFrag);
            ft.Commit();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++);
            };
        }
Beispiel #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            spinner = FindViewById <Spinner>(Resource.Id.spinner);
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            mapFragment.GetMapAsync(this);


            spinner.ItemSelected += Spinner_ItemSelected;


            locationManager = (LocationManager)GetSystemService(Context.LocationService);
            provider        = locationManager.GetBestProvider(new Criteria(), false);

            Location location = locationManager.GetLastKnownLocation(provider);

            if (location == null)
            {
                System.Diagnostics.Debug.WriteLine("No Location");
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Map);

            // Create your application here
            ImageButton img_Back = FindViewById <ImageButton>(Resource.Id.imageButton_Back);

            img_Back.Click += Img_Back_Click;
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            mapFragment.GetMapAsync(this);
            locationManager = (LocationManager)GetSystemService(Context.LocationService);
            provider        = locationManager.GetBestProvider(new Criteria(), false);

            Location location = locationManager.GetLastKnownLocation(provider);

            if (location == null)
            {
                System.Diagnostics.Debug.WriteLine("ERROR");
            }
            //
            FnProcessOnMap();
        }
Beispiel #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
            GoogleMap   map         = mapFragment.Map;

            // TODO: move this to a listener instead
            map.MyLocationEnabled = true;

            var location = map.MyLocation;

            if (location == null)
            {
                LocationManager locationManager = (LocationManager)GetSystemService(Service.LocationService);
                Criteria        criteria        = new Criteria();
                String          provider        = locationManager.GetBestProvider(criteria, true);
                location = locationManager.GetLastKnownLocation(provider);
            }
            if (location != null)
            {
                // TODO: get marker from Parse
                var latlong = new LatLng(location.Latitude, location.Longitude);
                map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(latlong, 16));

                MarkerOptions markerOption = new MarkerOptions();
                markerOption.SetPosition(latlong);
                markerOption.SetTitle("Ganteng");
                markerOption.InvokeIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.Icon));
                map.AddMarker(markerOption);
            }
        }
Beispiel #16
0
        protected virtual Fragment FindFragmentInChildren(string fragmentName, FragmentManager fragManager)
        {
            if (fragManager.BackStackEntryCount == 0)
            {
                return(null);
            }

            for (int i = 0; i < fragManager.BackStackEntryCount; i++)
            {
                var parentFrag = fragManager.FindFragmentById(fragManager.GetBackStackEntryAt(i).Id);

                //let's try again finding it
                var frag = parentFrag?.ChildFragmentManager?.FindFragmentByTag(fragmentName);

                //if we found the frag lets return it!
                if (frag != null)
                {
                    return(frag);
                }

                //reloop for other fragments
                FindFragmentInChildren(fragmentName, parentFrag?.ChildFragmentManager);
            }

            return(null);
        }
Beispiel #17
0
        //to change map view

        /*
         * gmap.MapType = GoogleMap.MapTypeNormal; ect
         *
         * */

        public void SetUpMap()
        {
            if (gmap == null)
            {
                FragmentManager.FindFragmentById <MapFragment>(Resource.Id.mapa).GetMapAsync(this); //GetMapAsync zove OnMapReady
            }
        }
Beispiel #18
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.MapView);
            vm = ViewModel as MapViewModel;

            // init Google Maps MapFragment
            var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.MapViewMap) as MapFragment;

            mapFragment.GetMapAsync(this);

/*            GoogleMap map = mapFrag.Map;
 *          if (map != null)
 *          {
 *              // The GoogleMap object is ready to go.
 *              map.MapType = GoogleMap.MapTypeNormal;
 *              map.UiSettings.ZoomControlsEnabled = true;
 *              map.UiSettings.CompassEnabled = true;
 *              map.UiSettings.MapToolbarEnabled = true;
 *              map.UiSettings.MyLocationButtonEnabled = true;
 *
 *              moveCamera();
 *          }
 */
        }
Beispiel #19
0
 /// <summary>
 /// init Map on layot
 /// </summary>
 public void initializeMap()
 {
     if (mMap == null)
     {
         FragmentManager.FindFragmentById <MapFragment>(Resource.Id.map).GetMapAsync(this);
     }
 }
        private void ShowDetails(int playId)
        {
            _currentPlayId = playId;
            if (_isDualPane)
            {
                // We can display everything in-place with fragments.
                // Have the list highlight this item and show the data.
                ListView.SetItemChecked(playId, true);

                // Check what fragment is shown, replace if needed.
                var details = FragmentManager.FindFragmentById(Resource.Id.details) as DetailsFragment;
                if (details == null || details.ShownPlayId != playId)
                {
                    // Make new fragment to show this selection.
                    details = DetailsFragment.NewInstance(playId);

                    // Execute a transaction, replacing any existing
                    // fragment with this one inside the frame.
                    var ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.details, details);
                    ft.SetTransition(FragmentTransaction.TransitFragmentFade);
                    ft.Commit();
                }
            }
            else
            {
                // Otherwise we need to launch a new activity to display
                // the dialog fragment with selected text.
                var intent = new Intent();

                intent.SetClass(Activity, typeof(DetailsActivity));
                intent.PutExtra("current_play_id", playId);
                StartActivity(intent);
            }
        }
Beispiel #21
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Map);

            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);

            map = mapFrag.Map;

            if (map != null)
            {
                MarkerOptions opt1 = new MarkerOptions();

                double lat     = Convert.ToDouble(Intent.GetStringExtra("Latitude"));
                double lng     = Convert.ToDouble(Intent.GetStringExtra("Longitude"));
                string address = Intent.GetStringExtra("Address");

                LatLng location = new LatLng(lat, lng);
                opt1.SetPosition(location);
                opt1.SetTitle(address);
                map.AddMarker(opt1);

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(15);

                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                map.MoveCamera(cameraUpdate);
            }
        }
Beispiel #22
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.FirstView);

            var viewModel = (FirstViewModel)ViewModel;

            var mapFragment = (MapFragment)FragmentManager.FindFragmentById <MapFragment>(Resource.Id.map);

            map = mapFragment.Map;


            //MarkOnMap("keith", new LatLng(viewModel.Keith.Location.Lat, viewModel.Keith.Location.Lng));
            //MarkOnMap("Helen", new LatLng(viewModel.Helen.Location.Lat, viewModel.Helen.Location.Lng));

            //var options = new MarkerOptions();
            //options.SetPosition(new LatLng(viewModel.Keith.Location.Lat, viewModel.Keith.Location.Lng));
            //options.SetTitle("keith");
            //map.AddMarker(options);

            //var options2 = new MarkerOptions();
            //options2.SetPosition(new LatLng(viewModel.Helen.Location.Lat, viewModel.Helen.Location.Lng));
            //options2.SetTitle("helen");
            //map.AddMarker(options2);

            //UpdateCameraPosition(new LatLng(viewModel.Helen.Location.Lat, viewModel.Helen.Location.Lng));

            FnDrawPath("Aalborg", "Herning");
        }
Beispiel #23
0
        protected override void OnStart()
        {
            base.OnStart();

            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.mapContainer);

            this.map = mapFrag.Map;
            if (this.map != null)
            {
                // The GoogleMap object is ready to go.
                if (this.cameraUpdate == null)
                {
                    InitMapInRegion();
                }
                this.map.MarkerClick  += OnMapMarkerClick;
                this.map.MapClick     += OnMapClick;
                this.map.MapLongClick += MapLongClick;

                // Clean Map to ensure to load new items created at Tools
                ClearMap();

                // Load Markers
                InitMarkers();
            }
        }
Beispiel #24
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
            GoogleMap   map     = mapFrag.Map;

            if (map != null)
            {
                LatLng location = new LatLng(-23.549852, -46.633935);

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(16);

                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                map.MoveCamera(cameraUpdate);

                map.MyLocationEnabled = true;


                MarkerOptions markerOpt1 = new MarkerOptions();
                markerOpt1.SetPosition(new LatLng(-23.550368, -46.631725));
                markerOpt1.SetTitle("Ponto Central");
                map.AddMarker(markerOpt1);
            }
        }
Beispiel #25
0
        private void Query(SearchParameters searchParams)
        {
            Group = null;
            try {
                foreach (var db in App.Kp2a.OpenDatabases)
                {
                    PwGroup resultsForThisDb = db.Search(searchParams, null);
                    if (Group == null)
                    {
                        Group = resultsForThisDb;
                    }
                    else
                    {
                        foreach (var entry in resultsForThisDb.Entries)
                        {
                            Group.AddEntry(entry, false);
                        }
                    }
                }
            } catch (Exception e) {
                Kp2aLog.LogUnexpectedError(e);
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
                Finish();
                return;
            }

            if (Group == null || (!Group.Entries.Any()))
            {
                SetContentView(Resource.Layout.group_empty);
            }

            SetGroupTitle();

            FragmentManager.FindFragmentById <GroupListFragment>(Resource.Id.list_fragment).ListAdapter = new PwGroupListAdapter(this, Group);
        }
Beispiel #26
0
 /// <summary>
 ///     Méthode permettant d'initialiser le fragment d'auto-completion de l'adresse
 /// </summary>
 private void InitializeAutoCompleteFragment()
 {
     //Etape 1 : On récupère la référence du fragment AutoCOmplete.
     autocompleteFragment = (PlaceAutocompleteFragment)FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_fragment);
     // Etape 2 : On lui attribue un Listener pour récupérer la latitude et la longitude d'un lieu renseigné.
     autocompleteFragment.SetOnPlaceSelectedListener(this);
 }
 private void setupGoogleMap()
 {
     if (gMap == null)
     {
         FragmentManager.FindFragmentById <MapFragment>(Resource.Id.mapview2).GetMapAsync(this);
     }
 }
 private void setUpMap()
 {
     if (map == null)
     {
         FragmentManager.FindFragmentById <MapFragment>(Resource.Id.map).GetMapAsync(this);
     }
 }
Beispiel #29
0
        protected override void OnResume()
        {
            if (mGoogleMap == null)
            {
                mGoogleMap = ((MapFragment)FragmentManager.FindFragmentById(Resource.Id.map)).Map;

                if (mGoogleMap != null)
                {
                    mGoogleMap.MyLocationEnabled = true;

                    var mbProvider = new MBTilesProvider();
                    var mbOptions  = new TileOverlayOptions();
                    mGoogleMap.AddTileOverlay(mbOptions.InvokeTileProvider(mbProvider));

                    //var bounds = mbProvider.bounds ();
                    //var update = CameraUpdateFactory.NewLatLngBounds(
                    //	new LatLngBounds(new LatLng(bounds[1],bounds[0]),new LatLng(bounds[3],bounds[2])),
                    //	600,600,10
                    //);

                    var zoomLatLng = mbProvider.zoomLatLng();

                    var update = CameraUpdateFactory.NewLatLngZoom(
                        new LatLng(zoomLatLng[2], zoomLatLng [1]),
                        (float)zoomLatLng [0]
                        );

                    mGoogleMap.MoveCamera(update);
                }
            }
            base.OnResume();
        }
Beispiel #30
0
        private void ShowPlayQuote(int playId)
        {
            selectedPlayId = playId;
            if (showingTwoFragments)
            {
                ListView.SetItemChecked(selectedPlayId, true);
                var playQuoteFragment = FragmentManager.FindFragmentById(Resource.Id.playquote_container)
                                        as PlayQuoteFragment;

                if (playQuoteFragment == null || playQuoteFragment.PlayId != playId)
                {
                    var constainer = Activity.FindViewById(Resource.Id.playquote_container);
                    var quoteFrag  = PlayQuoteFragment.NewInstance(selectedPlayId);

                    FragmentTransaction ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.playquote_container, quoteFrag);
                    ft.Commit();
                }
            }
            else
            {
                var intent = new Intent(Activity, typeof(PlayQuoteActivity));
                intent.PutExtra("current_play_id", playId);
                StartActivity(intent);
            }
        }
        public void OnArticleSelected(int position)
        {
            ArticleFragment articleFrag = FragmentManager.FindFragmentById <ArticleFragment>(Resource.Id.article_fragment);

            if (articleFrag != null)
            {
                articleFrag.updateArticleView(position);
            }
            else
            {
                ArticleFragment newFragment = new ArticleFragment();
                Bundle          args        = new Bundle();
                args.PutInt(ArticleFragment.ARG_POSITION, position);
                newFragment.Arguments = args;
                FragmentTransaction transaction = FragmentManager.BeginTransaction();

                // Replace whatever is in the fragment_container view with this fragment,
                // and add the transaction to the back stack so the user can navigate back
                transaction.Replace(Resource.Id.fragment_container, newFragment);
                transaction.AddToBackStack(null);

                // Commit the transaction
                transaction.Commit();
            }
        }