diff --git a/ptr-demo/src/in/srain/cube/views/ptr/demo/ui/EnableNextPTRAtOnce.java b/ptr-demo/src/in/srain/cube/views/ptr/demo/ui/EnableNextPTRAtOnce.java index cca6429..4fca557 100644 --- a/ptr-demo/src/in/srain/cube/views/ptr/demo/ui/EnableNextPTRAtOnce.java +++ b/ptr-demo/src/in/srain/cube/views/ptr/demo/ui/EnableNextPTRAtOnce.java @@ -1,5 +1,7 @@ package in.srain.cube.views.ptr.demo.ui; +import android.view.View; + import in.srain.cube.views.ptr.PtrClassicFrameLayout; import in.srain.cube.views.ptr.demo.R; import in.srain.cube.views.ptr.demo.ui.classic.WithTextViewInFrameLayoutFragment; @@ -7,9 +9,16 @@ public class EnableNextPTRAtOnce extends WithTextViewInFrameLayoutFragment { @Override - protected void setupViews(PtrClassicFrameLayout ptrFrame) { + protected void setupViews(final PtrClassicFrameLayout ptrFrame) { setHeaderTitle(R.string.ptr_demo_enable_next_ptr_at_once); ptrFrame.setEnabledNextPtrAtOnce(true); ptrFrame.setPullToRefresh(false); + + mTitleHeaderBar.setRightOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ptrFrame.autoRefresh(); + } + }); } } \ No newline at end of file diff --git a/ptr-lib/src/in/srain/cube/views/ptr/PtrFrameLayout.java b/ptr-lib/src/in/srain/cube/views/ptr/PtrFrameLayout.java index dc1ea65..ee13471 100755 --- a/ptr-lib/src/in/srain/cube/views/ptr/PtrFrameLayout.java +++ b/ptr-lib/src/in/srain/cube/views/ptr/PtrFrameLayout.java @@ -680,7 +680,9 @@ private void clearFlag() { public void autoRefresh(boolean atOnce, int duration) { - if (mStatus != PTR_STATUS_INIT) { + if(isEnabledNextPtrAtOnce()){ + tryToNotifyReset(); + }else if (mStatus != PTR_STATUS_INIT) { return; }