private void BeginRefresh(View viewToUpdate, IRefreshListener refreshAction) { ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters; layoutParams.Height = (int)PullElementStandbyHeight; viewToUpdate.LayoutParameters = layoutParams; //UITrace.Trace("PullDown:refreshing"); State = new RefreshingState(); ThreadPool.QueueUserWorkItem((ignored) => { try { //var start = DateTime.UtcNow; refreshAction.DoRefresh(); //var finish = DateTime.UtcNow; //long difference = finish - start; //try //{ // Thread.Sleep(Math.Max(difference, 1500)); //} //catch (InterruptedException e) //{ //} } catch (RuntimeException e) { //UITrace.Trace("Error: {0}", e.ToLongString()); throw e; } finally { RunOnUiThread(() => RefreshFinished(refreshAction)); } }); }
private void BeginRefresh(View viewToUpdate, IRefreshListener refreshAction) { ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters; layoutParams.Height = (int) PullElementStandbyHeight; viewToUpdate.LayoutParameters = layoutParams; //UITrace.Trace("PullDown:refreshing"); State = new RefreshingState(); ThreadPool.QueueUserWorkItem((ignored) => { try { //var start = DateTime.UtcNow; refreshAction.DoRefresh(); //var finish = DateTime.UtcNow; //long difference = finish - start; //try //{ // Thread.Sleep(Math.Max(difference, 1500)); //} //catch (InterruptedException e) //{ //} } catch (RuntimeException e) { //UITrace.Trace("Error: {0}", e.ToLongString()); throw e; } finally { RunOnUiThread(() => RefreshFinished(refreshAction)); } }); }
public void RefreshFinished(IRefreshListener refreshAction) { //UITrace.Trace("PullDown: ready"); State = new PullToRefreshState(); InitializeYsHistory(); RunOnUiThread(() => { float dp = new Pixel(0, _listView.Resources).ToDp(); SetUpperButtonHeight(dp); SetLowerButtonHeight(dp); refreshAction.RefreshFinished(); }); }
private void Initialize() { State = new PullToRefreshState(); _listView.Touch += (sender, args) => { MotionEvent motionEvent = args.Event; if (motionEvent.Action == MotionEventActions.Up) { InitializeYsHistory(); State.TouchStopped(motionEvent, this); } else if (motionEvent.Action == MotionEventActions.Move) { args.Handled = State.HandleMovement(motionEvent, this); } args.Handled = false; }; }
public void SetPullingUp(MotionEvent motionEvent) { //UITrace.Trace("PullDown pulling up"); State = new PullingUpState(motionEvent); }
/**************************************************************/ // State Change /**************************************************************/ public void SetPullingDown(MotionEvent motionEvent) { //UITrace.Trace("PullDown pulling down"); State = new PullingDownState(motionEvent); }