Skip to content

Commit

Permalink
Update 1.2.3.
Browse files Browse the repository at this point in the history
Major and minor fixes.
Scrolling and swipe issues fixes.
Fix wrong index and fraction at the end of animation and page scroll.
Pre 17 API fixes.
Layer type fixes.
Background draw fix.
New methods to set: background color, title size, badge size, swipe.
  • Loading branch information
GIGAMOLE committed Jun 28, 2016
1 parent 46c2159 commit bb6db54
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 154 deletions.
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
Or Gradle Maven Central:

```groovy
compile 'com.github.devlight.navigationtabbar:navigationtabbar:1.2.2'
compile 'com.github.devlight.navigationtabbar:navigationtabbar:1.2.3'
```

Or Maven:
Expand All @@ -42,7 +42,7 @@ Or Maven:
<dependency>
<groupId>com.github.devlight.navigationtabbar</groupId>
<artifactId>navigationtabbar</artifactId>
<version>1.2.2</version>
<version>1.2.3</version>
<type>aar</type>
</dependency>
```
Expand Down Expand Up @@ -71,9 +71,9 @@ For NTB you can set such parameters as:

allows you to connect NTB with ViewPager. If you want your can also set OnPageChangeListener.

- background:
- background color:

allows you to set background to NTB which automatically set with offset relative to badge gravity.
allows you to set background to NTB which automatically set with offset relative to badge gravity and corners radius.

- model selected icon:

Expand All @@ -95,13 +95,21 @@ For NTB you can set such parameters as:

allows you to handle mode of the model title show. Can show all or only active.

- title size:

allows you to set titles size.

- scale mode:

allows you to handle mode of the model icon and title scale.

- tint mode:

allows you to enable or disable icon tinting.
allows you to enable or disable icon tinting.

- badge size:

allows you to set badges size.

- badge position:

Expand Down Expand Up @@ -153,12 +161,11 @@ You can set selected icon. Resize and scale of selected icon equals to original

Orientation automatically detected according to view size.

By default badge bg color is the active model color and badge title color is the model bg color. To reset colors just set badge bg and title color to 0.
By default badge bg color is the active model color and badge title color is the model bg color. To reset colors just set AUTO_COLOR value to badge bg and title color.

If your set ViewPager you can action down on active pointer and do like drag.

If you want to set the background to NTB, just set background via XML or code and its automatically set relative to badge gravity.
By default badge sizes and title sizes is auto fit. To reset calculation just set AUTO_SIZE value to badge size and title size.

If your set ViewPager and enable swipe you can action down on active pointer and do like drag.

<b>Init</b>

Expand Down Expand Up @@ -220,6 +227,10 @@ navigationTabBar.setIsTinted(true);
navigationTabBar.setIsBadgeUseTypeface(true);
navigationTabBar.setBadgeBgColor(Color.RED);
navigationTabBar.setBadgeTitleColor(Color.WHITE);
navigationTabBar.setIsSwiped(true);
navigationTabBar.setBgColor(Color.BLACK);
navigationTabBar.setBadgeSize(10);
navigationTabBar.setTitleSize(10);
```

If your models is in badge mode you can set title, hide, show, toggle and update badge title like this:
Expand All @@ -233,7 +244,12 @@ model.updateBadgeTitle("Here some title like NEW or some integer value");
To enable behavior translation inside CoordinatorLayout when at bottom of screen:
```java
bottomNavigation.setBehaviorEnabled(true);
navigationTabBar.setBehaviorEnabled(true);
```

To deselect active index and reset pointer:
```java
navigationTabBar.deselect();
```

