Skip to content

Commit

Permalink
resolve issue #15
Browse files Browse the repository at this point in the history
  • Loading branch information
valkriaine committed May 9, 2022
1 parent ff732b0 commit cf59f09
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bouncy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 31
versionCode 22
versionName "2.2"
versionCode 23
versionName "2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1951,15 +1951,15 @@ class BouncyNestedScrollView @JvmOverloads constructor(context: Context, attrs:
overscrollAnimationSize = getFloat(R.styleable.BouncyNestedScrollView_overscroll_animation_size, 0.5f)
flingAnimationSize = getFloat(R.styleable.BouncyNestedScrollView_fling_animation_size, 0.5f)

when (getInt(R.styleable.BouncyNestedScrollView_damping_ratio, 0))
when (getInt(R.styleable.BouncyNestedScrollView_bouncy_scrollview_damping_ratio, 0))
{
0 -> dampingRatio = Bouncy.DAMPING_RATIO_NO_BOUNCY
1 -> dampingRatio = Bouncy.DAMPING_RATIO_LOW_BOUNCY
2 -> dampingRatio = Bouncy.DAMPING_RATIO_MEDIUM_BOUNCY
3 -> dampingRatio = Bouncy.DAMPING_RATIO_HIGH_BOUNCY
}

when (getInt(R.styleable.BouncyNestedScrollView_stiffness, 1))
when (getInt(R.styleable.BouncyNestedScrollView_bouncy_scrollview_stiffness, 1))
{
0 -> stiffness = Bouncy.STIFFNESS_VERY_LOW
1 -> stiffness = Bouncy.STIFFNESS_LOW
Expand Down
20 changes: 10 additions & 10 deletions bouncy/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<attr name="overscroll_animation_size" format="float"/>
<attr name="fling_animation_size" format="float"/>

<attr name="damping_ratio" format="integer">
<attr name="bouncy_scrollview_damping_ratio" format="integer">
<enum name="DAMPING_RATIO_NO_BOUNCY" value="0" />
<enum name="DAMPING_RATIO_LOW_BOUNCY" value="1" />
<enum name="DAMPING_RATIO_MEDIUM_BOUNCY" value="2" />
<enum name="DAMPING_RATIO_HIGH_BOUNCY" value="3" />
</attr>
<attr name="stiffness" format="integer">
<attr name="bouncy_scrollview_stiffness" format="integer">
<enum name="STIFFNESS_VERY_LOW" value="0" />
<enum name="STIFFNESS_LOW" value="1" />
<enum name="STIFFNESS_MEDIUM" value="2" />
Expand All @@ -26,16 +26,16 @@
<attr name="allow_item_swipe" format="boolean"/>

<attr name="recyclerview_damping_ratio" format="integer">
<enum name="RECYCLERVIEW_DAMPING_RATIO_NO_BOUNCY" value="0" />
<enum name="RECYCLERVIEW_DAMPING_RATIO_LOW_BOUNCY" value="1" />
<enum name="RECYCLERVIEW_DAMPING_RATIO_MEDIUM_BOUNCY" value="2" />
<enum name="RECYCLERVIEW_DAMPING_RATIO_HIGH_BOUNCY" value="3" />
<enum name="DAMPING_RATIO_NO_BOUNCY" value="0" />
<enum name="DAMPING_RATIO_LOW_BOUNCY" value="1" />
<enum name="DAMPING_RATIO_MEDIUM_BOUNCY" value="2" />
<enum name="DAMPING_RATIO_HIGH_BOUNCY" value="3" />
</attr>
<attr name="recyclerview_stiffness" format="integer">
<enum name="RECYCLERVIEW_STIFFNESS_VERY_LOW" value="0" />
<enum name="RECYCLERVIEW_STIFFNESS_LOW" value="1" />
<enum name="RECYCLERVIEW_STIFFNESS_MEDIUM" value="2" />
<enum name="RECYCLERVIEW_STIFFNESS_HIGH" value="3" />
<enum name="STIFFNESS_VERY_LOW" value="0" />
<enum name="STIFFNESS_LOW" value="1" />
<enum name="STIFFNESS_MEDIUM" value="2" />
<enum name="STIFFNESS_HIGH" value="3" />
</attr>
</declare-styleable>
</resources>
9 changes: 6 additions & 3 deletions example/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
android:background="@color/cardview_light_background"/>

</com.google.android.material.appbar.AppBarLayout>


<!--
<!--
<com.factor.bouncy.BouncyRecyclerView
android:id="@+id/rc"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:recyclerview_stiffness="STIFFNESS_HIGH"
app:allow_item_swipe="true"
app:allow_drag_reorder="true"/>
-->
-->

<!--BouncyNestedScrollView-->

<com.factor.bouncy.BouncyNestedScrollView
android:id="@+id/scrollView"
app:bouncy_scrollview_stiffness="STIFFNESS_LOW"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down

0 comments on commit cf59f09

Please sign in to comment.