Skip to content

Commit

Permalink
v2.3.0 (#734)
Browse files Browse the repository at this point in the history
* 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.

* v2.3.0 (#732)

* Update CHANGELOG.md

* Update README.md

* Update README.md

* Bumped up version number.

* Updated Changelog & Readme
  • Loading branch information
roughike authored Apr 6, 2017
1 parent c7e0fb5 commit 9bfea75
Show file tree
Hide file tree
Showing 32 changed files with 459 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ captures/
.idea/libraries

# Keystore files
*.jks
*.jks
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.1
- build-tools-25.0.2
- android-25
- extra-android-m2repository

Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
## Changelog

(or: y u no add shiny new things?!)
### 2.3.0

* [#713](https://github.com/roughike/BottomBar/pull/713): Ripple touch feedback for tabs!
* [#716](https://github.com/roughike/BottomBar/pull/716): Bugfix for misbehaving shadow. No more weird white spaces above the bar!
* [#717](https://github.com/roughike/BottomBar/pull/717): Support for tabs with icons only, without titles!
* [#722](https://github.com/roughike/BottomBar/pull/722): Showing / hiding the BottomBar when on shy mode.
* [#714](https://github.com/roughike/BottomBar/pull/714): Controlling whether Toasts of tab titles are shown when long pressing tabs.
* [#719](https://github.com/roughike/BottomBar/pull/719): Fix for wrong size in tabs
* [#712](https://github.com/roughike/BottomBar/pull/712): Data binding fixes.

Thanks for @yombunker, @MarcRubio and @tushar-acharya for their contributions!

### 2.2.0

* Ability to change icons when the tabs are selected, using drawable selectors
* 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)
* Internal code quality improvements and small changes

### 2.2.0

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Nope. The minSDK version is **API level 11 (Honeycomb).**
## Gimme that Gradle sweetness, pls?

```groovy
compile 'com.roughike:bottom-bar:2.2.0'
compile 'com.roughike:bottom-bar:2.3.0'
```

**Maven:**
```xml
<dependency>
<groupId>com.roughike</groupId>
<artifactId>bottom-bar</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<type>pom</type>
</dependency>
```
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ android {
}
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
resolutionStrategy.force "com.android.support:support-annotations:${rootProject.ext.supportLibraryVersion}"
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':bottom-bar')
compile 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibraryVersion
compile 'com.android.support:design:' + rootProject.ext.supportLibraryVersion
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibraryVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibraryVersion}"

androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'org.mockito:mockito-core:1.+'
androidTestCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</intent-filter>
</activity>
<activity android:name=".ThreeTabsActivity" />
<activity android:name=".IconsOnlyActivity" />
<activity android:name=".FiveColorChangingTabsActivity" android:theme="@style/AppTheme.TransNav" />
<activity android:name=".ThreeTabsQRActivity" android:theme="@style/AppTheme.TransNav" />
<activity android:name=".BadgeActivity" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.bottombar.sample;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.widget.TextView;
import android.widget.Toast;

import com.roughike.bottombar.BottomBar;
import com.roughike.bottombar.OnTabReselectListener;
import com.roughike.bottombar.OnTabSelectListener;

public class IconsOnlyActivity extends Activity {
private TextView messageView;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_icons_only);

messageView = (TextView) findViewById(R.id.messageView);

BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
messageView.setText(TabMessage.get(tabId, false));
}
});

bottomBar.setOnTabReselectListener(new OnTabReselectListener() {
@Override
public void onTabReSelected(@IdRes int tabId) {
Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);

findViewById(R.id.simple_three_tabs).setOnClickListener(this);
findViewById(R.id.icons_only).setOnClickListener(this);
findViewById(R.id.five_tabs_changing_colors).setOnClickListener(this);
findViewById(R.id.three_tabs_quick_return).setOnClickListener(this);
findViewById(R.id.five_tabs_custom_colors).setOnClickListener(this);
Expand All @@ -27,6 +28,9 @@ public void onClick(View v) {
case R.id.simple_three_tabs:
clazz = ThreeTabsActivity.class;
break;
case R.id.icons_only:
clazz = IconsOnlyActivity.class;
break;
case R.id.five_tabs_changing_colors:
clazz = FiveColorChangingTabsActivity.class;
break;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_color_changing_tabs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<com.roughike.bottombar.BottomBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_height="64dp"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/bottombar_tabs_color_changing"
app:bb_behavior="shifting|underNavbar" />
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/res/layout/activity_icons_only.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<TextView
android:id="@+id/messageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomBar"
android:gravity="center"
android:text="Hi mom!" />

<com.roughike.bottombar.BottomBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/bottombar_tabs_five"
app:bb_behavior="iconsOnly" />

</RelativeLayout>
6 changes: 6 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
android:layout_height="wrap_content"
android:text="Simple example with three tabs" />

<Button
android:id="@+id/icons_only"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tabs with icons only" />

<Button
android:id="@+id/five_tabs_custom_colors"
android:layout_width="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion bottom-bar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext {
siteUrl = 'https://github.com/roughike/BottomBar'
gitUrl = 'https://github.com/roughike/BottomBar.git'

libraryVersion = '2.2.0'
libraryVersion = '2.3.0'

developerId = 'roughike'
developerName = 'Iiro Krankka'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

import static org.junit.Assert.assertEquals;

/**
* Created by iiro on 22.8.2016.
*/
@RunWith(AndroidJUnit4.class)
public class BottomBarTabTest {
private FrameLayout tabContainer;
Expand All @@ -28,19 +25,25 @@ public void setUp() {
}

@Test
public void correctLayoutReturned_ForFixedTab() {
public void correctLayoutReturnedForFixedTab() {
tab.setType(BottomBarTab.Type.FIXED);
assertEquals(R.layout.bb_bottom_bar_item_fixed, tab.getLayoutResource());
}

@Test(expected = IllegalStateException.class)
public void setIsTitleless_WhenTrueAndIconDoesNotExist_ThrowsException() {
tab.setIsTitleless(true);
assertEquals(R.layout.bb_bottom_bar_item_titleless, tab.getLayoutResource());
}

@Test
public void correctLayoutReturned_ForShiftingTab() {
public void correctLayoutForShiftingTab() {
tab.setType(BottomBarTab.Type.SHIFTING);
assertEquals(R.layout.bb_bottom_bar_item_shifting, tab.getLayoutResource());
}

@Test
public void correctLayoutReturned_ForTabletTab() {
public void correctLayoutForTabletTab() {
tab.setType(BottomBarTab.Type.TABLET);
assertEquals(R.layout.bb_bottom_bar_item_fixed_tablet, tab.getLayoutResource());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ public void correctBadgeHidingPolicies() {
assertTrue(tabs.get(4).getBadgeHidesWhenActive());
}

@Test
public void titlelessTabsAsExpected() {
assertFalse(tabs.get(0).isTitleless());
assertFalse(tabs.get(1).isTitleless());
assertTrue(tabs.get(2).isTitleless());
assertFalse(tabs.get(3).isTitleless());
assertTrue(tabs.get(4).isTitleless());
}

private Drawable getDrawableByResource(int iconResId) {
return ContextCompat.getDrawable(context, iconResId);
}
Expand Down
4 changes: 2 additions & 2 deletions bottom-bar/src/androidTest/res/xml/dummy_tabs_five.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<tabs>
<tab inActiveColor="#00FF00" activeColor="#FF0000" id="@+id/tab_recents" title="Recents" icon="@drawable/empty_icon" barColorWhenSelected="#FF0000" badgeBackgroundColor="#FF0000" badgeHidesWhenActive="false" />
<tab inActiveColor="#0000FF" activeColor="@color/test_random_color" id="@+id/tab_favorites" title="@string/favorites" icon="@drawable/empty_icon" barColorWhenSelected="#00FF00" badgeBackgroundColor="#00FF00" />
<tab inActiveColor="#FF0000" activeColor="#0000FF" id="@+id/tab_nearby" title="Nearby" icon="@drawable/empty_icon" barColorWhenSelected="#F00000" badgeBackgroundColor="#F00000" badgeHidesWhenActive="false" />
<tab inActiveColor="#FF0000" activeColor="#0000FF" id="@+id/tab_nearby" title="Nearby" icon="@drawable/empty_icon" barColorWhenSelected="#F00000" badgeBackgroundColor="#F00000" badgeHidesWhenActive="false" iconOnly="true" />
<tab inActiveColor="#F0F000" activeColor="@color/test_random_color_two" id="@+id/tab_friends" title="@string/friends" icon="@drawable/empty_icon" barColorWhenSelected="#00F000" badgeBackgroundColor="#00F000" badgeHidesWhenActive="true" />
<tab inActiveColor="#F00F00" activeColor="#F00F00" id="@+id/tab_food" title="Food" icon="@drawable/empty_icon" barColorWhenSelected="#00F0F0" badgeBackgroundColor="#00F0F0" />
<tab inActiveColor="#F00F00" activeColor="#F00F00" id="@+id/tab_food" title="Food" icon="@drawable/empty_icon" barColorWhenSelected="#00F0F0" badgeBackgroundColor="#00F0F0" iconOnly="true" />
</tabs>
Loading

0 comments on commit 9bfea75

Please sign in to comment.