Skip to content

Commit

Permalink
Update 1.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
GIGAMOLE committed Apr 18, 2016
1 parent ab38909 commit b331fe4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
4 changes: 2 additions & 2 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:library:1.1.3'
compile 'com.github.devlight.navigationtabbar:library:1.1.4'
```

Or Maven:
Expand All @@ -42,7 +42,7 @@ Or Maven:
<dependency>
<groupId>com.github.devlight.navigationtabbar</groupId>
<artifactId>library</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
<type>aar</type>
</dependency>
```
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
</intent-filter>
</activity>

<activity android:name=".HorizontalNtbActivity"/>
<activity android:name=".HorizontalNtbActivity"
android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity android:name=".TopHorizontalNtbActivity"/>
<activity android:name=".VerticalNtbActivity"/>
<activity android:name=".SamplesNtbActivity"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,20 @@ public Object instantiateItem(final ViewGroup container, final int position) {
getResources().getDrawable(R.drawable.ic_fifth), Color.parseColor(colors[4]), "Medal"));
navigationTabBar.setModels(models);
navigationTabBar.setViewPager(viewPager, 2);

navigationTabBar.setOnTabBarSelectedIndexListener(new NavigationTabBar.OnTabBarSelectedIndexListener() {
navigationTabBar.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onStartTabSelected(final NavigationTabBar.Model model, final int index) {
public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {

}

@Override
public void onEndTabSelected(final NavigationTabBar.Model model, final int index) {
model.hideBadge();
public void onPageSelected(final int position) {
navigationTabBar.getModels().get(position).hideBadge();
}

@Override
public void onPageScrollStateChanged(final int state) {

}
});

Expand Down
4 changes: 2 additions & 2 deletions library/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.1.3"
version = "1.1.4"

android {
compileSdkVersion 23
Expand All @@ -29,7 +29,7 @@ android {
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.1.3"
versionName "1.1.4"
}
buildTypes {
release {
Expand Down
20 changes: 19 additions & 1 deletion library/src/main/java/com/gigamole/library/NavigationTabBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
Expand Down Expand Up @@ -1186,7 +1187,7 @@ public Parcelable onSaveInstanceState() {
return savedState;
}

static class SavedState extends BaseSavedState {
private static class SavedState extends BaseSavedState {
int index;

public SavedState(Parcelable superState) {
Expand Down Expand Up @@ -1218,6 +1219,23 @@ public SavedState[] newArray(int size) {
};
}

@Override
protected void onConfigurationChanged(final Configuration newConfig) {
// Config view on rotate etc.
super.onConfigurationChanged(newConfig);
requestLayout();

// Refresh pointer and state after config changed to current
final int tempIndex = mIndex;
setModelIndex(INVALID_INDEX, true);
post(new Runnable() {
@Override
public void run() {
setModelIndex(tempIndex, true);
}
});
}

// Model class
public static class Model {

Expand Down

0 comments on commit b331fe4

Please sign in to comment.