Other methods check out in sample.
Expand All @@ -260,7 +276,11 @@ And XML init:
app:ntb_badge_bg_color="#ffff0000"
app:ntb_badge_title_color="#ffffffff"
app:ntb_typeface="fonts/custom_typeface.ttf"
app:ntb_badge_use_typeface="true"/>
app:ntb_badge_use_typeface="true"
app:ntb_swiped="true"
app:ntb_bg_color="#000"
app:ntb_badge_size="10sp"
app:ntb_title_size="10sp"/>
```

Getting Help
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':navigationtabbar')
// compile 'com.github.devlight.navigationtabbar:navigationtabbar:1.2.2'

compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ public void onEndTabSelected(final NavigationTabBar.Model model, final int index
model.hideBadge();
}
});
navigationTabBar.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {

}

@Override
public void onPageSelected(final int position) {

}

@Override
public void onPageScrollStateChanged(final int state) {

}
});

final CoordinatorLayout coordinatorLayout = (CoordinatorLayout) findViewById(R.id.parent);
findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() {
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/drawable/bg_round_circle.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
android:background="#605271"
app:ntb_badge_size="12sp"
app:ntb_badge_bg_color="#ffff0000"
app:ntb_badge_gravity="top"
app:ntb_badge_position="left"
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_horizontal_ntb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#423752"
android:orientation="vertical">

Expand All @@ -17,13 +18,13 @@
android:id="@+id/ntb_horizontal"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#605271"
app:ntb_badge_gravity="top"
app:ntb_badge_position="right"
app:ntb_badged="true"
app:ntb_scaled="true"
app:ntb_tinted="true"
app:ntb_title_mode="all"
app:ntb_titled="true"/>
app:ntb_titled="true"
app:ntb_swiped="true"/>

</LinearLayout>
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_horizontal_top_ntb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">

<com.gigamole.library.ntb.NavigationTabBar
<com.gigamole.navigationtabbar.ntb.NavigationTabBar
android:id="@+id/ntb_horizontal"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#605271"
app:ntb_bg_color="#605271"
app:ntb_title_size="15sp"
app:ntb_badge_bg_color="#ffff0000"
app:ntb_badge_gravity="bottom"
app:ntb_badge_position="left"
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/res/layout/activity_samples_ntb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#605271"
app:ntb_bg_color="#605271"
app:ntb_active_color="#000"
app:ntb_scaled="false"
app:ntb_inactive_color="#fff"
Expand All @@ -45,7 +45,7 @@
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#d78cd3"
app:ntb_bg_color="#d78cd3"
app:ntb_active_color="#d78cd3"
app:ntb_inactive_color="#d78cd3"/>

Expand All @@ -62,6 +62,7 @@
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_gravity="center"
app:ntb_bg_color="#00000000"
app:ntb_corners_radius="10dp"
app:ntb_inactive_color="#000"
app:ntb_preview_colors="@array/red_wine"/>
Expand All @@ -88,6 +89,7 @@
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_gravity="center"
app:ntb_bg_color="#00FFFFFF"
app:ntb_active_color="#be7818"
app:ntb_inactive_color="#be7818"
app:ntb_animation_duration="1000"/>
Expand All @@ -105,13 +107,13 @@
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/bg_round_circle"
app:ntb_animation_duration="400"
app:ntb_preview_colors="@array/red_wine"
app:ntb_corners_radius="50dp"
app:ntb_corners_radius="25dp"
app:ntb_scaled="false"
app:ntb_active_color="#8d88e4"
app:ntb_inactive_color="#dddfec"/>
app:ntb_inactive_color="#dddfec"
app:ntb_bg_color="#8d88e4"/>

</FrameLayout>

Expand All @@ -126,7 +128,7 @@
android:layout_width="240dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="@drawable/bg_round_rect"
app:ntb_bg_color="#4b405c"
app:ntb_corners_radius="4dp"
app:ntb_preview_colors="@array/polluted_waves"/>

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_vertical_ntb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<com.gigamole.navigationtabbar.ntb.NavigationTabBar
android:id="@+id/ntb_vertical"
android:layout_width="50dp"
android:background="#605271"
android:layout_height="match_parent"
app:ntb_preview_colors="@array/vertical_ntb"/>

Expand Down
4 changes: 2 additions & 2 deletions navigationtabbar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ apply plugin: "com.jfrog.bintray"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven'

version = "1.2.2"
version = "1.2.3"

android {
compileSdkVersion 23
Expand All @@ -29,7 +29,7 @@ android {
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.2.2"
versionName "1.2.3"
}
buildTypes {
release {
Expand Down
Loading

0 comments on commit bb6db54

Please sign in to comment.