コード例 #1
0
		protected void AddContentView (ViewGroup container, View quizContentView)
		{
			var layoutParams = new LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			container.AddView (questionView, layoutParams);
			container.AddView (quizContentView, layoutParams);
			AddView (container, layoutParams);
		}
コード例 #2
0
        /// <summary>
        /// Construct the UI and start loading
        /// </summary>
		public void onCreate()
		{
			string startUrl = webSettings.GetString ("url");
			string title = webSettings.GetString ("title");
			mainLayout = new LinearLayout (this.context);
			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 0.0F);
			mainLayout.LayoutParameters = lp;
			((LinearLayout)mainLayout).SetGravity (GravityFlags.CenterVertical);
			((LinearLayout)mainLayout).Orientation = Orientation.Vertical;

			webView = new WebView (this.context);
			WebSettings settings = webView.Settings;
			settings.JavaScriptEnabled = true;
			settings.BuiltInZoomControls = true;
			settings.JavaScriptCanOpenWindowsAutomatically = true;

			webView.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 1.0F);

			webView.SetWebViewClient (new FHOAuthWebViewClient (this));
			webView.RequestFocusFromTouch ();
			webView.Visibility = ViewStates.Visible;

			LinearLayout barlayout = initHeaderBar (title);

			mainLayout.AddView (barlayout);
			mainLayout.SetBackgroundColor (Color.Transparent);
			mainLayout.SetBackgroundResource (0);
			mainLayout.AddView (this.webView);

			this.webView.LoadUrl (startUrl);

		}
コード例 #3
0
		public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
		{
			_container = container;
			View view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.VacationInfoCreateDetail, container, false);

			var packageName =Application.Context.PackageName.ToString();
			view.Id =_container.Context.Resources.GetIdentifier ("view_"+position, "id" ,packageName);
			container.AddView (view);

			TextView ItemType = view.FindViewById<TextView> (Resource.Id.ItemType);
			Button ItemStartDateBtn = view.FindViewById<Button> (Resource.Id.ItemStartDateBtn);
			Button ItemEndDateBtn = view.FindViewById<Button> (Resource.Id.ItemEndDateBtn);
			Button ItemCreate = view.FindViewById<Button> (Resource.Id.ItemCreate);

			Button ItemPickImageFromGallery= view.FindViewById<Button> (Resource.Id.ItemPickImageFromGallery);
			Button ItemPickImageFromCamera= view.FindViewById<Button> (Resource.Id.ItemPickImageFromCamera);

			ItemStartDateBtn.Click += delegate { ShowDialog (0); };
			ItemEndDateBtn.Click += delegate { ShowDialog (1); };

			ItemStartDateBtn.Text = DateTime.Now.ToLocalTime ().ToString ("d");  
			ItemEndDateBtn.Text = DateTime.Now.ToLocalTime ().ToString ("d");

			ItemPickImageFromGallery.Click += onItemPickImageFromGalleryButtonClicked;
			ItemPickImageFromCamera.Click += onItemPickImageFromCameraButtonClicked;
			ItemCreate.Click += onItemCreateButtonClicked;

			int pos = position;
			ItemType.Text = items[pos];

			return view;
		}
コード例 #4
0
ファイル: Tap5050Fragment.cs プロジェクト: MADMUC/TAP5050
        public void AddSpinner(ViewGroup rootview,string loadingtext)
        {
            loading = true;
            if(loadingcontainer==null||(loadingcontainer!=null&&!loadingcontainer.IsShown)){
                loadingcontainer = new RelativeLayout (nn_activity);
                loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                loadingcontainer.SetBackgroundColor (Color.White);

                var detailcontainer = new LinearLayout (nn_activity);

                detailcontainer.Orientation = Orientation.Vertical;
                RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams ((int)TapUtil.dptodx (100), RelativeLayout.LayoutParams.WrapContent);
                param.AddRule (LayoutRules.CenterInParent);
                detailcontainer.LayoutParameters = param;

                LinearLayout.LayoutParams linearlayoutparm = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                linearlayoutparm.Gravity = GravityFlags.CenterHorizontal;

                ProgressBar progressbar = new ProgressBar (nn_activity);
                progressbar.LayoutParameters = linearlayoutparm;

                TextView tectview = new TextView (nn_activity);
                tectview.LayoutParameters = linearlayoutparm;
                tectview.Text = loadingtext;
                tectview.Gravity = GravityFlags.CenterHorizontal;

                detailcontainer.AddView (progressbar);
                detailcontainer.AddView (tectview);

                loadingcontainer.AddView (detailcontainer);
                rootview.AddView (loadingcontainer);
            }
        }
コード例 #5
0
        private void ShowBaiduAdIn(ViewGroup adContainer)
        {
            BDBannerAd banner = new BDBannerAd(this, "Z03uBILZVtfZ0NxKfgc6yFDT", "QLD7hWvVAxEYCKNwDSCanemk");
            banner.SetAdSize(BDBannerAd.Size320x50);
            banner.AdvertisementViewDidShow += (a, b) => 
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementViewDidShow));
            };
            banner.AdvertisementDataDidLoadFailure += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementDataDidLoadFailure));
            };
            banner.AdvertisementDataDidLoadSuccess += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementDataDidLoadSuccess));
            };
            banner.AdvertisementViewDidClick += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementViewDidClick));
            };
            banner.AdvertisementViewWillStartNewIntent += (a, b) =>
            {
                System.Diagnostics.Debug.WriteLine(nameof(BDBannerAd.AdvertisementViewWillStartNewIntent));
            };

            adContainer.AddView(banner);
        }
コード例 #6
0
        public override Java.Lang.Object InstantiateItem(Android.Views.ViewGroup container, int position)
        {
            BasePager pager = hactivity.pagerList [position];

            container.AddView(pager.rootView);
            return(pager.rootView);
        }
コード例 #7
0
        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position) {
            position %= this.Items.Count();

            var item = this.Items.ElementAt(position);
            var img = new ImageView(this.Ctx);
            this.SetSource(img, item);
            container.AddView(img, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
            return img;
        }
コード例 #8
0
ファイル: SlidingTabsFragment.cs プロジェクト: Poli143/Login
            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                View view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.pager_item,container,false);
                container.AddView(view);
                

                
                return view;
            }
コード例 #9
0
        public override Object InstantiateItem(ViewGroup container, int position)
        {
            imageView = new ImageView(container.Context);
            imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
            imageLoader.DisplayImage(Urls[position], imageView);
            container.AddView(imageView);

            return imageView;
        }
コード例 #10
0
			public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
			{
				View view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.pager_item, container, false);
				container.AddView(view);

				TextView txtTitle = view.FindViewById<TextView>(Resource.Id.item_title);
				int pos = position + 1;
				txtTitle.Text = pos.ToString();

				return view;
			}
コード例 #11
0
 public override Java.Lang.Object InstantiateItem(ViewGroup container, Int32 position)
 {
     var context = container.Context;
     var inflater = LayoutInflater.From(context);
     var view = inflater.Inflate(Resource.Layout.ItemFont, container, false);
     var recyclerView = (RecyclerView)view.FindViewById(Resource.Id.recyclerView);
     var nbColumns = Utils.AndroidUtils.GetScreenSize((Activity)context).Width / context.Resources.GetDimensionPixelSize(Resource.Dimension.item_width);
     recyclerView.SetLayoutManager(new GridLayoutManager(context, nbColumns));
     recyclerView.SetAdapter(new IconAdapter(_fonts[position].Characters.ToArray()));
     container.AddView(view);
     return view;
 }
コード例 #12
0
        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position) {
            position %= this.Items.Count();

            var item = this.Items.ElementAt(position);

            if (item.Parent != null) {
                var p = item.Parent as ViewGroup;
                if (p != null)
                    p.RemoveView(item);
            }

            container.AddView(item, 200, 200);
            return item;
        }
コード例 #13
0
		/// <summary>
		/// 初始item位置界面
		/// </summary>
		/// <returns>The item.</returns>
		/// <param name="container">Container.</param>
		/// <param name="position">Position.</param>
		public override Java.Lang.Object InstantiateItem (ViewGroup container, int position)
		{

			container.AddView(views[position]);
			if (position == views.Count - 1) {
				var btn_start_use = container.FindViewById<Button> (Resource.Id.btn_start_use);
				btn_start_use.SetOnClickListener (this);
			} else {
				var btn_skip = container.FindViewById<Button> (Resource.Id.btn_skip);
				btn_skip.SetOnClickListener (this);
			}

			return views[position];
		}
コード例 #14
0
		public ShadowWrapper (Android.Content.Context context, ViewGroup realContent) : base (context)
		{
			Content = realContent;
			OriginalParent = realContent.Parent as ViewGroup;
			OriginalParent.RemoveView (realContent);
			this.SetMinimumHeight (realContent.Height);
			this.SetMinimumWidth (realContent.Width);
			this.AddView (realContent, new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent,
				LinearLayout.LayoutParams.FillParent));
			OriginalParent.AddView (this, new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent,
				LinearLayout.LayoutParams.FillParent));
			this.SetBackgroundColor (Android.Graphics.Color.Red);

		}
