示例#1
0
            /// <summary>
            /// Called when the <see cref="AndroidListView"/> is being scrolled.
            /// If the view is being scrolled, this method will be called before the next frame of the scroll is rendered.
            /// </summary>
            /// <param name="view">The <see cref="AndroidListView"/> whose scroll state is being reported.</param>
            /// <param name="firstVisibleItem">The index of the first visible cell.</param>
            /// <param name="visibleItemCount">The number of visible cells.</param>
            /// <param name="totalItemCount">The number of items in the list adaptor.</param>
            public void OnScroll(AndroidListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
            {
                var wasTracked = false;

                foreach (var t in _trackElements)
                {
                    if (!wasTracked)
                    {
                        if (t.IsSafeToTrack(view))
                        {
                            wasTracked      = true;
                            _contentOffset += t.GetDeltaY();
                            SendScrollEvent(_contentOffset);
                            t.SyncState(view);
                        }
                        else
                        {
                            t.Reset();
                        }
                    }
                    else
                    {
                        t.SyncState(view);
                    }
                }
            }
 static void n_OnScrollStateChanged_Landroid_widget_AbsListView_I(IntPtr jnienv, IntPtr native__this, IntPtr native_p0, int native_p1)
 {
     global::Com.Nostra13.Universalimageloader.Core.Listener.PauseOnScrollListener __this = global::Java.Lang.Object.GetObject <global::Com.Nostra13.Universalimageloader.Core.Listener.PauseOnScrollListener> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.AbsListView p0 = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.ScrollState p1 = (global::Android.Widget.ScrollState)native_p1;
     __this.OnScrollStateChanged(p0, p1);
 }
 static void n_OnScrollStateChanged_Landroid_widget_AbsListView_I(IntPtr jnienv, IntPtr native__this, IntPtr native_p0, int native_p1)
 {
     global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeOnScrollListener __this = global::Java.Lang.Object.GetObject <global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeOnScrollListener> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.AbsListView p0 = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.ScrollState p1 = (global::Android.Widget.ScrollState)native_p1;
     __this.OnScrollStateChanged(p0, p1);
 }
示例#4
0
 static void n_OnScrollStateChanged_Landroid_widget_AbsListView_I(IntPtr jnienv, IntPtr native__this, IntPtr native_p0, int native_p1)
 {
     global::Com.Bumptech.Glide.ListPreloader __this = global::Java.Lang.Object.GetObject <global::Com.Bumptech.Glide.ListPreloader> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.AbsListView       p0     = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.ScrollState       p1     = (global::Android.Widget.ScrollState)native_p1;
     __this.OnScrollStateChanged(p0, p1);
 }
        public ContextualUndoListViewTouchListener(global::Android.Widget.AbsListView p0, global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.Contextualundo.ContextualUndoListViewTouchListener.ICallback p1) : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
        {
            if (Handle != IntPtr.Zero)
            {
                return;
            }

            if (GetType() != typeof(ContextualUndoListViewTouchListener))
            {
                SetHandle(
                    global::Android.Runtime.JNIEnv.StartCreateInstance(GetType(), "(Landroid/widget/AbsListView;Lcom/nhaarman/listviewanimations/itemmanipulation/swipedismiss/contextualundo/ContextualUndoListViewTouchListener$Callback;)V", new JValue(p0), new JValue(p1)),
                    JniHandleOwnership.TransferLocalRef);
                global::Android.Runtime.JNIEnv.FinishCreateInstance(Handle, "(Landroid/widget/AbsListView;Lcom/nhaarman/listviewanimations/itemmanipulation/swipedismiss/contextualundo/ContextualUndoListViewTouchListener$Callback;)V", new JValue(p0), new JValue(p1));
                return;
            }

            if (id_ctor_Landroid_widget_AbsListView_Lcom_nhaarman_listviewanimations_itemmanipulation_swipedismiss_contextualundo_ContextualUndoListViewTouchListener_Callback_ == IntPtr.Zero)
            {
                id_ctor_Landroid_widget_AbsListView_Lcom_nhaarman_listviewanimations_itemmanipulation_swipedismiss_contextualundo_ContextualUndoListViewTouchListener_Callback_ = JNIEnv.GetMethodID(class_ref, "<init>", "(Landroid/widget/AbsListView;Lcom/nhaarman/listviewanimations/itemmanipulation/swipedismiss/contextualundo/ContextualUndoListViewTouchListener$Callback;)V");
            }
            SetHandle(
                global::Android.Runtime.JNIEnv.StartCreateInstance(class_ref, id_ctor_Landroid_widget_AbsListView_Lcom_nhaarman_listviewanimations_itemmanipulation_swipedismiss_contextualundo_ContextualUndoListViewTouchListener_Callback_, new JValue(p0), new JValue(p1)),
                JniHandleOwnership.TransferLocalRef);
            JNIEnv.FinishCreateInstance(Handle, class_ref, id_ctor_Landroid_widget_AbsListView_Lcom_nhaarman_listviewanimations_itemmanipulation_swipedismiss_contextualundo_ContextualUndoListViewTouchListener_Callback_, new JValue(p0), new JValue(p1));
        }
示例#6
0
 public void SetAbsListView(global::Android.Widget.AbsListView p0)
 {
     if (id_setAbsListView_Landroid_widget_AbsListView_ == IntPtr.Zero)
     {
         id_setAbsListView_Landroid_widget_AbsListView_ = JNIEnv.GetMethodID(class_ref, "setAbsListView", "(Landroid/widget/AbsListView;)V");
     }
     JNIEnv.CallVoidMethod(Handle, id_setAbsListView_Landroid_widget_AbsListView_, new JValue(p0));
 }
        static IntPtr n_CreateListViewTouchListener_Landroid_widget_AbsListView_(IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
        {
            global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeDismissAdapter __this = global::Java.Lang.Object.GetObject <global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeDismissAdapter> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
            global::Android.Widget.AbsListView p0 = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
            IntPtr __ret = JNIEnv.ToLocalJniHandle(__this.CreateListViewTouchListener(p0));

            return(__ret);
        }
示例#8
0
 /// <summary>
 /// Synchronize the state for the tracked view.
 /// </summary>
 /// <param name="view">The native list view.</param>
 public void SyncState(AndroidListView view)
 {
     if (view.ChildCount > 0)
     {
         _trackedView             = GetChild(view);
         _trackedViewPrevTop      = GetY();
         _trackedViewPrevPosition = view.GetPositionForView(_trackedView);
     }
 }
示例#9
0
 /// <summary>
 /// Called when the <see cref="AndroidListView"/> has been scrolled.
 /// </summary>
 /// <param name="view">The <see cref="AndroidListView"/> whose scroll state is being reported.</param>
 /// <param name="scrollState">The current scroll state.</param>
 public void OnScrollStateChanged(AndroidListView view, [GeneratedEnum] AndroidScrollState scrollState)
 {
     // Initialize the values every time the list is moving.
     if (scrollState == AndroidScrollState.TouchScroll || scrollState == AndroidScrollState.Fling)
     {
         foreach (var t in _trackElements)
         {
             t.SyncState(view);
         }
     }
 }
 static void n_OnDismiss_Landroid_widget_AbsListView_arrayI(IntPtr jnienv, IntPtr native__this, IntPtr native_p0, IntPtr native_p1)
 {
     global::Com.Nhaarman.Listviewanimations.Itemmanipulation.IOnDismissCallback __this = global::Java.Lang.Object.GetObject <global::Com.Nhaarman.Listviewanimations.Itemmanipulation.IOnDismissCallback> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.AbsListView p0 = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
     int[] p1 = (int[])JNIEnv.GetArray(native_p1, JniHandleOwnership.DoNotTransfer, typeof(int));
     __this.OnDismiss(p0, p1);
     if (p1 != null)
     {
         JNIEnv.CopyArray(p1, native_p1);
     }
 }
        public void OnDismiss(global::Android.Widget.AbsListView p0, int[] p1)
        {
            if (id_onDismiss_Landroid_widget_AbsListView_arrayI == IntPtr.Zero)
            {
                id_onDismiss_Landroid_widget_AbsListView_arrayI = JNIEnv.GetMethodID(class_ref, "onDismiss", "(Landroid/widget/AbsListView;[I)V");
            }
            IntPtr native_p1 = JNIEnv.NewArray(p1);

            JNIEnv.CallVoidMethod(Handle, id_onDismiss_Landroid_widget_AbsListView_arrayI, new JValue(p0), new JValue(native_p1));
            if (p1 != null)
            {
                JNIEnv.CopyArray(native_p1, p1);
                JNIEnv.DeleteLocalRef(native_p1);
            }
        }
        public virtual void OnScroll(global::Android.Widget.AbsListView p0, int p1, int p2, int p3)
        {
            if (id_onScroll_Landroid_widget_AbsListView_III == IntPtr.Zero)
            {
                id_onScroll_Landroid_widget_AbsListView_III = JNIEnv.GetMethodID(class_ref, "onScroll", "(Landroid/widget/AbsListView;III)V");
            }

            if (GetType() == ThresholdType)
            {
                JNIEnv.CallVoidMethod(Handle, id_onScroll_Landroid_widget_AbsListView_III, new JValue(p0), new JValue(p1), new JValue(p2), new JValue(p3));
            }
            else
            {
                JNIEnv.CallNonvirtualVoidMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "onScroll", "(Landroid/widget/AbsListView;III)V"), new JValue(p0), new JValue(p1), new JValue(p2), new JValue(p3));
            }
        }
        public virtual void OnScrollStateChanged(global::Android.Widget.AbsListView p0, [global::Android.Runtime.GeneratedEnum] global::Android.Widget.ScrollState p1)
        {
            if (id_onScrollStateChanged_Landroid_widget_AbsListView_I == IntPtr.Zero)
            {
                id_onScrollStateChanged_Landroid_widget_AbsListView_I = JNIEnv.GetMethodID(class_ref, "onScrollStateChanged", "(Landroid/widget/AbsListView;I)V");
            }

            if (GetType() == ThresholdType)
            {
                JNIEnv.CallVoidMethod(Handle, id_onScrollStateChanged_Landroid_widget_AbsListView_I, new JValue(p0), new JValue((int)p1));
            }
            else
            {
                JNIEnv.CallNonvirtualVoidMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "onScrollStateChanged", "(Landroid/widget/AbsListView;I)V"), new JValue(p0), new JValue((int)p1));
            }
        }
