-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
777 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
demo/src/main/java/nl/joery/demo/animatedbottombar/Extensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package nl.joery.demo.animatedbottombar | ||
|
||
import android.content.res.Resources | ||
import kotlin.math.roundToInt | ||
|
||
internal val Int.dp: Int | ||
get() = (this / Resources.getSystem().displayMetrics.density).roundToInt() | ||
internal val Int.px: Int | ||
get() = (this * Resources.getSystem().displayMetrics.density).roundToInt() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
demo/src/main/java/nl/joery/demo/animatedbottombar/Utils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package nl.joery.demo.animatedbottombar | ||
|
||
internal object Utils { | ||
fun getProperty(instance: Any, property: String): Any? { | ||
val methodName = "get" + property.capitalize() | ||
val method = instance.javaClass.methods.toList().find { it.name == methodName } | ||
return method?.invoke(instance) | ||
} | ||
|
||
fun setProperty(instance: Any, property: String, value: Any) { | ||
val methodName = "set" + property.capitalize() | ||
val method = instance.javaClass.methods.toList().find { it.name == methodName } | ||
method?.invoke(instance, value) | ||
} | ||
} |
128 changes: 128 additions & 0 deletions
128
demo/src/main/java/nl/joery/demo/animatedbottombar/playground/PlaygroundActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package nl.joery.demo.animatedbottombar.playground | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import kotlinx.android.synthetic.main.activity_playground.* | ||
import nl.joery.animatedbottombar.AnimatedBottomBar | ||
import nl.joery.demo.animatedbottombar.R | ||
import nl.joery.demo.animatedbottombar.playground.properties.* | ||
|
||
|
||
class PlaygroundActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_playground) | ||
|
||
val properties = ArrayList<Property>() | ||
properties.add( | ||
CategoryProperty( | ||
"General" | ||
) | ||
) | ||
properties.add( | ||
ColorProperty( | ||
"backgroundColor" | ||
) | ||
) | ||
properties.add( | ||
CategoryProperty( | ||
"Tab appearance" | ||
) | ||
) | ||
properties.add( | ||
EnumProperty( | ||
"selectedTabType", | ||
AnimatedBottomBar.TabType::class.java | ||
) | ||
) | ||
properties.add( | ||
ColorProperty( | ||
"tabColor" | ||
) | ||
) | ||
properties.add( | ||
ColorProperty( | ||
"tabColorSelected" | ||
) | ||
) | ||
properties.add( | ||
BooleanProperty( | ||
"rippleEnabled" | ||
) | ||
) | ||
properties.add( | ||
ColorProperty( | ||
"rippleColor" | ||
) | ||
) | ||
|
||
properties.add( | ||
CategoryProperty( | ||
"Animations" | ||
) | ||
) | ||
properties.add( | ||
IntegerProperty( | ||
"animationDuration" | ||
) | ||
) | ||
properties.add( | ||
EnumProperty( | ||
"tabAnimation", | ||
AnimatedBottomBar.TabAnimation::class.java | ||
) | ||
) | ||
properties.add( | ||
EnumProperty( | ||
"tabAnimationSelected", | ||
AnimatedBottomBar.TabAnimation::class.java | ||
) | ||
) | ||
|
||
properties.add( | ||
CategoryProperty( | ||
"Indicator appearance" | ||
) | ||
) | ||
properties.add( | ||
ColorProperty( | ||
"indicatorColor" | ||
) | ||
) | ||
properties.add( | ||
IntegerProperty( | ||
"indicatorHeight", | ||
true | ||
) | ||
) | ||
properties.add( | ||
IntegerProperty( | ||
"indicatorMargin", | ||
true | ||
) | ||
) | ||
properties.add( | ||
EnumProperty( | ||
"indicatorAppearance", | ||
AnimatedBottomBar.IndicatorAppearance::class.java | ||
) | ||
) | ||
properties.add( | ||
EnumProperty( | ||
"indicatorLocation", | ||
AnimatedBottomBar.IndicatorLocation::class.java | ||
) | ||
) | ||
properties.add( | ||
EnumProperty( | ||
"indicatorAnimation", | ||
AnimatedBottomBar.IndicatorAnimation::class.java | ||
) | ||
) | ||
|
||
recycler.layoutManager = | ||
LinearLayoutManager(applicationContext, LinearLayoutManager.VERTICAL, false) | ||
recycler.adapter = PropertyAdapter(bottom_bar, properties) | ||
} | ||
} |
Oops, something went wrong.