Skip to content

Commit

Permalink
SlippyOptions class has been implemented.
Browse files Browse the repository at this point in the history
  • Loading branch information
Furkan Ayaz committed Jun 29, 2024
1 parent 36a86b3 commit 2d69dd0
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 13 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 1,7 @@
*.iml
.gradle
/local.properties
/.idea
/.idea/caches
/.idea/libraries
/.idea/modules.xml
Expand All @@ -13,3 14,14 @@
.externalNativeBuild
.cxx
local.properties
/.gradle
/proguard-rules.pro
*.apk
*.aar
*.ap_
.classpath
.project
*.log
*.pot
*.dat
*.tmp
10 changes: 5 additions & 5 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 24,7 @@ dependencyResolutionManagement {

```
dependencies {
implementation("com.github.furkanayaz:Slippy-Bottom-Bar:2.5")
implementation("com.github.furkanayaz:Slippy-Bottom-Bar:2.6")
}
```

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/drawable/settings.xml
Original file line number Diff line number Diff line change
@@ -1,10 1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="19dp"
android:height="20dp"
android:viewportWidth="19"
android:viewportHeight="20">
<path
android:pathData="M17.902,11.58C18.26,11.77 18.536,12.07 18.73,12.37C19.108,12.99 19.078,13.75 18.71,14.42L17.994,15.62C17.616,16.26 16.911,16.66 16.185,16.66C15.828,16.66 15.429,16.56 15.102,16.36C14.837,16.19 14.53,16.13 14.203,16.13C13.191,16.13 12.343,16.96 12.312,17.95C12.312,19.1 11.372,20 10.197,20H8.807C7.621,20 6.681,19.1 6.681,17.95C6.661,16.96 5.813,16.13 4.801,16.13C4.464,16.13 4.157,16.19 3.902,16.36C3.575,16.56 3.166,16.66 2.818,16.66C2.082,16.66 1.377,16.26 0.999,15.62L0.294,14.42C-0.084,13.77 -0.105,12.99 0.274,12.37C0.437,12.07 0.744,11.77 1.091,11.58C1.377,11.44 1.561,11.21 1.735,10.94C2.246,10.08 1.939,8.95 1.071,8.44C0.059,7.87 -0.268,6.6 0.314,5.61L0.999,4.43C1.592,3.44 2.859,3.09 3.881,3.67C4.77,4.15 5.925,3.83 6.446,2.98C6.61,2.7 6.702,2.4 6.681,2.1C6.661,1.71 6.773,1.34 6.967,1.04C7.346,0.42 8.03,0.02 8.776,0H10.217C10.974,0 11.658,0.42 12.036,1.04C12.22,1.34 12.343,1.71 12.312,2.1C12.292,2.4 12.384,2.7 12.547,2.98C13.068,3.83 14.223,4.15 15.123,3.67C16.134,3.09 17.412,3.44 17.994,4.43L18.679,5.61C19.272,6.6 18.945,7.87 17.923,8.44C17.054,8.95 16.747,10.08 17.269,10.94C17.432,11.21 17.616,11.44 17.902,11.58ZM6.61,10.01C6.61,11.58 7.908,12.83 9.512,12.83C11.116,12.83 12.384,11.58 12.384,10.01C12.384,8.44 11.116,7.18 9.512,7.18C7.908,7.18 6.61,8.44 6.61,10.01Z"
android:fillColor="#D6DBDE"
android:fillType="evenOdd"/>
android:fillType="evenOdd"
tools:ignore="VectorPath" />
</vector>
2 changes: 1 addition & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 54,7 @@ publishing {
register<MavenPublication>("release") {
groupId = "com.github.furkanayaz"
artifactId = "slippy-bottom-bar"
version = "2.5"
version = "2.6"

afterEvaluate {
from(components["release"])
Expand Down
6 changes: 5 additions & 1 deletion lib/src/main/java/com/fa/lib/SlippyBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 8,8 @@ data class SlippyBar(
val badgeStyle: SlippyBadgeStyle? = null,
val startIndex: Int = 0,
val animationMillis: Int = 250
)
) {
init {
SlippyOptions.CURRENT_PAGE = startIndex
}
}
4 changes: 2 additions & 2 deletions lib/src/main/java/com/fa/lib/SlippyBottomBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 113,12 @@ fun SlippyBottomBar(
) {
if (tabs.isEmpty()) throw SlippyTabsException(message = ExceptionMessage.TABS_EMPTY_MESSAGE.message)

if (bar.startIndex > tabs.lastIndex) throw SlippyTabsException(message = ExceptionMessage.START_INDEX_GREATER_MESSAGE.message)
if (SlippyOptions.CURRENT_PAGE > tabs.lastIndex) throw SlippyTabsException(message = ExceptionMessage.START_INDEX_GREATER_MESSAGE.message)

val divColor: Color = colorResource(id = bar.dividerStyle?.dividerColor ?: R.color.dividerColor)

val currentTab: MutableIntState = rememberSaveable {
mutableIntStateOf(value = bar.startIndex)
mutableIntStateOf(value = SlippyOptions.CURRENT_PAGE)
}

val barSize: MutableState<IntSize> = remember {
Expand Down
5 changes: 5 additions & 0 deletions lib/src/main/java/com/fa/lib/SlippyOptions.kt
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
package com.fa.lib

object SlippyOptions {
var CURRENT_PAGE = 0
}

0 comments on commit 2d69dd0

Please sign in to comment.