Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty UI #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/call_background_stroke.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
android:width="3dp"
android:color="@color/green_active" />
<solid android:color="@android:color/transparent"/>
<corners android:radius="8dp" />
<corners android:radius="50dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/photos_background_stroke.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
android:width="3dp"
android:color="@color/purple_active" />
<solid android:color="@android:color/transparent"/>
<corners android:radius="8dp" />
<corners android:radius="50dp" />
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/rounded_rect_white.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/white"/>
<corners android:radius="16dp"/>
<corners android:radius="50dp"/>
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/shop_background_stroke.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
android:width="3dp"
android:color="@color/blue_active" />
<solid android:color="@android:color/transparent"/>
<corners android:radius="8dp" />
<corners android:radius="50dp" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,6 +33,7 @@
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.gauravk.bubblenavigation.util.ViewUtils;

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bubblenavigation/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<attr name="bt_title" format="string" />
<attr name="bt_titleSize" format="dimension" />
<attr name="bt_colorActive" format="color" />
<attr name="bt_titleColorActive" format="color" />
<attr name="bt_colorInactive" format="color" />
<attr name="bt_active" format="boolean" />
<attr name="bt_duration" format="integer" />
Expand Down
Binary file removed sample/bn_four.gif
Binary file not shown.
Binary file removed sample/bn_one.gif
Binary file not shown.
Binary file removed sample/bn_three.gif
Binary file not shown.
Binary file removed sample/bn_two.gif
Binary file not shown.
Binary file removed sample/sample_bottom.gif
Binary file not shown.
Binary file removed sample/sample_middle.gif
Binary file not shown.
Binary file removed sample/sample_top.gif
Binary file not shown.