Skip to content

Commit

Permalink
Merge pull request #26 from st235/feature/avoid_conflicts
Browse files Browse the repository at this point in the history
Feature/avoid conflicts
  • Loading branch information
st235 authored Nov 28, 2019
2 parents 7d2236a + d60e25e commit b7c5776
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 97 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Firstly, you should declare your view in xml file
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
app:backgroundCornerRadius="25dp"
app:backgroundColor="#2e2e2e"
app:itemInactiveBackgroundColor="#fff"
app:exb_backgroundCornerRadius="25dp"
app:exb_backgroundColor="#2e2e2e"
app:exb_itemInactiveBackgroundColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down Expand Up @@ -99,20 +99,20 @@ Firstly, you should declare menu items in xml
<item
android:id="@+id/home"
android:title="@string/text"
app:color="#FF8888"
app:icon="@drawable/ic_home" />
app:exb_color="#FF8888"
app:exb_icon="@drawable/ic_home" />

<item
android:id="@+id/settings"
android:title="@string/text4"
app:color="@color/colorSettings"
app:icon="@drawable/ic_settings" />
app:exb_color="@color/colorSettings"
app:exb_icon="@drawable/ic_settings" />

<item
android:id="@+id/bookmarks"
android:title="@string/text3"
app:color="#fa2"
app:icon="@drawable/ic_bookmarks" />
app:exb_color="#fa2"
app:exb_icon="@drawable/ic_bookmarks" />
</menu>
```

Expand All @@ -135,9 +135,9 @@ Then you should reference this xml file at the view attributes
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
app:backgroundCornerRadius="25dp"
app:itemInactiveBackgroundColor="#fff"
app:items="@menu/bottom_bar"
app:exb_backgroundCornerRadius="25dp"
app:exb_itemInactiveBackgroundColor="#fff"
app:exb_items="@menu/bottom_bar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand All @@ -147,18 +147,18 @@ Then you should reference this xml file at the view attributes

| property | type | description |
| ----- | ----- | ----- |
| **elevation** | dimen | component elevation (important: api 21+) |
| **backgroundColor** | color | bottom bar background color |
| **transitionDuration** | integer | time between one item collapsed and another item expanded |
| **backgroundCornerRadius** | dimen | bottom bar background corners radius |
| **itemInactiveColor** | color | item menu color, when its inactive |
| **itemBackgroundCornerRadius** | dimen | item background corner radius |
| **itemBackgroundOpacity** | float | item background opacity (important: final color alpha calculates by next formulae alpha = opacity * 255) |
| **item_vertical_margin** | dimen | top & bottom item margins |
| **item_horizontal_margin** | dimen | left & right item margins |
| **item_vertical_padding** | dimen | top & bottom item padding |
| **item_horizontal_padding** | dimen | left & right item padding |
| **items** | reference | xml supported menu format |
| **exb_elevation** | dimen | component elevation (important: api 21+) |
| **exb_backgroundColor** | color | bottom bar background color |
| **exb_transitionDuration** | integer | time between one item collapsed and another item expanded |
| **exb_backgroundCornerRadius** | dimen | bottom bar background corners radius |
| **exb_itemInactiveColor** | color | item menu color, when its inactive |
| **exb_itemBackgroundCornerRadius** | dimen | item background corner radius |
| **exb_itemBackgroundOpacity** | float | item background opacity (important: final color alpha calculates by next formulae alpha = opacity * 255) |
| **exb_item_vertical_margin** | dimen | top & bottom item margins |
| **exb_item_horizontal_margin** | dimen | left & right item margins |
| **exb_item_vertical_padding** | dimen | top & bottom item padding |
| **exb_item_horizontal_padding** | dimen | left & right item padding |
| **exb_items** | reference | xml supported menu format |


## Coordinator Layout support
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_coordinator_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:items="@menu/bottom_bar" />
app:exb_items="@menu/bottom_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_java.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
app:backgroundCornerRadius="25dp"
app:backgroundColor="#2e2e2e"
app:itemInactiveColor="#fff"
app:exb_backgroundCornerRadius="25dp"
app:exb_backgroundColor="#2e2e2e"
app:exb_itemInactiveColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
app:backgroundCornerRadius="25dp"
app:backgroundColor="#2e2e2e"
app:itemInactiveColor="#fff"
app:exb_backgroundCornerRadius="25dp"
app:exb_backgroundColor="#2e2e2e"
app:exb_itemInactiveColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:layout_behavior="github.com.st235.lib_expandablebottombar.behavior.ExpandableBottomBarScrollableBehavior"
app:items="@menu/bottom_bar" />
app:exb_items="@menu/bottom_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_xml_declared.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:id="@+id/expandable_bottom_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:items="@menu/bottom_bar"
app:exb_items="@menu/bottom_bar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/menu/bottom_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<item
android:id="@+id/home"
android:title="@string/text"
app:color="#FF8888"
app:icon="@drawable/ic_home" />
app:exb_color="#FF8888"
app:exb_icon="@drawable/ic_home" />

<item
android:id="@+id/settings"
android:title="@string/text4"
app:color="@color/colorSettings"
app:icon="@drawable/ic_settings" />
app:exb_color="@color/colorSettings"
app:exb_icon="@drawable/ic_settings" />

<item
android:id="@+id/bookmarks"
android:title="@string/text3"
app:color="#fa2"
app:icon="@drawable/ic_bookmarks" />
app:exb_color="#fa2"
app:exb_icon="@drawable/ic_bookmarks" />
</menu>
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
buildscript {
ext.kotlin_version = '1.3.30'
ext.kotlin_version = '1.3.41'

repositories {
google()
jcenter()
Expand Down
12 changes: 6 additions & 6 deletions lib-expandablebottombar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish {
userOrg = 'st235'
groupId = 'com.github.st235'
artifactId = 'expandablebottombar'
publishVersion = '1.0.1'
publishVersion = '1.1.0'
desc = 'A new way to improve navigation in your app.'
website = 'https://github.com/st235/ExpandableBottomBar'
}
Expand All @@ -26,13 +26,13 @@ androidExtensions {
}

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 21
versionName "1.0.1"
targetSdkVersion 29
versionCode 23
versionName "1.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -55,7 +55,7 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ internal const val ITEM_NOT_SELECTED = -1
typealias OnItemClickListener = (v: View, menuItem: ExpandableBottomBarMenuItem) -> Unit

/**
* Widget, which implements bottom bar navigation pattern xyn
* Widget, which implements bottom bar navigation pattern
*/
class ExpandableBottomBar @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.expandableButtonBarDefaultStyle
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.exb_expandableButtonBarDefaultStyle
) : ConstraintLayout(context, attrs, defStyleAttr), CoordinatorLayout.AttachedBehavior {

@FloatRange(from = 0.0, to = 1.0) private var backgroundOpacity: Float = 0F
Expand Down Expand Up @@ -76,26 +76,26 @@ class ExpandableBottomBar @JvmOverloads constructor(
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableBottomBar,
defStyleAttr, R.style.ExpandableBottomBar)

backgroundOpacity = typedArray.getFloat(R.styleable.ExpandableBottomBar_itemBackgroundOpacity, 0.2F)
backgroundCornerRadius = typedArray.getDimension(R.styleable.ExpandableBottomBar_itemBackgroundCornerRadius, 30F.toPx())
transitionDuration = typedArray.getInt(R.styleable.ExpandableBottomBar_transitionDuration, 100)
itemInactiveColor = typedArray.getColor(R.styleable.ExpandableBottomBar_itemInactiveColor, Color.BLACK)
menuItemHorizontalMargin = typedArray.getDimension(R.styleable.ExpandableBottomBar_item_horizontal_margin, 5F.toPx()).toInt()
menuItemVerticalMargin = typedArray.getDimension(R.styleable.ExpandableBottomBar_item_vertical_margin, 5F.toPx()).toInt()
menuHorizontalPadding = typedArray.getDimension(R.styleable.ExpandableBottomBar_item_horizontal_padding, 15F.toPx()).toInt()
menuVerticalPadding = typedArray.getDimension(R.styleable.ExpandableBottomBar_item_vertical_padding, 10F.toPx()).toInt()
backgroundOpacity = typedArray.getFloat(R.styleable.ExpandableBottomBar_exb_itemBackgroundOpacity, 0.2F)
backgroundCornerRadius = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_itemBackgroundCornerRadius, 30F.toPx())
transitionDuration = typedArray.getInt(R.styleable.ExpandableBottomBar_exb_transitionDuration, 100)
itemInactiveColor = typedArray.getColor(R.styleable.ExpandableBottomBar_exb_itemInactiveColor, Color.BLACK)
menuItemHorizontalMargin = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_item_horizontal_margin, 5F.toPx()).toInt()
menuItemVerticalMargin = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_item_vertical_margin, 5F.toPx()).toInt()
menuHorizontalPadding = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_item_horizontal_padding, 15F.toPx()).toInt()
menuVerticalPadding = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_item_vertical_padding, 10F.toPx()).toInt()

val backgroundColor = typedArray.getColor(R.styleable.ExpandableBottomBar_backgroundColor, Color.WHITE)
val backgroundCornerRadius = typedArray.getDimension(R.styleable.ExpandableBottomBar_backgroundCornerRadius, 0F)
val backgroundColor = typedArray.getColor(R.styleable.ExpandableBottomBar_exb_backgroundColor, Color.WHITE)
val backgroundCornerRadius = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_backgroundCornerRadius, 0F)

background =
DrawableHelper.createShapeDrawable(backgroundColor, backgroundCornerRadius, 1.0F)

applyForApiLAndHigher {
elevation = typedArray.getDimension(R.styleable.ExpandableBottomBar_elevation, 16F.toPx())
elevation = typedArray.getDimension(R.styleable.ExpandableBottomBar_exb_elevation, 16F.toPx())
}

val menuId = typedArray.getResourceId(R.styleable.ExpandableBottomBar_items, View.NO_ID)
val menuId = typedArray.getResourceId(R.styleable.ExpandableBottomBar_exb_items, View.NO_ID)
if (menuId != View.NO_ID) {
val barParser = ExpandableBottomBarParser(context)
val items = barParser.inflate(menuId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ internal class ExpandableBottomBarParser(private val context: Context) {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableBottomBarItem)

val id = typedArray.getResourceId(R.styleable.ExpandableBottomBarItem_android_id, NO_ID)
val iconId = typedArray.getResourceId(R.styleable.ExpandableBottomBarItem_icon, NO_ID)
val color = typedArray.getColor(R.styleable.ExpandableBottomBarItem_color, NO_COLOR)
val iconId = typedArray.getResourceId(R.styleable.ExpandableBottomBarItem_exb_icon, NO_ID)
val color = typedArray.getColor(R.styleable.ExpandableBottomBarItem_exb_color, NO_COLOR)
val text = typedArray.getString(R.styleable.ExpandableBottomBarItem_android_title) ?: NO_TEXT

typedArray.recycle()
Expand Down
20 changes: 10 additions & 10 deletions lib-expandablebottombar/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="ExpandableBottomBar">
<item name="backgroundColor">#FFF</item>
<item name="backgroundCornerRadius">0dp</item>
<item name="itemInactiveColor">#000</item>
<item name="itemBackgroundCornerRadius">30dp</item>
<item name="itemBackgroundOpacity">0.2</item>
<item name="transitionDuration">100</item>
<item name="item_vertical_margin">24dp</item>
<item name="item_horizontal_margin">5dp</item>
<item name="item_vertical_padding">10dp</item>
<item name="item_horizontal_padding">15dp</item>
<item name="exb_backgroundColor">#FFF</item>
<item name="exb_backgroundCornerRadius">0dp</item>
<item name="exb_itemInactiveColor">#000</item>
<item name="exb_itemBackgroundCornerRadius">30dp</item>
<item name="exb_itemBackgroundOpacity">0.2</item>
<item name="exb_transitionDuration">100</item>
<item name="exb_item_vertical_margin">24dp</item>
<item name="exb_item_horizontal_margin">5dp</item>
<item name="exb_item_vertical_padding">10dp</item>
<item name="exb_item_horizontal_padding">15dp</item>
</style>
</resources>
30 changes: 15 additions & 15 deletions lib-expandablebottombar/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
<declare-styleable name="ExpandableBottomBarItem">
<attr name="android:id" />
<attr name="android:title" />
<attr name="icon" format="reference" />
<attr name="color" format="reference|color" />
<attr name="exb_icon" format="reference" />
<attr name="exb_color" format="reference|color" />
</declare-styleable>

<declare-styleable name="ExpandableBottomBar">
<attr name="itemInactiveColor" format="color" />
<attr name="itemBackgroundCornerRadius" format="dimension" />
<attr name="itemBackgroundOpacity" format="float" />
<attr name="transitionDuration" format="integer" />
<attr name="elevation" format="dimension" />
<attr name="backgroundColor" format="color" />
<attr name="backgroundCornerRadius" format="dimension" />
<attr name="exb_itemInactiveColor" format="color" />
<attr name="exb_itemBackgroundCornerRadius" format="dimension" />
<attr name="exb_itemBackgroundOpacity" format="float" />
<attr name="exb_transitionDuration" format="integer" />
<attr name="exb_elevation" format="dimension" />
<attr name="exb_backgroundColor" format="color" />
<attr name="exb_backgroundCornerRadius" format="dimension" />

<attr name="item_vertical_margin" format="dimension" />
<attr name="item_horizontal_margin" format="dimension" />
<attr name="item_vertical_padding" format="dimension" />
<attr name="item_horizontal_padding" format="dimension" />
<attr name="exb_item_vertical_margin" format="dimension" />
<attr name="exb_item_horizontal_margin" format="dimension" />
<attr name="exb_item_vertical_padding" format="dimension" />
<attr name="exb_item_horizontal_padding" format="dimension" />

<attr name="items" format="reference" />
<attr name="exb_items" format="reference" />
</declare-styleable>

<attr name="expandableButtonBarDefaultStyle" format="reference" />
<attr name="exb_expandableButtonBarDefaultStyle" format="reference" />
</resources>
20 changes: 10 additions & 10 deletions lib-expandablebottombar/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="ExpandableBottomBar">
<item name="backgroundColor">#FFF</item>
<item name="backgroundCornerRadius">0dp</item>
<item name="itemInactiveColor">#000</item>
<item name="itemBackgroundCornerRadius">30dp</item>
<item name="itemBackgroundOpacity">0.2</item>
<item name="transitionDuration">100</item>
<item name="item_vertical_margin">24dp</item>
<item name="item_horizontal_margin">5dp</item>
<item name="item_vertical_padding">10dp</item>
<item name="item_horizontal_padding">15dp</item>
<item name="exb_backgroundColor">#FFF</item>
<item name="exb_backgroundCornerRadius">0dp</item>
<item name="exb_itemInactiveColor">#000</item>
<item name="exb_itemBackgroundCornerRadius">30dp</item>
<item name="exb_itemBackgroundOpacity">0.2</item>
<item name="exb_transitionDuration">100</item>
<item name="exb_item_vertical_margin">24dp</item>
<item name="exb_item_horizontal_margin">5dp</item>
<item name="exb_item_vertical_padding">10dp</item>
<item name="exb_item_horizontal_padding">15dp</item>
</style>
</resources>

0 comments on commit b7c5776

Please sign in to comment.