diff --git a/README.md b/README.md
index 2eeaab9..2225131 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,10 @@ The actual features are:
![demo_data](https://github.com/simformsolutions/SSCustomBottomNavigation/blob/master/images/custom_bottom_navigation.gif)
+Reverse Curve
+
+![demo_data](https://github.com/simformsolutions/SSCustomBottomNavigation/blob/master/images/custom_bottom_navigation_revese.gif)
+
### Gradle Dependency
* Add it in your root build.gradle at the end of repositories:
@@ -67,6 +71,7 @@ The actual features are:
| `app:ss_countTypeface` | Set Font for Notification Badge | `none` |
| `app:ss_rippleColor` | Set Ripple Color | `#757575` |
| `app:ss_shadowColor` | Set Bottom Bar Shadow Color | `shadowColor` |
+| `app:ss_reverseCurve` | Set Reverse Bzier Curve | `false` |
# Customization
------------------------
diff --git a/custombottomnavigation/build.gradle b/custombottomnavigation/build.gradle
index 8a3a02c..f6ae07c 100644
--- a/custombottomnavigation/build.gradle
+++ b/custombottomnavigation/build.gradle
@@ -11,7 +11,7 @@ afterEvaluate {
from components.release
groupId = 'com.simform.custombottomnavigation'
artifactId = 'custombottomnavigation'
- version = '3.3'
+ version = '3.4'
}
}
}
diff --git a/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/BezierView.kt b/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/BezierView.kt
index 788ce95..d56a1dc 100644
--- a/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/BezierView.kt
+++ b/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/BezierView.kt
@@ -28,6 +28,7 @@ class BezierView : View {
private var bezierInnerWidth = 0f
private var bezierInnerHeight = 0f
private val shadowHeight = dipf(context, 35) // this height will change bottomnavigation bg height
+ private val reverseCurveHeight = dipf(context, 10) // this will change bottomnavigation bg height reverse
var color = 0
set(value) {
@@ -90,6 +91,11 @@ class BezierView : View {
}
}
+ var isReverseCurve = false
+ set(value) {
+ field = value
+ invalidate()
+ }
@SuppressLint("NewApi")
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
@@ -203,12 +209,13 @@ class BezierView : View {
private fun calculateInner() {
val extra = shadowHeight
+ val pickHeight = if(isReverseCurve) (height - reverseCurveHeight) else (height - extra) / waveHeight
innerArray[0] = PointF(0f, bezierInnerHeight + extra)
innerArray[1] = PointF((bezierX - bezierInnerWidth / 2), bezierInnerHeight + extra)
innerArray[2] = PointF(bezierX - bezierInnerWidth / 4, bezierInnerHeight + extra)
- innerArray[3] = PointF(bezierX - bezierInnerWidth / 4, (height - extra) / waveHeight)
- innerArray[4] = PointF(bezierX, (height - extra) / waveHeight)
- innerArray[5] = PointF(bezierX + bezierInnerWidth / 4, (height - extra) / waveHeight)
+ innerArray[3] = PointF(bezierX - bezierInnerWidth / 4, pickHeight)
+ innerArray[4] = PointF(bezierX, pickHeight)
+ innerArray[5] = PointF(bezierX + bezierInnerWidth / 4, pickHeight)
innerArray[6] = PointF(bezierX + bezierInnerWidth / 4, bezierInnerHeight + extra)
innerArray[7] = PointF(bezierX + bezierInnerWidth / 2, bezierInnerHeight + extra)
innerArray[8] = PointF(width, bezierInnerHeight + extra)
diff --git a/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/SSCustomBottomNavigation.kt b/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/SSCustomBottomNavigation.kt
index 6bf6e6b..7833318 100644
--- a/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/SSCustomBottomNavigation.kt
+++ b/custombottomnavigation/src/main/java/com/simform/custombottomnavigation/SSCustomBottomNavigation.kt
@@ -127,6 +127,12 @@ class SSCustomBottomNavigation : FrameLayout {
updateAllIfAllowDraw()
}
+ var isReverseCurve = false
+ set(value) {
+ field = value
+ updateAllIfAllowDraw()
+ }
+
fun setSelectedIndex(activeIndex: Int = 0) {
selectedIndex = activeIndex
}
@@ -206,6 +212,8 @@ class SSCustomBottomNavigation : FrameLayout {
).toFloat()
waveHeight =
getInteger(R.styleable.SSCustomBottomNavigation_ss_waveHeight, waveHeight)
+
+ isReverseCurve = getBoolean(R.styleable.SSCustomBottomNavigation_ss_reverseCurve, isReverseCurve)
val iconTextTypeFace =
getString(R.styleable.SSCustomBottomNavigation_ss_iconTextTypeface)
if (iconTextTypeFace != null && iconTextTypeFace.isNotEmpty())
@@ -242,6 +250,7 @@ class SSCustomBottomNavigation : FrameLayout {
layoutParams = LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (heightCell))
color = backgroundBottomColor
shadowColor = this@SSCustomBottomNavigation.shadowColor
+ isReverseCurve = this@SSCustomBottomNavigation.isReverseCurve
}
bezierView.waveHeight = waveHeight
diff --git a/custombottomnavigation/src/main/res/values/attrs.xml b/custombottomnavigation/src/main/res/values/attrs.xml
index 587d593..370c457 100644
--- a/custombottomnavigation/src/main/res/values/attrs.xml
+++ b/custombottomnavigation/src/main/res/values/attrs.xml
@@ -29,6 +29,7 @@
+
\ No newline at end of file
diff --git a/images/custom_bottom_navigation_revese.gif b/images/custom_bottom_navigation_revese.gif
new file mode 100644
index 0000000..c483262
Binary files /dev/null and b/images/custom_bottom_navigation_revese.gif differ