update 排行榜 筛选 搜索
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
package com.shayu.onetoone.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
@Route(path = RouteManager.ACTIVITY_HOME_SCREEN)
|
||||
public class HomeScreenActivity extends AbsOTOActivity {
|
||||
EditText etSearch;
|
||||
TextView tvSearch;
|
||||
LinearLayout ageLayout;
|
||||
LinearLayout sexLayout;
|
||||
LinearLayout authLayout;
|
||||
FlexBoxRadioGroup ageRadioGroup;
|
||||
FlexBoxRadioGroup sexRadioGroup;
|
||||
FlexBoxRadioGroup authRadioGroup;
|
||||
Button apply;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_screen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
etSearch = findViewById(R.id.edit);
|
||||
tvSearch = findViewById(R.id.search);
|
||||
ageLayout = findViewById(R.id.age_layout);
|
||||
sexLayout = findViewById(R.id.sex_layout);
|
||||
authLayout = findViewById(R.id.auth_layout);
|
||||
ageRadioGroup = findViewById(R.id.age_radio_group);
|
||||
sexRadioGroup = findViewById(R.id.sex_radio_group);
|
||||
authRadioGroup = findViewById(R.id.auth_radio_group);
|
||||
apply = findViewById(R.id.apply);
|
||||
|
||||
|
||||
apply.setOnClickListener(v -> {
|
||||
String age = getRadioButtonValue(ageRadioGroup);
|
||||
String sex = getRadioButton(sexRadioGroup).getTag().toString();
|
||||
String auth = getRadioButtonValue(authRadioGroup);
|
||||
if (isRadioButtonEmpty(ageRadioGroup)) {
|
||||
age = "";
|
||||
}
|
||||
if (isRadioButtonEmpty(authRadioGroup)) {
|
||||
auth = "";
|
||||
}
|
||||
if (sex.equals("all")) {
|
||||
sex = "";
|
||||
}
|
||||
if (StringUtil.isEmptyAll(age, auth, sex)) {
|
||||
RouteManager.forwardMainActivity();
|
||||
} else {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("age", age);
|
||||
bundle.putString("sex", sex);
|
||||
bundle.putString("auth", auth);
|
||||
RouteManager.forwardMainActivityForScreen(bundle);
|
||||
}
|
||||
});
|
||||
tvSearch.setOnClickListener(v -> {
|
||||
String search = etSearch.getText().toString();
|
||||
if(StringUtil.isEmpty(search)){
|
||||
ToastUtil.show("空的不能搜索");
|
||||
return;
|
||||
}
|
||||
Bundle bundle=new Bundle();
|
||||
bundle.putString("search",search);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_HOME_SEARCH,bundle);
|
||||
});
|
||||
}
|
||||
|
||||
String getRadioButtonValue(FlexBoxRadioGroup group) {
|
||||
return ((RadioButton) findViewById(group.getCheckedRadioButtonId())).getText().toString();
|
||||
}
|
||||
|
||||
boolean isRadioButtonEmpty(FlexBoxRadioGroup group) {
|
||||
RadioButton button = (RadioButton) findViewById(group.getCheckedRadioButtonId());
|
||||
if (button.getTag() == null) {
|
||||
return false;
|
||||
}
|
||||
return button.getTag().toString().equals("all");
|
||||
}
|
||||
|
||||
RadioButton getRadioButton(FlexBoxRadioGroup group) {
|
||||
return findViewById(group.getCheckedRadioButtonId());
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,44 @@
|
||||
package com.shayu.onetoone.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.HomeHotListAdapter;
|
||||
import com.shayu.onetoone.adapter.HomeRecommendListAdapter;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
|
||||
import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
|
||||
|
||||
@Route(path = RouteManager.ACTIVITY_HOME_SEARCH)
|
||||
public class HomeSearchActivity extends AbsOTOActivity {
|
||||
View viewEmpty;
|
||||
View refresh;
|
||||
SmartRefreshLayout swipeRefreshLayout;
|
||||
RecyclerView searchList;
|
||||
RecyclerView recommendList;
|
||||
EditText edit;
|
||||
TextView searchBtn;
|
||||
int page = 1;
|
||||
HomeRecommendListAdapter searchListAdapter;
|
||||
HomeHotListAdapter recommendListAdapter;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_search;
|
||||
@@ -15,6 +46,94 @@ public class HomeSearchActivity extends AbsOTOActivity {
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
viewEmpty = findViewById(R.id.view_empty);
|
||||
refresh = findViewById(R.id.refresh);
|
||||
swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
|
||||
searchList = findViewById(R.id.searchList);
|
||||
recommendList = findViewById(R.id.recommendList);
|
||||
edit = findViewById(R.id.edit);
|
||||
searchBtn = findViewById(R.id.search);
|
||||
|
||||
searchListAdapter = new HomeRecommendListAdapter(this);
|
||||
recommendListAdapter = new HomeHotListAdapter(this);
|
||||
|
||||
swipeRefreshLayout.autoLoadMore();
|
||||
swipeRefreshLayout.setEnableRefresh(false);
|
||||
swipeRefreshLayout.setRefreshFooter(new RongRefreshHeader(this));
|
||||
swipeRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
search(edit.getText().toString());
|
||||
}
|
||||
});
|
||||
|
||||
searchList.setAdapter(searchListAdapter);
|
||||
recommendList.setAdapter(recommendListAdapter);
|
||||
|
||||
|
||||
refresh.setOnClickListener(v -> refresh());
|
||||
|
||||
searchBtn.setOnClickListener(v -> search(edit.getText().toString()));
|
||||
|
||||
edit.setText(getIntent().getBundleExtra("bundle").getString("search"));
|
||||
search(edit.getText().toString());
|
||||
refresh();
|
||||
}
|
||||
|
||||
private void search(String key) {
|
||||
if (StringUtil.isEmpty(key)) {
|
||||
ToastUtil.show("不能为空");
|
||||
return;
|
||||
}
|
||||
OTONetManager.getInstance(mContext)
|
||||
.search(key,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
page + "",
|
||||
new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
if (page == 1 && data.isEmpty()) {
|
||||
searchList.setVisibility(View.GONE);
|
||||
viewEmpty.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
viewEmpty.setVisibility(View.GONE);
|
||||
searchList.setVisibility(View.VISIBLE);
|
||||
if (page != 1 && data.isEmpty()) {
|
||||
page--;
|
||||
swipeRefreshLayout.finishLoadMore();
|
||||
return;
|
||||
}
|
||||
if (page == 1) {
|
||||
searchListAdapter.setList(data);
|
||||
} else {
|
||||
searchListAdapter.addLst(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
OTONetManager.getInstance(this)
|
||||
.getSearchRecommend(new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
recommendListAdapter.setList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,10 +46,13 @@ public class FriendsFragment extends BaseFragment {
|
||||
return fragments.size();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_top).setOnClickListener(v ->{
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_HOME_RANK);
|
||||
findViewById(R.id.btn_top).setOnClickListener(v -> RouteManager.forwardActivity(RouteManager.ACTIVITY_HOME_RANK));
|
||||
findViewById(R.id.btn_filter).setOnClickListener(v -> RouteManager.forwardActivity(RouteManager.ACTIVITY_HOME_SCREEN));
|
||||
|
||||
});
|
||||
Bundle screen = getActivity().getIntent().getBundleExtra("screen");
|
||||
if(screen!=null){
|
||||
viewPager2.setCurrentItem(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ public class HotFragment extends BaseFragment {
|
||||
SmartRefreshLayout mRefreshLayout;
|
||||
SwipeRecyclerView recyclerView;
|
||||
HomeHotListAdapter adapter;
|
||||
private int page = 1;
|
||||
|
||||
@Override
|
||||
public void initView(View itemView) {
|
||||
@@ -47,24 +48,37 @@ public class HotFragment extends BaseFragment {
|
||||
onConversationListLoadMore();
|
||||
}
|
||||
});
|
||||
page = 1;
|
||||
initData();
|
||||
}
|
||||
|
||||
private void onConversationListLoadMore() {
|
||||
page++;
|
||||
initData();
|
||||
mRefreshLayout.finishLoadMore();
|
||||
}
|
||||
|
||||
private void onConversationListRefresh(RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
initData();
|
||||
refreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getHomeHot(new HttpCallback<List<HomeItemBean>>() {
|
||||
.getHomeHot(page + "", new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
adapter.setList(data);
|
||||
if (page != 1 && data.isEmpty()) {
|
||||
page--;
|
||||
mRefreshLayout.finishLoadMore();
|
||||
return;
|
||||
}
|
||||
if (page != 1) {
|
||||
adapter.addList(data);
|
||||
} else {
|
||||
adapter.setList(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.shayu.onetoone.activity.fragments.home;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -9,9 +8,7 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.HomeSearchActivity;
|
||||
import com.shayu.onetoone.activity.fragments.BaseFragment;
|
||||
import com.shayu.onetoone.activity.HomepageRankingActivity;
|
||||
import com.shayu.onetoone.adapter.HomeRecommendListAdapter;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
@@ -31,6 +28,9 @@ public class RecommendFragment extends BaseFragment {
|
||||
SwipeRecyclerView recyclerView;
|
||||
HomeRecommendListAdapter adapter;
|
||||
View top;
|
||||
private int page = 1;
|
||||
private boolean isScreen;
|
||||
Bundle screen;
|
||||
|
||||
@Override
|
||||
public void initView(View itemView) {
|
||||
@@ -42,8 +42,10 @@ public class RecommendFragment extends BaseFragment {
|
||||
mRefreshLayout.setNestedScrollingEnabled(false);
|
||||
mRefreshLayout.setRefreshHeader(new RongRefreshHeader(this.getContext()));
|
||||
mRefreshLayout.setRefreshFooter(new RongRefreshHeader(this.getContext()));
|
||||
recyclerView.setEmptyView(itemView.findViewById(R.id.view_empty));
|
||||
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
onConversationListRefresh(refreshLayout);
|
||||
}
|
||||
});
|
||||
@@ -53,13 +55,63 @@ public class RecommendFragment extends BaseFragment {
|
||||
}
|
||||
});
|
||||
top.setOnClickListener(view -> {
|
||||
// recyclerView.scrollToPosition(0);
|
||||
startActivity(new Intent(getContext(), HomeSearchActivity.class));
|
||||
recyclerView.scrollToPosition(0);
|
||||
});
|
||||
initData();
|
||||
screen = getActivity().getIntent().getBundleExtra("screen");
|
||||
if (screen != null) {
|
||||
if (!isScreen) {
|
||||
page = 1;
|
||||
}
|
||||
isScreen = true;
|
||||
screen(screen);
|
||||
mRefreshLayout.setEnableRefresh(false);
|
||||
} else {
|
||||
if (isScreen) {
|
||||
page = 1;
|
||||
}
|
||||
isScreen = false;
|
||||
initData();
|
||||
}
|
||||
}
|
||||
|
||||
private void screen(Bundle screen) {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.search("",
|
||||
screen.getString("age", ""),
|
||||
screen.getString("auth", ""),
|
||||
screen.getString("sex", ""),
|
||||
page + "",
|
||||
new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
if (page != 1 && data.isEmpty()) {
|
||||
page--;
|
||||
mRefreshLayout.finishLoadMore();
|
||||
return;
|
||||
}
|
||||
if (page != 1) {
|
||||
adapter.addLst(data);
|
||||
} else {
|
||||
adapter.setList(data);
|
||||
}
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void onConversationListLoadMore() {
|
||||
page++;
|
||||
if (isScreen) {
|
||||
screen(screen);
|
||||
} else {
|
||||
initData();
|
||||
}
|
||||
mRefreshLayout.finishLoadMore();
|
||||
}
|
||||
|
||||
@@ -69,10 +121,19 @@ public class RecommendFragment extends BaseFragment {
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getHomeRecommend(new HttpCallback<List<HomeItemBean>>() {
|
||||
.getHomeRecommend(page + "", new HttpCallback<List<HomeItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HomeItemBean> data) {
|
||||
adapter.setList(data);
|
||||
if (page != 1 && data.isEmpty()) {
|
||||
page--;
|
||||
mRefreshLayout.finishLoadMore();
|
||||
return;
|
||||
}
|
||||
if (page != 1) {
|
||||
adapter.addLst(data);
|
||||
} else {
|
||||
adapter.setList(data);
|
||||
}
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
.getTargetUserInfo(Integer.parseInt(targetId), new HttpCallback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean data) {
|
||||
if (data.getInfo().getSage_auth() == 1) {
|
||||
if (data.getInfo().getName_auth() == 1) {
|
||||
listener.onError(0, "");
|
||||
} else {
|
||||
listener.onSuccess("");
|
||||
|
||||
@@ -42,7 +42,7 @@ public class HomeHotListAdapter extends RecyclerView.Adapter<HomeHotListAdapter.
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.setData(list.get(position),position);
|
||||
holder.setData(list.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,6 +50,11 @@ public class HomeHotListAdapter extends RecyclerView.Adapter<HomeHotListAdapter.
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void addList(List<HomeItemBean> data) {
|
||||
list.addAll(data);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private RoundedImageView avatar;
|
||||
private ImageView status;
|
||||
|
||||
@@ -52,6 +52,11 @@ public class HomeRecommendListAdapter extends RecyclerView.Adapter<HomeRecommend
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addLst(List<HomeItemBean> data) {
|
||||
this.list.addAll(data);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private RoundedImageView avatar;
|
||||
private ImageView chat;
|
||||
@@ -88,7 +93,7 @@ public class HomeRecommendListAdapter extends RecyclerView.Adapter<HomeRecommend
|
||||
} else {
|
||||
sex.setImageResource(R.mipmap.ic_message_tab_woman);
|
||||
}
|
||||
if (bean.getSage_auth() == 1) {
|
||||
if (bean.getName_auth() == 1) {
|
||||
auth.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
auth.setVisibility(View.GONE);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.text.SpannableString;
|
||||
|
||||
import com.shayu.onetoone.bean.MessageChatAuthContent;
|
||||
import com.shayu.onetoone.bean.MessageChatGiftContent;
|
||||
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
|
||||
|
||||
@@ -66,6 +67,8 @@ public class MsgMessageRecyclerViewAdapter extends ConversationListAdapter {
|
||||
if (datum.mCore.getConversationType() == Conversation.ConversationType.PRIVATE || datum.mCore.getConversationType() == Conversation.ConversationType.SYSTEM) {
|
||||
if(datum.mCore.getLatestMessage() instanceof MessageChatGiftContent){
|
||||
datum.mConversationContent=new SpannableString("[禮物]");
|
||||
}else if(datum.mCore.getLatestMessage() instanceof MessageChatAuthContent){
|
||||
datum.mConversationContent=new SpannableString("[邀請認證]");
|
||||
}
|
||||
if (datum.mCore.isTop()) {
|
||||
top.add(datum);
|
||||
|
||||
@@ -465,10 +465,10 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHomeHot(HttpCallback<List<HomeItemBean>> callback) {
|
||||
public void getHomeHot(String page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeHot()
|
||||
.getHomeHot(page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<HomeItemBean>>>() {
|
||||
@@ -489,10 +489,10 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHomeRecommend(HttpCallback<List<HomeItemBean>> callback) {
|
||||
public void getHomeRecommend(String page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeRecommend()
|
||||
.getHomeRecommend(page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<HomeItemBean>>>() {
|
||||
@@ -651,10 +651,11 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getHomeRank(String type,String date, HttpCallback<List<HomeRankBean>> callback) {
|
||||
|
||||
public void getHomeRank(String type, String date, HttpCallback<List<HomeRankBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeRank(type,date)
|
||||
.getHomeRank(type, date)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(model -> {
|
||||
@@ -672,6 +673,54 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void search(String keyword,
|
||||
String age,
|
||||
String name_auth,
|
||||
String sex,
|
||||
String page,
|
||||
HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.search(keyword, age, name_auth, sex, "",page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(model -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getSearchRecommend(HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getSearchRecommend()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<HomeItemBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<HomeItemBean>> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
|
||||
@@ -16,11 +16,17 @@ public class RouteManager {
|
||||
public static final String ACTIVITY_WEB_VIEW = "/activity/WebViewActivity";
|
||||
public static final String ACTIVITY_HOME_RANK = "/activity/HomepageRankingActivity";
|
||||
public static final String ACTIVITY_HOME_SEARCH = "/activity/HomeSearchActivity";
|
||||
public static final String ACTIVITY_HOME_SCREEN = "/activity/HomeScreenActivity";
|
||||
|
||||
public static void forwardMainActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_MAIN)
|
||||
.navigation();
|
||||
}
|
||||
public static void forwardMainActivityForScreen(Bundle bundle) {
|
||||
ARouter.getInstance().build(ACTIVITY_MAIN)
|
||||
.withBundle("screen",bundle)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
public static void forwardMsgMoreConfigActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_MSG_MORE_CONFIG_ACTIVITY)
|
||||
@@ -52,6 +58,11 @@ public class RouteManager {
|
||||
ARouter.getInstance().build(path)
|
||||
.navigation();
|
||||
}
|
||||
public static void forwardActivity(String path,Bundle bundle) {
|
||||
ARouter.getInstance().build(path)
|
||||
.withBundle("bundle",bundle)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -113,10 +113,10 @@ public interface OneToOneApi {
|
||||
Observable<ResponseModel<List<TargetUserInfoBean>>> getTargetUserInfoList(@Query("ids") String ids);
|
||||
|
||||
@GET("/api/public/?service=Friendappuser.hot")
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getHomeHot();
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getHomeHot(@Query("p") String p);
|
||||
|
||||
@GET("/api/public/?service=Friendappuser.recommend")
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getHomeRecommend();
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getHomeRecommend(@Query("p") String p);
|
||||
|
||||
@GET("/api/public/?service=Message.getListInfo")
|
||||
Observable<ResponseModel<List<SystemMessageBean>>> getSystemMessageList(@Query("type") int type);
|
||||
@@ -137,24 +137,36 @@ public interface OneToOneApi {
|
||||
|
||||
@GET("/api/public/?service=Friendappmsg.giftList")
|
||||
Observable<ResponseModel<List<GiftBean>>> getGiftList();
|
||||
|
||||
@GET("/api/public/?service=Friendappmoney.info")
|
||||
Observable<ResponseModel<PurseBean>> getPurseInfo();
|
||||
|
||||
@GET("/api/public/?service=User.setAttents")
|
||||
Observable<ResponseModel<List<FollowBean>>> follow(@Query("touid")String toUid);
|
||||
Observable<ResponseModel<List<FollowBean>>> follow(@Query("touid") String toUid);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type 1魅力榜 2财富榜
|
||||
* @param date 1日榜 2周榜
|
||||
*/
|
||||
@GET("/api/public/?service=Friendapprank.list")
|
||||
Observable<ResponseModel<List<HomeRankBean>>> getHomeRank(
|
||||
@Query("type")String type,
|
||||
@Query("date")String date
|
||||
@Query("type") String type,
|
||||
@Query("date") String date
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Friendappuser.list")
|
||||
Observable<ResponseModel<List<HomeItemBean>>> search(
|
||||
@Query("keyword") String keyword,
|
||||
@Query("age") String age,
|
||||
@Query("name_auth") String name_auth,
|
||||
@Query("sex") String sex,
|
||||
@Query("star") String star,
|
||||
@Query("p") String p
|
||||
);
|
||||
|
||||
|
||||
|
||||
@GET("/api/public/?service=Friendappuser.like")
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getSearchRecommend();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user