void ITabProvider.UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position)
 {
     if (!UpdateTabStyle(view, owner, position))
     {
         _getFallBackProvider(owner).UpdateTabStyle(view, owner, position);
     }
 }
 void ITabProvider.UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint)
 {
     if (!UpdateTab(view, owner, position, hint))
     {
         _getFallBackProvider(owner).UpdateTab(view, owner, position, hint);
     }
     OnTabUpdated(position, hint);
 }
        public override void UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position)
        {
            TextView v = view as TextView;

            v.SetTextSize(ComplexUnitType.Px, owner.TextSize);
            v.SetTypeface(owner.Typeface, owner.TypefaceStyle);
            v.SetTextColor(owner.TextColor);
        }
        View ITabProvider.GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled)
        {
            var toReturn = GetTab(owner, root, position, recycled);

            if (toReturn != null)
            {
                return(toReturn);
            }

            return(_getFallBackProvider(owner).GetTab(owner, root, position, recycled));
        }
		public override void UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null)
		{
			TextView v = view as TextView;
			if (v == null)
				return;

			var s = _adapter.GetPageTitle(position);
			if (owner.TextAllCaps)
				s = (s ?? "").ToUpper();
			v.SetText(s, TextView.BufferType.Normal);
			OnTabUpdated(position);
		}
		/// <summary>
		/// Gets the tab.
		/// </summary>
		/// <param name="owner">The owner.</param>
		/// <param name="root">The root.</param>
		/// <param name="position">The position.</param>
		/// <param name="recycled">The recycled.</param>
		/// <returns></returns>
		public override View GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null)
		{
			ImageView tab = recycled as ImageView;

			//ImageButton tab = recycled as ImageButton;
			if(recycled != null)
				return tab;

			tab = new ImageView(Context);
			tab.SetPadding(0, 0, 0, 0);
			tab.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent);

			return tab;
		}
Example #7
0
        /// <summary>
        /// Updates the tab.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="owner">The owner.</param>
        /// <param name="position">The position.</param>
        /// <param name="hint">The hint.</param>
        /// <exception cref="System.InvalidOperationException">No IconProvider is available.</exception>
        public override void UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null)
        {
            ImageView v = view as ImageView;

            if (v == null)
            {
                return;
            }
            var iconProvider = IconProvider;

            if (iconProvider == null)
            {
                throw new InvalidOperationException("No IconProvider is available.");
            }
            v.SetImageResource(iconProvider.GetPageIconResId(position));
        }
