-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add default unselectedColor * Add iconSize attribute * Fix animation for HorizontaMenuItem on portrait
- Loading branch information
1 parent
9a4459c
commit 72d3331
Showing
8 changed files
with
45 additions
and
28 deletions.
There are no files selected for viewing
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
34 changes: 29 additions & 5 deletions
34
chip-navigation-bar/src/main/java/com/ismaeldivita/chipnavigation/model/MenuStyle.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 |
---|---|---|
@@ -1,11 +1,35 @@ | ||
package com.ismaeldivita.chipnavigation.model | ||
|
||
import android.content.Context | ||
import android.content.res.TypedArray | ||
import androidx.annotation.ColorInt | ||
import androidx.annotation.IdRes | ||
import androidx.core.content.ContextCompat | ||
import com.ismaeldivita.chipnavigation.R | ||
|
||
class MenuStyle( | ||
@ColorInt val badgeColor: Int, | ||
@ColorInt val unselectedColor: Int, | ||
@IdRes val textAppearance: Int?, | ||
class MenuStyle(context: Context, attr: TypedArray) { | ||
|
||
@ColorInt val badgeColor: Int | ||
@ColorInt val unselectedColor: Int | ||
@IdRes val textAppearance: Int? | ||
val radius: Float | ||
) | ||
val iconSize: Int | ||
|
||
init { | ||
textAppearance = attr.getResourceId(R.styleable.ChipNavigationBar_cnb_textAppearance, -1) | ||
.takeIf { it > 0 } | ||
|
||
radius = attr.getDimension(R.styleable.ChipNavigationBar_cnb_radius, Float.MAX_VALUE) | ||
badgeColor = attr.getColor(R.styleable.ChipNavigationBar_cnb_badgeColor, | ||
ContextCompat.getColor(context, R.color.cnb_default_badge_color) | ||
) | ||
unselectedColor = attr.getColor( | ||
R.styleable.ChipNavigationBar_cnb_unselectedColor, | ||
ContextCompat.getColor(context, R.color.cnb_default_unselected_color) | ||
) | ||
iconSize = attr.getDimension( | ||
R.styleable.ChipNavigationBar_cnb_iconSize, | ||
context.resources.getDimension(R.dimen.cnb_icon_size) | ||
).toInt() | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="cnb_default_badge_color">#F44336</color> | ||
<color name="cnb_default_unselected_color">#696969</color> | ||
<public/> | ||
</resources> |