//endregion

        public void RestoreScroll(float scroll, MaterialViewPagerSettings settings)
        {
            //try to scroll up, on a looper to wait until restored
            new Handler(Looper.MainLooper).PostDelayed(() =>
            {
                if (!OnMaterialScrolled(null, scroll))
                {
                    RestoreScroll(scroll, settings);
                }
            }, 100);
        }
		public MaterialViewPagerAnimator(MaterialViewPager materialViewPager)
		{
			Settings = materialViewPager.Settings;

			MaterialViewPager = materialViewPager;
			_mHeader = materialViewPager.MaterialViewPagerHeader;
			Context context = _mHeader.Context;

			// initialise the scrollMax to headerHeight, so until the first cell touch the top of the screen
			ScrollMax = Settings.HeaderHeight;
			//save in into dp once
			ScrollMaxDp = Utils.DpToPx(ScrollMax, context);

			//heightMaxScrollToolbar = context.getResources().getDimension(R.dimen.material_viewpager_padding_top);
			Elevation = Utils.DpToPx(4, context);
		}
        public MaterialViewPagerAnimator(MaterialViewPager materialViewPager)
        {
            Settings = materialViewPager.Settings;

            MaterialViewPager = materialViewPager;
            _mHeader          = materialViewPager.MaterialViewPagerHeader;
            Context context = _mHeader.Context;

            // initialise the scrollMax to headerHeight, so until the first cell touch the top of the screen
            ScrollMax = Settings.HeaderHeight;
            //save in into dp once
            ScrollMaxDp = Utils.DpToPx(ScrollMax, context);

            //heightMaxScrollToolbar = context.getResources().getDimension(R.dimen.material_viewpager_padding_top);
            Elevation = Utils.DpToPx(4, context);
        }
コード例 #4
0
        protected override void OnRestoreInstanceState(IParcelable state)
        {
            SavedState ss = (SavedState)state;

            base.OnRestoreInstanceState(ss.SuperState);

            Settings = ss.Settings;
            if (HeaderBackground != null)
            {
                HeaderBackground.SetBackgroundColor(new Color(Settings.Color));
            }

            MaterialViewPagerAnimator animator = MaterialViewPagerHelper.GetAnimator(Context);

            //-1*ss.yOffset restore to 0
            animator.RestoreScroll(-1 * ss.YOffset, ss.Settings);
            MaterialViewPagerHelper.Register(Context, animator);
        }
コード例 #5
0
			private SavedState(Parcel source)
				: base(source)
			{

				Settings = source.ReadParcelable(null) as MaterialViewPagerSettings;
				YOffset = source.ReadFloat();
			}
コード例 #6
0
		protected override void OnRestoreInstanceState(IParcelable state)
		{
			SavedState ss = (SavedState)state;
			base.OnRestoreInstanceState(ss.SuperState);

			Settings = ss.Settings;
			if (HeaderBackground != null)
				HeaderBackground.SetBackgroundColor(new Color(Settings.Color));

			MaterialViewPagerAnimator animator = MaterialViewPagerHelper.GetAnimator(Context);

			//-1*ss.yOffset restore to 0
			animator.RestoreScroll(-1 * ss.YOffset, ss.Settings);
			MaterialViewPagerHelper.Register(Context, animator);
		}
		//endregion

		public void RestoreScroll(float scroll, MaterialViewPagerSettings settings)
		{
			//try to scroll up, on a looper to wait until restored
			new Handler(Looper.MainLooper).PostDelayed(() =>
			{
				if (!OnMaterialScrolled(null, scroll))
				{
					RestoreScroll(scroll, settings);
				}
			}, 100);
		}
コード例 #8
0
 private SavedState(Parcel source)
     : base(source)
 {
     Settings = source.ReadParcelable(null) as MaterialViewPagerSettings;
     YOffset  = source.ReadFloat();
 }