修改首页

This commit is contained in:
nail
2026-03-31 23:19:33 +08:00
parent a6865363a8
commit cd79d348b8
25 changed files with 1286 additions and 79 deletions

View File

@@ -0,0 +1,89 @@
package com.xuebiping.bolizhuzi.controller.main.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.cardview.widget.CardView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.facebook.drawee.view.SimpleDraweeView;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import com.xuebiping.bolizhuzi.utils.SPUtils;
import com.xuebiping.bolizhuzi.utils.StrU;
import net.lucode.hackware.magicindicator.buildins.UIUtil;
import org.jetbrains.annotations.NotNull;
public class MainRecommendAdapter extends BaseQuickAdapter<LookMeBean, BaseViewHolder> {
private Context mContext;
private int mTabType; //1代表推荐 2代表语聊 0代表其他
public MainRecommendAdapter(int layoutResId, Context context) {
super(layoutResId);
this.mContext = context;
}
public MainRecommendAdapter(int layoutResId, Context context, int tabType) {
super(layoutResId);
this.mContext = context;
this.mTabType = tabType;
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, LookMeBean lookMeBean) {
recommend(baseViewHolder,lookMeBean);
}
private void recommend(BaseViewHolder baseViewHolder, LookMeBean lookMeBean) {
CardView card_view = baseViewHolder.getView(R.id.card_view);
LinearLayout ll_svip_price = baseViewHolder.getView(R.id.ll_svip_price);
if (mTabType == 1) {
int recommend_layout_change = SPUtils.getInt(mContext, "recommend_layout_change");
if (recommend_layout_change == 0) { //0代表2格 1代表1格
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext.getResources().getDimension(R.dimen.dp230));
card_view.setLayoutParams(layoutParams);
}else if (recommend_layout_change == 1) {
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext.getResources().getDimension(R.dimen.dp336));
card_view.setLayoutParams(layoutParams);
}
ll_svip_price.setVisibility(View.VISIBLE);
}else if (mTabType == 2) {
int voice_layout_change = SPUtils.getInt(mContext, "voice_layout_change");
if (voice_layout_change == 0) { //0代表2格 1代表1格
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext.getResources().getDimension(R.dimen.dp230));
card_view.setLayoutParams(layoutParams);
}else if (voice_layout_change == 1) {
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext.getResources().getDimension(R.dimen.dp336));
card_view.setLayoutParams(layoutParams);
}
ll_svip_price.setVisibility(View.GONE);
}else {
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext.getResources().getDimension(R.dimen.dp336));
card_view.setLayoutParams(layoutParams);
ll_svip_price.setVisibility(View.VISIBLE);
}
SimpleDraweeView list_photo = baseViewHolder.getView(R.id.ri_cover);
list_photo.setImageURI(StrU.getResourcePath(lookMeBean.getAvatar_url(), mContext));
}
}

View File