示例#14
0
                /// <summary>
                /// Get a child view for the specified position.
                /// </summary>
                /// <param name="view">The native list view.</param>
                /// <returns>A child view for the specified position.</returns>
                private global::Android.Views.View GetChild(AndroidListView view)
                {
                    switch (_position)
                    {
                    case 0:
                        return(view.GetChildAt(0));

                    case 1:
                    case 2:
                        return(view.GetChildAt(view.ChildCount / 2));

                    case 3:
                        return(view.GetChildAt(view.ChildCount - 1));

                    default:
                        return(null);
                    }
                }
示例#15
0
        public virtual unsafe void OnScrollStateChanged(global::Android.Widget.AbsListView p0, [global::Android.Runtime.GeneratedEnum] global::Android.Widget.ScrollState p1)
        {
            if (id_onScrollStateChanged_Landroid_widget_AbsListView_I == IntPtr.Zero)
            {
                id_onScrollStateChanged_Landroid_widget_AbsListView_I = JNIEnv.GetMethodID(class_ref, "onScrollStateChanged", "(Landroid/widget/AbsListView;I)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue((int)p1);

                if (GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(Handle, id_onScrollStateChanged_Landroid_widget_AbsListView_I, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "onScrollStateChanged", "(Landroid/widget/AbsListView;I)V"), __args);
                }
            } finally {
            }
        }