コード例 #15
0
            // Because FastRenderer of Label or Image can't be set ClickListener,
            // insert FrameLayout with same position and same size on the view.
            public void OnLayoutChange(Android.Views.View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom)
            {
                _overlay.Layout(v.Left, v.Top, v.Right, v.Bottom);

                if (_alreadyGotParent)
                {
                    return;
                }

                _parent           = _view.Parent as Android.Views.ViewGroup;
                _alreadyGotParent = true;

                _parent.AddView(_overlay);

                _overlay.BringToFront();
            }
コード例 #16
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            InputMethodManager imm = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);
            if (imm.IsActive)
            {
                View focusView = Activity.CurrentFocus;
                if (focusView != null)
                {
                    imm.HideSoftInputFromWindow(focusView.WindowToken, HideSoftInputFlags.None);
                }
            }
            mView = CreateView(inflater, container, savedInstanceState);
            mGroup = (ViewGroup)Activity.Window.DecorView;

            mGroup.AddView(mView);
            mBg.StartAnimation(CreateAlphaInAnimation());
            mPanel.StartAnimation(CreateTranslationInAnimation());
            return base.OnCreateView(inflater, container, savedInstanceState);
        }
コード例 #17
0
            // Because FastRenderer of Label or Image can't be set ClickListener,
            // insert FrameLayout with same position and same size on the view.
            public void OnLayoutChange(Android.Views.View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom)
            {
                _overlay.Layout(v.Left, v.Top, v.Right, v.Bottom);

                if (_alreadyGotParent)
                {
                    return;
                }

                _parent           = _effect.Control.Parent as Android.Views.ViewGroup;
                _alreadyGotParent = true;

                _parent.AddView(_overlay);

                _overlay.BringToFront();

                _effect._view.Touch -= _effect._view_Touch;
                _effect._view        = _overlay;
                _effect.UpdateEnableRipple();
            }
コード例 #18
0
        public override Object InstantiateItem(ViewGroup container, int position)
        {
            if (ItemsSource == null)
                return null;
            var item = GetRawItem(position);
            if (item == null)
                return new TextView(container.Context) { Text = "(null)" };
            var viewModel = item as IViewModel;
            if (viewModel != null)
                viewModel.Settings.Metadata.AddOrUpdate(ViewModelConstants.StateNotNeeded, true);

            var view = ServiceProvider.AttachedValueProvider.GetOrAdd(item, ContentPath,
                (o, o1) => (Object)PlatformExtensions.GetContentView(container, container.Context, o,
                    _itemTemplateProvider.GetTemplateId(), _itemTemplateProvider.GetDataTemplateSelector()), null);
            var fragment = view as Fragment;
            if (fragment == null)
                container.AddView((View)view);
            else
            {
                if (_currentTransaction == null)
                    _currentTransaction = _fragmentManager.BeginTransaction();
                if (fragment.IsDetached)
                    _currentTransaction.Attach(fragment);
                else if (!fragment.IsAdded)
                    _currentTransaction.Add(container.Id, fragment);
                if (fragment != _currentPrimaryItem)
                {
                    fragment.SetMenuVisibility(false);
                    fragment.UserVisibleHint = false;
                }
            }
            return view;
        }
