修改测试问题

This commit is contained in:
18401019693 2022-08-09 17:25:15 +08:00
parent 2db6115534
commit 971feb9f18
8 changed files with 94 additions and 63 deletions

View File

@ -10,8 +10,8 @@ import java.util.List;
*/ */
public class AnchorRecommendModel extends BaseModel { public class AnchorRecommendModel extends BaseModel {
/** /**
* list_show : 1 * list_show : 1 //1,展示 0不展示
* up_show : 1 * up_show : 1 //1,刷新按钮展示 0不展示
* list : [{"islive":1,"uid":97616,"title":"12","stream":"97616_1649830285","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97616_1649830285.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":30579,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"1","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs20","level":"32","level_anchor":"58"},{"islive":1,"uid":97617,"title":"23","stream":"97617_1649830293","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97617_1649830293.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":5356,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"1","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs21","level":"32","level_anchor":"12"},{"islive":1,"uid":97619,"title":"45","stream":"97619_1649830309","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97619_1649830309.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":41061,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"4","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs23","level":"32","level_anchor":"21"},{"islive":1,"uid":97620,"title":"56","stream":"97620_1649830320","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97620_1649830320.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":29610,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"4","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs24","level":"32","level_anchor":"34"},{"islive":1,"uid":97712,"title":"宽哥太牛辣","stream":"97712_1658912067","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97712_2022.flv","thumb":"https://qny.shayucm.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":41498,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"3","avatar":"https://qny.shayucm.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/200/h/200","avatar2":"","user_nicename":"rongyun002","level":"71","level_anchor":"14"}] * list : [{"islive":1,"uid":97616,"title":"12","stream":"97616_1649830285","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97616_1649830285.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":30579,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"1","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs20","level":"32","level_anchor":"58"},{"islive":1,"uid":97617,"title":"23","stream":"97617_1649830293","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97617_1649830293.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":5356,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"1","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs21","level":"32","level_anchor":"12"},{"islive":1,"uid":97619,"title":"45","stream":"97619_1649830309","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97619_1649830309.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":41061,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"4","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs23","level":"32","level_anchor":"21"},{"islive":1,"uid":97620,"title":"56","stream":"97620_1649830320","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97620_1649830320.flv","thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":29610,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"4","avatar":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20210805013115_aaf2203dd76321d068943bb6868c3461?imageView2/2/w/600/h/600","avatar2":"","user_nicename":"RongCloudcs24","level":"32","level_anchor":"34"},{"islive":1,"uid":97712,"title":"宽哥太牛辣","stream":"97712_1658912067","pull":"http://pullry.yaoulive.com/uwd1c0sxu1p71/97712_2022.flv","thumb":"https://qny.shayucm.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/600/h/600","isvideo":0,"type":0,"type_val":"","anyway":1,"landscape":1,"liveclassid":1,"is_rong":1,"hot_num":41498,"content_pic_size_one":"","content_pic_size_two":"","content_pic_size_three":"","nums":"3","avatar":"https://qny.shayucm.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/600/h/600","avatar_thumb":"https://qny.shayucm.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/200/h/200","avatar2":"","user_nicename":"rongyun002","level":"71","level_anchor":"14"}]
*/ */
//是否展示0=不展示1=展示 //是否展示0=不展示1=展示

View File

@ -65,7 +65,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
goHomeUser, anchorName, liveDurationAnchor, liveVotes, liveWatchNum; goHomeUser, anchorName, liveDurationAnchor, liveVotes, liveWatchNum;
private RelativeLayout userLiveEnd, anchorLiveEnd; private RelativeLayout userLiveEnd, anchorLiveEnd;
private ClipPathCircleImage clipImageUser, clipImageanchor; private ClipPathCircleImage clipImageUser, clipImageanchor;
private LinearLayout followUser; private LinearLayout followUser, listShow;
private ImageView changeBatchUser; private ImageView changeBatchUser;
private RecyclerView likeList; private RecyclerView likeList;
private SearchRecommendBodyAdapter adapter; private SearchRecommendBodyAdapter adapter;
@ -124,6 +124,16 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
.anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() { .anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() {
@Override @Override
public void onSuccess(AnchorRecommendModel data) { public void onSuccess(AnchorRecommendModel data) {
if (data.getListShow() == 1) {
listShow.setVisibility(View.VISIBLE);
} else {
listShow.setVisibility(View.GONE);
}
if (data.getUpShow() == 1) {
changeBatchUser.setVisibility(View.VISIBLE);
} else {
changeBatchUser.setVisibility(View.GONE);
}
fragment.dismiss(); fragment.dismiss();
//组装搜索历史数据 //组装搜索历史数据
adapter.showData(data.getList()); adapter.showData(data.getList());
@ -149,6 +159,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
clipImageUser = (ClipPathCircleImage) findViewById(R.id.clip_image_user); clipImageUser = (ClipPathCircleImage) findViewById(R.id.clip_image_user);
followUser = (LinearLayout) findViewById(R.id.follow_user); followUser = (LinearLayout) findViewById(R.id.follow_user);
listShow = (LinearLayout) findViewById(R.id.list_show);
changeBatchUser = (ImageView) findViewById(R.id.change_batch_user); changeBatchUser = (ImageView) findViewById(R.id.change_batch_user);
likeList = (RecyclerView) findViewById(R.id.like_list); likeList = (RecyclerView) findViewById(R.id.like_list);
goHomeUser.setOnClickListener(new View.OnClickListener() { goHomeUser.setOnClickListener(new View.OnClickListener() {

View File

@ -169,7 +169,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#b3000000" android:background="#b3000000"
android:visibility="gone"> android:visibility="visible">
<View <View
@ -280,6 +280,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/list_show"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/view_xian" android:layout_below="@id/view_xian"
@ -318,24 +319,28 @@
android:id="@+id/like_list" android:id="@+id/like_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="20.67dp"
android:layout_marginStart="11dp" android:layout_marginStart="11dp"
android:layout_marginTop="20.67dp"
android:layout_marginEnd="11dp" /> android:layout_marginEnd="11dp" />
</LinearLayout>
<TextView <TextView
android:id="@+id/go_home_user" android:id="@+id/go_home_user"
android:layout_width="206.33dp" android:layout_width="206.33dp"
android:layout_height="46.67dp" android:layout_height="46.67dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="71dp" android:layout_marginStart="71dp"
android:layout_marginTop="60dp" android:layout_marginTop="60dp"
android:layout_marginEnd="71dp" android:layout_marginEnd="71dp"
android:layout_marginBottom="52dp"
android:background="@drawable/background_live_end_btn" android:background="@drawable/background_live_end_btn"
android:gravity="center" android:gravity="center"
android:text="@string/live_back" android:text="@string/live_back"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>
@ -343,7 +348,8 @@
android:id="@+id/anchor_live_end" android:id="@+id/anchor_live_end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#b3000000"> android:background="#b3000000"
android:visibility="gone">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@ -481,13 +487,13 @@
android:layout_width="206.33dp" android:layout_width="206.33dp"
android:layout_height="46.67dp" android:layout_height="46.67dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="71dp" android:layout_marginStart="71dp"
android:layout_marginTop="60dp" android:layout_marginTop="60dp"
android:layout_marginEnd="71dp" android:layout_marginEnd="71dp"
android:layout_marginBottom="52dp" android:layout_marginBottom="52dp"
android:background="@drawable/background_live_end_btn" android:background="@drawable/background_live_end_btn"
android:gravity="center" android:gravity="center"
android:layout_centerHorizontal="true"
android:text="@string/live_back" android:text="@string/live_back"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp" />

View File

@ -3,12 +3,13 @@ package com.yunbao.main.activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
@ -65,7 +66,7 @@ public class SearchActivity extends AbsActivity {
transaction.replace(R.id.context_layout, searchRecommendFragment); transaction.replace(R.id.context_layout, searchRecommendFragment);
transaction.commit(); transaction.commit();
mEditText = findViewById(R.id.edit); mEditText = findViewById(R.id.edit);
mEditText.addTextChangedListener(textWatcher); mEditText.setOnEditorActionListener(onEditorActionListener);
//退出检索页面保存搜索记录 //退出检索页面保存搜索记录
findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() { findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -105,16 +106,13 @@ public class SearchActivity extends AbsActivity {
finish(); finish();
} }
//輸入框監聽函數 TextView.OnEditorActionListener onEditorActionListener = new TextView.OnEditorActionListener() {
TextWatcher textWatcher = new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
} // 保存关键词到本地数据库
String search_word = mEditText.getText().toString().trim();
@Override if (TextUtils.isEmpty(search_word.trim())) {
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(s.toString())) {
//檢索推薦頁面 //檢索推薦頁面
SearchRecommendFragment searchRecommendFragment = new SearchRecommendFragment(); SearchRecommendFragment searchRecommendFragment = new SearchRecommendFragment();
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();
@ -127,20 +125,19 @@ public class SearchActivity extends AbsActivity {
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("searchKey", s.toString()); bundle.putString("searchKey", search_word.toString());
searchResultsFragment.setArguments(bundle); searchResultsFragment.setArguments(bundle);
transaction.replace(R.id.context_layout, searchResultsFragment); transaction.replace(R.id.context_layout, searchResultsFragment);
transaction.commit(); transaction.commit();
} }
return true;
} }
return false;
@Override
public void afterTextChanged(Editable s) {
} }
}; };
/** /**
* 跳转用户首页 * 跳转用户首页
*/ */
@ -184,6 +181,15 @@ public class SearchActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onChip(String chip) { public void onChip(String chip) {
mEditText.setText(chip); mEditText.setText(chip);
//展示檢索頁面
SearchResultsFragment searchResultsFragment = new SearchResultsFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
Bundle bundle = new Bundle();
bundle.putString("searchKey", chip);
searchResultsFragment.setArguments(bundle);
transaction.replace(R.id.context_layout, searchResultsFragment);
transaction.commit();
} }
} }

View File

@ -61,7 +61,7 @@ public class SearchRecommendFragment extends BaseFragment {
LoadingDialog fragment = new LoadingDialog(); LoadingDialog fragment = new LoadingDialog();
fragment.show(getChildFragmentManager(), "LoadingDialog"); fragment.show(getChildFragmentManager(), "LoadingDialog");
MainNetManager.get(getActivity()) MainNetManager.get(getActivity())
.anchorRecommend("6", new HttpCallback<AnchorRecommendModel>() { .anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
@Override @Override
public void onSuccess(AnchorRecommendModel data) { public void onSuccess(AnchorRecommendModel data) {
fragment.dismiss(); fragment.dismiss();

View File

@ -69,7 +69,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;
this.type = type; this.type = type;
if (type == 1) { if (type == 1) {
@ -79,6 +81,7 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<List<SearchModel>>>() { type, page, new HttpCallback<List<List<SearchModel>>>() {
@Override @Override
public void onSuccess(List<List<SearchModel>> data) { public void onSuccess(List<List<SearchModel>> data) {
fragment.dismiss();
if (page > 1) { if (page > 1) {
itemAdapter.onLoadMoreData(data); itemAdapter.onLoadMoreData(data);
} else { } else {
@ -88,7 +91,8 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override @Override
public void onError(String error) { public void onError(String error) {
ToastUtil.show(error);
fragment.dismiss();
} }
}); });
} else { } else {
@ -98,8 +102,9 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<SearchModel>>() { type, page, new HttpCallback<List<SearchModel>>() {
@Override @Override
public void onSuccess(List<SearchModel> data) { public void onSuccess(List<SearchModel> data) {
fragment.dismiss();
if (data.size() == 0) { if (data.size() == 0) {
ToastUtil.show(R.string.refresh_footer_nothing);
} else { } else {
List<List<SearchModel>> listList = new ArrayList<>(); List<List<SearchModel>> listList = new ArrayList<>();
listList.add(data); listList.add(data);
@ -114,7 +119,8 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override @Override
public void onError(String error) { public void onError(String error) {
ToastUtil.show(error);
fragment.dismiss();
} }
}); });
} }

View File

@ -40,6 +40,7 @@
<TextView <TextView
android:id="@+id/anchor_more" android:id="@+id/anchor_more"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:gravity="center_vertical"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right" android:layout_gravity="center_vertical|right"
android:drawableRight="@mipmap/icon_more" android:drawableRight="@mipmap/icon_more"

View File

@ -40,6 +40,7 @@
<TextView <TextView
android:id="@+id/anchor_more" android:id="@+id/anchor_more"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:gravity="center_vertical"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right" android:layout_gravity="center_vertical|right"
android:drawableRight="@mipmap/icon_more" android:drawableRight="@mipmap/icon_more"