public override Dialog OnCreateDialog(Bundle savedInstanceState) { if (savedInstanceState != null) { e = ExhibitManager.GetExhibit(savedInstanceState.GetString(Data)); } var alert = new AlertDialog.Builder(Activity); alert.SetTitle(Resources.GetString(Resource.String.exhibit_is__near_title)); alert.SetMessage($"{Activity.Resources.GetString (Resource.String.exhibit_is_near1)} \"{e.Name}\" {Activity.Resources.GetString (Resource.String.exhibit_is_near2)}"); alert.SetPositiveButton(Resource.String.exhibit_open_yes, (senderAlert, args) => { var intent = new Intent(Activity, typeof(ExhibitDetailsActivity)); var pageList = e.Pages; if ((pageList == null) || !pageList.Any()) { Toast.MakeText(Activity, Activity.GetString(Resource.String.currently_no_further_info), ToastLength.Short).Show(); } else { intent.PutExtra(ExhibitDetailsActivity.INTENT_EXTRA_EXHIBIT_ID, e.Id); Activity.StartActivity(intent); } }); alert.SetNegativeButton(Resource.String.exhibit_open_no, (senderAlert, args) => { ExtendedLocationListener.GetInstance().EnableCheckForExhibits(); }); return(alert.Create()); }
public ViaPointInfoWindow(int layoutResId, MapView mapView, Context context) : base(layoutResId, mapView) { Button infoButton = this.View.FindViewById <Button> (Resource.Id.bubble_info); infoButton.Click += (sender, e) => { if (markerID != null) { var intent = new Intent(context, typeof(ExhibitDetailsActivity)); var exhibit = ExhibitManager.GetExhibit(markerID); if (exhibit.Id != null) { intent.PutExtra(ExhibitDetailsActivity.INTENT_EXTRA_EXHIBIT_ID, markerID); } context.StartActivity(intent); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); Exhibit = ExhibitManager.GetExhibit(ExhibitID); ExhibitAppetizer = Exhibit.Pages[0].AppetizerPage; // each exhibit page list should have for first element an appetizer page if (ExhibitAppetizer != null) { NavigationItem.Title = ExhibitTitle; NSData imageData = NSData.FromArray(ExhibitAppetizer.Image.Data); appetizerImageView.Image = new UIImage(imageData); var titleAttributes = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(13) }; NSMutableAttributedString attributedString = new NSMutableAttributedString(ExhibitTitle + "\n\n" + ExhibitAppetizer.Text); attributedString.SetAttributes(titleAttributes, new NSRange(0, ExhibitTitle.Length)); appetizerTextView.AttributedText = attributedString; } NavigationItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //initialize media player mediaPlayerConnection = new CustomServiceConnection(this); DoBindService(); SetContentView(Resource.Layout.activity_exhibit_details); if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop) { Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); } var toolbar = (Toolbar)FindViewById(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.ic_clear_white_24dp); SetSupportActionBar(toolbar); audioSeekbar = FindViewById <SeekBar> (Resource.Id.audio_progress_bar); audioSeekbar.ProgressChanged += (sender, args) => { if (mediaPlayerService != null && args.FromUser) { mediaPlayerService.SeekTo(args.Progress); } }; SupportActionBar.SetDisplayHomeAsUpEnabled(true); sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this); if (savedInstanceState != null) { // activity re-creation because of device rotation, instant run, ... exhibitId = savedInstanceState.GetString(KEY_EXHIBIT_ID); exhibit = ExhibitManager.GetExhibit(exhibitId); currentPageIndex = savedInstanceState.GetInt(KEY_CURRENT_PAGE_INDEX, 0); isAudioPlaying = savedInstanceState.GetBoolean(KEY_AUDIO_PLAYING, false); if (!isAudioPlaying) { pauseAudioPlaybackFlag = true; } isAudioToolbarHidden = savedInstanceState.GetBoolean(KEY_AUDIO_TOOLBAR_HIDDEN, true); if (!isAudioToolbarHidden) { showAudioToolbarFlag = true; } extras = savedInstanceState.GetBundle(KEY_EXTRAS); isCaptionShown = savedInstanceState.GetBoolean(KEY_CAPTION_SHOWN); var selectedTab = savedInstanceState.GetInt(KEY_CURRENT_CAPTION_TAB); var currentSource = savedInstanceState.GetInt(KEY_CURRENT_SOURCE); if (isCaptionShown) { ShowCaptions(selectedTab, currentSource); } isHelpDialogShown = savedInstanceState.GetBoolean(KEY__HELP_DIALOG_SHOWN, false); isSwitchToNextPageAutomatically = savedInstanceState.GetBoolean(KEY_PAGE_SWITCH_BASED_ON_SETTINGS, false); } else { // activity creation because of intent var intent = Intent; extras = intent.Extras; exhibitId = intent.GetStringExtra(INTENT_EXTRA_EXHIBIT_ID); exhibit = ExhibitManager.GetExhibit(exhibitId); } Title = exhibit.Name; if (exhibit.Pages.Count == 0) { throw new NullPointerException("Cannot display exhibit with no pages."); } // set up bottom sheet behavior bottomSheet = FindViewById(Resource.Id.bottom_sheet); bottomSheetBehavior = BottomSheetBehavior.From(bottomSheet); bottomSheetBehavior.SetBottomSheetCallback(new CustomBottomSheetCallback(this)); // audio toolbar revealView = (LinearLayout)FindViewById(Resource.Id.reveal_items); revealView.Visibility = ViewStates.Invisible; // Does not work with animations: // see also: http://stackoverflow.com/questions/7289827/how-to-start-animation-immediately-after-oncreate // set up play / pause toggle btnPlayPause = (ImageButton)FindViewById(Resource.Id.btnPlayPause); btnPlayPause.Click += (sender, args) => { if (isAudioPlaying) { PauseAudioPlayback(); isAudioPlaying = false; } else { StartAudioPlayback(); isAudioPlaying = true; btnPlayPause.SetImageResource(Android.Resource.Color.Transparent); } UpdatePlayPauseButtonIcon(); }; // set up CC button var btnCaptions = (ImageButton)FindViewById(Resource.Id.btnCaptions); btnCaptions.Click += (sender, args) => { ShowCaptions(); }; // set up previous / next button btnPreviousPage = (ImageButton)FindViewById(Resource.Id.buttonPrevious); btnPreviousPage.Click += (sender, args) => { DisplayPreviousExhibitPage(); }; btnNextPage = (ImageButton)FindViewById(Resource.Id.buttonNext); btnNextPage.Click += (sender, args) => { DisplayNextExhibitPage(); }; fab = (FloatingActionButton)FindViewById(Resource.Id.fab); fab.Click += (sender, args) => { switch (fabAction) { case BottomSheetConfig.FabAction.Next: DisplayNextExhibitPage(); break; case BottomSheetConfig.FabAction.Collapse: SetFabAction(BottomSheetConfig.FabAction.Expand); break; case BottomSheetConfig.FabAction.Expand: SetFabAction(BottomSheetConfig.FabAction.Collapse); break; default: throw new IllegalArgumentException("Unsupported FAB action!"); } }; }
public ExhibitDetailsViewModel(string exhibitId) : this(ExhibitManager.GetExhibit(exhibitId).Pages, ExhibitManager.GetExhibit(exhibitId).Name) { }