Esempio n. 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Inflate the layout for this fragment
            var v = inflater.Inflate(Resource.Layout.fragment_exhibitpage_image, container, false);

            if (savedInstanceState?.GetString(INSTANCE_STATE_PAGE) != null)
            {
                var pageId = savedInstanceState.GetString(INSTANCE_STATE_PAGE);
                page = PageManager.GetImagePage(pageId);
            }

            drawView = (DrawView)v.FindViewById(Resource.Id.fragment_exhibitpage_image_imageview);
            drawView.SetImageDrawable(page.Image.GetDrawable(Context, drawView.Width, drawView.Height));
            if (page.Areas != null && page.Areas.Count > 0)
            {
                drawView.Rectangles.AddRange(page.Areas);
            }
            else
            {
                //There are no areas to highlight, don't show button
                var button = (Button)v.FindViewById(Resource.Id.fragment_exhibitpage_image_button);
                button.Visibility = ViewStates.Invisible;
            }
            drawView.OriginalImageDimensions = new [] { page.Image.Width, page.Image.Height };

            InitListeners(v);

            return(v);
        }