@@ -4,6 +4,7 @@ public class LookMeBean {
private String id;
private String avatar_url;
private int type;
public String getId() {
return id;
@@ -20,4 +21,12 @@ public class LookMeBean {
public void setAvatar_url(String avatar_url) {
this.avatar_url = avatar_url;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}

View File

@@ -0,0 +1,26 @@
package com.xuebiping.bolizhuzi.model.main;
import java.util.ArrayList;
import java.util.List;
public class MainRecommendListBean {
private List<LookMeBean> list = new ArrayList<>();
private List<BannerBean> banner = new ArrayList<>();
public List<LookMeBean> getList() {
return list;
}
public void setList(List<LookMeBean> list) {
this.list = list;
}
public List<BannerBean> getBanner() {
return banner;
}
public void setBanner(List<BannerBean> banner) {
this.banner = banner;
}
}

View File

@@ -0,0 +1,93 @@
package com.xuebiping.bolizhuzi.view.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainRecommendAdapter;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MainFiveStarFragment extends Fragment implements OnRefreshLoadMoreListener {
private SmartRefreshLayout mSmart_refresh;
private RecyclerView mRv_list;
private MainRecommendAdapter mAdapter;
private int mPage = 1;
private List<LookMeBean> mData = new ArrayList<>();
private LinearLayoutManager mLinearLayoutManager;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main_voice, container, false);
initView(v);
getData(mPage);
return v;
}
private void initView(View v) {
mSmart_refresh = v.findViewById(R.id.smart_refresh);
mRv_list = v.findViewById(R.id.rv_list);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
mRv_list.setLayoutManager(mLinearLayoutManager);
mAdapter = new MainRecommendAdapter(R.layout.item_home_recommend, getActivity());
mRv_list.setAdapter(mAdapter);
mSmart_refresh.setOnRefreshLoadMoreListener(this);
}
private void getData(int page) {
if (page == 1) {
mData.clear();
}
for (int i = 0; i < 10; i++) {
LookMeBean lookMeBean = new LookMeBean();
lookMeBean.setId(i + "");
lookMeBean.setAvatar_url("uploads/admin/202403/25/04cf409ab9148f11c0052bb254b5c155.jpg");
mData.add(lookMeBean);
}
finishFresh();
mAdapter.setList(mData);
}
public void finishFresh() {
mSmart_refresh.finishLoadMore();
mSmart_refresh.finishRefresh();
}
@Override
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage++;
getData(mPage);
}
@Override
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage = 1;
getData(mPage);
}
}

View File

@@ -0,0 +1,93 @@
package com.xuebiping.bolizhuzi.view.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainRecommendAdapter;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MainFourStarFragment extends Fragment implements OnRefreshLoadMoreListener {
private SmartRefreshLayout mSmart_refresh;
private RecyclerView mRv_list;
private MainRecommendAdapter mAdapter;
private int mPage = 1;
private List<LookMeBean> mData = new ArrayList<>();
private LinearLayoutManager mLinearLayoutManager;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main_voice, container, false);
initView(v);
getData(mPage);
return v;
}
private void initView(View v) {
mSmart_refresh = v.findViewById(R.id.smart_refresh);
mRv_list = v.findViewById(R.id.rv_list);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
mRv_list.setLayoutManager(mLinearLayoutManager);
mAdapter = new MainRecommendAdapter(R.layout.item_home_recommend, getActivity());
mRv_list.setAdapter(mAdapter);
mSmart_refresh.setOnRefreshLoadMoreListener(this);
}
private void getData(int page) {
if (page == 1) {
mData.clear();
}
for (int i = 0; i < 10; i++) {
LookMeBean lookMeBean = new LookMeBean();
lookMeBean.setId(i + "");
lookMeBean.setAvatar_url("uploads/admin/202403/25/04cf409ab9148f11c0052bb254b5c155.jpg");
mData.add(lookMeBean);
}
finishFresh();
mAdapter.setList(mData);
}
public void finishFresh() {
mSmart_refresh.finishLoadMore();
mSmart_refresh.finishRefresh();
}
@Override
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage++;
getData(mPage);
}
@Override
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage = 1;
getData(mPage);
}
}

View File

@@ -0,0 +1,93 @@
package com.xuebiping.bolizhuzi.view.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainRecommendAdapter;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MainNewPeopleFragment extends Fragment implements OnRefreshLoadMoreListener {
private SmartRefreshLayout mSmart_refresh;
private RecyclerView mRv_list;
private MainRecommendAdapter mAdapter;
private int mPage = 1;
private List<LookMeBean> mData = new ArrayList<>();
private LinearLayoutManager mLinearLayoutManager;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main_voice, container, false);
initView(v);
getData(mPage);
return v;
}
private void initView(View v) {
mSmart_refresh = v.findViewById(R.id.smart_refresh);
mRv_list = v.findViewById(R.id.rv_list);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
mRv_list.setLayoutManager(mLinearLayoutManager);
mAdapter = new MainRecommendAdapter(R.layout.item_home_recommend, getActivity());
mRv_list.setAdapter(mAdapter);
mSmart_refresh.setOnRefreshLoadMoreListener(this);
}
private void getData(int page) {
if (page == 1) {
mData.clear();
}
for (int i = 0; i < 10; i++) {
LookMeBean lookMeBean = new LookMeBean();
lookMeBean.setId(i + "");
lookMeBean.setAvatar_url("uploads/admin/202403/25/04cf409ab9148f11c0052bb254b5c155.jpg");
mData.add(lookMeBean);
}
finishFresh();
mAdapter.setList(mData);
}
public void finishFresh() {
mSmart_refresh.finishLoadMore();
mSmart_refresh.finishRefresh();
}
@Override
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage++;
getData(mPage);
}
@Override
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage = 1;
getData(mPage);
}
}