Example #8
0
        /// <summary>
        /// Gets the tab.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="root">The root.</param>
        /// <param name="position">The position.</param>
        /// <param name="recycled">The recycled.</param>
        /// <returns></returns>
        public override View GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null)
        {
            ImageView tab = recycled as ImageView;

            //ImageButton tab = recycled as ImageButton;
            if (recycled != null)
            {
                return(tab);
            }

            tab = new ImageView(Context);
            tab.SetPadding(0, 0, 0, 0);
            tab.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent);

            return(tab);
        }
		public override View GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null)
		{
			TextView tRecycled = recycled as TextView;
			if (tRecycled != null)
			{
				//TODO: should this method reset the gravity and singleline flag on the recycled view?
				//after all, there's no guarantee that the recycled view was originally constructed by this
				//provider.

				return recycled;
			}
			//var p = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			//p.Gravity = GravityFlags.Center;
			LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
			TextView tab = (TextView)inflater.Inflate(_textTabResourceID, root, false);// new TextView(Context);
			return tab;
		}
        public override void UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null)
        {
            TextView v = view as TextView;

            if (v == null)
            {
                return;
            }

            var s = _adapter.GetPageTitle(position);

            if (owner.TabTextAllCaps)
            {
                s = (s ?? "").ToUpper();
            }
            v.SetText(s, TextView.BufferType.Normal);
            OnTabUpdated(position);
        }
        public override View GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null)
        {
            TextView tRecycled = recycled as TextView;

            if (tRecycled != null)
            {
                //TODO: should this method reset the gravity and singleline flag on the recycled view?
                //after all, there's no guarantee that the recycled view was originally constructed by this
                //provider.

                return(recycled);
            }
            //var p = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            //p.Gravity = GravityFlags.Center;
            LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
            TextView       tab      = (TextView)inflater.Inflate(_textTabResourceID, root, false); // new TextView(Context);

            return(tab);
        }
 /// <summary>
 /// Called by the underlying implementation of <see cref="ITabProvider"/> to allow you to perform a custom
 /// action to update the UI of the given tab (in response to text changes etc).  If you return false,
 /// then the default implementation will fall back to either the TextTabProvider or IconTabProvider,
 /// depending on whether the View is a TextView or if this instance also implements the <see cref="IIconTabProvider"/>.
 /// If neither of these two conditions are met for fall back, then no update is performed.
 ///
 /// Note that the OnTabUpdated method is called after this method finishes - unless you return false and
 /// no fall back behaviour could be selected.
 /// </summary>
 /// <param name="view">The view to be updated.</param>
 /// <param name="owner">The tab strip that owns this tab.</param>
 /// <param name="position">The tab position.</param>
 /// <param name="hint">An optional string that provides an implementation-specific hint as to the nature
 /// of the data that has changed.</param>
 /// <returns>True if you successfully handle the update.  Return false to fall back to default behaviour.</returns>
 protected abstract bool UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null);
 /// <summary>
 /// Called by the underlying implementation of <see cref="ITabProvider"/> to get your custom view for a
 /// given tab.  To have the default implementation kick in (which creates text tabs by default or icon tabs
 /// if this instance also implements IIconTabProvider), simply return null.
 ///
 /// Note - you do not have to handle the standard padding, background, focusability or click event for your view -
 /// this is handled by the tab strip itself through a container control (the root).
 /// </summary>
 /// <param name="owner">The tab strip that is requesting the view (allows access to its styled attributes and the current <see cref="Context" /></param>
 /// <param name="root">The view that will be the root for the view you pass back - typically a FrameLayout.</param>
 /// <param name="position">The position of the tab to be created.</param>
 /// <param name="recycled">A previous view that could possibly be recycled.  To indicate that this view
 /// can simply be re-bound, just return this view.</param>
 /// <returns>
 /// A view for the tab. If you return null, a default will be created (see summary).
 /// </returns>
 protected abstract View GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null);
 void ITabProvider.UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position)
 {
     if (!UpdateTabStyle(view, owner, position))
         _getFallBackProvider(owner).UpdateTabStyle(view, owner, position);
 }
 /// <summary>
 /// Called by the underlying implementation of <see cref="ITabProvider"/> to allow you to perform a custom
 /// action to update the UI of the given tab (in response to text changes etc).  If you return false, 
 /// then the default implementation will fall back to either the TextTabProvider or IconTabProvider, 
 /// depending on whether the View is a TextView or if this instance also implements the <see cref="IIconTabProvider"/>.
 /// If neither of these two conditions are met for fall back, then no update is performed.
 /// 
 /// Note that the OnTabUpdated method is called after this method finishes - unless you return false and
 /// no fall back behaviour could be selected.
 /// </summary>
 /// <param name="view">The view to be updated.</param>
 /// <param name="owner">The tab strip that owns this tab.</param>
 /// <param name="position">The tab position.</param>
 /// <param name="hint">An optional string that provides an implementation-specific hint as to the nature
 /// of the data that has changed.</param>
 /// <returns>True if you successfully handle the update.  Return false to fall back to default behaviour.</returns>
 protected abstract bool UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null);
 /// <summary>
 /// Called by the underlying implementation of <see cref="ITabProvider"/> to give you the chance to apply any styles
 /// defined on the PagerSlidingTabStrip to your tab's UI components (e.g. Text styles, colours etc).  Return true from this
 /// method to prevent the default functionality, which is to fallback to either the text or icon providers.
 /// </summary>
 /// <param name="view">The view to be styled.</param>
 /// <param name="owner">The tab strip that owns this tab.</param>
 /// <param name="position">The tab position.</param>
 /// <returns>True if all styling has been done, or false if you want the default behaviour to kick in.</returns>
 protected abstract bool UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position);
			public PagerAdapterDataSetObserver(PagerSlidingTabStrip tabStrip)
			{
				TabStrip = tabStrip;
			}
 public PagerAdapterDataSetObserver(PagerSlidingTabStrip tabStrip)
 {
     TabStrip = tabStrip;
 }
		/// <summary>
		/// Binds the tab view - i.e. sets any text, calculates the visibility of more complex items etc.
		/// First time this is called for a tab is just after it's created or recycled by a call to <see cref="GetTab" />.
		/// </summary>
		/// <param name="view">The view to be bound.</param>
		/// <param name="owner">The tab strip that the view belongs to.</param>
		/// <param name="position">The position of the tab being updated.</param>
		/// <param name="hint">An optional string providing an implementation-specific hint for the part(s)
		/// of the view that should be updated.</param>
		public abstract void UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null);
		/// <summary>
		/// Called to get the view for a particular tab, either by creating a view or recycling an old one.
		/// Note - you do not have to handle the padding, background, focusability or click event for your view -
		/// this is handled by the tab strip itself through a container control.
		/// </summary>
		/// <param name="owner">The tab strip that is requesting the view (allows access to its styled attributes and the current <see cref="Context" /></param>
		/// <param name="root">The view that will be the root for the view you pass back - typically a FrameLayout.</param>
		/// <param name="position">The position of the tab to be created.</param>
		/// <param name="recycled">A previous view that could possibly be recycled.  To indicate that this view
		/// can simply be re-bound, just return this view.</param>
		/// <returns>
		/// A view for the tab. MUST NOT RETURN NULL.
		/// </returns>
		public abstract View GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled = null);
        View ITabProvider.GetTab(PagerSlidingTabStrip owner, ViewGroup root, int position, View recycled)
        {
            var toReturn = GetTab(owner, root, position, recycled);
            if (toReturn != null)
                return toReturn;

            return _getFallBackProvider(owner).GetTab(owner, root, position, recycled);
        }
