Skip to content

Commit

Permalink
Merge pull request #7 from shwetachauhan-simform/fix/redme_update
Browse files Browse the repository at this point in the history
update : - bottomnavigation background color not changed
  • Loading branch information
simform-solutions authored May 18, 2020
2 parents 9032b2a + 871a73e commit 711ba2c
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 13 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ The actual features are:
### Demo
------------------------

<img src="https://github.com/simformsolutions/sscustombottomnavigation/blob/master/images/demo.gif" width="320" height="624"/>
![demo_data](https://github.com/simformsolutions/CustomBottomNavigation/blob/master/images/custom_bottom_navigation.gif)


### All Attributes
------------------------
Expand All @@ -34,6 +35,10 @@ The actual features are:
| `app:ss_rippleColor` | Set Ripple Color | `#757575` |
| `app:ss_shadowColor` | Set Bottom Bar Shadow Color | `shadowColor` |

# Customization
------------------------
![alt text](https://github.com/simformsolutions/CustomBottomNavigation/blob/master/images/custom_bottom_navigation_image.png)

### Usage
------------------------

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.sscustombottomnavigation.MainActivity"
<activity
android:name="com.sscustombottomnavigation.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
25 changes: 21 additions & 4 deletions app/src/main/java/com/sscustombottomnavigation/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.sscustombottomnavigation
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import com.simform.custombottomnavigation.SSCustomBottomNavigation
import com.sscustombottomnavigation.databinding.ActivityMainBinding
Expand All @@ -27,10 +28,16 @@ class MainActivity : AppCompatActivity() {
binding.bottomNavigation.apply {

add(SSCustomBottomNavigation.Model(ID_HOME, R.drawable.ic_home, "Home"))
add(SSCustomBottomNavigation.Model(ID_EXPLORE, R.drawable.ic_explore, "Explore"))
add(SSCustomBottomNavigation.Model(ID_MESSAGE, R.drawable.ic_message, "Message"))
add(SSCustomBottomNavigation.Model(ID_NOTIFICATION, R.drawable.ic_notification, "Notification"))
add(SSCustomBottomNavigation.Model(ID_ACCOUNT, R.drawable.ic_account, "Account"))
add(SSCustomBottomNavigation.Model(ID_EXPLORE, R.drawable.ic_heart, "Favorite"))
add(SSCustomBottomNavigation.Model(ID_MESSAGE, R.drawable.ic_message, "Chat"))
add(
SSCustomBottomNavigation.Model(
ID_NOTIFICATION,
R.drawable.ic_notification,
"Notification"
)
)
add(SSCustomBottomNavigation.Model(ID_ACCOUNT, R.drawable.ic_account, "Profile"))

setCount(ID_NOTIFICATION, "10")

Expand All @@ -44,7 +51,17 @@ class MainActivity : AppCompatActivity() {
else -> ""
}

val bgColor = when (it.id) {
ID_HOME -> ContextCompat.getColor(this@MainActivity, R.color.color_home_bg)
ID_EXPLORE -> ContextCompat.getColor(this@MainActivity, R.color.color_favorite_bg)
ID_MESSAGE -> ContextCompat.getColor(this@MainActivity, R.color.color_chat_bg)
ID_NOTIFICATION -> ContextCompat.getColor(this@MainActivity, R.color.color_notification_bg)
ID_ACCOUNT -> ContextCompat.getColor(this@MainActivity, R.color.color_profile_bg)
else -> ContextCompat.getColor(this@MainActivity, R.color.colorPrimary)
}

tvSelected.text = getString(R.string.main_page_selected, name)
binding.lnrLayout.setBackgroundColor(bgColor)
}

setOnClickMenuListener {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_favorite_border_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="25dp"
android:height="25dp"
android:viewportWidth="25.0"
android:viewportHeight="25.0">
<path
android:fillColor="#FF000000"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_heart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="512.001dp"
android:height="512dp"
android:viewportWidth="512.001"
android:viewportHeight="512">
<path
android:fillColor="#FF000000"
android:pathData="m256,483.516c-7.289,0 -14.316,-2.641 -19.793,-7.438 -20.684,-18.086 -40.625,-35.082 -58.219,-50.074l-0.09,-0.078c-51.582,-43.957 -96.125,-81.918 -127.117,-119.313 -34.645,-41.805 -50.781,-81.441 -50.781,-124.742 0,-42.07 14.426,-80.883 40.617,-109.293 26.504,-28.746 62.871,-44.578 102.414,-44.578 29.555,0 56.621,9.344 80.445,27.77 12.023,9.301 22.922,20.684 32.523,33.961 9.605,-13.277 20.5,-24.66 32.527,-33.961 23.824,-18.426 50.891,-27.77 80.445,-27.77 39.539,0 75.91,15.832 102.414,44.578 26.191,28.41 40.613,67.223 40.613,109.293 0,43.301 -16.133,82.938 -50.777,124.738 -30.992,37.398 -75.531,75.355 -127.105,119.309 -17.625,15.016 -37.598,32.039 -58.328,50.168 -5.473,4.789 -12.504,7.43 -19.789,7.43zM143.031,57.992c-31.066,0 -59.605,12.398 -80.367,34.914 -21.07,22.855 -32.676,54.449 -32.676,88.965 0,36.418 13.535,68.988 43.883,105.605 29.332,35.395 72.961,72.574 123.477,115.625l0.094,0.078c17.66,15.051 37.68,32.113 58.516,50.332 20.961,-18.254 41.012,-35.344 58.707,-50.418 50.512,-43.051 94.137,-80.223 123.469,-115.617 30.344,-36.617 43.879,-69.188 43.879,-105.605 0,-34.516 -11.605,-66.109 -32.676,-88.965 -20.758,-22.516 -49.301,-34.914 -80.363,-34.914 -22.758,0 -43.652,7.234 -62.102,21.5 -16.441,12.719 -27.895,28.797 -34.609,40.047 -3.453,5.785 -9.531,9.238 -16.262,9.238s-12.809,-3.453 -16.262,-9.238c-6.711,-11.25 -18.164,-27.328 -34.609,-40.047 -18.449,-14.266 -39.344,-21.5 -62.098,-21.5zM143.031,57.992"/>
</vector>
7 changes: 4 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:orientation="vertical">

<LinearLayout
android:id="@+id/lnrLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
Expand Down Expand Up @@ -36,11 +37,11 @@
app:ss_countBackgroundColor="#ff6f00"
app:ss_countTextColor="#ffffff"
app:ss_countTypeface="fonts/graphik_semibold.ttf"
app:ss_defaultIconColor="#6200EE"
app:ss_iconTextColor="#6200EE"
app:ss_defaultIconColor="@color/color_black"
app:ss_iconTextColor="@color/color_black"
app:ss_iconTextTypeface="fonts/graphik_semibold.ttf"
app:ss_rippleColor="#2f424242"
app:ss_iconTextSize="14sp"
app:ss_iconTextSize="12sp"
app:ss_selectedIconColor="#ff6f00"
app:ss_selectedIconTextColor="#ff6f00"
app:ss_shadowColor="#1f212121" />
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorPrimary">#000000</color>
<color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#03DAC5</color>

<color name="color_white">#FFFFFF</color>
<color name="color_gray">#D3D3D3</color>
<color name="color_black">#000000</color>

<color name="color_home_bg">#9A979C</color>
<color name="color_favorite_bg">#444145</color>
<color name="color_chat_bg">#21FF06</color>
<color name="color_notification_bg">#80007F</color>
<color name="color_profile_bg">#0D5FFF</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ class BezierView : View {

var color = 0
set(value) {
field = Color.WHITE
field = value
mainPaint?.color = field
invalidate()
}
var shadowColor = 0
set(value) {
field = Color.WHITE
field = value
shadowPaint?.setShadowLayer(dipf(context, 2), 0f, 0f, shadowColor)
invalidate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class SSCustomBottomNavigation : FrameLayout {
iconTextSize = this@SSCustomBottomNavigation.iconTextSize
countTextColor = this@SSCustomBottomNavigation.countTextColor
countBackgroundColor = this@SSCustomBottomNavigation.countBackgroundColor
backgroundBottomColor = this@SSCustomBottomNavigation.backgroundBottomColor
countTypeface = this@SSCustomBottomNavigation.countTypeface
rippleColor = this@SSCustomBottomNavigation.rippleColor
onClickListener = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:includeFontPadding="false"
android:ellipsize="end"
android:maxLines="1"
android:text="test"/>

Expand Down
Binary file added images/custom_bottom_navigation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/custom_bottom_navigation_full.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/custom_bottom_navigation_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 711ba2c

Please sign in to comment.