feat:首页广场的下拉刷新组件换新样式

This commit is contained in:
Max
2023-12-28 15:49:05 +08:00
parent d83dbe2337
commit 91b006422c
2 changed files with 15 additions and 10 deletions

View File

@@ -32,6 +32,9 @@ import com.nnbc123.core.user.event.LoadLoginUserInfoEvent;
import com.nnbc123.core.utils.net.DontWarnObserver; import com.nnbc123.core.utils.net.DontWarnObserver;
import com.nnbc123.library.utils.SizeUtils; import com.nnbc123.library.utils.SizeUtils;
import com.nnbc123.xchat_android_constants.XChatConstants; import com.nnbc123.xchat_android_constants.XChatConstants;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.trello.rxlifecycle3.android.FragmentEvent; import com.trello.rxlifecycle3.android.FragmentEvent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@@ -58,7 +61,7 @@ public class SquareDynamicFragment extends BaseFragment {
@BindView(R.id.recycler_view) @BindView(R.id.recycler_view)
RecyclerView recyclerView; RecyclerView recyclerView;
@BindView(R.id.refresh_layout) @BindView(R.id.refresh_layout)
SwipeRefreshLayout refreshLayout; SmartRefreshLayout refreshLayout;
private String nextDynamicId; private String nextDynamicId;
@@ -137,9 +140,8 @@ public class SquareDynamicFragment extends BaseFragment {
}); });
refreshLayout = mView.findViewById(R.id.refresh_layout); refreshLayout = mView.findViewById(R.id.refresh_layout);
refreshLayout.setOnRefreshListener(() -> { refreshLayout.setEnableLoadmore(false);
loadData(true); refreshLayout.setOnRefreshListener(refreshlayout -> loadData(true));
});
loadData(true); loadData(true);
} }
@@ -174,7 +176,7 @@ public class SquareDynamicFragment extends BaseFragment {
@Override @Override
public void accept(WorldDynamicListResult result, String error) { public void accept(WorldDynamicListResult result, String error) {
super.accept(result, error); super.accept(result, error);
refreshLayout.setRefreshing(false); refreshLayout.finishRefresh();
if (error != null) { if (error != null) {
if (!isRefresh) adapter.loadMoreFail(); if (!isRefresh) adapter.loadMoreFail();
return; return;

View File

@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refresh_layout" android:id="@+id/refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:focusable="true"
android:background="@color/color_F9F9F9" android:background="@color/color_F9F9F9"
android:focusable="true"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true">
<com.nnbc123.app.home.refresh.HomeRefreshHeader
android:layout_width="match_parent"
android:layout_height="47dp" />
<com.nnbc123.app.common.widget.StatusLayout <com.nnbc123.app.common.widget.StatusLayout
android:id="@+id/status_layout" android:id="@+id/status_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -18,9 +22,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:clipToPadding="false" android:clipToPadding="false" />
/>
</com.nnbc123.app.common.widget.StatusLayout> </com.nnbc123.app.common.widget.StatusLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>