コード例 #19
0
		protected override void OnFinishInflate()
		{
			base.OnFinishInflate();

			//add @layout/material_view_pager_layout as child, containing all the MaterialViewPager views
			AddView(LayoutInflater.From(Context).Inflate(Resource.Layout.material_view_pager_layout, this, false));

			_headerBackgroundContainer = FindViewById<ViewGroup>(Resource.Id.headerBackgroundContainer);
			_pagerTitleStripContainer = FindViewById<ViewGroup>(Resource.Id.pagerTitleStripContainer);
			_logoContainer = FindViewById<ViewGroup>(Resource.Id.logoContainer);

			MToolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
			if (Settings.DisableToolbar)
				MToolbar.Visibility = ViewStates.Invisible;
			MViewPager = FindViewById<ViewPager>(Resource.Id.viewPager);

			MViewPager.AddOnPageChangeListener(this);

			//inflate subviews defined in attributes

			{
				int headerId = Settings.HeaderLayoutId;
				if (headerId == -1)
				{
					headerId = Settings.AnimatedHeaderImage ? Resource.Layout.material_view_pager_moving_header : Resource.Layout.material_view_pager_imageview_header;
				}
				_headerBackgroundContainer.AddView(LayoutInflater.From(Context).Inflate(headerId, _headerBackgroundContainer, false));
			}

			if (IsInEditMode)
			{ //preview titlestrip
				//add fake tabs on edit mode
				Settings.PagerTitleStripId = Resource.Layout.tools_material_view_pager_pagertitlestrip;
			}
			if (Settings.PagerTitleStripId != -1)
			{
				_pagerTitleStripContainer.AddView(LayoutInflater.From(Context).Inflate(Settings.PagerTitleStripId, _pagerTitleStripContainer, false));
			}

			if (Settings.LogoLayoutId != -1)
			{
				_logoContainer.AddView(LayoutInflater.From(Context).Inflate(Settings.LogoLayoutId, _logoContainer, false));
				if (Settings.LogoMarginTop != 0)
				{
					RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)_logoContainer.LayoutParameters;
					layoutParams.SetMargins(0, Settings.LogoMarginTop, 0, 0);
					_logoContainer.LayoutParameters = layoutParams;
				}
			}

			HeaderBackground = FindViewById(Resource.Id.headerBackground);
			ToolbarLayoutBackground = FindViewById(Resource.Id.toolbar_layout_background);

			InitialiseHeights();

			//construct the materialViewPagerHeader with subviews
			if (!IsInEditMode)
			{
				MaterialViewPagerHeader = MaterialViewPagerHeader
						.WithToolbar(MToolbar)
						.WithToolbarLayoutBackground(ToolbarLayoutBackground)
						.WithPagerSlidingTabStrip(_pagerTitleStripContainer)
						.WithHeaderBackground(HeaderBackground)
						.WithStatusBackground(FindViewById(Resource.Id.statusBackground))
						.WithLogo(_logoContainer);

				//and construct the MaterialViewPagerAnimator
				//attach it to the activity to enable MaterialViewPagerHeaderView.setMaterialHeight();
				MaterialViewPagerHelper.Register(Context, new MaterialViewPagerAnimator(this));
			}
			else
			{

				//if in edit mode, add fake cardsviews
				View sample = LayoutInflater.From(Context).Inflate(Resource.Layout.tools_list_items, _pagerTitleStripContainer, false);

				LayoutParams param = (LayoutParams)sample.LayoutParameters;
				int marginTop = (int)Math.Round(Utils.DpToPx(Settings.HeaderHeight + 10, Context));
				param.SetMargins(0, marginTop, 0, 0);
				LayoutParameters = param;

				AddView(sample);
			}
		}
コード例 #20
0
            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                try
                {
                    View view;

                    Int32 lastExpandedPosition = -1;

                    CreateExpandableListData ();

                    if (position == 0) //Current Booking tab
                    {
                        view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.CurrentBookingLayout, container, false);
                        container.AddView (view);

                        flCurrentBookings = container.FindViewById<FrameLayout> (Resource.Id.flCurrentBookings);
                        flNoCurrentBookings = container.FindViewById<FrameLayout> (Resource.Id.flNoCurrentBookings);
                        elvCurrentBookings = container.FindViewById<ExpandableListView> (Resource.Id.elvCurrentBookings);

                        if (dictGroupCurr.Count > 0)
                        {
                            flNoCurrentBookings.Visibility = ViewStates.Gone;
                            flCurrentBookings.Visibility = ViewStates.Visible;

                            elvCurrentBookings.SetAdapter (new ExpandViewBookingAdapter (parent, dictGroupCurr));

                            elvCurrentBookings.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) {
                                string itmGroup = lstKeysCurr [e.GroupPosition];
                                WorkshopBooking itmChild = dictGroupCurr [itmGroup];
                            };

                            elvCurrentBookings.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) {
                                if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition) {
                                    elvCurrentBookings.CollapseGroup (lastExpandedPosition);
                                }

                                lastExpandedPosition = e.GroupPosition;
                            };
                        }
                        else
                        {
                            flNoCurrentBookings.Visibility = ViewStates.Visible;
                            flCurrentBookings.Visibility = ViewStates.Gone;
                        }
                    }
                    else //Past Bookings
                    {
                        view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.PastBookings, container, false);
                        container.AddView (view);

                        flPastBookings = container.FindViewById<FrameLayout> (Resource.Id.flPastBookings);
                        flNoPastBookings = container.FindViewById<FrameLayout> (Resource.Id.flNoPastBookings);
                        elvPastBookings = container.FindViewById<ExpandableListView> (Resource.Id.elvPastBookings);

                        if (dictGroupPast.Count > 0)
                        {
                            flNoPastBookings.Visibility = ViewStates.Gone;
                            flPastBookings.Visibility = ViewStates.Visible;
                            elvPastBookings.SetAdapter (new ExpandViewBookingAdapter (parent, dictGroupPast));

                            elvPastBookings.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) {
                                string itmGroup = lstKeysPast [e.GroupPosition];
                                WorkshopBooking itmChild = dictGroupPast [itmGroup];
                            };

                            elvPastBookings.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) {
                                if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition) {
                                    elvPastBookings.CollapseGroup (lastExpandedPosition);
                                }

                                lastExpandedPosition = e.GroupPosition;
                            };
                        }
                        else
                        {
                            flNoPastBookings.Visibility = ViewStates.Visible;
                            flPastBookings.Visibility = ViewStates.Gone;
                        }
                    }

                    return view;
                }
                catch (Exception e)
                {
                    ErrorHandling.LogError (e, container.Context);
                    return -1;
                }
            }