View File

@@ -0,0 +1,93 @@
package com.xuebiping.bolizhuzi.view.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainRecommendAdapter;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MainThreeStarFragment extends Fragment implements OnRefreshLoadMoreListener {
private SmartRefreshLayout mSmart_refresh;
private RecyclerView mRv_list;
private MainRecommendAdapter mAdapter;
private int mPage = 1;
private List<LookMeBean> mData = new ArrayList<>();
private LinearLayoutManager mLinearLayoutManager;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main_voice, container, false);
initView(v);
getData(mPage);
return v;
}
private void initView(View v) {
mSmart_refresh = v.findViewById(R.id.smart_refresh);
mRv_list = v.findViewById(R.id.rv_list);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
mRv_list.setLayoutManager(mLinearLayoutManager);
mAdapter = new MainRecommendAdapter(R.layout.item_home_recommend, getActivity());
mRv_list.setAdapter(mAdapter);
mSmart_refresh.setOnRefreshLoadMoreListener(this);
}
private void getData(int page) {
if (page == 1) {
mData.clear();
}
for (int i = 0; i < 10; i++) {
LookMeBean lookMeBean = new LookMeBean();
lookMeBean.setId(i + "");
lookMeBean.setAvatar_url("uploads/admin/202403/25/04cf409ab9148f11c0052bb254b5c155.jpg");
mData.add(lookMeBean);
}
finishFresh();
mAdapter.setList(mData);
}
public void finishFresh() {
mSmart_refresh.finishLoadMore();
mSmart_refresh.finishRefresh();
}
@Override
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage++;
getData(mPage);
}
@Override
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage = 1;
getData(mPage);
}
}

View File

@@ -0,0 +1,119 @@
package com.xuebiping.bolizhuzi.view.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainRecommendAdapter;
import com.xuebiping.bolizhuzi.model.main.BannerBean;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import com.xuebiping.bolizhuzi.utils.SPUtils;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MainVoiceFragment extends Fragment implements OnRefreshLoadMoreListener {
private SmartRefreshLayout mSmart_refresh;
private RecyclerView mRv_list;
private MainRecommendAdapter mAdapter;
private int mPage = 1;
private List<LookMeBean> mData = new ArrayList<>();
private GridLayoutManager mGridLayoutManager;
private LinearLayoutManager mLinearLayoutManager;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main_voice, container, false);
initView(v);
getData(mPage);
return v;
}
private void initView(View v) {
mSmart_refresh = v.findViewById(R.id.smart_refresh);
mRv_list = v.findViewById(R.id.rv_list);
mGridLayoutManager = new GridLayoutManager(getActivity(), 2);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
int voice_layout_change = SPUtils.getInt(getActivity(), "voice_layout_change");
if (voice_layout_change == 0) { //0代表2格 1代表1格
mRv_list.setLayoutManager(mGridLayoutManager);
}else {
mRv_list.setLayoutManager(mLinearLayoutManager);
}
mAdapter = new MainRecommendAdapter(R.layout.item_home_recommend, getActivity(), 2);
mRv_list.setAdapter(mAdapter);
mSmart_refresh.setOnRefreshLoadMoreListener(this);
}
public void layoutChange() {
int voice_layout_change = SPUtils.getInt(getActivity(), "voice_layout_change");
if (voice_layout_change == 0) {
SPUtils.saveInt(getActivity(), "voice_layout_change", 1);
mRv_list.setLayoutManager(mLinearLayoutManager);
mAdapter.notifyDataSetChanged();
}else if (voice_layout_change == 1) {
SPUtils.saveInt(getActivity(), "voice_layout_change", 0);
mRv_list.setLayoutManager(mGridLayoutManager);
mAdapter.notifyDataSetChanged();
}
}
private void getData(int page) {
if (page == 1) {
mData.clear();
}
for (int i = 0; i < 10; i++) {
LookMeBean lookMeBean = new LookMeBean();
lookMeBean.setId(i + "");
lookMeBean.setAvatar_url("uploads/admin/202403/25/04cf409ab9148f11c0052bb254b5c155.jpg");
mData.add(lookMeBean);
}
finishFresh();
mAdapter.setList(mData);
}
public void finishFresh() {
mSmart_refresh.finishLoadMore();
mSmart_refresh.finishRefresh();
}
@Override
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage++;
getData(mPage);
}
@Override
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage = 1;
getData(mPage);
}
}

