首页,搜索页
This commit is contained in:
@@ -81,7 +81,6 @@ public class ContactsIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
|
||||
public ContactsPagerTitleView(Context context, String tabInfo) {
|
||||
super(context);
|
||||
setWidth(Utils.dip2px(getContext(), 96));
|
||||
setHeight(Utils.dip2px(getContext(), 30));
|
||||
setTextSize(16);
|
||||
setText(tabInfo);
|
||||
@@ -93,13 +92,13 @@ public class ContactsIndicatorAdapter extends CommonNavigatorAdapter {
|
||||
@Override
|
||||
public void onSelected(int index, int totalCount) {
|
||||
// setBackgroundResource(R.drawable.shape_bg_contact_indicator_item);
|
||||
setTextColor(getResources().getColor(R.color.color_333333));
|
||||
setTextColor(getResources().getColor(R.color.appColor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeselected(int index, int totalCount) {
|
||||
// setBackgroundDrawable(null);
|
||||
setTextColor(getResources().getColor(R.color.color_B3B3B3));
|
||||
setTextColor(getResources().getColor(R.color.color_666666));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -2,6 +2,7 @@ package com.yizhuan.erban.home.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@@ -9,6 +10,7 @@ import android.widget.ImageView;
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.netease.nim.uikit.support.glide.GlideRequest;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.home.bean.HomeTabMapInfo;
|
||||
@@ -60,49 +62,13 @@ public class HomeRoomFragmentAdapter extends BaseMultiItemQuickAdapter<HomeTabMa
|
||||
.setText(R.id.tv_title, item.getRoomTitle());
|
||||
// helper.getView(R.id.lock_bg).setVisibility(!TextUtils.isEmpty(homeRoom.getRoomPwd()) ? View.VISIBLE : View.GONE);
|
||||
ImageView mIvTabLabel = helper.getView(R.id.iv_tab_label);
|
||||
// boolean showTab = false;
|
||||
// Drawable icon = null;
|
||||
// if (item.isShowRankHalfIcon()) {
|
||||
// showTab = true;
|
||||
// icon = mContext.getResources().getDrawable(R.drawable.icon_rank_half);
|
||||
// } else if (homeRoom.getIsRecom() > 0) {
|
||||
// showTab = true;
|
||||
// icon = mContext.getResources().getDrawable(R.drawable.ic_king_recommend);
|
||||
// } else if (!TextUtils.isEmpty(homeRoom.badge)) {
|
||||
// showTab = true;
|
||||
// } else
|
||||
// mIvTabLabel.setVisibility(View.INVISIBLE);
|
||||
if (!TextUtils.isEmpty(item.getTagPict())) {
|
||||
mIvTabLabel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadAvatarBig(item.getTagPict(), mIvTabLabel);
|
||||
} else {
|
||||
mIvTabLabel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// if (showTab) {
|
||||
// mIvTabLabel.setVisibility(View.VISIBLE);
|
||||
// GlideRequest request;
|
||||
// if (icon != null)
|
||||
// request = GlideApp.with(mContext).load(icon);
|
||||
// else
|
||||
// request = GlideApp.with(mContext).load(homeRoom.badge);
|
||||
//
|
||||
// request.listener(new RequestListener<Drawable>() {
|
||||
// @Override
|
||||
// public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Drawable> target, boolean b) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onResourceReady(Drawable drawable, Object o, Target<Drawable> target, DataSource dataSource, boolean b) {
|
||||
// float ratio = (drawable.getIntrinsicHeight() + 0.F) / drawable.getIntrinsicWidth();
|
||||
// int width = Math.round(mBadgeHeight / ratio);
|
||||
// int height = mBadgeHeight;
|
||||
// ViewGroup.LayoutParams params = mIvTabLabel.getLayoutParams();
|
||||
// params.width = width;
|
||||
// params.height = height;
|
||||
// mIvTabLabel.setLayoutParams(params);
|
||||
// mIvTabLabel.setImageDrawable(drawable);
|
||||
// return true;
|
||||
// }
|
||||
// })
|
||||
// .into(mIvTabLabel);
|
||||
//
|
||||
// }
|
||||
ImageView ivCover = helper.getView(R.id.iv_cover);
|
||||
if (!TextUtils.isEmpty(item.getAvatar())) {
|
||||
ImageLoadUtils.loadAvatarBig(item.getAvatar(), ivCover, R.drawable.default_cover);
|
||||
|
@@ -24,6 +24,15 @@ public class HomeTabMapInfo implements MultiItemEntity, Serializable {
|
||||
public static final int TYPE_EMPTY = 0;
|
||||
public static final int TYPE_NORMAL = 1;
|
||||
private int itemType=0;
|
||||
private String tagPict;
|
||||
|
||||
public String getTagPict() {
|
||||
return tagPict;
|
||||
}
|
||||
|
||||
public void setTagPict(String tagPict) {
|
||||
this.tagPict = tagPict;
|
||||
}
|
||||
|
||||
public int getOnlineNum() {
|
||||
return onlineNum;
|
||||
|
@@ -6,15 +6,19 @@ import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseFragment;
|
||||
import com.yizhuan.erban.home.adapter.HomeDynamicAdapter;
|
||||
import com.yizhuan.erban.home.bean.HomeDynamicInfo;
|
||||
|
||||
import com.yizhuan.erban.home.bean.HomeTabMapInfo;
|
||||
import com.yizhuan.erban.home.event.RefreshHomeDataEvent;
|
||||
import com.yizhuan.erban.home.model.HomeModel;
|
||||
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
|
||||
@@ -25,6 +29,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
@@ -42,9 +47,10 @@ public class HomeDynamicFragment extends BaseFragment{
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
private boolean isLoading = false;
|
||||
|
||||
private HomeDynamicAdapter dynamicAdapter;
|
||||
private Handler handler = new Handler();
|
||||
private Runnable runnable;
|
||||
private final List<HomeDynamicInfo> dynamicList = new ArrayList<>();
|
||||
|
||||
public static HomeDynamicFragment newInstance() {
|
||||
HomeDynamicFragment fragment = new HomeDynamicFragment();
|
||||
@@ -88,14 +94,12 @@ public class HomeDynamicFragment extends BaseFragment{
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
dynamicAdapter = new HomeDynamicAdapter(getActivity());
|
||||
recyclerView.setAdapter(dynamicAdapter);
|
||||
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
if (isLoading) {
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getHomeDynamic();
|
||||
}
|
||||
|
||||
@@ -103,36 +107,54 @@ public class HomeDynamicFragment extends BaseFragment{
|
||||
private void getHomeDynamic(){
|
||||
HomeModel.get().getHomeDynamic().subscribe((serviceResult, throwable) -> {
|
||||
if (throwable != null) {
|
||||
isLoading = false;
|
||||
} else {
|
||||
isLoading = false;
|
||||
List<HomeDynamicInfo> info = serviceResult;
|
||||
if (ListUtils.isListEmpty(info)) {
|
||||
dynamicList.clear();
|
||||
dynamicList.addAll(serviceResult);
|
||||
if (ListUtils.isListEmpty(dynamicList)) {
|
||||
showNoData(R.drawable.icon_common_failure, "这里什么都没有");
|
||||
}else {
|
||||
hideStatus();
|
||||
refreshData();
|
||||
}
|
||||
dynamicAdapter.setNewData(info);
|
||||
dynamicAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void refreshData(){
|
||||
dynamicAdapter.setNewData(dynamicList);
|
||||
if (runnable != null){
|
||||
return;
|
||||
}
|
||||
runnable = new Runnable() {
|
||||
@Override
|
||||
public void onReloadData() {
|
||||
loadData();
|
||||
public void run() {
|
||||
if (getActivity() != null) {
|
||||
// dynamicAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
|
||||
dynamicAdapter.addData(0,dynamicList.get(dynamicList.size()-1));
|
||||
dynamicAdapter.remove(dynamicList.size()-1);
|
||||
dynamicAdapter.notifyDataSetChanged();
|
||||
handler.postDelayed(this, 3000);
|
||||
}
|
||||
}
|
||||
};
|
||||
handler.postDelayed(runnable,3000);
|
||||
}
|
||||
|
||||
private List<HomeDynamicInfo> getConvertData(List<HomeDynamicInfo> dynamicList){
|
||||
List<HomeDynamicInfo> convertedList = new ArrayList<>(dynamicList);
|
||||
convertedList.add(convertedList.get(convertedList.size()-1));
|
||||
convertedList.remove(convertedList.size()-1);
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLoadLoginUserInfoEvent(LoadLoginUserInfoEvent event) {
|
||||
loadData();
|
||||
getHomeDynamic();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLoadLoginUserInfoEvent(RefreshHomeDataEvent event) {
|
||||
loadData();
|
||||
getHomeDynamic();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,4 +169,22 @@ public class HomeDynamicFragment extends BaseFragment{
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
||||
private void stopTimer(){
|
||||
handler.removeCallbacks(runnable);
|
||||
runnable = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -3,8 +3,6 @@ package com.yizhuan.erban.home.fragment;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -13,7 +11,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.trello.rxlifecycle2.android.FragmentEvent;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseFragment;
|
||||
@@ -21,17 +18,12 @@ import com.yizhuan.erban.common.NoDataFragment;
|
||||
import com.yizhuan.erban.home.adapter.HomeRoomFragmentAdapter;
|
||||
import com.yizhuan.erban.home.bean.HomeTabMapInfo;
|
||||
import com.yizhuan.erban.home.model.HomeModel;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.log.MLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
||||
/**
|
||||
@@ -91,6 +83,7 @@ public class HomeTabHomeFragment extends BaseFragment {
|
||||
|
||||
private void stopTimer(){
|
||||
handler.removeCallbacks(runnable);
|
||||
runnable = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +128,9 @@ public class HomeTabHomeFragment extends BaseFragment {
|
||||
*/
|
||||
private void refreshRoomData(){
|
||||
mHomeRoomAdapter.setNewData(getConvertData(allRoomList));
|
||||
if (runnable != null){
|
||||
return;
|
||||
}
|
||||
runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -185,9 +181,6 @@ public class HomeTabHomeFragment extends BaseFragment {
|
||||
sixRoomsList.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return sixRoomsList;
|
||||
}
|
||||
|
||||
|
@@ -77,8 +77,6 @@ public class MsgFragment extends BaseFragment implements TopMagicIndicatorAdapte
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -135,7 +135,6 @@ public class RecentListFragment extends BaseFragment {
|
||||
if (getArguments() != null) {
|
||||
isInRoom = getArguments().getBoolean("isInRoom", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,7 +186,7 @@ public class RecentListFragment extends BaseFragment {
|
||||
fragmentTransaction.replace(R.id.recent_container, recentContactsFragment).commitAllowingStateLoss();
|
||||
grabApprenticesRecyclerView = mView.findViewById(R.id.rv_grab_apprentices);
|
||||
grabApprenticesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(),
|
||||
OrientationHelper.HORIZONTAL, false));
|
||||
RecyclerView.HORIZONTAL, false));
|
||||
grabApprenticesAdapter = new GrabApprenticesAdapter();
|
||||
grabApprenticesRecyclerView.setAdapter(grabApprenticesAdapter);
|
||||
grabApprenticesAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
|
@@ -4,8 +4,6 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
@@ -14,21 +12,34 @@ import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.ViewPagerAdapter;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.decoration.helper.DecorationDialogHelper;
|
||||
import com.yizhuan.erban.decoration.helper.DecorationSaleType;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||
import com.yizhuan.erban.home.adapter.ContactsIndicatorAdapter;
|
||||
import com.yizhuan.erban.home.adapter.FragmentViewPagerAdapter;
|
||||
import com.yizhuan.erban.ui.search.presenter.SearchPresenter;
|
||||
import com.yizhuan.erban.ui.search.view.ISearchView;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator;
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.decoration.VerticalDecoration;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
|
||||
import com.yizhuan.xchat_android_core.community.dynamic.DynamicModel;
|
||||
@@ -62,16 +73,13 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
* jack 修改于 2018/5/2
|
||||
*/
|
||||
@CreatePresenter(SearchPresenter.class)
|
||||
public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter> implements ISearchView, View.OnClickListener {
|
||||
public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter> implements ISearchView, View.OnClickListener,ContactsIndicatorAdapter.OnItemSelectListener {
|
||||
private static final String MARK = "isCar";
|
||||
private static final String CAR_INFO = "carInfo";
|
||||
private static final String WEAR_INFO = "wearInfo";
|
||||
private static final String SHOW_HISTORY = "show_history";
|
||||
|
||||
public static final int CODE_REQUEST_TO_SEARCH = 200;
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private SearchAdapter searchAdapter;
|
||||
protected EditText searchEdit;
|
||||
private ImageView ivBack;
|
||||
private TextView tvSearch;
|
||||
@@ -85,6 +93,11 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
private RecyclerView rvRoomHistory;
|
||||
private View flClearRoomHistory;
|
||||
|
||||
private MagicIndicator indicator;
|
||||
private ViewPager viewPager;
|
||||
|
||||
private LinearLayout llSearchDetail;
|
||||
|
||||
private CarInfo carInfo;
|
||||
private HeadWearInfo wearInfo;
|
||||
protected int type = AbstractSelectFriendAction.TYPE_NORMAL;
|
||||
@@ -161,7 +174,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
flClearRoomHistory = findViewById(R.id.fl_clear_room_history);
|
||||
flClearRoomHistory.setOnClickListener(this);
|
||||
|
||||
recyclerView = findViewById(R.id.recycler_view);
|
||||
|
||||
searchEdit = findViewById(R.id.search_edit);
|
||||
searchEdit.addTextChangedListener(textWatcher);
|
||||
searchEdit.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
|
||||
@@ -176,17 +189,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
}
|
||||
});
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
searchAdapter = new SearchAdapter(this, null);
|
||||
searchAdapter.setType(type);
|
||||
searchAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
SearchRoomInfo item = (SearchRoomInfo) adapter.getData().get(position);
|
||||
showSureDialog(item.getUid() + "",item.getAvatar(), item.getNick());
|
||||
}
|
||||
});
|
||||
recyclerView.setAdapter(searchAdapter);
|
||||
|
||||
|
||||
ivBack = findViewById(R.id.iv_back);
|
||||
ivBack.setOnClickListener(this);
|
||||
@@ -198,11 +201,46 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
ivClearText.setOnClickListener(this);
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
|
||||
llSearchDetail = findViewById(R.id.ll_search_detail);
|
||||
|
||||
if (mShowHistory) {
|
||||
showSearchHistory();
|
||||
showRoomHistory();
|
||||
}
|
||||
|
||||
indicator = findViewById(R.id.indicator);
|
||||
viewPager = findViewById(R.id.viewpager);
|
||||
}
|
||||
|
||||
private void initSearchDetail(String str){
|
||||
List<String> mTabInfoList = new ArrayList<>();
|
||||
mTabInfoList.add(getString(R.string.search_room_tab));
|
||||
mTabInfoList.add(getString(R.string.search_user_tab));
|
||||
|
||||
List<Fragment> mTabs = new ArrayList<>();
|
||||
mTabs.add(SearchDetailFragment.newInstance(str,SearchDetailFragment.TYPE_SEARCH_ROOM));
|
||||
mTabs.add(SearchDetailFragment.newInstance(str,SearchDetailFragment.TYPE_SEARCH_USER));
|
||||
|
||||
ContactsIndicatorAdapter topMagicIndicatorAdapter = new ContactsIndicatorAdapter(this, mTabInfoList,0);
|
||||
topMagicIndicatorAdapter.setOnItemSelectListener(this);
|
||||
CommonNavigator commonNavigator = new CommonNavigator(this);
|
||||
commonNavigator.setAdjustMode(true);
|
||||
commonNavigator.setAdapter(topMagicIndicatorAdapter);
|
||||
indicator.setNavigator(commonNavigator);
|
||||
// must after setNavigator
|
||||
LinearLayout titleContainer = commonNavigator.getTitleContainer();
|
||||
titleContainer.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
|
||||
|
||||
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), mTabs,null));
|
||||
ViewPagerHelper.bind(indicator, viewPager);
|
||||
llSearchDetail.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemSelect(int position) {
|
||||
viewPager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
private void addHistory(String record) {
|
||||
@@ -223,7 +261,6 @@ 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));
|
||||
@@ -311,14 +348,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
@Override
|
||||
public void update(List<SearchRoomInfo> homeRooms) {
|
||||
if (homeRooms != null && homeRooms.size() > 0) {
|
||||
hideStatus();
|
||||
searchAdapter.setNewData(homeRooms);
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
searchAdapter.setNewData(null);
|
||||
showNoData(R.drawable.icon_common_failure, getString(R.string.dearch_no_data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,7 +387,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_back:
|
||||
finish();
|
||||
goBack();
|
||||
break;
|
||||
|
||||
case R.id.tv_search:
|
||||
@@ -390,6 +420,14 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
}
|
||||
|
||||
private void goBack() {
|
||||
if (llSearchDetail.getVisibility() == View.VISIBLE){
|
||||
showHistory();
|
||||
return;
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private void toSearch() {
|
||||
String str = searchEdit.getText().toString();
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
@@ -402,8 +440,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
}
|
||||
addHistory(str);
|
||||
ImeUtil.hideIME(this, tvSearch);
|
||||
getMvpPresenter().searchRooms(str);
|
||||
|
||||
initSearchDetail(str);
|
||||
}
|
||||
|
||||
private void clearSearchHistory() {
|
||||
@@ -519,9 +556,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
private void showHistory() {
|
||||
hideStatus();
|
||||
if (searchAdapter != null) {
|
||||
searchAdapter.setNewData(null);
|
||||
}
|
||||
llSearchDetail.setVisibility(View.GONE);
|
||||
if (mShowHistory) {
|
||||
clSearchHistoryContainer.setVisibility(mSearchHistoryList != null && mSearchHistoryList.size() > 0 ?
|
||||
View.VISIBLE : View.GONE);
|
||||
@@ -541,4 +576,11 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
goBack();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,134 @@
|
||||
package com.yizhuan.erban.ui.search;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseMvpFragment;
|
||||
import com.yizhuan.erban.ui.search.presenter.SearchPresenter;
|
||||
import com.yizhuan.erban.ui.search.view.ISearchView;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CreatePresenter(SearchPresenter.class)
|
||||
public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPresenter> implements ISearchView {
|
||||
|
||||
public static final int TYPE_SEARCH_ROOM = 1;
|
||||
public static final int TYPE_SEARCH_USER = 2;
|
||||
private String mInPutText;
|
||||
private int mType;
|
||||
private RecyclerView recyclerView;
|
||||
private SearchAdapter searchAdapter;
|
||||
|
||||
public static SearchDetailFragment newInstance(String inPutText,int type) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("str", inPutText);
|
||||
args.putInt("type", type);
|
||||
SearchDetailFragment fragment = new SearchDetailFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
LogUtils.e("onCreate");
|
||||
if (getArguments() != null) {
|
||||
mInPutText = getArguments().getString("str");
|
||||
mType = getArguments().getInt("type");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFindViews() {
|
||||
LogUtils.e("onFindViews");
|
||||
recyclerView = mView.findViewById(R.id.recycler_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitArguments(Bundle bundle) {
|
||||
super.onInitArguments(bundle);
|
||||
if (bundle != null) {
|
||||
this.mInPutText = bundle.getString("str");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
LogUtils.e("initiate");
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData(){
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
searchAdapter = new SearchAdapter(mContext, null);
|
||||
recyclerView.setAdapter(searchAdapter);
|
||||
getMvpPresenter().searchRooms(mInPutText,mType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(List<SearchRoomInfo> homeRooms) {
|
||||
if (homeRooms != null && homeRooms.size() > 0) {
|
||||
hideStatus();
|
||||
searchAdapter.setNewData(homeRooms);
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
searchAdapter.setNewData(null);
|
||||
showNoData(R.drawable.icon_common_failure, getString(R.string.dearch_no_data));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_search_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showToast(String msg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getInRoomRecordSuccess(List<RoomHistoryInfo> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getInRoomRecordFail(String error) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInRoomRecordSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInRoomRecordFail(String error) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.yizhuan.erban.ui.search.event;
|
||||
|
||||
public class SearchEvent {
|
||||
public String inPutText;
|
||||
public SearchEvent(String str) {
|
||||
this.inPutText = str;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -51,9 +51,9 @@ public class SearchPresenter extends BaseMvpPresenter<ISearchView> {
|
||||
* @param str
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void searchRooms(String str) {
|
||||
public void searchRooms(String str,int type) {
|
||||
AvRoomModel.get()
|
||||
.roomSearch(str)
|
||||
.roomSearch(str,type)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe((homeTabResult, throwable) -> {
|
||||
if (throwable != null) {
|
||||
|
@@ -45,9 +45,10 @@
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layout_constraintTop_toBottomOf="@id/magic_indicator"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
@@ -164,9 +164,35 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_search_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_FAFAFA"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:background="@color/white" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.yizhuan.erban.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
|
@@ -134,7 +134,7 @@
|
||||
android:id="@+id/collapsing_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
app:layout_scrollFlags="scroll">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -153,7 +153,7 @@
|
||||
android:layout_marginTop="@dimen/dp_8"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
@@ -167,6 +167,10 @@
|
||||
android:id="@+id/magic_indicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_38"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_room_more"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_weight="1"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
/>
|
||||
@@ -174,16 +178,21 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_room_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="38dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="更多房间"
|
||||
app:layout_constraintTop_toTopOf="@id/magic_indicator"
|
||||
app:layout_constraintStart_toEndOf="@id/magic_indicator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/magic_indicator"
|
||||
android:paddingTop="@dimen/dp_5"
|
||||
android:onClick="@{click}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:drawablePadding="@dimen/dp_3"
|
||||
android:drawableRight="@drawable/arrow_right_white"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
@@ -264,6 +273,7 @@
|
||||
android:id="@+id/view_pager_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="@dimen/dp_50"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
|
||||
|
13
app/src/main/res/layout/fragment_search_detail.xml
Normal file
13
app/src/main/res/layout/fragment_search_detail.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.yizhuan.erban.common.widget.StatusLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</com.yizhuan.erban.common.widget.StatusLayout>
|
@@ -23,7 +23,7 @@
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:riv_corner_radius="@dimen/dp_12"
|
||||
app:riv_corner_radius="@dimen/dp_13"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
|
||||
@@ -67,9 +67,8 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_width="51dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@mipmap/ic_home_hot_tag"
|
||||
android:scaleType="centerCrop"
|
||||
tools:visibility="visible"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
@@ -79,7 +78,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/icon_lock_bg"
|
||||
app:riv_corner_radius="@dimen/dp_16"
|
||||
app:riv_corner_radius="@dimen/dp_13"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
@@ -881,5 +881,7 @@
|
||||
<string name="agreement">《用户充值协议》</string>
|
||||
<string name="user_info">个人资料</string>
|
||||
|
||||
<string name="search_room_tab">房间</string>
|
||||
<string name="search_user_tab">用户</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -1,18 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.yizhuan.erban.common.widget.StatusLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.yizhuan.erban.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/status_layout">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_F9F9F9" />
|
||||
</com.yizhuan.erban.common.widget.StatusLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.yizhuan.erban.common.widget.StatusLayout>
|
@@ -189,7 +189,7 @@ public class UriProvider {
|
||||
* @return
|
||||
*/
|
||||
public static String getUserProtocolUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/guide/protocol.html");
|
||||
return JAVA_WEB_URL.concat("/accompany/modules/rule/protocol.html");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,7 +272,7 @@ public class UriProvider {
|
||||
* @return
|
||||
*/
|
||||
public static String getPrivacyAgreement() {
|
||||
return JAVA_WEB_URL.concat("/modules/rule/privacy-wap.html");
|
||||
return JAVA_WEB_URL.concat("/accompany/modules/rule/privacy-wap.html");
|
||||
}
|
||||
|
||||
public static String getUserAgreement() {
|
||||
|
@@ -447,8 +447,8 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key) {
|
||||
return mRoomService.roomSearch(key)
|
||||
public Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key,int type) {
|
||||
return mRoomService.roomSearch(key,type)
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
@@ -706,7 +706,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
* @return
|
||||
*/
|
||||
@GET("/search/room")
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(@Query("key") String key);
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(@Query("key") String key ,@Query("type") int type);
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -86,7 +86,7 @@ public interface IAvRoomModel extends IModel {
|
||||
/**
|
||||
* 搜索房间
|
||||
*/
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key);
|
||||
Single<ServiceResult<List<SearchRoomInfo>>> roomSearch(String key,int type);
|
||||
|
||||
/**
|
||||
* 获取某个用户的房间信息
|
||||
|
Reference in New Issue
Block a user