Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/compiler.xml

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

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

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

15 changes: 14 additions & 1 deletion .idea/misc.xml

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

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.32"

ext.kotlin_version = '1.6.20'

repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.15.1'
}
Expand All @@ -17,12 +19,11 @@ allprojects {
google()
mavenCentral()
}

plugins.withId("com.vanniktech.maven.publish") {
/*plugins.withId("com.vanniktech.maven.publish") {
Comment thread
am3n marked this conversation as resolved.
Outdated
mavenPublish {
sonatypeHost = "S01"
}
}
}*/
}

subprojects {
Expand Down
33 changes: 20 additions & 13 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29

compileSdkVersion 32

defaultConfig {
applicationId "nl.joery.demo.animatedbottombar"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 32
versionCode 3

versionName "1.0.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -32,17 +32,24 @@ android {
}

dependencies {

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'

implementation 'com.jaredrummler:colorpicker:1.1.0'

implementation project(path: ':library')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}
1 change: 1 addition & 0 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</activity>
<activity
android:name=".playground.PlaygroundActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ class PlaygroundActivity : AppCompatActivity() {
TypedValue.COMPLEX_UNIT_SP
)
)
properties.add(
TypefaceProperty(
"badgeTypeface"
)
)
}

private fun initRecyclerView() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package nl.joery.demo.animatedbottombar.playground.properties

class TypefaceProperty(name: String) : Property(name)
32 changes: 16 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

GROUP=nl.joery.animatedbottombar
POM_ARTIFACT_ID=library
VERSION_NAME=1.1.0
#GROUP=nl.joery.animatedbottombar
#POM_ARTIFACT_ID=library
#VERSION_NAME=1.1.0

POM_NAME=AnimatedBottomBar
POM_DESCRIPTION=A customizable and easy to use BottomBar navigation view with sleek animations.
POM_INCEPTION_YEAR=2020
POM_URL=https://github.com/Droppers/AnimatedBottomBar
#POM_NAME=AnimatedBottomBar
Comment thread
am3n marked this conversation as resolved.
Outdated
#POM_DESCRIPTION=A customizable and easy to use BottomBar navigation view with sleek animations.
#POM_INCEPTION_YEAR=2020
#POM_URL=https://github.com/Droppers/AnimatedBottomBar

POM_LICENCE_NAME=The MIT License
POM_LICENCE_URL=https://github.com/Droppers/AnimatedBottomBar/blob/master/LICENSE
POM_LICENCE_DIST=repo
#POM_LICENCE_NAME=The MIT License
#POM_LICENCE_URL=https://github.com/Droppers/AnimatedBottomBar/blob/master/LICENSE
#POM_LICENCE_DIST=repo

POM_SCM_URL=https://github.com/Droppers/AnimatedBottomBar
POM_SCM_CONNECTION=scm:git:git://github.com/Droppers/AnimatedBottomBar.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/Droppers/AnimatedBottomBar.git
#POM_SCM_URL=https://github.com/Droppers/AnimatedBottomBar
#POM_SCM_CONNECTION=scm:git:git://github.com/Droppers/AnimatedBottomBar.git
#POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/Droppers/AnimatedBottomBar.git

POM_DEVELOPER_ID=Droppers
POM_DEVELOPER_NAME=Joery Droppers
POM_DEVELOPER_URL=https://github.com/Droppers
#POM_DEVELOPER_ID=Droppers
#POM_DEVELOPER_NAME=Joery Droppers
#POM_DEVELOPER_URL=https://github.com/Droppers
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Feb 27 16:22:39 CET 2020
#Mon Apr 04 13:26:57 IRDT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
39 changes: 19 additions & 20 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: "com.vanniktech.maven.publish"
//apply plugin: "com.vanniktech.maven.publish"
Comment thread
am3n marked this conversation as resolved.
Outdated

android {
compileSdkVersion 29

compileSdkVersion 32

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
Comment thread
am3n marked this conversation as resolved.
versionName VERSION_NAME

targetSdkVersion 32
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles 'consumer-rules.pro'
}
Expand All @@ -25,25 +23,26 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

kotlinOptions.freeCompilerArgs += ['-module-name', "${GROUP}.${POM_ARTIFACT_ID}"]
//kotlinOptions.freeCompilerArgs += ['-module-name', "${GROUP}.${POM_ARTIFACT_ID}"]
Comment thread
am3n marked this conversation as resolved.
Outdated
}
}

dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api 'androidx.core:core-ktx:1.5.0'
api 'androidx.appcompat:appcompat:1.3.0'