コード例 #21
0
        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
        {
            ScaleImageView imageView;

            lock (syncObject)
            {
                // create view
                imageView = new ScaleImageView(baseContext, tVP);
                views[position] = imageView;

                // prepare page bitmap
                Bitmap bm = GetPageBitmap(position);

                ReplaceBitmap(position, bm);

                imageView.SetImageBitmap(bm);

                container.AddView(imageView);
            }

            // proceed with rendering
            SchedulePageRendering(position);

            return imageView;
        }
コード例 #22
0
            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                View view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.pager_item, container, false);
                container.AddView (view);

                var listView = view.FindViewById<ExpandableListView> (Resource.Id.myExpandableListview);
                listView.SetAdapter (new ExpandableDataAdapter (CurrentWeather[position]));

                return view;
            }
コード例 #23
0
 private void setupNavBarView(Context context, ViewGroup decorViewGroup)
 {
     mNavBarTintView = new View(context);
     FrameLayout.LayoutParams lparams;
     if (mConfig.isNavigationAtBottom())
     {
         lparams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, mConfig.getNavigationBarHeight());
         lparams.Gravity = GravityFlags.Bottom;
     }
     else
     {
         lparams = new FrameLayout.LayoutParams(mConfig.getNavigationBarWidth(), FrameLayout.LayoutParams.MatchParent);
         lparams.Gravity = GravityFlags.Right;
     }
     mNavBarTintView.LayoutParameters = lparams;
     mNavBarTintView.SetBackgroundColor(DEFAULT_TINT_COLOR);
     mNavBarTintView.Visibility = ViewStates.Gone;
     decorViewGroup.AddView(mNavBarTintView);
 }
コード例 #24
0
 public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
 {
     ScaleImageView SIV = new ScaleImageView (baseContext, CustVP);
     if (bitmaps [position] == null) {
         var cachepath = System.IO.Path.Combine (documentsPath, "Cache" + position + ".jpg");
         Bitmap BM = BitmapFactory.DecodeFile (cachepath);
         bitmaps [position] = BM;
         BM = null;
     }
     SIV.SetImageBitmap (bitmaps [position]);
     SIV.ZoomOut ();
     SIV.Cutting ();
     views [position] = SIV;
     container.AddView (SIV);
     SIV = null;
     return views [position];
 }
コード例 #25
0
 public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
 {
     View view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.pager_item, container, false);
     container.AddView(view);
     ListView txtTitle = view.FindViewById<ListView>(Resource.Id.listView1);
     txtTitle.Adapter = new OrigamiAdapter(_fvm.Items[position].Items.ToList());
     txtTitle.ItemClick += (s, e) =>
     {
         var clickedItem = _fvm.Items[position].Items[e.Position];
         Toast.MakeText(container.Context, clickedItem.Title, ToastLength.Short).Show();
         _fvm.ShowDetailCommand.Execute(clickedItem);
         //var intent = new Intent(container.Context,typeof(OrigamiItemView));
         //container.Context.StartActivity(intent);
     };
     return view;
 }
コード例 #26
0
            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                View view = LayoutInflater.From (container.Context).Inflate (Resource.Layout.ItemPager, container, false);
                container.AddView (view);

                TextView title = view.FindViewById<TextView> (Resource.Id.titleItem);

                title.Text = position + 1 + "";

                return view;
            }
