From 9bfea75734acaf2cad7a025ee763b6c8eafa5448 Mon Sep 17 00:00:00 2001 From: Iiro Krankka Date: Thu, 6 Apr 2017 21:04:07 +0300 Subject: [PATCH] v2.3.0 (#734) * 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 --- .gitignore | 2 +- .travis.yml | 2 +- CHANGELOG.md | 18 ++- README.md | 4 +- app/build.gradle | 8 +- app/src/main/AndroidManifest.xml | 1 + .../bottombar/sample/IconsOnlyActivity.java | 39 +++++ .../bottombar/sample/MainActivity.java | 4 + .../layout/activity_color_changing_tabs.xml | 2 +- .../main/res/layout/activity_icons_only.xml | 23 +++ app/src/main/res/layout/activity_main.xml | 6 + bottom-bar/build.gradle | 2 +- .../roughike/bottombar/BottomBarTabTest.java | 15 +- .../com/roughike/bottombar/TabParserTest.java | 9 ++ .../androidTest/res/xml/dummy_tabs_five.xml | 4 +- .../com/roughike/bottombar/BottomBar.java | 144 ++++++++++++++---- .../com/roughike/bottombar/BottomBarTab.java | 101 ++++++++---- .../bottombar/BottomNavigationBehavior.java | 12 +- .../com/roughike/bottombar/MiscUtils.java | 20 ++- .../com/roughike/bottombar/ShySettings.java | 55 +++++++ .../com/roughike/bottombar/TabParser.java | 18 ++- .../bb_bottom_bar_item_container.xml | 24 +++ .../layout/bb_bottom_bar_item_container.xml | 6 +- .../res/layout/bb_bottom_bar_item_fixed.xml | 2 +- .../layout/bb_bottom_bar_item_shifting.xml | 5 +- .../layout/bb_bottom_bar_item_titleless.xml | 10 ++ bottom-bar/src/main/res/values/attrs.xml | 2 + bottom-bar/src/main/res/values/dimensions.xml | 2 + bottom-bar/src/main/res/values/ids.xml | 5 + bottom-bar/src/main/res/values/styles.xml | 1 - build.gradle | 7 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 32 files changed, 459 insertions(+), 98 deletions(-) create mode 100644 app/src/main/java/com/example/bottombar/sample/IconsOnlyActivity.java create mode 100644 app/src/main/res/layout/activity_icons_only.xml create mode 100644 bottom-bar/src/main/java/com/roughike/bottombar/ShySettings.java create mode 100644 bottom-bar/src/main/res/layout-v21/bb_bottom_bar_item_container.xml create mode 100644 bottom-bar/src/main/res/layout/bb_bottom_bar_item_titleless.xml create mode 100644 bottom-bar/src/main/res/values/ids.xml diff --git a/.gitignore b/.gitignore index 0d4ee63f..e5df7b91 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,4 @@ captures/ .idea/libraries # Keystore files -*.jks \ No newline at end of file +*.jks diff --git a/.travis.yml b/.travis.yml index e4725cdb..a334babe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ android: components: - tools - platform-tools - - build-tools-25.0.1 + - build-tools-25.0.2 - android-25 - extra-android-m2repository diff --git a/CHANGELOG.md b/CHANGELOG.md index 980148f5..57a43657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 5f31bf35..cbad3755 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ 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:** @@ -37,7 +37,7 @@ compile 'com.roughike:bottom-bar:2.2.0' com.roughike bottom-bar - 2.2.0 + 2.3.0 pom ``` diff --git a/app/build.gradle b/app/build.gradle index f3645884..434d4acd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0e04901e..fd181570 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,6 +18,7 @@ + diff --git a/app/src/main/java/com/example/bottombar/sample/IconsOnlyActivity.java b/app/src/main/java/com/example/bottombar/sample/IconsOnlyActivity.java new file mode 100644 index 00000000..6a53d579 --- /dev/null +++ b/app/src/main/java/com/example/bottombar/sample/IconsOnlyActivity.java @@ -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(); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/bottombar/sample/MainActivity.java b/app/src/main/java/com/example/bottombar/sample/MainActivity.java index 2f22302b..87a23cd2 100644 --- a/app/src/main/java/com/example/bottombar/sample/MainActivity.java +++ b/app/src/main/java/com/example/bottombar/sample/MainActivity.java @@ -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); @@ -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; diff --git a/app/src/main/res/layout/activity_color_changing_tabs.xml b/app/src/main/res/layout/activity_color_changing_tabs.xml index f9412358..a39325bd 100644 --- a/app/src/main/res/layout/activity_color_changing_tabs.xml +++ b/app/src/main/res/layout/activity_color_changing_tabs.xml @@ -15,7 +15,7 @@ diff --git a/app/src/main/res/layout/activity_icons_only.xml b/app/src/main/res/layout/activity_icons_only.xml new file mode 100644 index 00000000..795454be --- /dev/null +++ b/app/src/main/res/layout/activity_icons_only.xml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 48d4223e..e90ec527 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -19,6 +19,12 @@ android:layout_height="wrap_content" android:text="Simple example with three tabs" /> +