api 'androidx.recyclerview:recyclerview:1.2.0'
api 'androidx.viewpager2:viewpager2:1.0.0'
api 'com.google.android.flexbox:flexbox:3.0.0'
api 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.core:core-ktx:1.7.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

implementation "androidx.navigation:navigation-ui-ktx:2.4.1"

api "androidx.navigation:navigation-ui-ktx:2.3.5"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.view.animation.AnimationUtils
import android.widget.FrameLayout
import androidx.annotation.*
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.navigation.NavController
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager.widget.ViewPager
Expand Down Expand Up @@ -218,6 +219,13 @@ class AnimatedBottomBar @JvmOverloads constructor(
R.styleable.AnimatedBottomBar_abb_badgeTextSize,
tabStyle.badge.textSize
)
badgeTypeface =
if (attr.hasValue(R.styleable.AnimatedBottomBar_abb_badgeTypeface))
ResourcesCompat.getFont(
context,
attr.getResourceId(R.styleable.AnimatedBottomBar_abb_badgeTypeface, 0)
) ?: Typeface.DEFAULT
Comment thread
am3n marked this conversation as resolved.
Outdated
else Typeface.DEFAULT
Comment thread
am3n marked this conversation as resolved.
Outdated

// Initials tabs
val tabsResId = attr.getResourceId(R.styleable.AnimatedBottomBar_abb_tabs, -1)
Expand Down Expand Up @@ -1075,6 +1083,13 @@ class AnimatedBottomBar @JvmOverloads constructor(
applyTabStyle(BottomBarStyle.StyleUpdateType.BADGE)
}

var badgeTypeface
get() = tabStyle.badge.typeface
set(value) {
tabStyle.badge.typeface = value
applyTabStyle(BottomBarStyle.StyleUpdateType.BADGE)
}

class Tab internal constructor(
val icon: Drawable,
var iconSize: Int = -1,
Expand All @@ -1088,10 +1103,11 @@ class AnimatedBottomBar @JvmOverloads constructor(
val text: String? = null,
@ColorInt val backgroundColor: Int? = null,
@ColorInt val textColor: Int? = null,
@Dimension val textSize: Int? = null
@Dimension val textSize: Int? = null,
val typeface: Typeface? = null
) {
constructor() : this(null, null, null, null)
constructor(text: String?) : this(text, null, null, null)
constructor() : this(null, null, null, null, null)
constructor(text: String?) : this(text, null, null, null, null)
}

enum class TabType(val id: Int) {
Expand Down
11 changes: 11 additions & 0 deletions library/src/main/java/nl/joery/animatedbottombar/BadgeView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ class BadgeView @JvmOverloads constructor(
invalidate()
}

private var _typeface: Typeface = Typeface.DEFAULT
var typeface: Typeface
get() = _typeface
set(value) {
_typeface = value

textPaint.typeface = value
updateTextBounds()
invalidate()
}

init {
isEnabled = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ object BottomBarStyle {
var animationDuration: Int = 150,
@ColorInt var backgroundColor: Int = Color.rgb(255, 12, 16),
@ColorInt var textColor: Int = Color.WHITE,
@Dimension var textSize: Int = 9.spPx
@Dimension var textSize: Int = 9.spPx,
var typeface: Typeface = Typeface.DEFAULT
)

data class Indicator(
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/nl/joery/animatedbottombar/TabView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ internal class TabView @JvmOverloads constructor(
it.setBackgroundColor(badge.backgroundColor ?: style.badge.backgroundColor)
it.textColor = badge.textColor ?: style.badge.textColor
it.textSize = badge.textSize ?: style.badge.textSize
it.typeface = badge.typeface ?: style.badge.typeface

it.isEnabled = true
}
Expand Down Expand Up @@ -403,9 +404,8 @@ internal class TabView @JvmOverloads constructor(

val valueFrom: Float
val valueTo: Float
val animationType = if (selected) style.tabAnimationSelected else style.tabAnimation

when(animationType) {
when(if (selected) style.tabAnimationSelected else style.tabAnimation) {
Comment thread
am3n marked this conversation as resolved.
Outdated
AnimatedBottomBar.TabAnimation.SLIDE -> {
if (selected) {
valueFrom = when {
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
<attr name="abb_badgeBackgroundColor" format="color" />
<attr name="abb_badgeTextColor" format="color" />
<attr name="abb_badgeTextSize" format="dimension" />
<attr name="abb_badgeTypeface" format="reference" />
</declare-styleable>
</resources>