コード例 #27
0
		//********************************************************************
		// PUBLIC METHODS
		//********************************************************************
		/**
	 * This method shows a popover in a ViewGroup, from an origin rect (relative to the Application Window)
	 * @param group The group we want to insert the popup. Normally a Relative Layout so it can stand on top of everything
	 * @param originRect The rect we want the popup to appear from (relative to the Application Window!)
	 * @param arrowDirections The mask of bits to tell in which directions we want the popover to be shown
	 * @param animated Whether is animated, or not
	 */
		public void showPopoverFromRectInViewGroup (ViewGroup group, Rect originRect, int arrowDirections, bool animated)
		{

			//First, tell delegate we will show
			if (del != null)
				del.popoverViewWillShow (this);

			//Save superview
			Superview = group;

			//First, add the view to the view group. The popover will cover the whole area
			LayoutParams insertParams = new  LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent);
			group.AddView (this, insertParams);

			//Now, save rect for the layout (is the same as the superview)
			popoverLayoutRect = PopoverView.getFrameForView (Superview);

			//Add available rects
			addAvailableRects (originRect, arrowDirections);
			//Get best rect
			int best = getBestRect ();

			//Add popover
//				Rect bestRect = possibleRects.get(best);
			Rect bestRect = null; 
			possibleRects.TryGetValue (best, out bestRect);
			addPopoverInRect (bestRect);
			//Add arrow image
			addArrow (originRect, best);


			//If we don't want animation, just tell the delegate
			if (!animated) {
				//Tell delegate we did show
				if (del != null)
					del.popoverViewDidShow (this);
			}
				//If we want animation, animate it!
				else {
				//Continue only if we are not animating
				if (!isAnimating) {

					//Create alpha animation, with its listener
					AlphaAnimation animation = new AlphaAnimation (0.0f, 1.0f);
					animation.Duration = fadeAnimationTime;
					animation.AnimationStart += (object sender, Animation.AnimationStartEventArgs e) => {
					};
					animation.AnimationRepeat += (object sender, Animation.AnimationRepeatEventArgs e) => {
					};
					animation.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => {
						//End animation
						isAnimating = false;
						//Tell delegate we did show
						if (del != null)
							del.popoverViewDidShow (this);
					};
								
					//Start animation
					isAnimating = true;
					StartAnimation (animation);

				}
			}

		}
