diff --git a/README.md b/README.md index 025beb4..76855b4 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The best feature is Lottie animations in refresh view, it uses lottie animations ```groovy dependencies { - implementation 'com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.2' + implementation 'com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.3' } ``` 2. Wrap your refreshing view ( RecyclerView, listView etc..) with SSPullToRefreshLayout diff --git a/app/src/main/java/com/simform/demo/MainActivity.kt b/app/src/main/java/com/simform/demo/MainActivity.kt index 6df09d0..c88913a 100644 --- a/app/src/main/java/com/simform/demo/MainActivity.kt +++ b/app/src/main/java/com/simform/demo/MainActivity.kt @@ -32,7 +32,9 @@ class MainActivity : AppCompatActivity() { override fun onRefresh() { GlobalScope.launch { delay(5000) - ssPullRefresh.setRefreshing(false) + runOnUiThread { + ssPullRefresh.setRefreshing(false) + } MainScope().launch { adapter.randomizeData() Toast.makeText(this@MainActivity,"Refresh Complete",Toast.LENGTH_SHORT).show() @@ -51,6 +53,9 @@ class MainActivity : AppCompatActivity() { ssPullRefresh.setRepeatCount(SSPullToRefreshLayout.RepeatCount.INFINITE) //set style of RefreshLayout : NORMAL, FLOAT, PINNED ssPullRefresh.setRefreshStyle(SSPullToRefreshLayout.RefreshStyle.NORMAL) + + ssPullRefresh.setRefreshInitialOffset(100f) + ssPullRefresh.setRefreshStyle(SSPullToRefreshLayout.RefreshStyle.FLOAT) } private fun setUpRecyclerView() { diff --git a/sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt b/sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt index 95cf1d4..d39d0fa 100644 --- a/sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt +++ b/sspulltorefresh/src/main/java/com/simform/refresh/SSPullToRefreshLayout.kt @@ -1002,7 +1002,7 @@ class SSPullToRefreshLayout(context: Context?, attrs: AttributeSet? = null) : mTargetOrRefreshViewOffsetY / mRefreshTargetOffset ) } - if (mRefreshView.visibility != VISIBLE) { + if (mCurrentTouchOffsetY != 0f && mRefreshView.visibility != VISIBLE) { mRefreshView.visibility = VISIBLE } invalidate()