Skip to content

Commit 18f8290

Browse files
roughikeyombunker
authored andcommitted
v2.3.1 (#751)
* Bug fix/shadow not respecting flag (#749) * Data binding fixes clean (#712) * Fix Bottom Bar issues with Android Data Binding * keep .idea * travis changes * Fix for shadow (#716) * - Removing the view for API 21 - Adding a negative margin for API 20 or less so that the content is overlapped with the shadow - Fix the annotation for the MiscUtils * - Removing the view for API 21 - Adding a negative margin for API 20 or less so that the content is overlapped with the shadow - Fix the annotation for the MiscUtils * - Removing the view for API 21 - Adding a negative margin for API 20 or less so that the content is overlapped with the shadow - Fix the annotation for the MiscUtils * SelectableItemBackground Ripple! (#713) * Add selectableItemBackground programmatically which shows user touch response with either ripple or slight change of colour if below lollipop. * Remove style in tablet mode which makes ripple go out of bounds. Without it ripple is contained within its view. * Remove unnecessary local reference. * Added getTypedValue and getDrawableRes methods in MiscUtils and changed to selectableItemBackgroundBorderless. * Change color to resId. * Fix for wrong size in tabs - Setting the modified LayoutParams so that the views are changed (#719) * Tabs without titles (#717) * Update CHANGELOG.md * Update README.md * Update README.md * Basic support for tabs that have no title, only icons. * Reverted debug code. * Made sure that icon-only tabs throw an exception if they don't have icons. * There's no need to set visibility to the title, as it's already visible. * Added a sample for the icons only mode. * Made the titleless mode combined with shifting mode work. * Removed the eight dp padding from XML layout, since that offsets titleless tab icons from the center & isn't needed anyway since it's set dynamically. * Added some zoom to active tab icons that are both shifting and titleless. * Cleared up the select & unselect methods. * Modified the color changing tabs sample height, so it looks less crammed and more like the design specs. * Show & Hide methods when on shy mode. (#722) * Added methods for showing / hiding the BottomBar when on shy mode. * Better naming. * Refactored the hide / show methods to a separate ShySettings class, since they were only related for a shy BottomBar. * Made getting shy settings not throw an exception when the bottombar isn't shy, but have a log warning instead. * Made it possible to have individual titleless tabs. (#726) * Feature/optional long press toasts (#714) * Update CHANGELOG.md * Update README.md * Update README.md * Made it possible to control whether or not the Toasts are shown when long pressing tabs. * Updated changelog. * - Fix for shadow not respecting flag - API 21+ was not using the flag at all - API 20- where not removing the margin when no shadow was displayed - API 20- set the default visibility of the shadow to GONE * Bumped up version numbers & updated changelog for new release.
1 parent 9bfea75 commit 18f8290

File tree

6 files changed

+58
-36
lines changed

6 files changed

+58
-36
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog
22

3+
### 2.3.1
4+
5+
* [#749](https://github.com/roughike/BottomBar/pull/749): Quick fix for the issue where *bb_showShadow* set to false didn't have any effect. Thanks @yombunker!
6+
37
### 2.3.0
48

59
* [#713](https://github.com/roughike/BottomBar/pull/713): Ripple touch feedback for tabs!
@@ -24,6 +28,12 @@ Thanks for @yombunker, @MarcRubio and @tushar-acharya for their contributions!
2428
* Overriding tab selections is now supported, by using [TabSelectionInterceptor](https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/TabSelectionInterceptor.java)
2529
* Internal code quality improvements and small changes
2630

31+
### 2.2.0
32+
33+
* Ability to change icons when the tabs are selected, using drawable selectors
34+
* Overriding tab selections is now supported, by using [TabSelectionInterceptor](https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/TabSelectionInterceptor.java)
35+
* Internal code quality improvements and small changes
36+
2737
### 2.1.2
2838

2939
* Merged [#703](https://github.com/roughike/BottomBar/pull/703) that allows controlling badge visibility for tabs that are active.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ Nope. The minSDK version is **API level 11 (Honeycomb).**
2929
## Gimme that Gradle sweetness, pls?
3030

3131
```groovy
32-
compile 'com.roughike:bottom-bar:2.3.0'
32+
compile 'com.roughike:bottom-bar:2.3.1'
3333
```
3434

3535
**Maven:**
3636
```xml
3737
<dependency>
3838
<groupId>com.roughike</groupId>
3939
<artifactId>bottom-bar</artifactId>
40-
<version>2.3.0</version>
40+
<version>2.3.1</version>
4141
<type>pom</type>
4242
</dependency>
4343
```

bottom-bar/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ext {
1414
siteUrl = 'https://github.com/roughike/BottomBar'
1515
gitUrl = 'https://github.com/roughike/BottomBar.git'
1616

17-
libraryVersion = '2.3.0'
17+
libraryVersion = '2.3.1'
1818

1919
developerId = 'roughike'
2020
developerName = 'Iiro Krankka'

bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class BottomBar extends LinearLayout implements View.OnClickListener, Vie
8383
private Typeface titleTypeFace;
8484
private boolean showShadow;
8585
private float shadowElevation;
86+
private View shadowView;
8687

8788
private View backgroundOverlay;
8889
private ViewGroup outerContainer;
@@ -153,7 +154,8 @@ protected void onAttachedToWindow() {
153154
super.onAttachedToWindow();
154155

155156
// This is so that in Pre-Lollipop devices there is a shadow BUT without pushing the content
156-
if (showShadow) {
157+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && showShadow && shadowView != null) {
158+
shadowView.setVisibility(VISIBLE);
157159
ViewGroup.LayoutParams params = getLayoutParams();
158160
if (params instanceof MarginLayoutParams) {
159161
MarginLayoutParams layoutParams = (MarginLayoutParams) params;
@@ -170,12 +172,14 @@ protected void onAttachedToWindow() {
170172

171173
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
172174
private void init21(Context context) {
173-
shadowElevation = getElevation();
174-
shadowElevation = shadowElevation > 0
175-
? shadowElevation
176-
: getResources().getDimensionPixelSize(R.dimen.bb_default_elevation);
177-
setElevation(MiscUtils.dpToPixel(context, shadowElevation));
178-
setOutlineProvider(ViewOutlineProvider.BOUNDS);
175+
if (showShadow) {
176+
shadowElevation = getElevation();
177+
shadowElevation = shadowElevation > 0
178+
? shadowElevation
179+
: getResources().getDimensionPixelSize(R.dimen.bb_default_elevation);
180+
setElevation(MiscUtils.dpToPixel(context, shadowElevation));
181+
setOutlineProvider(ViewOutlineProvider.BOUNDS);
182+
}
179183
}
180184

181185
private void populateAttributes(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
@@ -184,7 +188,8 @@ private void populateAttributes(Context context, AttributeSet attrs, int defStyl
184188
tenDp = MiscUtils.dpToPixel(getContext(), 10);
185189
maxFixedItemWidth = MiscUtils.dpToPixel(getContext(), 168);
186190

187-
TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomBar, defStyleAttr, defStyleRes);
191+
TypedArray ta = context.getTheme()
192+
.obtainStyledAttributes(attrs, R.styleable.BottomBar, defStyleAttr, defStyleRes);
188193

189194
try {
190195
tabXmlResource = ta.getResourceId(R.styleable.BottomBar_bb_tabXmlResource, 0);
@@ -230,7 +235,9 @@ boolean isShyHeightAlreadyCalculated() {
230235
return shyHeightAlreadyCalculated;
231236
}
232237

233-
private boolean isIconsOnlyMode() { return !isTabletMode && hasBehavior(BEHAVIOR_ICONS_ONLY); }
238+
private boolean isIconsOnlyMode() {
239+
return !isTabletMode && hasBehavior(BEHAVIOR_ICONS_ONLY);
240+
}
234241

235242
private boolean hasBehavior(int behavior) {
236243
return (behaviors | behavior) == behaviors;
@@ -260,6 +267,7 @@ private void initializeViews() {
260267
backgroundOverlay = rootView.findViewById(R.id.bb_bottom_bar_background_overlay);
261268
outerContainer = (ViewGroup) rootView.findViewById(R.id.bb_bottom_bar_outer_container);
262269
tabContainer = (ViewGroup) rootView.findViewById(R.id.bb_bottom_bar_item_container);
270+
shadowView = findViewById(R.id.bb_bottom_bar_shadow);
263271
}
264272

265273
private void determineInitialBackgroundColor() {
@@ -386,7 +394,8 @@ private void resizeTabsToCorrectSizes(BottomBarTab[] tabsToAdd) {
386394

387395
inActiveShiftingItemWidth = (int) (proposedItemWidth * 0.9);
388396
activeShiftingItemWidth = (int) (proposedItemWidth + (proposedItemWidth * ((tabsToAdd.length - 1) * 0.1)));
389-
int height = Math.round(getContext().getResources().getDimension(R.dimen.bb_height));
397+
int height = Math.round(getContext().getResources()
398+
.getDimension(R.dimen.bb_height));
390399

391400
for (BottomBarTab tabView : tabsToAdd) {
392401
ViewGroup.LayoutParams params = tabView.getLayoutParams();
@@ -925,7 +934,8 @@ private boolean handleLongClick(BottomBarTab longClickedTab) {
925934
&& longPressHintsEnabled;
926935

927936
if (shouldShowHint) {
928-
Toast.makeText(getContext(), longClickedTab.getTitle(), Toast.LENGTH_SHORT).show();
937+
Toast.makeText(getContext(), longClickedTab.getTitle(), Toast.LENGTH_SHORT)
938+
.show();
929939
}
930940

931941
return true;
@@ -1044,23 +1054,24 @@ private void onEnd() {
10441054
private void backgroundCrossfadeAnimation(final int newColor) {
10451055
ViewCompat.setAlpha(backgroundOverlay, 0);
10461056
ViewCompat.animate(backgroundOverlay)
1047-
.alpha(1)
1048-
.setListener(new ViewPropertyAnimatorListenerAdapter() {
1049-
@Override
1050-
public void onAnimationEnd(View view) {
1051-
onEnd();
1052-
}
1053-
1054-
@Override
1055-
public void onAnimationCancel(View view) {
1056-
onEnd();
1057-
}
1058-
1059-
private void onEnd() {
1060-
outerContainer.setBackgroundColor(newColor);
1061-
backgroundOverlay.setVisibility(View.INVISIBLE);
1062-
ViewCompat.setAlpha(backgroundOverlay, 1);
1063-
}
1064-
}).start();
1057+
.alpha(1)
1058+
.setListener(new ViewPropertyAnimatorListenerAdapter() {
1059+
@Override
1060+
public void onAnimationEnd(View view) {
1061+
onEnd();
1062+
}
1063+
1064+
@Override
1065+
public void onAnimationCancel(View view) {
1066+
onEnd();
1067+
}
1068+
1069+
private void onEnd() {
1070+
outerContainer.setBackgroundColor(newColor);
1071+
backgroundOverlay.setVisibility(View.INVISIBLE);
1072+
ViewCompat.setAlpha(backgroundOverlay, 1);
1073+
}
1074+
})
1075+
.start();
10651076
}
10661077
}

bottom-bar/src/main/res/layout/bb_bottom_bar_item_container.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
android:id="@+id/bb_bottom_bar_shadow"
66
android:layout_width="match_parent"
77
android:layout_height="@dimen/bb_fake_shadow_height"
8-
android:background="@drawable/bb_bottom_bar_top_shadow" />
8+
android:background="@drawable/bb_bottom_bar_top_shadow"
9+
android:visibility="gone"/>
910

1011
<FrameLayout
1112
android:id="@+id/bb_bottom_bar_outer_container"
@@ -16,14 +17,14 @@
1617
android:id="@+id/bb_bottom_bar_background_overlay"
1718
android:layout_width="match_parent"
1819
android:layout_height="match_parent"
19-
android:visibility="invisible" />
20+
android:visibility="invisible"/>
2021

2122
<LinearLayout
2223
android:id="@+id/bb_bottom_bar_item_container"
2324
android:layout_width="match_parent"
2425
android:layout_height="match_parent"
2526
android:gravity="center"
26-
android:orientation="horizontal" />
27+
android:orientation="horizontal"/>
2728

2829
</FrameLayout>
2930

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.0'
8+
classpath 'com.android.tools.build:gradle:2.3.1'
99
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
1111
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'

0 commit comments

Comments
 (0)