|
@@ -30,6 +30,7 @@ public class TemplateFragment extends BaseMVPFragment implements ITemplateView<S
|
|
|
public static final int SPACE_WIDTH_DP = 3; // 空隙宽度
|
|
public static final int SPACE_WIDTH_DP = 3; // 空隙宽度
|
|
|
|
|
|
|
|
private int mTemplateType = FunctionFragment.TEMPLATE_TYPE_BONUS;
|
|
private int mTemplateType = FunctionFragment.TEMPLATE_TYPE_BONUS;
|
|
|
|
|
+ private boolean mIsCurrentVisible;
|
|
|
|
|
|
|
|
@InjectPresenter
|
|
@InjectPresenter
|
|
|
TemplatePresenter mPresenter;
|
|
TemplatePresenter mPresenter;
|
|
@@ -98,6 +99,10 @@ public class TemplateFragment extends BaseMVPFragment implements ITemplateView<S
|
|
|
@Override
|
|
@Override
|
|
|
public void onBottom() {
|
|
public void onBottom() {
|
|
|
super.onBottom();
|
|
super.onBottom();
|
|
|
|
|
+ if (!mIsCurrentVisible) {
|
|
|
|
|
+ // 不可见的时候,不要去加载
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
// 如果到底部了,而且不是正在加载状态,就变为正在加载状态,并及时去加载数据
|
|
// 如果到底部了,而且不是正在加载状态,就变为正在加载状态,并及时去加载数据
|
|
|
if (!srl_template.isRefreshing()) {
|
|
if (!srl_template.isRefreshing()) {
|
|
|
mIsRefresh = false;
|
|
mIsRefresh = false;
|
|
@@ -108,6 +113,12 @@ public class TemplateFragment extends BaseMVPFragment implements ITemplateView<S
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
|
|
|
+ super.setUserVisibleHint(isVisibleToUser);
|
|
|
|
|
+ mIsCurrentVisible = isVisibleToUser;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected void onLazyLoad() {
|
|
protected void onLazyLoad() {
|
|
|
// 获取数据
|
|
// 获取数据
|