Skip to content

Commit b5cd7d1

Browse files
committed
Always call setCurrentItem from updateCurrentItem
Previously updateCurrentItem() was only called if pager.setItem() returned true which would not be the case when the pager was manually swiped since the position had already been set to the new value. Closes pockethub#352
1 parent d69fbc8 commit b5cd7d1

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

app/src/main/java/com/github/mobile/ui/TabPagerActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ protected int getContentView() {
136136
}
137137

138138
private void updateCurrentItem(final int newPosition) {
139-
if (newPosition > -1 && newPosition < adapter.getCount()
140-
&& pager.setItem(newPosition))
139+
if (newPosition > -1 && newPosition < adapter.getCount()) {
140+
pager.setItem(newPosition);
141141
setCurrentItem(newPosition);
142+
}
142143
}
143144

144145
private void createPager() {

app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package com.github.mobile.ui.comment;
1717

1818
import android.support.v4.app.Fragment;
19-
2019
import com.actionbarsherlock.app.SherlockFragmentActivity;
2120
import com.github.mobile.ui.FragmentPagerAdapter;
2221

app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public void invalidateOptionsMenu() {
6161
if (applyItem != null)
6262
applyItem.setEnabled(adapter != null
6363
&& !TextUtils.isEmpty(adapter.getCommentText()));
64-
6564
}
6665

6766
@Override

0 commit comments

Comments
 (0)