示例#16
0
        public virtual unsafe void OnScroll(global::Android.Widget.AbsListView p0, int p1, int p2, int p3)
        {
            if (id_onScroll_Landroid_widget_AbsListView_III == IntPtr.Zero)
            {
                id_onScroll_Landroid_widget_AbsListView_III = JNIEnv.GetMethodID(class_ref, "onScroll", "(Landroid/widget/AbsListView;III)V");
            }
            try {
                JValue *__args = stackalloc JValue [4];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);
                __args [2] = new JValue(p2);
                __args [3] = new JValue(p3);

                if (GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(Handle, id_onScroll_Landroid_widget_AbsListView_III, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "onScroll", "(Landroid/widget/AbsListView;III)V"), __args);
                }
            } finally {
            }
        }
示例#17
0
 void global::Com.Nhaarman.Listviewanimations.IListViewSetter.SetAbsListView(global::Android.Widget.AbsListView listView)
 {
     AbsListView = listView;
 }
        protected virtual global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeDismissListViewTouchListener CreateListViewTouchListener(global::Android.Widget.AbsListView p0)
        {
            if (id_createListViewTouchListener_Landroid_widget_AbsListView_ == IntPtr.Zero)
            {
                id_createListViewTouchListener_Landroid_widget_AbsListView_ = JNIEnv.GetMethodID(class_ref, "createListViewTouchListener", "(Landroid/widget/AbsListView;)Lcom/nhaarman/listviewanimations/itemmanipulation/swipedismiss/SwipeDismissListViewTouchListener;");
            }

            global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeDismissListViewTouchListener __ret;
            if (GetType() == ThresholdType)
            {
                __ret = global::Java.Lang.Object.GetObject <global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeDismissListViewTouchListener> (JNIEnv.CallObjectMethod(Handle, id_createListViewTouchListener_Landroid_widget_AbsListView_, new JValue(p0)), JniHandleOwnership.TransferLocalRef);
            }
            else
            {
                __ret = global::Java.Lang.Object.GetObject <global::Com.Nhaarman.Listviewanimations.Itemmanipulation.Swipedismiss.SwipeDismissListViewTouchListener> (JNIEnv.CallNonvirtualObjectMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "createListViewTouchListener", "(Landroid/widget/AbsListView;)Lcom/nhaarman/listviewanimations/itemmanipulation/swipedismiss/SwipeDismissListViewTouchListener;"), new JValue(p0)), JniHandleOwnership.TransferLocalRef);
            }
            return(__ret);
        }
