Skip to content

Commit cff2736

Browse files
committed
Getting the number of fragments in the stack
closed #6
1 parent 87b0e45 commit cff2736

File tree

7 files changed

+30
-8
lines changed

7 files changed

+30
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android:
88
- tools
99

1010
- android-25
11-
- build-tools-25.0.2
11+
- build-tools-25.0.3
1212
- extra-google-m2repository
1313
- extra-android-m2repository
1414

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Change Log
22
==========
33

44

5+
## Version 1.2.1
6+
7+
_2016-07-11_
8+
9+
Implemented the ability to get the number of fragments in the stack (`backStackSize()`).
10+
11+
512
## Version 1.2.0
613

714
_2016-07-11_

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add the dependency
3838

3939
```groovy
4040
dependencies {
41-
compile 'com.github.jetradarmobile:multibackstack:1.2.0'
41+
compile 'com.github.jetradarmobile:multibackstack:1.2.1'
4242
}
4343
```
4444

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
jcenter()
44
}
55
dependencies {
6-
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
6+
classpath 'com.android.tools.build:gradle:2.3.1'
77
}
88
}
99

@@ -15,11 +15,11 @@ allprojects {
1515

1616
ext {
1717
compileSdkVersion = 25
18-
buildToolsVersion = '25.0.2'
18+
buildToolsVersion = '25.0.3'
1919

20-
supportDesign = 'com.android.support:design:25.0.1'
21-
supportAppCompat = 'com.android.support:appcompat-v7:25.0.1'
22-
bottomNavigationBar = 'com.ashokvarma.android:bottom-navigation-bar:1.3.0'
20+
supportDesign = 'com.android.support:design:25.3.1'
21+
supportAppCompat = 'com.android.support:appcompat-v7:25.3.1'
22+
bottomNavigationBar = 'com.ashokvarma.android:bottom-navigation-bar:1.4.1'
2323
}
2424

2525
task clean(type: Delete) {

multibackstack/src/main/java/com/jetradar/multibackstack/BackStack.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import android.os.Parcelable;
2121
import android.support.annotation.NonNull;
2222
import android.support.annotation.Nullable;
23-
2423
import java.util.Stack;
2524

2625
public class BackStack implements Parcelable {
@@ -44,6 +43,10 @@ public boolean empty() {
4443
return entriesStack.empty();
4544
}
4645

46+
public int size() {
47+
return entriesStack.size();
48+
}
49+
4750
@Override
4851
public int describeContents() {
4952
return 0;

multibackstack/src/main/java/com/jetradar/multibackstack/BackStackActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,11 @@ protected boolean resetBackStackToRoot(int hostId) {
9494
protected boolean clearBackStack(int hostId) {
9595
return backStackManager.clear(hostId);
9696
}
97+
98+
/**
99+
* @return the number of fragments in back stack.
100+
*/
101+
protected int backStackSize(int hostId) {
102+
return backStackManager.backStackSize(hostId);
103+
}
97104
}

multibackstack/src/main/java/com/jetradar/multibackstack/BackStackManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public boolean clear(int hostId) {
7878
return true;
7979
}
8080

81+
public int backStackSize(int hostId) {
82+
BackStack backStack = getBackStack(hostId);
83+
return backStack!= null ? backStack.size() : 0;
84+
}
85+
8186
public boolean resetToRoot(int hostId) {
8287
BackStack backStack = getBackStack(hostId);
8388
if (backStack == null) {

0 commit comments

Comments
 (0)