/** * Register a ScrollView to the current MaterialViewPagerAnimator * Listen to ObservableScrollViewCallbacks so give to $[observableScrollViewCallbacks] your ObservableScrollViewCallbacks if you already use one * For loadmore or anything else * * @param activity current context * @param mScrollView the scrollable * @param observableScrollViewCallbacks use it if you want to get a callback of the RecyclerView */ public static void RegisterScrollView(Activity activity, ObservableScrollView.ObservableScrollView mScrollView, IObservableScrollViewCallbacks observableScrollViewCallbacks) { if (activity != null && _hashMap.ContainsKey(activity)) { MaterialViewPagerAnimator animator; if (_hashMap.TryGetValue(activity, out animator) && animator != null) { animator.RegisterScrollView(mScrollView, observableScrollViewCallbacks); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here //first lets get the passed activity data _vehicleObjectId = Intent.GetStringExtra("VehicleID") ?? "NA"; AndHUD.Shared.Show(this, "Loading vehicle details...", -1, MaskType.Black); _observableScrollView = FindViewById <ObservableScrollView>(Resource.Id.scrollableContents); _linearLayout = FindViewById <LinearLayout>(Resource.Id.thumbnails); _mainImage = FindViewById <ImageView>(Resource.Id.MainImageView); //initialize the labels _lblDescription = FindViewById <Button>(Resource.Id.txtDescription); _lblPrice = FindViewById <TextView>(Resource.Id.lblPrice); _lblDescription = FindViewById <TextView>(Resource.Id.lblDescription); _lblMake = FindViewById <TextView>(Resource.Id.txtMake); _lblModel = FindViewById <TextView>(Resource.Id.txtModel); _lblModelVar = FindViewById <TextView>(Resource.Id.txtModelVar); _lblYear = FindViewById <TextView>(Resource.Id.txtYear); _lblDriveTrain = FindViewById <TextView>(Resource.Id.txtDriveTrain); _lblEngine = FindViewById <TextView>(Resource.Id.txtEngine); _lblTransmission = FindViewById <TextView>(Resource.Id.txtTransmission); _lblMileage = FindViewById <TextView>(Resource.Id.txtMileage); _lblVin = FindViewById <TextView>(Resource.Id.txtVin); _lblStockNo = FindViewById <TextView>(Resource.Id.txtStockNo); _lblVat = FindViewById <TextView>(Resource.Id.txtVat); _lblExtColor = FindViewById <TextView>(Resource.Id.txtExtColor); _lblIntColor = FindViewById <TextView>(Resource.Id.txtIntColor); _lblOwnerName = FindViewById <TextView>(Resource.Id.txtOwner); //will only be visible for the owner var editFab = FindViewById <FloatingActionButton>(Resource.Id.editFab); //fab.AttachToRecyclerView(recyclerView, this); editFab.AttachToScrollView(_observableScrollView); editFab.Size = FabSize.Normal; editFab.Click += EditVehicleProfile; editFab.Visibility = ViewStates.Visible; _ownerImage = FindViewById <ImageView>(Resource.Id.ownerImage); _btnMessageOwner = FindViewById <Button>(Resource.Id.btnMessageOwner); //click events _ownerImage.Click += OwnerImageClicked; _lblOwnerName.Click += OwnerImageClicked; //make main image view clickable _mainImage.Clickable = true; _mainImage.Click += MainImageTapped; _btnMessageOwner.Visibility = ViewStates.Gone; //naot applicable to teh owner's profile }
public void OnScrollChanged(ObservableScrollView view) { // Keep each day view at the same vertical scroll offset. int scrollY = view.ScrollY; foreach (var day in mDays) { if (day.ScrollView != view) { day.ScrollView.ScrollTo(0, scrollY); } } }
protected override void OnCreateContent(ViewGroup Content) { var scroll = new ObservableScrollView(this); scroll.LayoutParameters = new RelativeLayout.LayoutParams(MatchParent, MatchParent); Content.AddView(scroll); Main = new LinearLayout(this) { Orientation = Orientation.Vertical }; Main.LayoutParameters = new RelativeLayout.LayoutParams(MatchParent, MatchParent); scroll.AddView(Main); BuildList(); }
public ObservableScrollViewCallbacks(MaterialViewPagerAnimator materialViewPagerAnimator, ObservableScrollView.ObservableScrollView scrollView, IObservableScrollViewCallbacks observableScrollViewCallbacks) { _animator = materialViewPagerAnimator; _scrollView = scrollView; _observableScrollViewCallbacks = observableScrollViewCallbacks; }
/** * Register a ScrollView to the current MaterialViewPagerAnimator * Listen to ObservableScrollViewCallbacks so give to $[observableScrollViewCallbacks] your ObservableScrollViewCallbacks if you already use one * For loadmore or anything else * * @param scrollView the scrollable * @param observableScrollViewCallbacks use it if you want to get a callback of the RecyclerView */ public void RegisterScrollView(ObservableScrollView.ObservableScrollView scrollView, IObservableScrollViewCallbacks observableScrollViewCallbacks) { if (scrollView != null) { ScrollViewList.Add(scrollView); //add to the scrollable list if (scrollView.Parent != null && scrollView.Parent.Parent is ViewGroup) scrollView.SetTouchInterceptionViewGroup((ViewGroup)scrollView.Parent.Parent); scrollView.SetScrollViewCallbacks(new ObservableScrollViewCallbacks(this, scrollView, observableScrollViewCallbacks)); scrollView.Post(() => SetScrollOffset(scrollView, LastYOffset)); } }
public void OnScrollChanged (ObservableScrollView view) { // Keep each day view at the same vertical scroll offset. int scrollY = view.ScrollY; foreach (var day in mDays) { if (day.ScrollView != view) { day.ScrollView.ScrollTo(0, scrollY); } } }