示例#19
0
 /// <summary>
 /// Determine if it is safe to track the nested view.
 /// </summary>
 /// <param name="view">The native list view.</param>
 /// <returns>True if safe, false if not.</returns>
 public bool IsSafeToTrack(AndroidListView view)
 {
     return(_trackedView != null &&
            _trackedView.Parent == view &&
            view.GetPositionForView(_trackedView) == _trackedViewPrevPosition);
 }
示例#20
0
 static void n_SetAbsListView_Landroid_widget_AbsListView_(IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
 {
     global::Com.Nhaarman.Listviewanimations.BaseAdapterDecorator __this = global::Java.Lang.Object.GetObject <global::Com.Nhaarman.Listviewanimations.BaseAdapterDecorator> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.AbsListView p0 = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
     __this.AbsListView = p0;
 }
        private bool CanScrollUp(global::Android.Views.View view)
        {
            if (!RefreshView.IsPullToRefreshEnabled)
            {
                return(true);
            }
            else
            {
                ViewGroup viewGroup = view as ViewGroup;
                if (viewGroup == null)
                {
                    return(base.CanChildScrollUp());
                }

                int sdk = (int)global::Android.OS.Build.VERSION.SdkInt;
                if (sdk >= 16)
                {
                    //
                    //is a scroll container such as listview, scroll view, gridview
                    //
                    if (viewGroup.IsScrollContainer)
                    {
                        return(base.CanChildScrollUp());
                    }
                }

                //
                //if you have something custom and you can't scroll up you might need to enable this
                //for instance on a custom recycler view where the code above isn't working!
                //
                for (int i = 0; i < viewGroup.ChildCount; i++)
                {
                    var child = viewGroup.GetChildAt(i);
                    if (child is global::Android.Widget.AbsListView)
                    {
                        global::Android.Widget.AbsListView list = child as global::Android.Widget.AbsListView;
                        if (list != null)
                        {
                            if (list.FirstVisiblePosition == 0)
                            {
                                global::Android.Views.View subChild = list.GetChildAt(0);

                                return(subChild != null && subChild.Top != 0);
                            }

                            //
                            //if children are in list and we are scrolled a bit... sure you can scroll up
                            //
                            return(true);
                        }
                    }
                    else if (child is global::Android.Widget.ScrollView)
                    {
                        global::Android.Widget.ScrollView scrollview = child as global::Android.Widget.ScrollView;
                        return(scrollview.ScrollY <= 0.0);
                    }
                    else if (child is global::Android.Webkit.WebView)
                    {
                        global::Android.Webkit.WebView webView = child as global::Android.Webkit.WebView;
                        return(webView.ScrollY > 0.0);
                    }
                    else if (child is global::Android.Support.V4.Widget.SwipeRefreshLayout)
                    {
                        return(CanScrollUp(child as ViewGroup));
                    }
                    //
                    //else if something else like a recycler view?
                    //
                }

                return(false);
            }
        }
示例#22
0
 static void n_OnScroll_Landroid_widget_AbsListView_III(IntPtr jnienv, IntPtr native__this, IntPtr native_p0, int p1, int p2, int p3)
 {
     global::Com.Bumptech.Glide.ListPreloader __this = global::Java.Lang.Object.GetObject <global::Com.Bumptech.Glide.ListPreloader> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
     global::Android.Widget.AbsListView       p0     = global::Java.Lang.Object.GetObject <global::Android.Widget.AbsListView> (native_p0, JniHandleOwnership.DoNotTransfer);
     __this.OnScroll(p0, p1, p2, p3);
 }