修改测试问题

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 {
/**
* list_show : 1
* up_show : 1
* list_show : 1 //1,展示 0不展示
* 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"}]
*/
//是否展示0=不展示1=展示

View File

@ -65,18 +65,18 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
goHomeUser, anchorName, liveDurationAnchor, liveVotes, liveWatchNum;
private RelativeLayout userLiveEnd, anchorLiveEnd;
private ClipPathCircleImage clipImageUser, clipImageanchor;
private LinearLayout followUser;
private LinearLayout followUser, listShow;
private ImageView changeBatchUser;
private RecyclerView likeList;
private SearchRecommendBodyAdapter adapter;
private IMLoginModel model = null;
public LiveEndViewHolder(Context context, ViewGroup parentView,String uid) {
public LiveEndViewHolder(Context context, ViewGroup parentView, String uid) {
super(context, parentView);
model = IMLoginManager.get(mContext).getUserInfo();
if (TextUtils.equals(model.getId()+"",uid)){
if (TextUtils.equals(model.getId() + "", uid)) {
type = LiveOfType.ANCHOR;
}else {
} else {
type = LiveOfType.USER;
}
}
@ -124,6 +124,16 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
.anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() {
@Override
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();
//组装搜索历史数据
adapter.showData(data.getList());
@ -149,6 +159,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
clipImageUser = (ClipPathCircleImage) findViewById(R.id.clip_image_user);
followUser = (LinearLayout) findViewById(R.id.follow_user);
listShow = (LinearLayout) findViewById(R.id.list_show);
changeBatchUser = (ImageView) findViewById(R.id.change_batch_user);
likeList = (RecyclerView) findViewById(R.id.like_list);
goHomeUser.setOnClickListener(new View.OnClickListener() {
@ -197,7 +208,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
});
}
public static void upData(String votes, String length, int nums,String uname) {
public static void upData(String votes, String length, int nums, String uname) {
Log.e("", votes + "votes" + length + "length" + nums + "nums");
// mVotes.setText(votes);
@ -214,9 +225,9 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
}
public void showData(LiveBean liveBean, final String stream) {
if (TextUtils.equals(model.getId()+"",liveBean.getUid())){
if (TextUtils.equals(model.getId() + "", liveBean.getUid())) {
type = LiveOfType.ANCHOR;
}else {
} else {
type = LiveOfType.USER;
}
if (type == LiveOfType.USER) {

View File

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

View File

@ -3,12 +3,13 @@ package com.yunbao.main.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@ -65,7 +66,7 @@ public class SearchActivity extends AbsActivity {
transaction.replace(R.id.context_layout, searchRecommendFragment);
transaction.commit();
mEditText = findViewById(R.id.edit);
mEditText.addTextChangedListener(textWatcher);
mEditText.setOnEditorActionListener(onEditorActionListener);
//退出检索页面保存搜索记录
findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
@Override
@ -105,42 +106,38 @@ public class SearchActivity extends AbsActivity {
finish();
}
//輸入框監聽函數
TextWatcher textWatcher = new TextWatcher() {
TextView.OnEditorActionListener onEditorActionListener = new TextView.OnEditorActionListener() {
@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();
if (TextUtils.isEmpty(search_word.trim())) {
//檢索推薦頁面
SearchRecommendFragment searchRecommendFragment = new SearchRecommendFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.context_layout, searchRecommendFragment);
transaction.commit();
} else {
//展示檢索頁面
SearchResultsFragment searchResultsFragment = new SearchResultsFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
Bundle bundle = new Bundle();
bundle.putString("searchKey", search_word.toString());
searchResultsFragment.setArguments(bundle);
transaction.replace(R.id.context_layout, searchResultsFragment);
transaction.commit();
}
return true;
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(s.toString())) {
//檢索推薦頁面
SearchRecommendFragment searchRecommendFragment = new SearchRecommendFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.context_layout, searchRecommendFragment);
transaction.commit();
} else {
//展示檢索頁面
SearchResultsFragment searchResultsFragment = new SearchResultsFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
Bundle bundle = new Bundle();
bundle.putString("searchKey", s.toString());
searchResultsFragment.setArguments(bundle);
transaction.replace(R.id.context_layout, searchResultsFragment);
transaction.commit();
}
}
@Override
public void afterTextChanged(Editable s) {
return false;
}
};
/**
* 跳转用户首页
*/
@ -184,6 +181,15 @@ public class SearchActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onChip(String 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();
fragment.show(getChildFragmentManager(), "LoadingDialog");
MainNetManager.get(getActivity())
.anchorRecommend("6", new HttpCallback<AnchorRecommendModel>() {
.anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
fragment.dismiss();

View File

@ -69,7 +69,9 @@ public class SearchResultsItemFragment extends BaseFragment {
* @param type 類型
*/
public void setSearchKey(String searchKey, int type) {
//展示网络请求弹窗
LoadingDialog fragment = new LoadingDialog();
fragment.show(getChildFragmentManager(), "LoadingDialog");
this.searchKey = searchKey;
this.type = type;
if (type == 1) {
@ -79,6 +81,7 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<List<SearchModel>>>() {
@Override
public void onSuccess(List<List<SearchModel>> data) {
fragment.dismiss();
if (page > 1) {
itemAdapter.onLoadMoreData(data);
} else {
@ -88,7 +91,8 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override
public void onError(String error) {
ToastUtil.show(error);
fragment.dismiss();
}
});
} else {
@ -98,8 +102,9 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<SearchModel>>() {
@Override
public void onSuccess(List<SearchModel> data) {
fragment.dismiss();
if (data.size() == 0) {
ToastUtil.show(R.string.refresh_footer_nothing);
} else {
List<List<SearchModel>> listList = new ArrayList<>();
listList.add(data);
@ -114,7 +119,8 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override
public void onError(String error) {
ToastUtil.show(error);
fragment.dismiss();
}
});
}

View File

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

View File

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