コード例 #28
0
        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
        {
            int pos = position + 1;

            if (pos == 1)
            {

                View view1 = LayoutInflater.From(container.Context).Inflate(Resource.Layout.Paper_Item_ShouDong, container, false);
                container.AddView(view1);

                txtTitle = view1.FindViewById<TextView>(Resource.Id.item_subtitle1);

                mHuoJingSpinner1 = view1.FindViewById<Spinner> (Resource.Id.spinnerHuoJingLiShiDiDIanXinXi1);

                mHuoJingSpinner1.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner1_ItemSelected);
                var adapter = ArrayAdapter.CreateFromResource (
                    mActivity, Resource.Array.baoJingJieGuo, Android.Resource.Layout.SimpleSpinnerItem);

                adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
                mHuoJingSpinner1.Adapter = adapter;

                mHuoJingLiShiBeginTime1 = view1.FindViewById<Button> (Resource.Id.HuojingLiShipickDateBegin1);
                mHuoJingLiShiEndTime1 = view1.FindViewById<Button> (Resource.Id.HuojingLiShipickDateEnd1);
                mHuoJingSouSuo1 = view1.FindViewById<Button> (Resource.Id.btnShouDongBaoJingSouSuo);

                mHuoJingLiShiBeginTime1.Click += delegate {

                    clickFlag=0;
                    var dialogShow = new DatePickerDialogFragment(mActivity, BeginDate,mListener);
                    dialogShow.Show(mActivity.FragmentManager.BeginTransaction(), null);

                };

                mHuoJingLiShiEndTime1.Click += delegate {

                    clickFlag=1;
                    var dialogShow = new DatePickerDialogFragment(mActivity, BeginDate,mListener);
                    dialogShow.Show(mActivity.FragmentManager.BeginTransaction(), null);

                };

                mHuoJingSouSuo1.Click += delegate(object sender, EventArgs e) {

                    //每次成功查询结束后,把三个string置空
                    var ft1=mActivity.FragmentManager.BeginTransaction ();

                    ft1.SetCustomAnimations(Resource.Animation.card_flip_right_in, Resource.Animation.card_flip_right_out,
                        Resource.Animation.card_flip_left_in, Resource.Animation.card_flip_left_out);

                    var fragment = HuoJingXiangXiSouSuoJieGuoFrag.NewInstance ("1",selectedBaoJingJieGuo ,selectedBeginTime,selectedEndTime);

                    selectedBaoJingJieGuo="";
                    selectedBeginTime="";
                    selectedEndTime="";

                    ft1.Hide (fragment);
                    ft1.Replace (Resource.Id.content_frame, fragment,"HuoJingXiangXiXinXIShouDongSouSuo");

                    ft1.AddToBackStack (null);

                    ft1.Show (fragment);
                    ft1.Commit ();

                };

                return view1;

            }

            else if (pos == 2)
            {

                View view2 = LayoutInflater.From(container.Context).Inflate(Resource.Layout.Paper_Item_ZiDong, container, false);
                container.AddView(view2);

                txtTitle = view2.FindViewById<TextView>(Resource.Id.item_subtitle2);

                mHuoJingSpinner2 = view2.FindViewById<Spinner> (Resource.Id.spinnerHuoJingLiShiDiDIanXinXi2);

                mHuoJingSpinner2.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner2_ItemSelected);
                var adapter = ArrayAdapter.CreateFromResource (
                    mActivity, Resource.Array.baoJingJieGuo, Android.Resource.Layout.SimpleSpinnerItem);

                adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
                mHuoJingSpinner2.Adapter = adapter;

                mHuoJingLiShiBeginTime2 = view2.FindViewById<Button> (Resource.Id.HuojingLiShipickDateBegin2);
                mHuoJingLiShiEndTime2 = view2.FindViewById<Button> (Resource.Id.HuojingLiShipickDateEnd2);
                mHuoJingSouSuo2 = view2.FindViewById<Button> (Resource.Id.btnZiDongBaoJingSouSuo);

                mHuoJingLiShiBeginTime2.Click += delegate {

                    clickFlag=0;
                    var dialogShow = new DatePickerDialogFragment(mActivity, BeginDate,mListener);
                    dialogShow.Show(mActivity.FragmentManager.BeginTransaction(), null);

                };

                mHuoJingLiShiEndTime2.Click += delegate {

                    clickFlag=1;
                    var dialogShow = new DatePickerDialogFragment(mActivity, BeginDate,mListener);
                    dialogShow.Show(mActivity.FragmentManager.BeginTransaction(), null);

                };

                mHuoJingSouSuo2.Click += delegate(object sender, EventArgs e) {

                    //每次成功查询结束后,把三个string置空
                    var ft1=mActivity.FragmentManager.BeginTransaction ();

                    ft1.SetCustomAnimations(Resource.Animation.card_flip_right_in, Resource.Animation.card_flip_right_out,
                        Resource.Animation.card_flip_left_in, Resource.Animation.card_flip_left_out);
                    var fragment = HuoJingXiangXiSouSuoJieGuoFrag.NewInstance ("3",selectedBaoJingJieGuo ,selectedBeginTime,selectedEndTime);

                    selectedBaoJingJieGuo="";
                    selectedBeginTime="";
                    selectedEndTime="";

                    ft1.Hide (fragment);
                    ft1.Replace (Resource.Id.content_frame, fragment,"HuoJingXiangXiXinXIShouDongSouSuo");

                    ft1.AddToBackStack (null);

                    ft1.Show (fragment);
                    ft1.Commit ();

                };

                return view2;

            }

            else
            {

                View view3 = LayoutInflater.From(container.Context).Inflate(Resource.Layout.Paper_Item_JianGuan, container, false);
                container.AddView(view3);

                txtTitle = view3.FindViewById<TextView>(Resource.Id.item_subtitle3);

                mHuoJingSpinner3 = view3.FindViewById<Spinner> (Resource.Id.spinnerHuoJingLiShiDiDIanXinXi3);

                mHuoJingSpinner3.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner3_ItemSelected);
                var adapter = ArrayAdapter.CreateFromResource (
                    mActivity, Resource.Array.baoJingJieGuo, Android.Resource.Layout.SimpleSpinnerItem);

                adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
                mHuoJingSpinner3.Adapter = adapter;

                mHuoJingLiShiBeginTime3 = view3.FindViewById<Button> (Resource.Id.HuojingLiShipickDateBegin3);
                mHuoJingLiShiEndTime3 = view3.FindViewById<Button> (Resource.Id.HuojingLiShipickDateEnd3);
                mHuoJingSouSuo3 = view3.FindViewById<Button> (Resource.Id.btnJianGuanBaoJingSouSuo);

                mHuoJingLiShiBeginTime3.Click += delegate {

                    clickFlag=0;
                    var dialogShow = new DatePickerDialogFragment(mActivity, BeginDate,mListener);
                    dialogShow.Show(mActivity.FragmentManager.BeginTransaction(), null);

                };

                mHuoJingLiShiEndTime3.Click += delegate {

                    clickFlag=1;
                    var dialogShow = new DatePickerDialogFragment(mActivity, BeginDate,mListener);
                    dialogShow.Show(mActivity.FragmentManager.BeginTransaction(), null);

                };

                mHuoJingSouSuo3.Click += delegate(object sender, EventArgs e) {

                    //每次成功查询结束后,把三个string置空
                    var ft1=mActivity.FragmentManager.BeginTransaction ();

                    ft1.SetCustomAnimations(Resource.Animation.card_flip_right_in, Resource.Animation.card_flip_right_out,
                        Resource.Animation.card_flip_left_in, Resource.Animation.card_flip_left_out);
                    var fragment = HuoJingXiangXiSouSuoJieGuoFrag.NewInstance ("2",selectedBaoJingJieGuo ,selectedBeginTime,selectedEndTime);

                    selectedBaoJingJieGuo="";
                    selectedBeginTime="";
                    selectedEndTime="";

                    ft1.Hide (fragment);
                    ft1.Replace (Resource.Id.content_frame, fragment,"HuoJingXiangXiXinXIShouDongSouSuo");

                    ft1.AddToBackStack (null);

                    ft1.Show (fragment);
                    ft1.Commit ();

                };

                return view3;

            }
        }