Example #22
0
 /// <summary>
 /// This is called to give the provider a chance to sync any styles defined on the passed PagerSlidingTabStrip
 /// (e.g. text styles, layout etc) to the tabs it's created.
 /// Called just after a tab is created, but also whenever a style changes on the tab strip itself.
 /// </summary>
 /// <param name="view"></param>
 /// <param name="owner"></param>
 /// <param name="position"></param>
 public abstract void UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position);
 void ITabProvider.UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint)
 {
     if (!UpdateTab(view, owner, position, hint))
     {
         _getFallBackProvider(owner).UpdateTab(view, owner, position, hint);
     }
     OnTabUpdated(position, hint);
 }
		public override void UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position)
		{
			TextView v = view as TextView;
			v.SetTextSize(ComplexUnitType.Px, owner.TextSize);
			v.SetTypeface(owner.Typeface, owner.TypefaceStyle);
			v.SetTextColor(owner.TextColor);
		}
 /// <summary>
 /// Called by the underlying implementation of <see cref="ITabProvider"/> to give you the chance to apply any styles
 /// defined on the PagerSlidingTabStrip to your tab's UI components (e.g. Text styles, colours etc).  Return true from this
 /// method to prevent the default functionality, which is to fallback to either the text or icon providers.
 /// </summary>
 /// <param name="view">The view to be styled.</param>
 /// <param name="owner">The tab strip that owns this tab.</param>
 /// <param name="position">The tab position.</param>
 /// <returns>True if all styling has been done, or false if you want the default behaviour to kick in.</returns>
 protected abstract bool UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position);
		/// <summary>
		/// This is called to give the provider a chance to sync any styles defined on the passed PagerSlidingTabStrip
		/// (e.g. text styles, layout etc) to the tabs it's created.
		/// Called just after a tab is created, but also whenever a style changes on the tab strip itself.
		/// </summary>
		/// <param name="view"></param>
		/// <param name="owner"></param>
		/// <param name="position"></param>
		public abstract void UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position);
		/// <summary>
		/// Updates the tab.
		/// </summary>
		/// <param name="view">The view.</param>
		/// <param name="owner">The owner.</param>
		/// <param name="position">The position.</param>
		/// <param name="hint">The hint.</param>
		/// <exception cref="System.InvalidOperationException">No IconProvider is available.</exception>
		public override void UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null)
		{
			ImageView v = view as ImageView;
			if (v == null)
				return;
			var iconProvider = IconProvider;
			
			if(iconProvider == null)
				throw new InvalidOperationException("No IconProvider is available.");
			v.SetImageResource(iconProvider.GetPageIconResId(position));
		}
Example #28
0
 /// <summary>
 /// Updates the tab style.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="owner">The owner.</param>
 /// <param name="position">The position.</param>
 public override void UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position)
 {
     //don't need to inherit any styling here
 }
		/// <summary>
		/// Updates the tab style.
		/// </summary>
		/// <param name="view">The view.</param>
		/// <param name="owner">The owner.</param>
		/// <param name="position">The position.</param>
		public override void UpdateTabStyle(View view, PagerSlidingTabStrip owner, int position)
		{
			//don't need to inherit any styling here
		}
Example #30
0
 /// <summary>
 /// Binds the tab view - i.e. sets any text, calculates the visibility of more complex items etc.
 /// First time this is called for a tab is just after it's created or recycled by a call to <see cref="GetTab" />.
 /// </summary>
 /// <param name="view">The view to be bound.</param>
 /// <param name="owner">The tab strip that the view belongs to.</param>
 /// <param name="position">The position of the tab being updated.</param>
 /// <param name="hint">An optional string providing an implementation-specific hint for the part(s)
 /// of the view that should be updated.</param>
 public abstract void UpdateTab(View view, PagerSlidingTabStrip owner, int position, string hint = null);