Commit 5f353dff by 严久程

动态内部viewpager切换后重复调用方法的问题

parent 2aafb11b
...@@ -113,6 +113,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView, ...@@ -113,6 +113,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
private Fragment[] mFragments; private Fragment[] mFragments;
private TrendsHomeVpAdapter vpAdapter; private TrendsHomeVpAdapter vpAdapter;
private long lastTabClick = 0; private long lastTabClick = 0;
private int currentPostion = -1;
String tab; String tab;
public TrendsHomeFragment setTab(String tab) { public TrendsHomeFragment setTab(String tab) {
...@@ -229,6 +230,10 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView, ...@@ -229,6 +230,10 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
@Override @Override
public void onPageSelected(int position) { public void onPageSelected(int position) {
if (position == currentPostion) {
return;
}
currentPostion = position;
if (position >= 1) { if (position >= 1) {
vpContent.setOffscreenPageLimit(2); vpContent.setOffscreenPageLimit(2);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment