// Overridden from Activity; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ActionBar.SetDisplayHomeAsUpEnabled(true); SetContentView(Resource.Layout.activity_fluid_manager); colorView = FindViewById(Resource.Id.color); fluidNameView = FindViewById <TextView>(Resource.Id.name); pagerView = FindViewById <ViewPager>(Resource.Id.content); pagerView.AddOnPageChangeListener(this); favoritesButton = FindViewById <Button>(Resource.Id.button1); libraryButton = FindViewById <Button>(Resource.Id.button2); favoritesButton.Click += (sender, e) => { pagerView.SetCurrentItem(0, true); }; libraryButton.Click += (sender, e) => { pagerView.SetCurrentItem(1, true); }; ion = AppState.context; ion.fluidManager.onFluidPreferenceChanged += OnFluidPreferenceChanged; preferred = new FluidFragment(ion); preferred.emptyText = GetString(Resource.String.fluid_empty_preferred); preferred.title = GetString(Resource.String.favorites); preferred.onFluidSelected += OnFluidSelected; library = new FluidFragment(ion); library.emptyText = GetString(Resource.String.fluid_empty_library); library.title = GetString(Resource.String.library); library.onFluidSelected += OnFluidSelected; selectedFluid = Intent.GetStringExtra(EXTRA_SELECTED); if (selectedFluid == null) { selectedFluid = ion.fluidManager.lastUsedFluid.name; } adapter = new FluidFragmentAdapter(FragmentManager, new FluidFragment[] { preferred, library, }); pagerView.Adapter = adapter; var help = FindViewById(Resource.Id.help); help.SetOnClickListener(new ViewClickAction((view) => { var adb = new IONAlertDialog(this); adb.SetTitle(Resource.String.fluid_safety_help); adb.SetMessage(Resource.String.fluid_safety_help_descriptions); adb.SetPositiveButton(Resource.String.ok, (s, e2) => { }); adb.Show(); })); }
/// <summary> /// Called whan a fluid is selected by on of the fragments. /// </summary> /// <param name="fragment">Fragment.</param> /// <param name="fluidName">Fluid name.</param> private void OnFluidSelected(FluidFragment fragment, string fluidName) { selectedFluid = fluidName; Invalidate(); }