View File

@@ -0,0 +1,202 @@
package com.xuebiping.bolizhuzi.view.main;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.viewholder.BaseViewHolder;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.xuebiping.bolizhuzi.R;
import com.xuebiping.bolizhuzi.controller.constant.ConstUrl;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainLookMeAdapter;
import com.xuebiping.bolizhuzi.controller.main.adapter.MainRecommendAdapter;
import com.xuebiping.bolizhuzi.model.main.BannerBean;
import com.xuebiping.bolizhuzi.model.main.LookMeBean;
import com.xuebiping.bolizhuzi.model.main.MainRecommendListBean;
import com.xuebiping.bolizhuzi.utils.BaseUtils;
import com.xuebiping.bolizhuzi.utils.GlideImageLoader;
import com.xuebiping.bolizhuzi.utils.SPUtils;
import com.xuebiping.bolizhuzi.view.main.utils.JumpUtils;
import com.youth.banner.Banner;
import com.youth.banner.listener.OnBannerListener;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class RecommendFragment2 extends Fragment implements OnRefreshLoadMoreListener {
private SmartRefreshLayout mSmart_refresh;
private RecyclerView mRv_list;
private Banner mBn_recommend;
private MainRecommendAdapter mAdapter;
private int mPage = 1;
private List<LookMeBean> mData = new ArrayList<>();
private List<BannerBean> mData2 = new ArrayList<>();
List<String> images = new ArrayList<>();
private GridLayoutManager mGridLayoutManager;
private LinearLayoutManager mLinearLayoutManager;
private RelativeLayout mRl_banner;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_recommend2, container, false);
initView(v);
getData(mPage);
return v;
}
private void initView(View v) {
mSmart_refresh = v.findViewById(R.id.smart_refresh);
mRv_list = v.findViewById(R.id.rv_list);
mRl_banner = v.findViewById(R.id.rl_banner);
mBn_recommend = v.findViewById(R.id.bn_recommend);
mGridLayoutManager = new GridLayoutManager(getActivity(), 2);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
int recommend_layout_change = SPUtils.getInt(getActivity(), "recommend_layout_change");
if (recommend_layout_change == 0) {
mRv_list.setLayoutManager(mGridLayoutManager);
}else if (recommend_layout_change == 1){
mRv_list.setLayoutManager(mLinearLayoutManager);
}
mAdapter = new MainRecommendAdapter(R.layout.item_home_recommend, getActivity(), 1);
mRv_list.setAdapter(mAdapter);
mSmart_refresh.setOnRefreshLoadMoreListener(this);
}
public void layoutChange() {
int recommend_layout_change = SPUtils.getInt(getActivity(), "recommend_layout_change");
if (recommend_layout_change == 0) {
SPUtils.saveInt(getActivity(), "recommend_layout_change", 1);
mRv_list.setLayoutManager(mLinearLayoutManager);
mAdapter.notifyDataSetChanged();
}else if (recommend_layout_change == 1) {
SPUtils.saveInt(getActivity(), "recommend_layout_change", 0);
mRv_list.setLayoutManager(mGridLayoutManager);
mAdapter.notifyDataSetChanged();
}
}
private void getData(int page) {
if (page == 1) {
mData.clear();
mData2.clear();
}
for (int i = 0; i < 10; i++) {
if (i < 3 && page == 1) {
BannerBean bannerBean = new BannerBean();
bannerBean.setImage("https://img.boxinxinc.cn/images/banner/050ba52eec6c9211436bf82aecfd3f81.jpg");
mData2.add(bannerBean);
}
LookMeBean lookMeBean = new LookMeBean();
lookMeBean.setId(i + "");
lookMeBean.setAvatar_url("uploads/admin/202403/25/04cf409ab9148f11c0052bb254b5c155.jpg");
mData.add(lookMeBean);
}
finishFresh();
if (page == 1) {
banner(mData2);
}
mAdapter.setList(mData);
}
private void banner(List<BannerBean> mBanners) {
images.clear();
if (null != mBanners) {
if (mBanners.size() != 0) {
for (int i = 0; i < mBanners.size(); i++) {
// images.add(StrU.getResourcePath(mBanners.get(i).getImage(), mContext));
images.add(mBanners.get(i).getImage());
}
}
}
//简单使用
BaseUtils.setBannerLayoutParams(mBn_recommend).setImages(images)
.setImageLoader(new GlideImageLoader())
.setOnBannerListener(new OnBannerListener() {
@Override
public void OnBannerClick(int position) {
if (null != mBanners) {
int size = mBanners.size();
if (size != 0) {
int i = position % size;
JumpUtils.jump(mBanners.get(i).getLink_type(),
mBanners.get(i).getLink_url(), getActivity());
// mRv_list.setLayoutManager(mLinearLayoutManager);
// mAdapter.notifyDataSetChanged();
}
}
}
})
.setDelayTime(3000)
.start()
.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
}
@Override
public void onPageScrollStateChanged(int state) {
// if (state == 1) {
// mChannelRefresh.setEnabled(false);//设置不可触发
// } else if (state == 2) {
// mChannelRefresh.setEnabled(true);//设置可触发
// }
}
});
}
public void finishFresh() {
mSmart_refresh.finishLoadMore();
mSmart_refresh.finishRefresh();
}
@Override
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage++;
getData(mPage);
}
@Override
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
mPage = 1;
getData(mPage);
}
}