コード例 #29
0
        public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
        {
            var view = GetView(position, null, container, ItemTemplateId > 0 ? ItemTemplateId : 0);

            container.AddView(view);

            return view;
        }
コード例 #30
0
ファイル: ViewPagerAdapter.cs プロジェクト: hwqdt/Demos
 public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
 {
     container.AddView(views[position], 0);
     return views[position];
 }
コード例 #31
0
        private void SetupGravity(ViewGroup view)
        {
            LinearLayout itemRoot = (LinearLayout)view;
            GravityFlags gravityInt = GravityExt.GetGravity(itemGravity);
            itemRoot.SetGravity(gravityInt | GravityFlags.CenterVertical);

            if (view.ChildCount == 2)
            {
                if (itemGravity == GravityEnum.End && !IsRtl() && view.GetChildAt(0) is CompoundButton)
                {
                    CompoundButton first = (CompoundButton)view.GetChildAt(0);
                    view.RemoveView(first);

                    TextView second = (TextView)view.GetChildAt(0);
                    view.RemoveView(second);
                    second.SetPadding(second.PaddingRight, second.PaddingTop,
                        second.PaddingLeft, second.PaddingBottom);

                    view.AddView(second);
                    view.AddView(first);
                }
                else if (itemGravity == GravityEnum.Start && IsRtl() && view.GetChildAt(1) is CompoundButton)
                {
                    CompoundButton first = (CompoundButton)view.GetChildAt(1);
                    view.RemoveView(first);

                    TextView second = (TextView)view.GetChildAt(0);
                    view.RemoveView(second);
                    second.SetPadding(second.PaddingRight, second.PaddingTop,
                        second.PaddingRight, second.PaddingBottom);

                    view.AddView(first);
                    view.AddView(second);
                }
            }
        }
コード例 #32
0
			public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
			{	TextView v = new TextView(_activity);
				v.SetBackgroundResource(Resource.Color.background_window);
				v.Text = string.Format("PAGE {0}", position + 1);
				int padding = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 16, _activity.Resources.DisplayMetrics);
				v.SetPadding(padding, padding, padding, padding);
				v.Gravity = GravityFlags.Center;
				container.AddView(v, 0);
				return v;
			}
コード例 #33
0
                public void AddToView( ViewGroup parentView )
                {
                    // first, create the layout that will store the button and label
                    Layout = new BorderedRectView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Layout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    parentView.AddView( Layout );

                    // now create the linearLayout that will store the button labels (Symbol & Text)
                    LinearLayout labelLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    labelLayout.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)labelLayout.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    Layout.AddView( labelLayout );

                    // add the button, which is just a frame wrapping the entire layout
                    Button = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Button.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    Button.Background = null;
                    Layout.AddView( Button );

                    // now set the icon
                    Icon = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    labelLayout.AddView( Icon );

                    // and lastly the text
                    Label = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Label.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)Label.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    labelLayout.AddView( Label );
                }