界面优化,数据整理
This commit is contained in:
parent
19dfe093af
commit
ae9f15d963
@ -4,12 +4,12 @@ import android.os.Bundle;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.yunbao.common.bean.SearchModel;
|
import com.yunbao.common.bean.SearchModel;
|
||||||
|
import com.yunbao.common.dialog.LoadingDialog;
|
||||||
import com.yunbao.common.fragment.BaseFragment;
|
import com.yunbao.common.fragment.BaseFragment;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.main.MainNetManager;
|
import com.yunbao.common.http.main.MainNetManager;
|
||||||
@ -19,7 +19,6 @@ import com.yunbao.main.adapter.SearchResultsItemAdapter;
|
|||||||
import com.yunbao.main.utils.WordsTypeUtil;
|
import com.yunbao.main.utils.WordsTypeUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +27,6 @@ import java.util.List;
|
|||||||
public class SearchResultsItemFragment extends BaseFragment {
|
public class SearchResultsItemFragment extends BaseFragment {
|
||||||
private String searchKey = "";
|
private String searchKey = "";
|
||||||
private int page = 1;
|
private int page = 1;
|
||||||
private LinearLayout loading;
|
|
||||||
private RecyclerView searchList;
|
private RecyclerView searchList;
|
||||||
private SearchResultsItemAdapter itemAdapter;
|
private SearchResultsItemAdapter itemAdapter;
|
||||||
|
|
||||||
@ -44,9 +42,7 @@ public class SearchResultsItemFragment extends BaseFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViews(Bundle savedInstanceState, View contentView) {
|
protected void initViews(Bundle savedInstanceState, View contentView) {
|
||||||
loading = contentView.findViewById(R.id.loading);
|
|
||||||
searchList = contentView.findViewById(R.id.search_list);
|
searchList = contentView.findViewById(R.id.search_list);
|
||||||
loading.setVisibility(View.VISIBLE);
|
|
||||||
itemAdapter = new SearchResultsItemAdapter();
|
itemAdapter = new SearchResultsItemAdapter();
|
||||||
searchList.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
searchList.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||||
searchList.setAdapter(itemAdapter);
|
searchList.setAdapter(itemAdapter);
|
||||||
@ -64,6 +60,9 @@ public class SearchResultsItemFragment extends BaseFragment {
|
|||||||
* @param type 類型
|
* @param type 類型
|
||||||
*/
|
*/
|
||||||
public void setSearchKey(String searchKey, int type) {
|
public void setSearchKey(String searchKey, int type) {
|
||||||
|
//展示网络请求弹窗
|
||||||
|
LoadingDialog fragment = new LoadingDialog();
|
||||||
|
fragment.show(getChildFragmentManager(), "LoadingDialog");
|
||||||
this.searchKey = searchKey;
|
this.searchKey = searchKey;
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
MainNetManager.get(getActivity())
|
MainNetManager.get(getActivity())
|
||||||
@ -73,12 +72,12 @@ public class SearchResultsItemFragment extends BaseFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<List<SearchModel>> data) {
|
public void onSuccess(List<List<SearchModel>> data) {
|
||||||
itemAdapter.showData(data, type);
|
itemAdapter.showData(data, type);
|
||||||
loading.setVisibility(View.GONE);
|
fragment.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
loading.setVisibility(View.GONE);
|
fragment.dismiss();
|
||||||
ToastUtil.show(error);
|
ToastUtil.show(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -92,12 +91,12 @@ public class SearchResultsItemFragment extends BaseFragment {
|
|||||||
List<List<SearchModel>> listList = new ArrayList<>();
|
List<List<SearchModel>> listList = new ArrayList<>();
|
||||||
listList.add(data);
|
listList.add(data);
|
||||||
itemAdapter.showData(listList, type);
|
itemAdapter.showData(listList, type);
|
||||||
loading.setVisibility(View.GONE);
|
fragment.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
loading.setVisibility(View.GONE);
|
fragment.dismiss();
|
||||||
ToastUtil.show(error);
|
ToastUtil.show(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -136,6 +135,7 @@ public class SearchResultsItemFragment extends BaseFragment {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchResultsItemFragment newInstance(String searchKey, int type) {
|
public static SearchResultsItemFragment newInstance(String searchKey, int type) {
|
||||||
SearchResultsItemFragment searchRecommendFragment = new SearchResultsItemFragment();
|
SearchResultsItemFragment searchRecommendFragment = new SearchResultsItemFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@ -16,7 +14,10 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/type_title"
|
android:id="@+id/type_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginRight="20dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -50,6 +51,8 @@
|
|||||||
android:id="@+id/anchor_list"
|
android:id="@+id/anchor_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
android:fadingEdge="none" />
|
android:fadingEdge="none" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -2,8 +2,7 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@ -16,6 +15,8 @@
|
|||||||
android:id="@+id/type_title"
|
android:id="@+id/type_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
android:layout_marginTop="20dp">
|
android:layout_marginTop="20dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -51,5 +52,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
android:fadingEdge="none" />
|
android:fadingEdge="none" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user