diff --git a/README.md b/README.md index 2ee9ee7..d8a3875 100644 --- a/README.md +++ b/README.md @@ -117,13 +117,14 @@ This view can be used independently for: | **attr** | **Description** | | ------------- | ------------- | | bt_active | Sets to Active State | -| bt_colorActive | When in Active State, uses this color for the Icon and Title | -| bt_colorInctive | When in Inactive State, uses this color for the Icon and Title | +| bt_colorActive | When in Active State, uses this color for the Icon and set this as default Title text color | +| bt_colorInActive | When in Inactive State, uses this color for the Icon and Title | | bt_icon | Sets the Icon Drawable | | bt_iconWidth | Updates the Icon Width| | bt_iconHeigth | Updates the Icon Height | | bt_title | Sets the Title Text | -| bt_titleSize | Updates the Tilte Text Size in sp | +| bt_titleColorActive | You can set specific color for your title text | +| bt_titleSize | Updates the Title Text Size in sp | | bt_shape | Sets the Background Drawable. Use **TransitionDrawable** to get fade in-out effect when toggling | | bt_showShapeAlways | If true and using Normal drawable, background shape remains visible always | | bt_shapeColor | Changes the tint color of the shape. N/A when using TransitionDrawable or showShapeAlways is true. | diff --git a/app/src/main/res/layout/fragment_equal_bottom_bar.xml b/app/src/main/res/layout/fragment_equal_bottom_bar.xml index 9c3dcee..435b007 100644 --- a/app/src/main/res/layout/fragment_equal_bottom_bar.xml +++ b/app/src/main/res/layout/fragment_equal_bottom_bar.xml @@ -37,6 +37,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" + app:bt_titleColorActive="@color/red_active" app:bt_colorActive="@color/blue_active" app:bt_colorInactive="@color/default_inactive" app:bt_icon="@drawable/ic_shop" @@ -48,6 +49,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" + app:bt_titleColorActive="@color/green_active" app:bt_colorActive="@color/purple_active" app:bt_colorInactive="@color/default_inactive" app:bt_icon="@drawable/ic_photos" @@ -59,6 +61,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" + app:bt_titleColorActive="@color/blue_active" app:bt_colorActive="@color/green_active" app:bt_colorInactive="@color/default_inactive" app:bt_icon="@drawable/ic_call" diff --git a/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleItem.java b/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleItem.java index 4185985..1252737 100644 --- a/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleItem.java +++ b/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleItem.java @@ -23,6 +23,7 @@ class BubbleToggleItem { private String title = ""; private int colorActive = Color.BLUE; + private int titleColorActive = colorActive; private int colorInactive = Color.BLACK; private int shapeColor = Integer.MIN_VALUE; @@ -72,6 +73,14 @@ void setTitle(String title) { this.title = title; } + int getTitleColorActive() { + return titleColorActive; + } + + void setTitleColorActive(int titleColorActive) { + this.titleColorActive = titleColorActive; + } + int getColorActive() { return colorActive; } diff --git a/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleView.java b/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleView.java index a511477..17a63ae 100644 --- a/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleView.java +++ b/bubblenavigation/src/main/java/com/gauravk/bubblenavigation/BubbleToggleView.java @@ -23,7 +23,6 @@ import android.os.Build; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; -import android.support.graphics.drawable.VectorDrawableCompat; import android.support.v4.content.ContextCompat; import android.support.v4.view.ViewCompat; import android.support.v7.content.res.AppCompatResources; @@ -34,6 +33,7 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; + import com.gauravk.bubblenavigation.util.ViewUtils; /** @@ -101,6 +101,7 @@ private void init(Context context, @Nullable AttributeSet attrs) { Drawable shape = null; int shapeColor = Integer.MIN_VALUE; int colorActive = ViewUtils.getThemeAccentColor(context); + int titleColorActive = colorActive; int colorInactive = ContextCompat.getColor(context, R.color.default_inactive_color); float titleSize = context.getResources().getDimension(R.dimen.default_nav_item_text_size); maxTitleWidth = context.getResources().getDimension(R.dimen.default_nav_item_title_max_width); @@ -129,6 +130,7 @@ private void init(Context context, @Nullable AttributeSet attrs) { title = ta.getString(R.styleable.BubbleToggleView_bt_title); titleSize = ta.getDimension(R.styleable.BubbleToggleView_bt_titleSize, titleSize); colorActive = ta.getColor(R.styleable.BubbleToggleView_bt_colorActive, colorActive); + titleColorActive = ta.getColor(R.styleable.BubbleToggleView_bt_titleColorActive, colorActive); colorInactive = ta.getColor(R.styleable.BubbleToggleView_bt_colorInactive, colorInactive); isActive = ta.getBoolean(R.styleable.BubbleToggleView_bt_active, false); animationDuration = ta.getInteger(R.styleable.BubbleToggleView_bt_duration, DEFAULT_ANIM_DURATION); @@ -160,6 +162,7 @@ private void init(Context context, @Nullable AttributeSet attrs) { bubbleToggleItem.setTitlePadding(titlePadding); bubbleToggleItem.setShapeColor(shapeColor); bubbleToggleItem.setColorActive(colorActive); + bubbleToggleItem.setTitleColorActive(titleColorActive); bubbleToggleItem.setColorInactive(colorInactive); bubbleToggleItem.setIconWidth(iconWidth); bubbleToggleItem.setIconHeight(iconHeight); @@ -219,7 +222,7 @@ private void createBubbleItemView(Context context) { lpTitle.addRule(RelativeLayout.RIGHT_OF, iconView.getId()); titleView.setLayoutParams(lpTitle); titleView.setSingleLine(true); - titleView.setTextColor(bubbleToggleItem.getColorActive()); + titleView.setTextColor(bubbleToggleItem.getTitleColorActive()); titleView.setText(bubbleToggleItem.getTitle()); titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, bubbleToggleItem.getTitleSize()); //get the current measured title width diff --git a/bubblenavigation/src/main/res/values/attrs.xml b/bubblenavigation/src/main/res/values/attrs.xml index fdefaa8..ac20267 100644 --- a/bubblenavigation/src/main/res/values/attrs.xml +++ b/bubblenavigation/src/main/res/values/attrs.xml @@ -10,6 +10,7 @@ + diff --git a/sample/bn_four.gif b/sample/bn_four.gif deleted file mode 100644 index bb99631..0000000 Binary files a/sample/bn_four.gif and /dev/null differ diff --git a/sample/bn_one.gif b/sample/bn_one.gif deleted file mode 100644 index 7f16409..0000000 Binary files a/sample/bn_one.gif and /dev/null differ diff --git a/sample/bn_three.gif b/sample/bn_three.gif deleted file mode 100644 index 78b9ae8..0000000 Binary files a/sample/bn_three.gif and /dev/null differ diff --git a/sample/bn_two.gif b/sample/bn_two.gif deleted file mode 100644 index 594b4c0..0000000 Binary files a/sample/bn_two.gif and /dev/null differ diff --git a/sample/sample_bottom.gif b/sample/sample_bottom.gif deleted file mode 100644 index 7e0f103..0000000 Binary files a/sample/sample_bottom.gif and /dev/null differ diff --git a/sample/sample_middle.gif b/sample/sample_middle.gif deleted file mode 100644 index ccf0867..0000000 Binary files a/sample/sample_middle.gif and /dev/null differ diff --git a/sample/sample_top.gif b/sample/sample_top.gif deleted file mode 100644 index 4eddaef..0000000 Binary files a/sample/sample_top.gif and /dev/null differ