View File

@@ -58,13 +58,11 @@ public class ShaiXuanDialog extends Dialog implements View.OnClickListener {
Window window = this.getWindow();
window.setGravity(Gravity.BOTTOM);
WindowManager.LayoutParams lp = window.getAttributes();
DisplayMetrics dm = new DisplayMetrics();
dm = mContext.getResources().getDisplayMetrics();
lp.width = (int) ((dm.widthPixels) * 0.8);
lp.height = LinearLayout.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = WindowManager.LayoutParams.MATCH_PARENT;
attributes.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(attributes);
window.setBackgroundDrawableResource(android.R.color.transparent);
}
public int isSelect = 0; // 0全部1男2女

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#80000000"/>
<corners android:radius="@dimen/dp45"/>
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#6CE4B7"/>
<size android:height="@dimen/dp8" android:width="@dimen/dp8"/>
<stroke android:width="@dimen/dp1" android:color="@color/white"/>
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:angle="0"
android:startColor="#6F76B4"
android:endColor="#262C63"/>
<corners android:radius="@dimen/dp45"/>
<stroke android:color="#F5ECCC" android:width="@dimen/dp1"/>
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:angle="270" android:startColor="#00000000"
android:endColor="#4D000000"/>
<corners android:bottomLeftRadius="@dimen/dp10" android:bottomRightRadius="@dimen/dp10"/>
</shape>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout
android:id="@+id/rl_head"
@@ -19,6 +20,7 @@
android:orientation="horizontal">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="筛选"
@@ -41,10 +43,23 @@
android:layout_weight="1"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:id="@+id/rl_home_change"
android:layout_alignParentRight="true"
android:layout_width="@dimen/dp32"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_home_change" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_home_search"
android:layout_alignParentRight="true"
android:layout_width="@dimen/dp44"
android:layout_width="@dimen/dp32"
android:layout_height="match_parent">
<ImageView

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:viewBindingIgnore="true">
<LinearLayout
android:id="@+id/ll_content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/smart_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlEnableLastTime="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp10"
android:layout_marginLeft="@dimen/dp5"
android:layout_marginRight="@dimen/dp5"
android:layout_marginBottom="@dimen/dp10" />
</LinearLayout>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:viewBindingIgnore="true"
android:background="@color/transparent">
<LinearLayout
android:id="@+id/ll_content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/smart_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:background="@color/transparent">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlEnableLastTime="false" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/channel_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/ctl_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
<RelativeLayout
android:id="@+id/rl_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="6dp"
android:layout_marginRight="6dp">
<com.youth.banner.Banner
android:id="@+id/bn_recommend"
android:layout_width="match_parent"
android:layout_height="@dimen/dp116"
android:background="@drawable/shape_banner_bg" />
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp10"
android:layout_marginLeft="@dimen/dp5"
android:layout_marginRight="@dimen/dp5"
android:layout_marginBottom="@dimen/dp10"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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_marginLeft="@dimen/dp5"
android:layout_marginRight="@dimen/dp5"
android:layout_marginBottom="@dimen/dp10"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="@dimen/dp230"
app:cardCornerRadius="@dimen/dp10">
<RelativeLayout
android:id="@+id/rl_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/ri_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<View
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="@dimen/dp60"
android:background="@drawable/shape_main_recommend_bottom_bg"/>
<RelativeLayout
android:layout_marginTop="@dimen/dp12"
android:layout_marginLeft="@dimen/dp12"
android:layout_marginRight="@dimen/dp12"
android:layout_width="match_parent"
android:layout_height="@dimen/dp20">
<LinearLayout
android:id="@+id/ll_star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_star_1"
android:layout_width="@dimen/dp10"
android:layout_height="@dimen/dp10"
android:src="@mipmap/ic_main_star" />
<ImageView
android:id="@+id/iv_star_2"
android:layout_width="@dimen/dp10"
android:layout_height="@dimen/dp10"
android:layout_marginLeft="@dimen/dp4"
android:src="@mipmap/ic_main_star" />
<ImageView
android:id="@+id/iv_star_3"
android:layout_width="@dimen/dp10"
android:layout_height="@dimen/dp10"
android:layout_marginLeft="@dimen/dp4"
android:src="@mipmap/ic_main_star" />
<ImageView
android:id="@+id/iv_star_4"
android:layout_width="@dimen/dp10"
android:layout_height="@dimen/dp10"
android:layout_marginLeft="@dimen/dp4"
android:src="@mipmap/ic_main_star" />
<ImageView
android:id="@+id/iv_star_5"
android:layout_width="@dimen/dp10"
android:layout_height="@dimen/dp10"
android:layout_marginLeft="@dimen/dp4"
android:src="@mipmap/ic_main_star" />
</LinearLayout>
<LinearLayout
android:layout_alignParentRight="true"
android:gravity="center"
android:background="@drawable/bg_black_50_line"
android:orientation="horizontal"
android:layout_width="@dimen/dp42"
android:layout_height="@dimen/dp20">
<View
android:layout_gravity="center_vertical"
android:background="@drawable/bg_online_round"
android:layout_width="@dimen/dp8"
android:layout_height="@dimen/dp8"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="在线"
android:textColor="@color/white"
android:textSize="@dimen/dp10"
/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_marginBottom="12dp"
android:layout_marginLeft="@dimen/dp10"
android:layout_marginRight="@dimen/dp10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="佳茵ovo"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/ll_svip_price"
android:layout_alignParentRight="true"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp18"
android:background="@drawable/bg_svip_chat_price">
<TextView
android:layout_marginLeft="@dimen/dp6"
android:textSize="@dimen/dp6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SVIP"
android:textStyle="bold"
android:textColor="#F5ECCC"/>
<TextView
android:layout_marginRight="@dimen/dp6"
android:layout_marginLeft="@dimen/dp4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="140金币/分"
android:textColor="#fff5eccc"
android:textSize="@dimen/dp8"
/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_marginTop="@dimen/dp4"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:maxEms="6"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我说心动至上哈哈哈"
android:textColor="#80FFFFFF"
android:textSize="12sp"
/>
<TextView
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="160金币/分"
android:textColor="#ffffffff"
android:textSize="@dimen/dp8"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>

