搜索功能改造
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.mango.moshen.ui.search
|
||||
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.isVisible
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.mango.core.home.bean.HomeRoomInfo
|
||||
import com.mango.core.utils.TextUtils
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.avroom.activity.AVRoomActivity
|
||||
import com.mango.moshen.ui.utils.load
|
||||
|
||||
|
||||
class CommonSearchEmptyAdapter :
|
||||
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_common_search_empty) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
||||
|
||||
val ivTag = helper.getView<ImageView>(R.id.iv_tag)
|
||||
ivTag.isVisible = !TextUtils.isEmptyText(item.tagPict)
|
||||
ivTag.load(item.tagPict)
|
||||
helper.setText(R.id.tv_online_num, item.onlineNum.toString())
|
||||
.setText(R.id.tv_nickname, item.nick)
|
||||
.setText(R.id.tv_room_name, item.title)
|
||||
.setImageResource(
|
||||
R.id.iv_gender,
|
||||
if (item.gender == 1) R.drawable.ic_gender_male else R.drawable.ic_gender_female
|
||||
)
|
||||
helper.getView<ImageView>(R.id.iv_room_avatar)
|
||||
.load(item.avatar, 12f, R.drawable.default_cover)
|
||||
|
||||
helper.itemView.setOnClickListener {
|
||||
AVRoomActivity.start(mContext, item.uid)
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package com.mango.moshen.ui.search;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -15,17 +16,26 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.google.android.flexbox.AlignContent;
|
||||
import com.google.android.flexbox.FlexboxLayoutManager;
|
||||
import com.google.android.flexbox.JustifyContent;
|
||||
import com.mango.core.auth.AuthModel;
|
||||
import com.mango.core.bean.RoomHistoryInfo;
|
||||
import com.mango.core.community.im.DynamicImMsg;
|
||||
import com.mango.core.manager.AvRoomDataManager;
|
||||
import com.mango.core.relation.cp.CpBindUnbindEvent;
|
||||
import com.mango.core.room.bean.SearchKeyInfo;
|
||||
import com.mango.core.room.bean.SearchRoomInfo;
|
||||
import com.mango.core.room.model.AvRoomModel;
|
||||
import com.mango.core.statistic.StatisticManager;
|
||||
import com.mango.core.statistic.protocol.StatisticsProtocol;
|
||||
import com.mango.core.utils.SharedPreferenceUtils;
|
||||
@@ -43,6 +53,8 @@ import com.mango.moshen.ui.widget.magicindicator.buildins.commonnavigator.Common
|
||||
import com.mango.moshen.ui.widget.recyclerview.decoration.VerticalDecoration;
|
||||
import com.mango.xchat_android_library.base.factory.CreatePresenter;
|
||||
import com.mango.xchat_android_library.utils.ImeUtil;
|
||||
import com.mango.xchat_android_library.utils.JavaUtil;
|
||||
import com.mango.xchat_android_library.utils.ListUtils;
|
||||
import com.mango.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.mango.xchat_android_library.utils.SizeUtils;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
@@ -81,10 +93,21 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
private ViewPager viewPager;
|
||||
private LinearLayout llSearchDetail;
|
||||
|
||||
private View llSearchCommonContainer;
|
||||
private RecyclerView rvCommonSearch;
|
||||
private View llCommonSearchDetail;
|
||||
private RecyclerView rvCommonSearchRoom;
|
||||
private View llCommonSearchEmpty;
|
||||
private RecyclerView rvCommonSearchEmpty;
|
||||
|
||||
private SearchHistoryAdapter mSearchHistoryAdapter;
|
||||
private RoomHistoryAdapter mRoomHistoryAdapter;
|
||||
private List<String> mSearchHistoryList = new ArrayList<>(20);
|
||||
|
||||
private BaseQuickAdapter<SearchKeyInfo, BaseViewHolder> commonSearchAdapter;
|
||||
private CommonSearchEmptyAdapter commonSearchEmptyAdapter;
|
||||
private SearchAdapter commonSearchResultAdapter;
|
||||
|
||||
private SearchDetailFragment roomFrg;
|
||||
private SearchDetailFragment userFrg;
|
||||
private TextWatcher textWatcher = new TextWatcher() {
|
||||
@@ -136,6 +159,12 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
indicator = findViewById(R.id.indicator);
|
||||
viewPager = findViewById(R.id.viewpager);
|
||||
|
||||
rvCommonSearch = findViewById(R.id.rv_common_search);
|
||||
llSearchCommonContainer = findViewById(R.id.ll_search_common_container);
|
||||
llCommonSearchDetail = findViewById(R.id.ll_common_search_detail);
|
||||
rvCommonSearchRoom = findViewById(R.id.rv_common_search_room);
|
||||
llCommonSearchEmpty = findViewById(R.id.ll_common_search_empty);
|
||||
rvCommonSearchEmpty = findViewById(R.id.rv_common_search_empty);
|
||||
|
||||
clSearchHistoryContainer = findViewById(R.id.cl_search_history_container);
|
||||
rvSearchHistory = findViewById(R.id.rv_search_history);
|
||||
@@ -177,6 +206,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
showSearchHistory();
|
||||
showRoomHistory();
|
||||
showCommonSearch();
|
||||
}
|
||||
|
||||
private void initSearchDetail() {
|
||||
@@ -225,8 +255,10 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
private void showSearchHistory() {
|
||||
mSearchHistoryAdapter = new SearchHistoryAdapter(mSearchHistoryList);
|
||||
rvSearchHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
rvSearchHistory.addItemDecoration(new VerticalDecoration(SizeUtils.dp2px(this, 10), false, true));
|
||||
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
|
||||
layoutManager.setJustifyContent(JustifyContent.FLEX_START);
|
||||
rvSearchHistory.setLayoutManager(layoutManager);
|
||||
rvSearchHistory.addItemDecoration(new VerticalDecoration(SizeUtils.dp2px(this, 12), false, true));
|
||||
mSearchHistoryAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_SEARCH_RECENT_SEARCH, "最近搜索记录");
|
||||
|
||||
@@ -256,6 +288,87 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void showCommonSearch() {
|
||||
commonSearchAdapter = new BaseQuickAdapter<SearchKeyInfo, BaseViewHolder>(R.layout.item_search_history) {
|
||||
@Override
|
||||
protected void convert(@NonNull BaseViewHolder helper, SearchKeyInfo item) {
|
||||
if (TextUtils.isEmpty(item.getWord())) {
|
||||
return;
|
||||
}
|
||||
helper.setText(R.id.tv_search_history, item.getWord());
|
||||
}
|
||||
};
|
||||
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
|
||||
layoutManager.setJustifyContent(JustifyContent.FLEX_START);
|
||||
rvCommonSearch.setLayoutManager(layoutManager);
|
||||
rvCommonSearch.addItemDecoration(new VerticalDecoration(SizeUtils.dp2px(this, 12), false, true));
|
||||
commonSearchAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
SearchKeyInfo keyInfo = commonSearchAdapter.getItem(position);
|
||||
if (keyInfo != null) {
|
||||
handleCommonSearch(keyInfo.getId());
|
||||
}
|
||||
|
||||
});
|
||||
rvCommonSearch.setAdapter(commonSearchAdapter);
|
||||
AvRoomModel.get().getCommonSearchList()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(data -> {
|
||||
commonSearchAdapter.setNewData(data);
|
||||
llSearchCommonContainer.setVisibility(ListUtils.isListEmpty(data) ? View.GONE : View.VISIBLE);
|
||||
}, throwable -> {
|
||||
llSearchCommonContainer.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void handleCommonSearch(String id) {
|
||||
AvRoomModel.get().commonSearch(id)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(
|
||||
data -> {
|
||||
if (ListUtils.isListEmpty(data)) {
|
||||
showCommonSearchEmpty();
|
||||
} else {
|
||||
showCommonSearchResult(data);
|
||||
}
|
||||
}, throwable -> {
|
||||
showCommonSearchEmpty();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void showCommonSearchResult(List<SearchRoomInfo> data) {
|
||||
llCommonSearchDetail.setVisibility(View.VISIBLE);
|
||||
if (commonSearchResultAdapter == null) {
|
||||
commonSearchResultAdapter = new SearchAdapter(this, 0, 0);
|
||||
rvCommonSearchRoom.setLayoutManager(new LinearLayoutManager(this));
|
||||
rvCommonSearchRoom.setAdapter(commonSearchResultAdapter);
|
||||
}
|
||||
commonSearchResultAdapter.setNewData(data);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void showCommonSearchEmpty() {
|
||||
llCommonSearchEmpty.setVisibility(View.VISIBLE);
|
||||
AvRoomModel.get()
|
||||
.getRecommendRoomList(String.valueOf(AvRoomDataManager.get().getRoomUid()))
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(
|
||||
data -> {
|
||||
if (commonSearchEmptyAdapter == null) {
|
||||
commonSearchEmptyAdapter = new CommonSearchEmptyAdapter();
|
||||
rvCommonSearchEmpty.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
rvCommonSearchEmpty.setAdapter(commonSearchEmptyAdapter);
|
||||
}
|
||||
commonSearchEmptyAdapter.setNewData(data);
|
||||
},
|
||||
throwable -> {
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void showRoomHistory() {
|
||||
mRoomHistoryAdapter = new RoomHistoryAdapter(null, context);
|
||||
rvRoomHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
@@ -298,7 +411,6 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
if (list != null && list.size() > 0) {
|
||||
clRoomHistoryContainer.setVisibility(View.VISIBLE);
|
||||
mRoomHistoryAdapter.setNewData(list);
|
||||
|
||||
} else {
|
||||
clRoomHistoryContainer.setVisibility(View.GONE);
|
||||
}
|
||||
@@ -358,7 +470,9 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
}
|
||||
|
||||
private void goBack() {
|
||||
if (llSearchDetail.getVisibility() == View.VISIBLE) {
|
||||
if (llSearchDetail.getVisibility() == View.VISIBLE ||
|
||||
llCommonSearchEmpty.getVisibility() == View.VISIBLE ||
|
||||
llCommonSearchDetail.getVisibility() == View.VISIBLE) {
|
||||
showHistory();
|
||||
return;
|
||||
}
|
||||
@@ -374,6 +488,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
} else {
|
||||
clSearchHistoryContainer.setVisibility(View.GONE);
|
||||
clRoomHistoryContainer.setVisibility(View.GONE);
|
||||
llSearchCommonContainer.setVisibility(View.GONE);
|
||||
}
|
||||
addHistory(str);
|
||||
ImeUtil.hideIME(this, tvSearch);
|
||||
@@ -381,10 +496,28 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
starSearch(str);
|
||||
}
|
||||
|
||||
private void starSearch(String str) {
|
||||
if (roomFrg != null) {
|
||||
roomFrg.search(str, SearchDetailFragment.TYPE_SEARCH_ROOM);
|
||||
}
|
||||
@SuppressLint("CheckResult")
|
||||
private void starSearch(final String str) {
|
||||
AvRoomModel.get().hijackSearch(str)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(hijackInfo -> {
|
||||
if (hijackInfo == null || TextUtils.isEmpty(hijackInfo.getRoomUid()) || hijackInfo.getAwardVo() == null) {
|
||||
starRealSearch(str);
|
||||
} else {
|
||||
long roomUid = JavaUtil.str2long(hijackInfo.getRoomUid());
|
||||
if (roomUid != 0) {
|
||||
AVRoomActivity.start(SearchActivity.this, roomUid);
|
||||
finish();
|
||||
} else {
|
||||
SearchPrizeDialog.newInstance(hijackInfo.getAwardVo()).show(SearchActivity.this);
|
||||
}
|
||||
}
|
||||
},
|
||||
throwable -> starRealSearch(str));
|
||||
}
|
||||
|
||||
private void starRealSearch(String str) {
|
||||
roomFrg.search(str, SearchDetailFragment.TYPE_SEARCH_ROOM);
|
||||
userFrg.search(str, SearchDetailFragment.TYPE_SEARCH_USER);
|
||||
if (llSearchDetail.getVisibility() != View.VISIBLE) {
|
||||
llSearchDetail.setVisibility(View.VISIBLE);
|
||||
@@ -393,6 +526,8 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
private void clearSearch() {
|
||||
llSearchDetail.setVisibility(View.GONE);
|
||||
llCommonSearchDetail.setVisibility(View.GONE);
|
||||
llCommonSearchEmpty.setVisibility(View.GONE);
|
||||
if (roomFrg != null) {
|
||||
roomFrg.clear();
|
||||
}
|
||||
@@ -428,18 +563,26 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
}
|
||||
|
||||
private void showHistory() {
|
||||
clearSearch();
|
||||
clSearchHistoryContainer.setVisibility(mSearchHistoryList != null && mSearchHistoryList.size() > 0 ?
|
||||
clearSearch();
|
||||
clSearchHistoryContainer.setVisibility(mSearchHistoryList != null && mSearchHistoryList.size() > 0 ?
|
||||
View.VISIBLE : View.GONE);
|
||||
|
||||
if (mRoomHistoryAdapter != null) {
|
||||
List<RoomHistoryInfo> roomHistoryInfos = mRoomHistoryAdapter.getData();
|
||||
clRoomHistoryContainer.setVisibility(roomHistoryInfos.size() > 0 ?
|
||||
View.VISIBLE : View.GONE);
|
||||
} else {
|
||||
clRoomHistoryContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (mRoomHistoryAdapter != null) {
|
||||
List<RoomHistoryInfo> roomHistoryInfos = mRoomHistoryAdapter.getData();
|
||||
clRoomHistoryContainer.setVisibility(roomHistoryInfos.size() > 0 ?
|
||||
View.VISIBLE : View.GONE);
|
||||
if (commonSearchAdapter != null) {
|
||||
List<SearchKeyInfo> roomHistoryInfos = commonSearchAdapter.getData();
|
||||
llSearchCommonContainer.setVisibility(roomHistoryInfos.size() > 0 ?
|
||||
View.VISIBLE : View.GONE);
|
||||
} else {
|
||||
llSearchCommonContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
} else {
|
||||
clRoomHistoryContainer.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package com.mango.moshen.ui.search
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import com.mango.core.room.bean.SearchHijackInfo
|
||||
import com.mango.moshen.base.BaseDialog
|
||||
import com.mango.moshen.databinding.DialogRoomPkRuleBinding
|
||||
import com.mango.moshen.databinding.DialogSearchPrizeBinding
|
||||
import com.mango.moshen.ui.utils.load
|
||||
|
||||
class SearchPrizeDialog : BaseDialog<DialogSearchPrizeBinding>() {
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(awardInfo: SearchHijackInfo.AwardInfo): SearchPrizeDialog {
|
||||
return SearchPrizeDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
putSerializable("awardInfo", awardInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
private val awardInfo by lazy { requireArguments().getSerializable("awardInfo") as SearchHijackInfo.AwardInfo }
|
||||
|
||||
override fun init() {
|
||||
binding.ivClose.setOnClickListener { dismissAllowingStateLoss() }
|
||||
binding.tvPrizeName.text = awardInfo.awardName
|
||||
binding.ivPrizeIcon.load(awardInfo.awardUrl)
|
||||
}
|
||||
}
|
@@ -74,11 +74,99 @@
|
||||
android:gravity="center"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="@string/search"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_common_search_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="相关房间"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_common_search_room"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_common_search_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:text="暂无开播厅房~"
|
||||
android:textColor="#BABBCD"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="#e4e4e4" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="为你推荐"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_common_search_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_search_common_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="大家都在搜"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_common_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_search_history_container"
|
||||
android:layout_width="match_parent"
|
||||
@@ -91,8 +179,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_search_history"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fl_clear_search_history"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/fl_clear_search_history" />
|
||||
@@ -100,14 +188,14 @@
|
||||
<TextView
|
||||
android:id="@+id/fl_clear_search_history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/common_item_view_height_big"
|
||||
android:layout_height="30dp"
|
||||
android:drawableStart="@drawable/ic_message_trash"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
android:gravity="center"
|
||||
android:paddingEnd="@dimen/dp_15"
|
||||
android:text="@string/label_clear"
|
||||
android:textColor="@color/text_normal_c6c6e9"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:textColor="#8A8CAB"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -135,8 +223,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_room_history"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fl_clear_room_history"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/fl_clear_room_history" />
|
||||
@@ -144,14 +232,14 @@
|
||||
<TextView
|
||||
android:id="@+id/fl_clear_room_history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/common_item_view_height_big"
|
||||
android:layout_height="30dp"
|
||||
android:drawableStart="@drawable/ic_message_trash"
|
||||
android:drawablePadding="@dimen/dp_2"
|
||||
android:gravity="center"
|
||||
android:paddingEnd="@dimen/dp_15"
|
||||
android:text="@string/label_clear"
|
||||
android:textColor="@color/text_normal_c6c6e9"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:textColor="#8A8CAB"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -183,21 +271,8 @@
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.mango.moshen.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
</com.mango.moshen.common.widget.StatusLayout>
|
||||
</LinearLayout>
|
75
app/src/main/res/layout/dialog_search_prize.xml
Normal file
75
app/src/main/res/layout/dialog_search_prize.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/shape_white_20dp_round"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:src="@drawable/ic_close_black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="不错哟~你获得了神秘奖励"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:scaleType="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="飞马座驾(1天)"
|
||||
android:textColor="@color/color_161958"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_prize_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="奖励已自动发放"
|
||||
android:textColor="#8A8CAB"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_prize_name" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
120
app/src/main/res/layout/item_common_search_empty.xml
Normal file
120
app/src/main/res/layout/item_common_search_empty.xml
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:orientation="vertical"
|
||||
tools:layout_width="180dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_room_avatar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/tag_101" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_bottom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/bg_single_anchor_more_bottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="334:110"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="交友厅官方交友厅交友厅官方交友厅" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_3"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_room_name"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_gender"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_room_name"
|
||||
tools:text="交友厅官方交友厅交友厅官方交友厅" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gender"
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_gender_male"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_nickname"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nickname" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_online"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:background="@drawable/shape_black_t40_12"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_10"
|
||||
android:layout_height="@dimen/dp_10"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:src="@drawable/ic_singer_hot" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_online_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_3"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="231人在聊" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -3,12 +3,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/tv_search_history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:paddingStart="12.5dp"
|
||||
android:paddingEnd="12.5dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:background="@drawable/bg_secondary_radius_15"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:textColor="#8A8CAB"
|
||||
android:textSize="12sp"
|
||||
android:singleLine="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
tools:text="12345678901234567890"/>
|
@@ -0,0 +1,20 @@
|
||||
package com.mango.core.room.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class SearchHijackInfo {
|
||||
|
||||
private String roomUid;
|
||||
private AwardInfo awardVo;
|
||||
|
||||
@Data
|
||||
public static class AwardInfo implements Serializable {
|
||||
private String awardType;
|
||||
private String awardName;
|
||||
private String awardUrl;
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package com.mango.core.room.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class SearchKeyInfo {
|
||||
|
||||
private String id;
|
||||
private String word;
|
||||
|
||||
}
|
@@ -5,6 +5,8 @@ import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.mango.core.room.bean.SearchHijackInfo;
|
||||
import com.mango.core.room.bean.SearchKeyInfo;
|
||||
import com.netease.nimlib.sdk.AbortableFuture;
|
||||
import com.netease.nimlib.sdk.NIMChatRoomSDK;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
@@ -475,6 +477,24 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<SearchHijackInfo> hijackSearch(String key) {
|
||||
return mRoomService.hijackSearch(key)
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SearchKeyInfo>> getCommonSearchList() {
|
||||
return mRoomService.getCommonSearchList()
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SearchRoomInfo>> commonSearch(String id) {
|
||||
return mRoomService.commonSearch(id)
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<RoomResult> getUserRoom(long uid) {
|
||||
return mRoomService.getUserRoom(String.valueOf(uid))
|
||||
|
@@ -9,6 +9,8 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mango.core.room.bean.SearchHijackInfo;
|
||||
import com.mango.core.room.bean.SearchKeyInfo;
|
||||
import com.netease.nimlib.sdk.NIMChatRoomSDK;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.RequestCallback;
|
||||
@@ -813,6 +815,25 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@GET("/search/room")
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(@Query("key") String key);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@GET("/search/hijack/get")
|
||||
Single<ServiceResult<SearchHijackInfo>> hijackSearch(@Query("key") String key);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@GET("/every/one/search/getList")
|
||||
Single<ServiceResult<List<SearchKeyInfo>>> getCommonSearchList();
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GET("/every/one/search/getRoomList")
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> commonSearch(@Query("id") String id);
|
||||
|
||||
/**
|
||||
* 获取该Uid 所在的房间信息,如果不在房间 返回的房间实体uid==0,或者roomId == 0
|
||||
*
|
||||
@@ -822,27 +843,6 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@GET("/userroom/get")
|
||||
Single<RoomResult> getUserRoom(@Query("uid") String uid);
|
||||
|
||||
|
||||
/**
|
||||
* 房间标签列表
|
||||
*
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@POST("/room/tag/all")
|
||||
Single<ServiceResult<List<RoomSettingTabInfo>>> getRoomTagList(@Query("ticket") String ticket);
|
||||
|
||||
/**
|
||||
* @param uid
|
||||
* @param ticket
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
@POST("/userroom/in")
|
||||
Single<ServiceResult> userRoomIn(@Query("uid") String uid,
|
||||
@Query("ticket") String ticket,
|
||||
@Query("roomUid") String roomUid);
|
||||
|
||||
/**
|
||||
* @param uid
|
||||
* @param ticket
|
||||
@@ -947,29 +947,6 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@Field("hasAnimationEffect") boolean hasAnimationEffect,
|
||||
@Field("audioQuality") int audioQuality);
|
||||
|
||||
/**
|
||||
* 更新房间设置信息
|
||||
*
|
||||
* @param title
|
||||
* @param desc
|
||||
* @param pwd
|
||||
* @param label 标签名字
|
||||
* @param tagId 标签id
|
||||
* @param uid 用户id
|
||||
* @param ticket
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("room/updateByAdmin")
|
||||
Single<ServiceResult<RoomInfo>> updateByAdmin(@Field("roomUid") long roomUid,
|
||||
@Field("title") String title,
|
||||
@Field("roomDesc") String desc,
|
||||
@Field("roomPwd") String pwd,
|
||||
@Field("roomTag") String label,
|
||||
@Field("tagId") int tagId,
|
||||
@Field("uid") long uid,
|
||||
@Field("ticket") String ticket,
|
||||
@Field("hasAnimationEffect") boolean hasAnimationEffect,
|
||||
@Field("audioQuality") int audioQuality);
|
||||
|
||||
/**
|
||||
* 关闭公屏
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package com.mango.core.room.model.inteface;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.mango.core.room.bean.SearchHijackInfo;
|
||||
import com.mango.core.room.bean.SearchKeyInfo;
|
||||
import com.netease.nimlib.sdk.chatroom.model.EnterChatRoomResultData;
|
||||
import com.mango.core.base.IModel;
|
||||
import com.mango.core.bean.response.ServiceResult;
|
||||
@@ -90,6 +92,12 @@ public interface IAvRoomModel extends IModel {
|
||||
*/
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key, int type);
|
||||
|
||||
Single<SearchHijackInfo> hijackSearch(String key);
|
||||
|
||||
Single<List<SearchKeyInfo>> getCommonSearchList();
|
||||
|
||||
Single<List<SearchRoomInfo>> commonSearch(String id);
|
||||
|
||||
/**
|
||||
* 获取某个用户的房间信息
|
||||
*/
|
||||
|
Reference in New Issue
Block a user