public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment View view = inflater.Inflate(Resource.Layout.home, container, false); SupportMapFragment mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); centerMarker = (ImageView)view.FindViewById(Resource.Id.centerMarker); mapFragment.GetMapAsync(this); // reference the accept ride views cancelTripButton = (ImageButton)view.FindViewById(Resource.Id.cancelTripButton); callRiderButton = (ImageButton)view.FindViewById(Resource.Id.callRiderButton); navigateButton = (ImageButton)view.FindViewById(Resource.Id.navigateButton); tripButton = (Button)view.FindViewById(Resource.Id.tripButton); riderNameText = (TextView)view.FindViewById(Resource.Id.riderNameText); rideInfoLayout = (LinearLayout)view.FindViewById(Resource.Id.rideInfoLayout); tripButton.Click += TripButton_Click; callRiderButton.Click += CallRiderButton_Click; navigateButton.Click += NavigateButton_Click; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var view = inflater.Inflate(Resource.Layout.StopFavoritFragment, container, false); _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>(); _favoritesViewModel.Load(); _searchFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stopfavoritfragmentfrom); var mainMapFragmentButtonSearch = view.FindViewById <Button>(Resource.Id.mainMapFragmentButtonSearch); mainMapFragmentButtonSearch.Click += (sender, e) => { HandleSearchClicked(); }; _searchFragment.Init(null, "Sök på hållplats", false, false); _searchFragment.Events.OnEvent += (object source, EventArgs e) => { var evt = (EventClassArgs)e; //if (evt.Name == "OnQueryTextSubmit") //{ // HandleSearchClicked(); //} }; return(view); }
public override void OnResume() { base.OnResume(); GMap = ChildFragmentManager.FindFragmentById <GMapFragment>(Resource.Id.gmap8485315486415); if (GMap == null) { GMap = FragmentManager.FindFragmentById <GMapFragment>(Resource.Id.gmap8485315486415); } GPlaces = new GPlacesHandler(); // registers to map events for adding the places GMap.mapReadyCallback.MapReady += (sender, args) => { var map = ((GMapHandler)sender).Map; map.CameraChange += async(s, a) => { var jsonval = await GPlaces.GetPlacesAsJSON(map.CameraPosition.Target.Latitude, map.CameraPosition.Target.Longitude, 1000); var gyms = Gym.InstatiateManyFromGeoJson(jsonval); if (gyms != null) { foreach (var gym in gyms) { Log.Debug("JSON", "" + gym); map.AddMarker(new MarkerOptions().SetPosition(new LatLng(gym.lat, gym.lng)).SetTitle(gym.name)); } } }; }; }
private void InitGoogleMap() { var mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); mapFragment.GetMapAsync(new OnMapReadyCallback(googleMap => { binding.mapSearchView.BindData(placeMapList, (_, placeMap) => { LatLng latLng = new LatLng(placeMap.latitude, placeMap.longitude); int duration = Resources.GetInteger(Resource.Integer.map_camera_move_mills); googleMap.AnimateCamera(CameraUpdateFactory.NewLatLng(latLng), duration, null); var marker = markers[placeMap.nameRes]; if (marker != null) { marker.ShowInfoWindow(); } }); binding.loadingView.Visibility = ViewStates.Gone; googleMap.MapType = GoogleMap.MapTypeNormal; googleMap.SetIndoorEnabled(true); googleMap.BuildingsEnabled = true; googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(LAT_LNG_CENTER, DEFAULT_ZOOM)); var mapUiSettings = googleMap.UiSettings; mapUiSettings.CompassEnabled = true; RenderMarkers(placeMapList, googleMap); })); }
public override bool OnBackPressed() { // Current view is listview if (ChildFragmentManager.BackStackEntryCount == 1) { return(true); } else { ChildFragmentManager.PopBackStack(); ChildFragmentManager.ExecutePendingTransactions(); // Do not show back on the actionbar when current fragment is ItemsListFragment var showFragment = ChildFragmentManager.FindFragmentById(Resource.Id.master_single); try { if (showFragment.JavaCast <ItemsListFragment>() != null) { ShowBackOnActionBar(false); } } catch { } } return(false); }
private void ConnectViews(View view) { var mapFragment = ChildFragmentManager.FindFragmentById(Resource.Id.fragMap).JavaCast <SupportMapFragment>(); mapFragment.GetMapAsync(this); // Toast.MakeText(context,$"{lat} + {lon}", ToastLength.Long).Show(); }
private void SetUpMap() { if (gmap == null) { // Activity. FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map).GetMapAsync(this); mFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); mFragment.GetMapAsync(this); } }
/// <summary> /// Ons the create view. /// </summary> /// <returns>The create view.</returns> /// <param name="inflater">Inflater.</param> /// <param name="container">Container.</param> /// <param name="savedInstanceState">Saved instance state.</param> public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { scale = Context.Resources.DisplayMetrics.Density; int pixels = 0; if (v == null) { v = (ViewGroup)inflater.Inflate(Resource.Layout.sucursales_fragment, container, false); } cordinatorSucursales = v.FindViewById <CoordinatorLayout>(Resource.Id.cordinatorSucursales); btnLogout = v.FindViewById <ImageButton>(Resource.Id.btnLogout); btnVolver = v.FindViewById <ImageView>(Resource.Id.btnVolver); linearLayoutBtnIrAMapasDeTienda = v.FindViewById <LinearLayout>(Resource.Id.linearLayoutBtnIrAMapasDeTienda); lblNombreActivity = v.FindViewById <TextView>(Resource.Id.lblNombreActivity); btnVolver.Visibility = ViewStates.Invisible; btnLogout.Visibility = ViewStates.Invisible; linearLayoutBtnIrAMapasDeTienda.Visibility = ViewStates.Invisible; lblNombreActivity.Text = "¿En qué tienda estás?"; sheet_suc = v.FindViewById <LinearLayout>(Resource.Id.linear_sheet_sucursales); linear_mapa = v.FindViewById <LinearLayout>(Resource.Id.linear_mapa); listaVacia = v.FindViewById <LinearLayout>(Resource.Id.sucursal_lista_vacia); CoordinatorLayout.LayoutParams linearLayoutParams = new CoordinatorLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); if (isVertical) { pixels = (int)(360 * scale + 0.5f); bottomSheetBehavior_suc = BottomSheetBehavior.From(sheet_suc); bottomSheetBehavior_suc.PeekHeight = pixels; } else { ViewGroup.LayoutParams parameters = (ViewGroup.LayoutParams)sheet_suc.LayoutParameters; parameters.Width = 500; parameters.Height = 660; if (parameters is ViewGroup.MarginLayoutParams) { ((ViewGroup.MarginLayoutParams)parameters).LeftMargin = 780; } sheet_suc.LayoutParameters = parameters; pixels = (int)(0 * scale + 0.5f); } linearLayoutParams.SetMargins(0, 0, 0, pixels); linear_mapa.LayoutParameters = linearLayoutParams; recycler = v.FindViewById <RecyclerView>(Resource.Id.mi_recycler_view_sucursales); adapter = new AdapterSucursal(DataManager.Sucursales, this); adapter.itemClick += OnItemClick; recycler.SetAdapter(adapter); layoutManager = new LinearLayoutManager(Activity); recycler.SetLayoutManager(layoutManager); mf = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map_sucursales); mf.GetMapAsync(this); ThreadPool.QueueUserWorkItem(o => cargaServicios()); RetainInstance = true; return(v); }
protected override void OnGotFocus() { base.OnGotFocus(); // Late load map if (mapFragment == null) { mapFragment = ChildFragmentManager.FindFragmentById(Resource.Id.NearbyMapFragment_Map) as SupportMapFragment; mapFragment.GetMapAsync(this); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment View view = inflater.Inflate(Resource.Layout.home, container, false); SupportMapFragment MapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); MapFragment.GetMapAsync(this); InitializeLocationManager(); return(view); }
public override void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); // Capture the Map Fragment SupportMapFragment mapFragment = ChildFragmentManager.FindFragmentById(Resource.Id.gmap).JavaCast <SupportMapFragment>(); if (mapFragment == null) { mapFragment = SupportMapFragment.NewInstance(); mapFragment.GetMapAsync(this); } mapFragment.GetMapAsync(this); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.home, container, false); SupportMapFragment mapFragment = ChildFragmentManager.FindFragmentById(Resource.Id.map).JavaCast <SupportMapFragment>(); mapFragment.GetMapAsync(new OnMapReady(map => { mainMap = map; })); profileImg = (_BaseCircleImageView)view.FindViewById(Resource.Id.home_iv); profileImg.Click += ProfileImg_Click; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.EditGroupedTimeEntryFragment, container, false); editTimeEntryFragment = (SimpleEditTimeEntryFragment)ChildFragmentManager.FindFragmentById(Resource.Id.TimeEntryEditChildFragment); HasOptionsMenu = true; recyclerView = view.FindViewById <RecyclerView> (Resource.Id.recyclerView); recyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); recyclerView.AddItemDecoration(new DividerItemDecoration(Activity, DividerItemDecoration.VerticalList)); return(view); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); var mapFragment = (SupportMapFragment)ChildFragmentManager .FindFragmentById(Resource.Id.map); if (mapFragment == null) { return; } mapFragment.GetMapAsync(this); }
public void InsertFragmentIntoContainer(BaseFragment fragment, int container) { var exFragment = ChildFragmentManager.FindFragmentById(container); FragmentTransaction childFragTrans = ChildFragmentManager.BeginTransaction(); if (exFragment == null) { childFragTrans.Add(container, fragment); } else { childFragTrans.Replace(container, fragment); } childFragTrans.CommitAllowingStateLoss(); }
void ShowFragment(Fragment fragment, int id) { var fragmentTransaction = ChildFragmentManager.BeginTransaction(); var showFragment = ChildFragmentManager.FindFragmentById(id); if (showFragment == null) { fragmentTransaction.Add(id, fragment); } else { fragmentTransaction.Remove(showFragment).Add(id, fragment); } fragmentTransaction.Commit(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment v = (ViewGroup)inflater.Inflate(Resource.Layout.maps_fragment, container, false); mf = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); mf.GetMapAsync(this); return(v); //return base.OnCreateView(inflater, container, savedInstanceState); }
void ShowFragment(Fragment fragment) { var fragmentTransaction = ChildFragmentManager.BeginTransaction(); var showFragment = ChildFragmentManager.FindFragmentById(Resource.Id.list_single); if (showFragment == null) { fragmentTransaction.Add(Resource.Id.list_single, fragment); } else { fragmentTransaction.Hide(showFragment).Add(Resource.Id.list_single, fragment); } fragmentTransaction.AddToBackStack(fragment.Class.Name); fragmentTransaction.Commit(); }
// gets the reference to the map instance private void SetUpMapIfNeeded() { mapFragment = ChildFragmentManager.FindFragmentById<MapFragment>(Resource.Id.map9879468784687); if (mapFragment == null) { mapFragment = FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map9879468784687); } if (Map == null) { // registers an event to the handler (implements the callback concept) mapReadyCallback.MapReady += (sender, args) => { Map = ((GMapHandler)sender).Map; SetUpMap(); }; mapFragment.GetMapAsync(mapReadyCallback); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { var layout = inflater.Inflate(Resource.Layout.mapfrag, container, false); var mapFrag = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); mapFrag.GetMapAsync(this); MapReadyAction += delegate(GoogleMap googleMap) { Map = googleMap; MapType = MapTypeToNum(Settings.MapType); Map.MapType = MapType; Map.UiSettings.ZoomControlsEnabled = false; Map.UiSettings.CompassEnabled = false; }; return(layout); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.Lab6Fragment, container, false); Spinner spinner = view.FindViewById <Spinner>(Resource.Id.spinner); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected); Adapter = new SpinnerAdapter(inflater.Context, Android.Resource.Layout.SimpleSpinnerDropDownItem, Android.Resource.Layout.SimpleSpinnerItem); spinner.Adapter = Adapter; if (mapFragment == null) { mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); mapFragment.GetMapAsync(this); } Activity.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.map, mapFragment).Commit(); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { _context = inflater.Context; _view = inflater.Inflate(Resource.Layout.activity_fragment, container, false); FindViews(); LinkEventHandlers(); var mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.googleMap); mapFragment.GetMapAsync(this); _rankingLayoutManager = new LinearLayoutManager(inflater.Context); _rankingAdapter = new RankingAdapter(); _rankingRecyclerView.SetLayoutManager(_rankingLayoutManager); _rankingRecyclerView.SetAdapter(_rankingAdapter); SetNewRoute(); BindData(); return(_view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.home, container, false); SupportMapFragment mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); _centerMarker = view.FindViewById <ImageView>(Resource.Id.centerMarker); mapFragment.GetMapAsync(this); _cancelTripButton = view.FindViewById <ImageButton>(Resource.Id.cancelTripButton); _callRiderButton = view.FindViewById <ImageButton>(Resource.Id.callRiderButton); _navigateButton = view.FindViewById <ImageButton>(Resource.Id.navigateButton); _tripButton = view.FindViewById <Button>(Resource.Id.tripButton); _riderNameText = view.FindViewById <TextView>(Resource.Id.riderNameText); _rideInfoLayout = view.FindViewById <LinearLayout>(Resource.Id.rideInfoLayout); _tripButton.Click += TripButton_Click; _callRiderButton.Click += CallRiderButton_Click; _navigateButton.Click += NavigateButton_Click; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var view = inflater.Inflate(Resource.Layout.StopsFavoritFragment, container, false); _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>(); _favoritesViewModel.Load(); _searchFromFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stopsfavoritfragmentfrom); _searchToFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stopsfavoritfragmentto); _searchFromFragment.Init(null, "Sök från hållplats", false, false); _searchToFragment.Init(null, "Sök till hållplats", false, false); var mainMapFragmentButtonSearch = view.FindViewById <Button>(Resource.Id.mainMapFragmentButtonSearch); mainMapFragmentButtonSearch.Click += (sender, e) => { HandleSearchClicked(); }; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.map, container, false); //Map mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); //Place if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(Activity, "AIzaSyBYxu6LmRE5baH64VLCfgZFJo1xaImdZw4"); } //TextViews startDestinationText = view.FindViewById <TextView>(Resource.Id.txtStartDestination); endDestinationText = view.FindViewById <TextView>(Resource.Id.txtEndDestination); TimerText = view.FindViewById <TextView>(Resource.Id.txtTimer); TimerTotalText = view.FindViewById <TextView>(Resource.Id.txtTotalTime); DistanceTotalText = view.FindViewById <TextView>(Resource.Id.txtTotalDistance); SpeedText = view.FindViewById <TextView>(Resource.Id.txtSpeed); //Buttons startRadio = view.FindViewById <RadioButton>(Resource.Id.rbtnStartDestination); endRadio = view.FindViewById <RadioButton>(Resource.Id.rbtnEndDestination); mapStartButton = view.FindViewById <Button>(Resource.Id.btnMapStart); mapDoneButton = view.FindViewById <Button>(Resource.Id.btnMapDone); datasheetDoneButton = view.FindViewById <Button>(Resource.Id.btnDatasheetDone); //ImageView centreMarker = view.FindViewById <ImageView>(Resource.Id.centreMarker); runCentreMarker = view.FindViewById <ImageView>(Resource.Id.runCentreMarker); //Layouts layoutStartDestination = view.FindViewById <RelativeLayout>(Resource.Id.layoutStartDestination); layoutEndDestination = view.FindViewById <RelativeLayout>(Resource.Id.layoutEndDestination); //Bottomsheets FrameLayout timerView = view.FindViewById <FrameLayout>(Resource.Id.timer_bottomsheet); timerBottomSheetBehaviour = BottomSheetBehavior.From(timerView); FrameLayout datasheetView = view.FindViewById <FrameLayout>(Resource.Id.datasheet_bottomsheet); datasheetBottomSheetBehaviour = BottomSheetBehavior.From(datasheetView); //Methods mapFragment.GetMapAsync(this); CheckLocationPermission(); CreateLocationRequest(); GetMyLocation(); StartLocationUpdates(); //Events layoutStartDestination.Click += LayoutStartDestination_Click; layoutEndDestination.Click += LayoutEndDestination_Click; startRadio.Click += StartRadio_Click; endRadio.Click += EndRadio_Click; mapStartButton.Click += MapStartButton_Click; datasheetDoneButton.Click += DatasheetDoneButton_Click; mapDoneButton.Click += MapDoneButton_Click; return(view); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { SupportMapFragment mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.mapnew); mapFragment.GetMapAsync(this); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment _view = inflater.Inflate(Resource.Layout.StoppingPlacesCard, container, false); _stoppingPlacesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.StoppingPlacesViewModel> (); _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>(); _favoritesViewModel.Load(); _root = (ViewGroup)_view.FindViewById(stops.Resource.Id.stoppingPlacesCardRoot); FavoriteBridge.Instance.OnEvent += (source, e) => { var evt = (EventClassArgs)e; if (evt.Name == "FavoriteSelected") { var data = (Favorite)evt.Data; if (data.fromName != null && data.toName != null) { _searchFromFragment.SetChoicedStop(new StoppingPlace() { Name = data.fromName, Id = data.fromId, Lat = data.fromLat, Lon = data.fromLon }); _searchToFragment.SetChoicedStop(new StoppingPlace() { Name = data.toName, Id = data.toId, Lat = data.toLat, Lon = data.toLon }); } } }; /* * Handle Date for search */ _dateFragment = (DateFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stoppingPlacesCardDate); _dateFragment.Events.OnEvent += (object source, EventArgs e) => { var evt = (EventClassArgs)e; if (evt.Name == "favoritebuttonclicked") { HandleAddFavorite(); } }; _dateFragment.Init(true); /* * Handle stop search from */ _searchFromFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stoppingPlacesCardSearchFromStops); _searchFromFragment.Events.OnEvent += (object source, EventArgs e) => { var evt = (EventClassArgs)e; if (evt.Name == "itemclicked") { //PerformSearch(); } else if (evt.Name == "locationClick") { ShowMapFragment(); } if (evt.Name == "OnQueryTextSubmit") { HandleSearchClicked(); } }; _searchFromFragment.Init("StoppingPlacesFromLastStop", "Från", false, true); /* * Handle stop search to */ _searchToFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stoppingPlacesCardSearchToStops); _searchToFragment.Events.OnEvent += (object source, EventArgs e) => { var evt = (EventClassArgs)e; if (evt.Name == "itemclicked") { //PerformSearch(); } else if (evt.Name == "locationClick") { //ShowMapFragment(); } if (evt.Name == "OnQueryTextSubmit") { HandleSearchClicked(); } }; _searchToFragment.Init("StoppingPlacesToLastStop", "Till", true, true); /* * Handle arrival spinner */ // var spinner = (Spinner)_view.FindViewById (stops.Resource.Id.stoppingPlacesCardDepartureSpinner); // spinner.ItemSelected += (sender, e) => { // // }; // var adapter = ArrayAdapter.CreateFromResource ( // Android.App.Application.Context, Resource.Array.when_array,Resource.Layout.SpinnerText); // // adapter.SetDropDownViewResource (Resource.Layout.Spinner); // spinner.Adapter = adapter; // SetUpDragAndDrop(); //PerformSearch (); MapBridge.Instance.OnEvent += (source, e) => { var evt = ((EventClassArgs)e); if (evt.Name == "stoppingplaceselected") { var data = (StoppingPlace)evt.Data; if (listenToStoppingPlaceSelectedEvent) { if (stoppingPlaceInt == 0) { _searchFromFragment.SetChoicedStop(data); } else { _searchToFragment.SetChoicedStop(data); } stoppingPlaceInt++; if (stoppingPlaceInt > 1) { stoppingPlaceInt = 0; } } } if (evt.Name == "ViewPagerPosition") { var data = (int)evt.Data; if (data == 1) { listenToStoppingPlaceSelectedEvent = true; } else { listenToStoppingPlaceSelectedEvent = false; } } if (evt.Name == "SearchButtonClicked") { HandleSearchClicked(); } }; return(_view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /* * Load view model */ _view = inflater.Inflate(Resource.Layout.StoppingPlaceCard, container, false); _stoppingPlaceViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.StoppingPlaceViewModel> (); _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>(); _favoritesViewModel.Load(); /* * Setup listview */ _root = (ViewGroup)_view.FindViewById(stops.Resource.Id.layout_container); // // ((FrameLayout)headerview.Parent).RemoveView(headerview); // var recyclerView = _view.FindViewById <RecyclerView>(Resource.Id.recyclerview); recyclerView.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false)); recyclerView.HasFixedSize = true; // items var elements = new List <string>(0); for (int i = 0; i < 0; i++) { elements.Add("row " + i); } recyclerView.SetAdapter(new SimpleRecyclerAdapter(Activity, elements)); FavoriteBridge.Instance.OnEvent += (source, e) => { var evt = (EventClassArgs)e; if (evt.Name == "FavoriteSelected") { var data = (Favorite)evt.Data; if (data.fromName != null && data.toName == null) { _searchFragment.SetChoicedStop(new StoppingPlace() { Name = data.fromName, Id = data.fromId, Lat = data.fromLat, Lon = data.fromLon }); } } }; /* * Handle stop search */ _searchFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stoppingPlaceCardSearchStop); _searchFragment.Events.OnEvent += (object source, EventArgs e) => { var evt = (EventClassArgs)e; if (evt.Name == "itemclicked" || evt.Name == "initWithStop") { //PerformSearch(); } else if (evt.Name == "locationClick") { //ShowMapFragment(); } if (evt.Name == "OnQueryTextSubmit") { HandleSearchClicked(); } }; /* * Handle Date for search */ _dateFragment = (DateFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stoppingPlaceCardDateStop); _dateFragment.Events.OnEvent += (object source, EventArgs e) => { var evt = (EventClassArgs)e; if (evt.Name == "Dateupdated") { //PerformSearch(); } }; _dateFragment.Init(); _searchFragment.Init("StoppingPlaceLastStop", "Hållplats", false, false, true); MapBridge.Instance.OnEvent += (source, e) => { var evt = ((EventClassArgs)e); if (evt.Name == "stoppingplaceselected") { var data = (StoppingPlace)evt.Data; if (listenToStoppingPlaceSelectedEvent) { _searchFragment.SetChoicedStop(data); } } if (evt.Name == "ViewPagerPosition") { var data = (int)evt.Data; if (data == 0) { listenToStoppingPlaceSelectedEvent = true; } else { listenToStoppingPlaceSelectedEvent = false; } } if (evt.Name == "SearchButtonClicked") { HandleSearchClicked(); } }; return(_view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.backup_path_fragment, container, false); backupPathLayout = view.FindViewById <LinearLayout>(Resource.Id.backup_path_layout); coordinatorLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.coordinator_layout); string backupPath = Pref.BackupPath; backupPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.backup_path_fragment); backupPathFragment.RefreshFilesList(backupPath); backupPathFragment.SnackbarView = coordinatorLayout; //backupPathFragment.PrefKey = Pref.BackupPathKey; etBackupPath = view.FindViewById <EditText>(Resource.Id.etBackupPath); etBackupPath.Text = backupPath; etBackupPath.FocusChange += (object sender, View.FocusChangeEventArgs e) => { try { var dir = new DirectoryInfo(etBackupPath.Text); if (dir.IsDirectory()) { Pref.BackupPath = etBackupPath.Text; } else { Show("잘못된 경로: " + etBackupPath.Text); etBackupPath.Text = Pref.BackupPath; } } catch { Show("잘못된 경로: " + etBackupPath.Text); etBackupPath.Text = Pref.BackupPath; } backupPathFragment.RefreshFilesList(etBackupPath.Text); }; etBackupPath.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) { var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(etBackupPath.WindowToken, 0); etBackupPath.ClearFocus(); e.Handled = true; } }; backupPathToolbar = view.FindViewById <Toolbar>(Resource.Id.backup_path_toolbar); backupPathToolbar.InflateMenu(Resource.Menu.toolbar_backup_path_menu); backupPathToolbar.MenuItemClick += (sender, e) => { switch (e.Item.ItemId) { case Resource.Id.toolbar_backup_path_menu_up: OnBackPressedFragment(); break; case Resource.Id.toolbar_backup_path_menu_home: Refresh(Pref.BackupPath); break; case Resource.Id.toolbar_backup_path_menu_restore: Show(Restore()); break; } }; fab = view.FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += (sender, e) => { Show(Backup()); }; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.work_path_fragment, container, false); workPathLayout = view.FindViewById <LinearLayout>(Resource.Id.work_path_layout); coordinatorLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.coordinator_layout); string workPath = Pref.WorkPath; workPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.work_path_fragment); workPathFragment.RefreshFilesList(workPath); workPathFragment.SnackbarView = coordinatorLayout; //workPathFragment.PrefKey = Pref.WorkPathKey; etWorkPath = view.FindViewById <EditText>(Resource.Id.etWorkPath); etWorkPath.Text = workPath; etWorkPath.FocusChange += (object sender, View.FocusChangeEventArgs e) => { try { var dir = new DirectoryInfo(etWorkPath.Text); if (dir.IsDirectory()) { Pref.WorkPath = etWorkPath.Text; } else { Show("잘못된 경로: " + etWorkPath.Text); etWorkPath.Text = Pref.WorkPath; } } catch { Show("잘못된 경로: " + etWorkPath.Text); etWorkPath.Text = Pref.WorkPath; } workPathFragment.RefreshFilesList(etWorkPath.Text); }; etWorkPath.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) { var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(etWorkPath.WindowToken, 0); etWorkPath.ClearFocus(); e.Handled = true; } }; workPathToolbar = view.FindViewById <Toolbar>(Resource.Id.work_path_toolbar); workPathToolbar.InflateMenu(Resource.Menu.toolbar_work_path_menu); workPathToolbar.MenuItemClick += (sender, e) => { //Toast.MakeText(this, "Bottom toolbar pressed: " + e.Item.TitleFormatted, ToastLength.Short).Show(); bool ret; switch (e.Item.ItemId) { case Resource.Id.toolbar_work_path_menu_up: OnBackPressedFragment(); break; case Resource.Id.toolbar_work_path_menu_home: if (!Refresh(Pref.WorkPath)) { Show("경로 이동 실패: " + Pref.WorkPath); } break; case Resource.Id.toolbar_work_path_menu_storage: if (!Refresh("/storage")) { Show("경로 이동 실패: " + "/storage"); } break; case Resource.Id.toolbar_work_path_menu_sdcard: if (!Refresh(Environment.ExternalStorageDirectory.AbsolutePath)) { Show("경로 이동 실패: " + Environment.ExternalStorageDirectory.AbsolutePath); } break; case Resource.Id.toolbar_work_path_menu_extsdcard: ret = false; try { var dir = new DirectoryInfo("/storage"); foreach (var item in dir.GetDirectories()) { if (item.Name.ToLower().StartsWith("ext") || item.Name.ToLower().StartsWith("sdcard1")) { foreach (var subItem in item.GetFileSystemInfos()) { if (Refresh(item.FullName)) { ret = true; break; } } } } } catch { } if (!ret) { Show("경로 이동 실패: " + "SD 카드"); } break; case Resource.Id.toolbar_work_path_menu_usbstorage: ret = false; try { var dir = new DirectoryInfo("/storage"); foreach (var item in dir.GetDirectories()) { if (item.Name.ToLower().StartsWith("usb")) { foreach (var subItem in item.GetFileSystemInfos()) { if (Refresh(item.FullName)) { ret = true; break; } } } } } catch { } if (!ret) { Show("경로 이동 실패: " + "USB 저장소"); } break; } }; fab = view.FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += (sender, e) => { etWorkPath.Text = workPathFragment.DirPath; Pref.WorkPath = etWorkPath.Text; workPathFragment.RefreshFilesList(); Show("경로 설정 완료: " + etWorkPath.Text); }; return(view); }