View File

@@ -9,64 +9,73 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_close"
android:layout_width="@dimen/dp12"
android:layout_height="@dimen/dp12"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp33"
android:layout_marginRight="@dimen/dp25"
android:src="@mipmap/feed_close"
android:tint="@color/black" />
<TextView
<RelativeLayout
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp25"
android:text="筛选"
android:textColor="@color/black"
android:textSize="@dimen/dp25"
android:textStyle="bold" />
android:layout_width="match_parent"
android:layout_height="@dimen/dp56">
<RelativeLayout
android:layout_alignParentRight="true"
android:layout_width="@dimen/dp44"
android:layout_height="@dimen/dp44">
<ImageView
android:id="@+id/iv_close"
android:layout_width="@dimen/dp12"
android:layout_height="@dimen/dp12"
android:layout_centerInParent="true"
android:src="@mipmap/ic_select_finish"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="筛选"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:id="@+id/tv_jjph"
android:layout_width="wrap_content"
android:layout_below="@+id/tv_title"
android:layout_marginTop="@dimen/dp25"
android:layout_marginLeft="@dimen/dp20"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_title"
android:layout_marginLeft="@dimen/dp24"
android:text="交友偏好"
android:textSize="@dimen/dp17"
android:textColor="@color/black"/>
android:textColor="@color/black"
android:textSize="17sp" />
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_jjph"
android:layout_marginTop="@dimen/dp15"
android:layout_marginHorizontal="@dimen/dp18"
android:layout_marginLeft="@dimen/dp18"
android:layout_marginTop="@dimen/dp16"
android:layout_marginRight="@dimen/dp18"
android:orientation="horizontal">
<TextView
android:layout_weight="1"
android:id="@+id/tv_all"
android:layout_width="@dimen/dp100"
android:layout_height="@dimen/dp45"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp17"
android:text="全部"
android:layout_width="match_parent"
android:layout_height="@dimen/dp44"
android:layout_gravity="center"
android:layout_marginRight="@dimen/dp6"
android:layout_marginLeft="@dimen/dp6"
android:background="@drawable/bg_fb65fd"
android:gravity="center"
android:background="@drawable/bg_fb65fd"/>
android:text="全部"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp17" />
<TextView
android:layout_weight="1"
android:id="@+id/tv_boy"
android:layout_width="@dimen/dp100"
android:layout_height="@dimen/dp45"
android:layout_width="match_parent"
android:layout_height="@dimen/dp44"
android:textColor="#999999"
android:textSize="@dimen/dp17"
android:text="男up"
@@ -77,12 +86,14 @@
android:background="@drawable/bg_999999_t10"/>
<TextView
android:layout_weight="1"
android:id="@+id/tv_girl"
android:layout_width="@dimen/dp100"
android:layout_height="@dimen/dp45"
android:layout_width="match_parent"
android:layout_height="@dimen/dp44"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp17"
android:layout_marginLeft="@dimen/dp6"
android:layout_marginRight="@dimen/dp6"
android:text="女up"
android:layout_gravity="center"
android:gravity="center"
@@ -93,14 +104,14 @@
<LinearLayout
android:id="@+id/ll_nm_video_call"
android:layout_width="match_parent"
android:layout_height="@dimen/dp40"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp40"
android:layout_marginHorizontal="@dimen/dp25"
android:layout_height="@dimen/dp44"
android:layout_below="@+id/ll_content"
android:layout_gravity="center"
android:layout_marginHorizontal="@dimen/dp24"
android:layout_marginTop="@dimen/dp40"
android:layout_marginBottom="@dimen/dp20"
android:layout_weight="1"
android:background="@drawable/bg_nmpp_video"
android:layout_marginBottom="@dimen/dp20"
android:gravity="center"
android:orientation="horizontal">

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

View File

@@ -15,6 +15,7 @@
<color name="email_color">#4D9AFF</color>
<color name="invitation_text_color">#FE3846</color>
<color name="invite_text_color">#5EA7FF</color>
<color name="white_50">#80FFFFFF</color>
<!--信息完善页用色-->
<color name="infoEditTextColor">#aaaaaa</color>