This commit is contained in:
zlzw 2023-10-13 18:29:38 +08:00
parent abeb92ab51
commit 427d10158b
31 changed files with 1887 additions and 63 deletions

View File

@ -99,5 +99,6 @@ dependencies {
implementation 'com.github.luqiming666:SwipeRecyclerView:1.4.8'// implementation 'com.github.luqiming666:SwipeRecyclerView:1.4.8'//
implementation 'com.google.android.material:material:1.6.1' implementation 'com.google.android.material:material:1.6.1'
implementation 'com.blankj:utilcode:1.30.0'//uuid implementation 'com.blankj:utilcode:1.30.0'//uuid
implementation 'com.google.android.flexbox:flexbox:3.0.0'//
} }

View File

@ -141,6 +141,7 @@
<activity <activity
android:name=".activity.HomepageRankingActivity" android:name=".activity.HomepageRankingActivity"
android:windowSoftInputMode="stateHidden|adjustResize" /> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".activity.HomeSearchActivity" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"

View File

@ -0,0 +1,20 @@
package com.shayu.onetoone.activity;
import android.os.Bundle;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.shayu.onetoone.R;
import com.shayu.onetoone.manager.RouteManager;
@Route(path = RouteManager.ACTIVITY_HOME_SEARCH)
public class HomeSearchActivity extends AbsOTOActivity {
@Override
protected int getLayoutId() {
return R.layout.activity_search;
}
@Override
protected void main(Bundle savedInstanceState) {
}
}

View File

@ -3,8 +3,6 @@ package com.shayu.onetoone.activity;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
@ -13,20 +11,24 @@ import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.angcyo.tablayout.DslTabLayout; import com.angcyo.tablayout.DslTabLayout;
import com.angcyo.tablayout.delegate2.ViewPager2Delegate; import com.angcyo.tablayout.delegate2.ViewPager2Delegate;
import com.shayu.onetoone.R; import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.fragments.home.HomeRankFragment; import com.shayu.onetoone.activity.fragments.home.HomeRankFragment;
import com.shayu.onetoone.listener.OnAppbarListener; import com.shayu.onetoone.listener.OnAppbarListener;
import com.shayu.onetoone.manager.RouteManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Route(path = RouteManager.ACTIVITY_HOME_RANK)
public class HomepageRankingActivity extends AbsOTOActivity { public class HomepageRankingActivity extends AbsOTOActivity {
ViewPager2 viewPager; ViewPager2 viewPager;
DslTabLayout dslTabLayout; DslTabLayout dslTabLayout;
RadioButton mDay, mWeek; RadioButton mDay, mWeek;
private RadioGroup radioGroup; private RadioGroup radioGroup;
private ViewPagerChangeCallback viewPagerChangeCallback;
List<HomeRankFragment> fragments = new ArrayList<>(); List<HomeRankFragment> fragments = new ArrayList<>();
@ -43,6 +45,7 @@ public class HomepageRankingActivity extends AbsOTOActivity {
dslTabLayout = findViewById(R.id.dslTabLayout); dslTabLayout = findViewById(R.id.dslTabLayout);
radioGroup = findViewById(R.id.radioGroup); radioGroup = findViewById(R.id.radioGroup);
viewPagerChangeCallback = new ViewPagerChangeCallback();
ViewPager2Delegate.Companion.install(viewPager, dslTabLayout, false); ViewPager2Delegate.Companion.install(viewPager, dslTabLayout, false);
fragments.add(new HomeRankFragment(HomeRankFragment.TYPE_CHARM));//魅力 fragments.add(new HomeRankFragment(HomeRankFragment.TYPE_CHARM));//魅力
@ -71,10 +74,19 @@ public class HomepageRankingActivity extends AbsOTOActivity {
}); });
mDay.setOnClickListener(v -> { mDay.setOnClickListener(v -> {
setRadioColor(mDay, mWeek); setRadioColor(mDay, mWeek);
fragments.get(viewPager.getCurrentItem()).setDate(HomeRankFragment.DATE_DAY);
}); });
mWeek.setOnClickListener(v -> { mWeek.setOnClickListener(v -> {
setRadioColor(mWeek, mDay); setRadioColor(mWeek, mDay);
fragments.get(viewPager.getCurrentItem()).setDate(HomeRankFragment.DATE_WEEK);
}); });
viewPager.registerOnPageChangeCallback(viewPagerChangeCallback);
}
@Override
protected void onDestroy() {
super.onDestroy();
viewPager.unregisterOnPageChangeCallback(viewPagerChangeCallback);
} }
private void setRadioColor(RadioButton select, RadioButton unSelect) { private void setRadioColor(RadioButton select, RadioButton unSelect) {
@ -83,4 +95,12 @@ public class HomepageRankingActivity extends AbsOTOActivity {
select.setBackgroundResource(R.drawable.bg_home_rank_day_select); select.setBackgroundResource(R.drawable.bg_home_rank_day_select);
unSelect.setBackgroundResource(R.drawable.bg_home_rank_day); unSelect.setBackgroundResource(R.drawable.bg_home_rank_day);
} }
private class ViewPagerChangeCallback extends ViewPager2.OnPageChangeCallback {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
fragments.get(position).setDate(mDay.isChecked()?HomeRankFragment.DATE_DAY:HomeRankFragment.DATE_WEEK);
}
}
} }

View File

@ -16,8 +16,7 @@ import com.angcyo.tablayout.delegate2.ViewPager2Delegate;
import com.shayu.onetoone.R; import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.fragments.home.HotFragment; import com.shayu.onetoone.activity.fragments.home.HotFragment;
import com.shayu.onetoone.activity.fragments.home.RecommendFragment; import com.shayu.onetoone.activity.fragments.home.RecommendFragment;
import com.shayu.onetoone.activity.fragments.message.MsgFriendFragment; import com.shayu.onetoone.manager.RouteManager;
import com.shayu.onetoone.activity.fragments.message.MsgMessageFragment;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -47,6 +46,10 @@ public class FriendsFragment extends BaseFragment {
return fragments.size(); return fragments.size();
} }
}); });
findViewById(R.id.btn_top).setOnClickListener(v ->{
RouteManager.forwardActivity(RouteManager.ACTIVITY_HOME_RANK);
});
} }
@Override @Override

View File

@ -1,6 +1,5 @@
package com.shayu.onetoone.activity.fragments.home; package com.shayu.onetoone.activity.fragments.home;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -9,56 +8,89 @@ import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAImageView;
import com.shayu.onetoone.R; import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.fragments.BaseFragment; import com.shayu.onetoone.activity.fragments.BaseFragment;
import com.shayu.onetoone.adapter.HomeRecommendListAdapter; import com.shayu.onetoone.adapter.HomeRankListAdapter;
import com.shayu.onetoone.bean.HomeRankBean; import com.shayu.onetoone.bean.HomeRankBean;
import com.shayu.onetoone.bean.UserBean;
import com.shayu.onetoone.listener.OnAppbarListener; import com.shayu.onetoone.listener.OnAppbarListener;
import com.shayu.onetoone.manager.OTONetManager;
import com.yanzhenjie.recyclerview.SwipeRecyclerView; import com.yanzhenjie.recyclerview.SwipeRecyclerView;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.custom.MyRadioButton;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import java.util.ArrayList;
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.listener.OnRefreshListener;
import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
import pl.droidsonroids.gif.GifImageView; import pl.droidsonroids.gif.GifImageView;
public class HomeRankFragment extends BaseFragment { public class HomeRankFragment extends BaseFragment {
public static final int TYPE_CHARM = 0; public static final int TYPE_CHARM = 1;
public static final int TYPE_WEALTH = 1; public static final int TYPE_WEALTH = 2;
public static final int DATE_DAY = 1;
public static final int DATE_WEEK = 2;
private AppBarLayout rootView; private AppBarLayout rootView;
private OnAppbarListener appbarListener; private OnAppbarListener appbarListener;
private SwipeRecyclerView mRecyclerView; private SwipeRecyclerView mRecyclerView;
HomeRecommendListAdapter adapter; HomeRankListAdapter adapter;
SmartRefreshLayout mRefreshLayout;
private HeadView hv;
private int type; private int type;
private int date;
public HomeRankFragment(int type) { public HomeRankFragment(int type) {
super(); super();
this.type = type; this.type = type;
this.date = DATE_DAY;
} }
public void setAppbarListener(OnAppbarListener appbarListener) { public void setAppbarListener(OnAppbarListener appbarListener) {
this.appbarListener = appbarListener; this.appbarListener = appbarListener;
} }
public void setDate(int date) {
this.date = date;
updateData();
}
@Override @Override
public void initView(View itemView) { public void initView(View itemView) {
rootView = findViewById(R.id.rootView); rootView = findViewById(R.id.rootView);
mRecyclerView = findViewById(R.id.recyclerView); mRecyclerView = findViewById(R.id.recyclerView);
adapter = new HomeRecommendListAdapter(getContext()); mRefreshLayout = findViewById(R.id.swipeRefreshLayout);
adapter = new HomeRankListAdapter(getContext());
hv = new HeadView(rootView);
mRecyclerView.setAdapter(adapter); mRecyclerView.setAdapter(adapter);
mRefreshLayout.setRefreshHeader(new RongRefreshHeader(this.getContext()));
rootView.addOnOffsetChangedListener(new AppBarLayout.BaseOnOffsetChangedListener() { mRefreshLayout.setRefreshFooter(new RongRefreshHeader(this.getContext()));
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override @Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { public void onRefresh(@NonNull RefreshLayout refreshLayout) {
if (appbarListener != null) { updateData();
if (verticalOffset == 0) { mRefreshLayout.finishRefresh();
appbarListener.onShow(true); }
} else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) { });
appbarListener.onShow(false); mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
} @Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
refreshLayout.finishLoadMore();
}
});
rootView.addOnOffsetChangedListener((AppBarLayout.BaseOnOffsetChangedListener) (appBarLayout, verticalOffset) -> {
if (appbarListener != null) {
if (verticalOffset == 0) {
appbarListener.onShow(true);
} else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) {
appbarListener.onShow(false);
} }
} }
}); });
@ -68,8 +100,33 @@ public class HomeRankFragment extends BaseFragment {
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home_ranking, container, false); return inflater.inflate(R.layout.fragment_home_ranking, container, false);
} }
private void initData(){
public void updateData() {
OTONetManager.getInstance(mContext)
.getHomeRank(type + "", date + "", new HttpCallback<List<HomeRankBean>>() {
@Override
public void onSuccess(List<HomeRankBean> tmp) {
List<HomeRankBean> data = new ArrayList<>();
for (int i = 0; i < 1; i++) {
data.addAll(tmp);
}
adapter.clear();
hv.clear();
for (int i = 0; i < data.size(); i++) {
if (i < 3) {
hv.setData(data.get(i), i);
continue;
}
adapter.add(data.get(i));
}
adapter.notifyDataSetChanged();
}
@Override
public void onError(String error) {
}
});
} }
class HeadView { class HeadView {
@ -117,33 +174,35 @@ public class HomeRankFragment extends BaseFragment {
mVotes1 = itemView.findViewById(R.id.votes_1); mVotes1 = itemView.findViewById(R.id.votes_1);
mVotes2 = itemView.findViewById(R.id.votes_2); mVotes2 = itemView.findViewById(R.id.votes_2);
mVotes3 = itemView.findViewById(R.id.votes_3); mVotes3 = itemView.findViewById(R.id.votes_3);
mSex1 = itemView.findViewById(R.id.sex_1); mSex1 = itemView.findViewById(R.id.sex_1);
mSex2 = itemView.findViewById(R.id.sex_2); mSex2 = itemView.findViewById(R.id.sex_2);
mSex3 = itemView.findViewById(R.id.sex_3); mSex3 = itemView.findViewById(R.id.sex_3);
diamond1 = itemView.findViewById(R.id.diamond1); diamond1 = itemView.findViewById(R.id.diamond1);
diamond2 = itemView.findViewById(R.id.diamond2); diamond2 = itemView.findViewById(R.id.diamond2);
diamond3 = itemView.findViewById(R.id.diamond3); diamond3 = itemView.findViewById(R.id.diamond3);
mBtnFollow1 = itemView.findViewById(R.id.btn_follow_1); mBtnFollow1 = itemView.findViewById(R.id.btn_follow_1);
mBtnFollow2 = itemView.findViewById(R.id.btn_follow_2); mBtnFollow2 = itemView.findViewById(R.id.btn_follow_2);
mBtnFollow3 = itemView.findViewById(R.id.btn_follow_3); mBtnFollow3 = itemView.findViewById(R.id.btn_follow_3);
svga1 = itemView.findViewById(R.id.svga1); svga1 = itemView.findViewById(R.id.svga1);
svga2 = itemView.findViewById(R.id.svga2); svga2 = itemView.findViewById(R.id.svga2);
svga3 = itemView.findViewById(R.id.svga3); svga3 = itemView.findViewById(R.id.svga3);
} }
void setData(HomeRankBean user, int position){
getItem(position,mName1,mName2,mName3).setText(user.getUserNicename()); void setData(HomeRankBean user, int position) {
getItem(position,mVotes1,mVotes2,mVotes3).setText(user.getMoney()); getItem(position,mItem1,mItem2,mItem3).setVisibility(View.VISIBLE);
if(user.isFollow()){ getItem(position, mName1, mName2, mName3).setText(user.getUserNicename());
getItem(position,mBtnFollow1,mBtnFollow2,mBtnFollow3).setVisibility(View.GONE); getItem(position, mVotes1, mVotes2, mVotes3).setText(user.getMoney());
}else{ if (user.isFollow()) {
getItem(position,mBtnFollow1,mBtnFollow2,mBtnFollow3).setVisibility(View.VISIBLE); getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.GONE);
} else {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.VISIBLE);
} }
if(user.getSex()==1) { if (user.getSex() == 1) {
getItem(position, mSex1, mSex2, mSex3).setImageResource(R.mipmap.ic_message_tab_man); getItem(position, mSex1, mSex2, mSex3).setImageResource(R.mipmap.ic_message_tab_man);
}else{ } else {
getItem(position, mSex1, mSex2, mSex3).setImageResource(R.mipmap.ic_message_tab_woman); getItem(position, mSex1, mSex2, mSex3).setImageResource(R.mipmap.ic_message_tab_woman);
} }
switch (position){ switch (position) {
case 0: case 0:
svga1.setImageResource(R.mipmap.ic_home_rank_top_1); svga1.setImageResource(R.mipmap.ic_home_rank_top_1);
break; break;
@ -154,8 +213,9 @@ public class HomeRankFragment extends BaseFragment {
svga3.setImageResource(R.mipmap.ic_home_rank_top_3); svga3.setImageResource(R.mipmap.ic_home_rank_top_3);
break; break;
} }
ImgLoader.display(mContext, user.getAvatar(), getItem(position, mAvatar1, mAvatar2, mAvatar3));
} }
private <T> T getItem(int position, T... views) { private <T> T getItem(int position, T... views) {
return views[position]; return views[position];
} }
@ -170,5 +230,8 @@ public class HomeRankFragment extends BaseFragment {
} }
} }
public void clear() {
setVisibility(View.INVISIBLE,-1,mItem1,mItem2,mItem3);
}
} }
} }

View File

@ -9,6 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.shayu.onetoone.R; import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.HomeSearchActivity;
import com.shayu.onetoone.activity.fragments.BaseFragment; import com.shayu.onetoone.activity.fragments.BaseFragment;
import com.shayu.onetoone.activity.HomepageRankingActivity; import com.shayu.onetoone.activity.HomepageRankingActivity;
import com.shayu.onetoone.adapter.HomeRecommendListAdapter; import com.shayu.onetoone.adapter.HomeRecommendListAdapter;
@ -52,8 +53,8 @@ public class RecommendFragment extends BaseFragment {
} }
}); });
top.setOnClickListener(view -> { top.setOnClickListener(view -> {
// recyclerView.scrollToPosition(0); // recyclerView.scrollToPosition(0);
startActivity(new Intent(getContext(), HomepageRankingActivity.class)); startActivity(new Intent(getContext(), HomeSearchActivity.class));
}); });
initData(); initData();
} }

View File

@ -5,6 +5,7 @@ import static android.content.Context.CLIPBOARD_SERVICE;
import android.app.Dialog; import android.app.Dialog;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@ -53,10 +54,15 @@ import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List;
import io.rong.imkit.IMCenter; import io.rong.imkit.IMCenter;
import io.rong.imkit.conversation.MessageListAdapter; import io.rong.imkit.conversation.MessageListAdapter;
import io.rong.imkit.conversation.extension.component.plugin.IPluginModule;
import io.rong.imkit.conversation.extension.component.plugin.ImagePlugin;
import io.rong.imkit.model.UiMessage; import io.rong.imkit.model.UiMessage;
import io.rong.imkit.picture.PictureSelector;
import io.rong.imkit.picture.config.PictureMimeType;
import io.rong.imlib.IRongCallback; import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
@ -98,7 +104,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
cameraUtil = new ProcessImageUtil(getActivity(), "com.shayu.onetoone.fileprovider"); cameraUtil = new ProcessImageUtil(getActivity(), "com.shayu.onetoone.fileprovider");
mRongExtension.setVisibility(View.VISIBLE); mRongExtension.setVisibility(View.VISIBLE);
img.setOnClickListener(v -> cameraUtil.getImageByCamera()); // img.setOnClickListener(v -> cameraUtil.getImageByCamera());
initCamera(); initCamera();
mSendBtn.setOnClickListener(v -> { mSendBtn.setOnClickListener(v -> {
@ -231,6 +237,43 @@ public class ChatMessageFragment extends AbsConversationFragment {
} }
}); });
}); });
img.setOnClickListener(v -> {
new BottomListDialog(mContext)
.setStrings(Arrays.asList("相册", "拍照"))
.setSelect(new OnItemClickListener<String>() {
@Override
public void onItemClick(String bean, int position) {
boolean isCamera = position == 1;
SendMessageManager.sendMessageForText(targetId, "图片信息", new OnSendMessageListener() {
// PictureSelector.create(currentFragment)
// .openGallery(RongConfigCenter.conversationConfig().rc_media_selector_contain_video ? PictureMimeType.ofAll() : PictureMimeType.ofImage())
// .loadImageEngine(RongConfigCenter.featureConfig().getKitImageEngine())
// .setRequestedOrientation(1)
// .videoDurationLimit(RongIMClient.getInstance().getVideoLimitTime())
// .maxSelectNum(9)
// .imageSpanCount(3)
// .isGif(true)
// .forResult(this.mRequestCode);
@Override
public void onSuccess(String token) {
super.onSuccess(token);
if (isCamera) {
PictureSelector.create(ChatMessageFragment.this).openCamera(PictureMimeType.ofImage());
} else {
PictureSelector.create(ChatMessageFragment.this).openGallery(PictureMimeType.ofImage());
}
}
@Override
public void onError(int status, String msg) {
super.onError(status, msg);
}
});
}
}).showDialog();
});
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e); throw new RuntimeException(e);
@ -238,10 +281,6 @@ public class ChatMessageFragment extends AbsConversationFragment {
} }
private void checkAuth(OnSendMessageListener listener) { private void checkAuth(OnSendMessageListener listener) {
if (true) {
listener.onSuccess("");
return;
}
OTONetManager.getInstance(mContext) OTONetManager.getInstance(mContext)
.getTargetUserInfo(Integer.parseInt(targetId), new HttpCallback<UserBean>() { .getTargetUserInfo(Integer.parseInt(targetId), new HttpCallback<UserBean>() {
@Override @Override
@ -517,4 +556,10 @@ public class ChatMessageFragment extends AbsConversationFragment {
protected MessageListAdapter onResolveAdapter() { protected MessageListAdapter onResolveAdapter() {
return new MsgChatMessageListAdapter(this); return new MsgChatMessageListAdapter(this);
} }
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ToastUtil.show("收到回调");
}
} }

View File

@ -0,0 +1,124 @@
package com.shayu.onetoone.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.shayu.onetoone.R;
import com.shayu.onetoone.bean.FollowBean;
import com.shayu.onetoone.bean.HomeRankBean;
import com.shayu.onetoone.manager.OTONetManager;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import java.util.ArrayList;
import java.util.List;
public class HomeRankListAdapter extends RecyclerView.Adapter<HomeRankListAdapter.ViewHolder> {
private Context mContext;
private List<HomeRankBean> list;
public HomeRankListAdapter(Context mContext) {
this.mContext = mContext;
list = new ArrayList<>();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_rank, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.setData(list.get(position), position);
}
@Override
public int getItemCount() {
return list.size();
}
public void setList(List<HomeRankBean> data) {
this.list = data;
notifyDataSetChanged();
}
public void add(HomeRankBean homeRankBean) {
this.list.add(homeRankBean);
}
public void clear() {
list.clear();
notifyDataSetChanged();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private TextView rank;
private RoundedImageView avatar;
private ImageView sex;
private TextView user_name;
private TextView level;
private ImageView ic_level;
private TextView money;
private Button follow;
public ViewHolder(@NonNull View itemView) {
super(itemView);
rank = itemView.findViewById(R.id.rank);
avatar = itemView.findViewById(R.id.avatar);
sex = itemView.findViewById(R.id.sex);
user_name = itemView.findViewById(R.id.user_name);
level = itemView.findViewById(R.id.level);
ic_level = itemView.findViewById(R.id.ic_level);
money = itemView.findViewById(R.id.money);
follow = itemView.findViewById(R.id.follow);
}
private void setData(HomeRankBean bean, int position) {
rank.setText(position + 4 + "");
user_name.setText(bean.getUserNicename());
level.setText("Lv." + bean.getLevel());
money.setText(bean.getMoney());
if (bean.getSex() == 1) {
sex.setImageResource(R.mipmap.ic_message_tab_man);
} else {
sex.setImageResource(R.mipmap.ic_message_tab_woman);
}
if (bean.isFollow()) {
follow.setVisibility(View.GONE);
} else {
follow.setVisibility(View.VISIBLE);
}
ImgLoader.display(mContext, bean.getAvatar(), avatar);
follow.setText(bean.getUid());
follow.setOnClickListener(v -> {
OTONetManager.getInstance(mContext)
.follow(v.getTag().toString(), new HttpCallback<FollowBean>() {
@Override
public void onSuccess(FollowBean data) {
ToastUtil.show(WordUtil.getNewString(R.string.system_tip_success));
v.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
}
});
});
}
}
}

View File

@ -1,5 +1,6 @@
package com.shayu.onetoone.bean; package com.shayu.onetoone.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BaseModel;
public class HomeRankBean extends BaseModel { public class HomeRankBean extends BaseModel {
@ -16,6 +17,7 @@ public class HomeRankBean extends BaseModel {
private int islive; private int islive;
private String avatar; private String avatar;
private String avatarThumb; private String avatarThumb;
@SerializedName("user_nicename")
private String userNicename; private String userNicename;
private int sex; private int sex;
private int level; private int level;

View File

@ -10,6 +10,7 @@ import com.shayu.onetoone.bean.FollowBean;
import com.shayu.onetoone.bean.GiftBean; import com.shayu.onetoone.bean.GiftBean;
import com.shayu.onetoone.bean.GreetBean; import com.shayu.onetoone.bean.GreetBean;
import com.shayu.onetoone.bean.HomeItemBean; import com.shayu.onetoone.bean.HomeItemBean;
import com.shayu.onetoone.bean.HomeRankBean;
import com.shayu.onetoone.bean.JoinAnchorBean; import com.shayu.onetoone.bean.JoinAnchorBean;
import com.shayu.onetoone.bean.MessageConsumeConfigBean; import com.shayu.onetoone.bean.MessageConsumeConfigBean;
import com.shayu.onetoone.bean.OfficialNoticeBean; import com.shayu.onetoone.bean.OfficialNoticeBean;
@ -650,6 +651,26 @@ public class OTONetManager {
} }
}).isDisposed(); }).isDisposed();
} }
public void getHomeRank(String type,String date, HttpCallback<List<HomeRankBean>> callback) {
API.get().otoApi(mContext)
.getHomeRank(type,date)
.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();
}
private MultipartBody.Part createUploadFile(File file) { private MultipartBody.Part createUploadFile(File file) {
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);

View File

@ -14,6 +14,8 @@ public class RouteManager {
public static final String ACTIVITY_ENTRY = "/activity/EntryActivity"; public static final String ACTIVITY_ENTRY = "/activity/EntryActivity";
public static final String ACTIVITY_LOGIN = "/activity/LoginActivity"; public static final String ACTIVITY_LOGIN = "/activity/LoginActivity";
public static final String ACTIVITY_WEB_VIEW = "/activity/WebViewActivity"; 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 void forwardMainActivity() { public static void forwardMainActivity() {
ARouter.getInstance().build(ACTIVITY_MAIN) ARouter.getInstance().build(ACTIVITY_MAIN)
@ -46,5 +48,10 @@ public class RouteManager {
.withString("url", url) .withString("url", url)
.navigation(); .navigation();
} }
public static void forwardActivity(String path) {
ARouter.getInstance().build(path)
.navigation();
}
} }

View File

@ -5,6 +5,7 @@ import com.shayu.onetoone.bean.FollowBean;
import com.shayu.onetoone.bean.GiftBean; import com.shayu.onetoone.bean.GiftBean;
import com.shayu.onetoone.bean.GreetBean; import com.shayu.onetoone.bean.GreetBean;
import com.shayu.onetoone.bean.HomeItemBean; import com.shayu.onetoone.bean.HomeItemBean;
import com.shayu.onetoone.bean.HomeRankBean;
import com.shayu.onetoone.bean.JoinAnchorBean; import com.shayu.onetoone.bean.JoinAnchorBean;
import com.shayu.onetoone.bean.MessageConsumeConfigBean; import com.shayu.onetoone.bean.MessageConsumeConfigBean;
import com.shayu.onetoone.bean.OfficialNoticeBean; import com.shayu.onetoone.bean.OfficialNoticeBean;
@ -121,7 +122,7 @@ public interface OneToOneApi {
Observable<ResponseModel<List<SystemMessageBean>>> getSystemMessageList(@Query("type") int type); Observable<ResponseModel<List<SystemMessageBean>>> getSystemMessageList(@Query("type") int type);
@GET("/api/public/?service=Friendappmsg.sendAfter") @GET("/api/public/?service=Friendappmsg.sendAfter")
Observable<ResponseModel<List<BaseModel>>> sendMessage( Observable<ResponseModel<BaseModel>> sendMessage(
@Query("tuid") int tuid, @Query("tuid") int tuid,
@Query("type") int type, @Query("type") int type,
@Query("gift_id") String giftId, @Query("gift_id") String giftId,
@ -141,6 +142,18 @@ public interface OneToOneApi {
@GET("/api/public/?service=User.setAttents") @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
);
} }

View File

@ -7,6 +7,9 @@ import io.rong.imkit.utils.RouteUtils;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.ConversationIdentifier; import io.rong.imlib.model.ConversationIdentifier;
/**
* 跳转到会话页面
*/
public class ConversationUtils { public class ConversationUtils {
public static void startConversation(Context mContext,String targetId){ public static void startConversation(Context mContext,String targetId){
ConversationIdentifier conversationIdentifier = new ConversationIdentifier(Conversation.ConversationType.PRIVATE, targetId); ConversationIdentifier conversationIdentifier = new ConversationIdentifier(Conversation.ConversationType.PRIVATE, targetId);

View File

@ -0,0 +1,201 @@
package com.shayu.onetoone.widget.flexboxradiogroup;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.ViewDebug;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Checkable;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
public class CustomizableRadioButton extends FrameLayout implements Checkable {
private boolean mChecked = false;
private CompoundButton.OnCheckedChangeListener mOnCheckedChangeListener;
private CompoundButton compoundButton;
private boolean mBroadcasting;
public CustomizableRadioButton(Context context) {
super(context);
init();
}
public CustomizableRadioButton(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setClickable(true);
setFocusable(true);
compoundButton = new CompoundButton(getContext()) {
@Override
public int getId() {
return CustomizableRadioButton.this.getId();
}
};
}
/**
* {@inheritDoc}
* <p>
* If the radio button is already checked, this method will not toggle the radio button.
*/
@Override
public void toggle() {
// we override to prevent toggle when the radio is already
// checked (as opposed to check boxes widgets)
if (!isChecked()) {
setChecked(!mChecked);
}
}
@Override
public boolean performClick() {
/*
* XXX: These are tiny, need some surrounding 'expanded touch area',
* which will need to be implemented in Button if we only override
* performClick()
*/
/* When clicked, toggle the state */
toggle();
return super.performClick();
}
@ViewDebug.ExportedProperty
public boolean isChecked() {
return mChecked;
}
/**
* <p>Changes the checked state of this button.</p>
*
* @param checked true to check the button, false to uncheck it
*/
public void setChecked(boolean checked) {
if (mChecked != checked) {
mChecked = checked;
refreshDrawableState();
compoundButton.setChecked(checked);
// Avoid infinite recursions if setChecked() is called from a listener
if (mBroadcasting) {
return;
}
mBroadcasting = true;
if (mOnCheckedChangeListener != null) {
mOnCheckedChangeListener.onCheckedChanged(compoundButton, mChecked);
}
mBroadcasting = false;
}
}
/**
* Register a callback to be invoked when the checked state of this button
* changes.
*
* @param listener the callback to call on checked state change
*/
public void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener) {
mOnCheckedChangeListener = listener;
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setClassName(CustomizableRadioButton.class.getName());
event.setChecked(mChecked);
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(CustomizableRadioButton.class.getName());
info.setCheckable(true);
info.setChecked(mChecked);
}
private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
@Override
protected int[] onCreateDrawableState(int extraSpace) {
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
if (isChecked()) {
mergeDrawableStates(drawableState, CHECKED_STATE_SET);
}
return drawableState;
}
static class SavedState extends BaseSavedState {
boolean checked;
/**
* Constructor called from {@link CompoundButton#onSaveInstanceState()}
*/
SavedState(Parcelable superState) {
super(superState);
}
/**
* Constructor called from {@link #CREATOR}
*/
private SavedState(Parcel in) {
super(in);
checked = (Boolean) in.readValue(null);
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(checked);
}
@Override
public String toString() {
return "CompoundButton.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " checked=" + checked + "}";
}
public static final Creator<SavedState> CREATOR
= new Creator<SavedState>() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
@Override
public Parcelable onSaveInstanceState() {
// Force our ancestor class to save its state
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.checked = isChecked();
return ss;
}
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
setChecked(ss.checked);
requestLayout();
}
}

View File

@ -0,0 +1,363 @@
package com.shayu.onetoone.widget.flexboxradiogroup;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.google.android.flexbox.FlexDirection;
import com.google.android.flexbox.FlexboxLayout;
import com.shayu.onetoone.R;
public class FlexBoxRadioGroup extends FlexboxLayout {
// holds the checked id; the selection is empty by default
private int mCheckedId = -1;
// tracks children radio buttons checked state
private CompoundButton.OnCheckedChangeListener mChildOnCheckedChangeListener;
// when true, mOnCheckedChangeListener discards events
private boolean mProtectFromCheckedChange = false;
private OnCheckedChangeListener mOnCheckedChangeListener;
private PassThroughHierarchyChangeListener mPassThroughListener;
/**
* {@inheritDoc}
*/
public FlexBoxRadioGroup(Context context) {
super(context);
setFlexDirection(FlexDirection.ROW);
init();
}
/**
* {@inheritDoc}
*/
public FlexBoxRadioGroup(Context context, AttributeSet attrs) {
super(context, attrs);
// retrieve selected radio button as requested by the user in the
// XML layout file
TypedArray attributes = context.obtainStyledAttributes(
attrs, R.styleable.FlexBoxRadioGroup);
int value = attributes.getResourceId(R.styleable.FlexBoxRadioGroup_uiCheckedButton, View.NO_ID);
if (value != View.NO_ID) {
mCheckedId = value;
}
attributes.recycle();
init();
}
private void init() {
mChildOnCheckedChangeListener = new CheckedStateTracker();
mPassThroughListener = new PassThroughHierarchyChangeListener();
super.setOnHierarchyChangeListener(mPassThroughListener);
}
/**
* {@inheritDoc}
*/
@Override
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
// the user listener is delegated to our pass-through listener
mPassThroughListener.mOnHierarchyChangeListener = listener;
}
/**
* {@inheritDoc}
*/
@Override
protected void onFinishInflate() {
super.onFinishInflate();
// checks the appropriate radio button as requested in the XML file
if (mCheckedId != -1) {
mProtectFromCheckedChange = true;
setCheckedStateForView(mCheckedId, true);
mProtectFromCheckedChange = false;
setCheckedId(mCheckedId);
}
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
if (child instanceof RadioButton) {
final RadioButton button = (RadioButton) child;
if (button.isChecked()) {
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
setCheckedId(button.getId());
}
}
super.addView(child, index, params);
}
/**
* <p>Sets the selection to the radio button whose identifier is passed in
* parameter. Using -1 as the selection identifier clears the selection;
* such an operation is equivalent to invoking {@link #clearCheck()}.</p>
*
* @param id the unique id of the radio button to select in this group
* @see #getCheckedRadioButtonId()
* @see #clearCheck()
*/
public void check(int id) {
// don't even bother
if (id != -1 && (id == mCheckedId)) {
return;
}
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
if (id != -1) {
setCheckedStateForView(id, true);
}
setCheckedId(id);
}
private void setCheckedId(int id) {
mCheckedId = id;
if (mOnCheckedChangeListener != null) {
mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId);
}
}
private void setCheckedStateForView(int viewId, boolean checked) {
View checkedView = findViewById(viewId);
if (checkedView != null && checkedView instanceof RadioButton) {
((RadioButton) checkedView).setChecked(checked);
}
}
/**
* <p>Returns the identifier of the selected radio button in this group.
* Upon empty selection, the returned value is -1.</p>
*
* @return the unique id of the selected radio button in this group
* @attr ref android.R.styleable#RadioGroup_checkedButton
* @see #check(int)
* @see #clearCheck()
*/
public int getCheckedRadioButtonId() {
return mCheckedId;
}
/**
* <p>Clears the selection. When the selection is cleared, no radio button
* in this group is selected and {@link #getCheckedRadioButtonId()} returns
* null.</p>
*
* @see #check(int)
* @see #getCheckedRadioButtonId()
*/
public void clearCheck() {
check(-1);
}
/**
* <p>Register a callback to be invoked when the checked radio button
* changes in this group.</p>
*
* @param listener the callback to call on checked state change
*/
public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
mOnCheckedChangeListener = listener;
}
/**
* {@inheritDoc}
*/
// @Override
// public FlexBoxRadioGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
// return new FlexBoxRadioGroup.LayoutParams(getContext(), attrs);
// }
/**
* {@inheritDoc}
*/
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof RadioGroup.LayoutParams;
}
@Override
protected FlexboxLayout.LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setClassName(RadioGroup.class.getName());
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(RadioGroup.class.getName());
}
/**
* <p>This set of layout parameters defaults the width and the height of
* the children to {@link #WRAP_CONTENT} when they are not specified in the
* XML file. Otherwise, this class uses the value read from the XML file.</p>
*/
public static class LayoutParams extends FlexboxLayout.LayoutParams {
/**
* {@inheritDoc}
*/
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
}
/**
* {@inheritDoc}
*/
public LayoutParams(int w, int h) {
super(w, h);
}
// /**
// * {@inheritDoc}
// */
// public LayoutParams(int w, int h, float initWeight) {
// super(w, h, initWeight);
// }
/**
* {@inheritDoc}
*/
public LayoutParams(ViewGroup.LayoutParams p) {
super(p);
}
/**
* {@inheritDoc}
*/
public LayoutParams(MarginLayoutParams source) {
super(source);
}
/**
* <p>Fixes the child's width to
* {@link ViewGroup.LayoutParams#WRAP_CONTENT} and the child's
* height to {@link ViewGroup.LayoutParams#WRAP_CONTENT}
* when not specified in the XML file.</p>
*
* @param a the styled attributes set
* @param widthAttr the width attribute to fetch
* @param heightAttr the height attribute to fetch
*/
@Override
protected void setBaseAttributes(TypedArray a,
int widthAttr, int heightAttr) {
if (a.hasValue(widthAttr)) {
width = a.getLayoutDimension(widthAttr, "layout_width");
} else {
width = WRAP_CONTENT;
}
if (a.hasValue(heightAttr)) {
height = a.getLayoutDimension(heightAttr, "layout_height");
} else {
height = WRAP_CONTENT;
}
}
}
/**
* <p>Interface definition for a callback to be invoked when the checked
* radio button changed in this group.</p>
*/
public interface OnCheckedChangeListener {
/**
* <p>Called when the checked radio button has changed. When the
* selection is cleared, checkedId is -1.</p>
*
* @param group the group in which the checked radio button has changed
* @param checkedId the unique identifier of the newly checked radio button
*/
void onCheckedChanged(FlexBoxRadioGroup group, int checkedId);
}
private class CheckedStateTracker implements CompoundButton.OnCheckedChangeListener {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// prevents from infinite recursion
if (mProtectFromCheckedChange) {
return;
}
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
int id = buttonView.getId();
setCheckedId(id);
}
}
/**
* <p>A pass-through listener acts upon the events and dispatches them
* to another listener. This allows the table layout to set its own internal
* hierarchy change listener without preventing the user to setup his.</p>
*/
private class PassThroughHierarchyChangeListener implements
OnHierarchyChangeListener {
private OnHierarchyChangeListener mOnHierarchyChangeListener;
/**
* {@inheritDoc}
*/
public void onChildViewAdded(View parent, View child) {
if (parent == FlexBoxRadioGroup.this && child instanceof RadioButton) {
int id = child.getId();
// generates an id if it's missing
if (id == View.NO_ID) {
id = child.hashCode();
child.setId(id);
}
((RadioButton) child).setOnCheckedChangeListener(
mChildOnCheckedChangeListener);
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewAdded(parent, child);
}
}
/**
* {@inheritDoc}
*/
public void onChildViewRemoved(View parent, View child) {
if (parent == FlexBoxRadioGroup.this && child instanceof RadioButton) {
((RadioButton) child).setOnCheckedChangeListener(null);
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewRemoved(parent, child);
}
}
}
}

View File

@ -0,0 +1,396 @@
package com.shayu.onetoone.widget.flexboxradiogroup;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Checkable;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.google.android.flexbox.FlexDirection;
import com.google.android.flexbox.FlexboxLayout;
import com.shayu.onetoone.R;
import java.lang.reflect.Method;
public class FlexBoxSingleCheckableGroup extends FlexboxLayout {
private static final String TAG = "FlexBoxSingleCheckableG";
// holds the checked id; the selection is empty by default
private int mCheckedId = -1;
// tracks children radio buttons checked state
private CompoundButton.OnCheckedChangeListener mChildOnCheckedChangeListener;
// when true, mOnCheckedChangeListener discards events
private boolean mProtectFromCheckedChange = false;
private OnCheckedChangeListener mOnCheckedChangeListener;
private PassThroughHierarchyChangeListener mPassThroughListener;
/**
* {@inheritDoc}
*/
public FlexBoxSingleCheckableGroup(Context context) {
super(context);
setFlexDirection(FlexDirection.ROW);
init();
}
/**
* {@inheritDoc}
*/
public FlexBoxSingleCheckableGroup(Context context, AttributeSet attrs) {
super(context, attrs);
// retrieve selected radio button as requested by the user in the
// XML layout file
TypedArray attributes = context.obtainStyledAttributes(
attrs, R.styleable.FlexBoxRadioGroup);
int value = attributes.getResourceId(R.styleable.FlexBoxRadioGroup_uiCheckedButton, View.NO_ID);
if (value != View.NO_ID) {
mCheckedId = value;
}
attributes.recycle();
init();
}
private void init() {
mChildOnCheckedChangeListener = new CheckedStateTracker();
mPassThroughListener = new PassThroughHierarchyChangeListener();
super.setOnHierarchyChangeListener(mPassThroughListener);
}
/**
* {@inheritDoc}
*/
@Override
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
// the user listener is delegated to our pass-through listener
mPassThroughListener.mOnHierarchyChangeListener = listener;
}
/**
* {@inheritDoc}
*/
@Override
protected void onFinishInflate() {
super.onFinishInflate();
// checks the appropriate radio button as requested in the XML file
if (mCheckedId != -1) {
mProtectFromCheckedChange = true;
setCheckedStateForView(mCheckedId, true);
mProtectFromCheckedChange = false;
setCheckedId(mCheckedId);
}
}
public void addView(View child, int index, ViewGroup.LayoutParams params, boolean isChecked) {
if (child instanceof Checkable) {
if (isChecked) {
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
setCheckedId(child.getId());
}
}
super.addView(child, index, params);
// if (child instanceof RadioButton) {
// final RadioButton button = (RadioButton) child;
// if (button.isChecked()) {
// mProtectFromCheckedChange = true;
// if (mCheckedId != -1) {
// setCheckedStateForView(mCheckedId, false);
// }
// mProtectFromCheckedChange = false;
// setCheckedId(button.getId());
// }
// }
//
// super.addView(child, index, params);
}
/**
* <p>Sets the selection to the radio button whose identifier is passed in
* parameter. Using -1 as the selection identifier clears the selection;
* such an operation is equivalent to invoking {@link #clearCheck()}.</p>
*
* @param id the unique id of the radio button to select in this group
* @see #getCheckedRadioButtonId()
* @see #clearCheck()
*/
public void check(int id) {
// don't even bother
if (id != -1 && (id == mCheckedId)) {
return;
}
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
if (id != -1) {
setCheckedStateForView(id, true);
}
setCheckedId(id);
}
private void setCheckedId(int id) {
mCheckedId = id;
if (mOnCheckedChangeListener != null) {
mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId);
}
}
private void setCheckedStateForView(int viewId, boolean checked) {
View checkedView = findViewById(viewId);
if (checkedView != null && checkedView instanceof Checkable) {
try {
Method m = checkedView.getClass()
.getMethod("setChecked", boolean.class);
m.invoke(checkedView, checked);
} catch (Exception e) {
Log.e(TAG, "");
}
}
}
/**
* <p>Returns the identifier of the selected radio button in this group.
* Upon empty selection, the returned value is -1.</p>
*
* @return the unique id of the selected radio button in this group
* @attr ref android.R.styleable#RadioGroup_checkedButton
* @see #check(int)
* @see #clearCheck()
*/
public int getCheckedRadioButtonId() {
return mCheckedId;
}
/**
* <p>Clears the selection. When the selection is cleared, no radio button
* in this group is selected and {@link #getCheckedRadioButtonId()} returns
* null.</p>
*
* @see #check(int)
* @see #getCheckedRadioButtonId()
*/
public void clearCheck() {
check(-1);
}
/**
* <p>Register a callback to be invoked when the checked radio button
* changes in this group.</p>
*
* @param listener the callback to call on checked state change
*/
public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
mOnCheckedChangeListener = listener;
}
/**
* {@inheritDoc}
*/
// @Override
// public FlexBoxRadioGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
// return new FlexBoxRadioGroup.LayoutParams(getContext(), attrs);
// }
/**
* {@inheritDoc}
*/
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof RadioGroup.LayoutParams;
}
@Override
protected FlexboxLayout.LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setClassName(RadioGroup.class.getName());
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(RadioGroup.class.getName());
}
/**
* <p>This set of layout parameters defaults the width and the height of
* the children to {@link #WRAP_CONTENT} when they are not specified in the
* XML file. Otherwise, this class uses the value read from the XML file.</p>
*/
public static class LayoutParams extends FlexboxLayout.LayoutParams {
/**
* {@inheritDoc}
*/
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
}
/**
* {@inheritDoc}
*/
public LayoutParams(int w, int h) {
super(w, h);
}
// /**
// * {@inheritDoc}
// */
// public LayoutParams(int w, int h, float initWeight) {
// super(w, h, initWeight);
// }
/**
* {@inheritDoc}
*/
public LayoutParams(ViewGroup.LayoutParams p) {
super(p);
}
/**
* {@inheritDoc}
*/
public LayoutParams(MarginLayoutParams source) {
super(source);
}
/**
* <p>Fixes the child's width to
* {@link ViewGroup.LayoutParams#WRAP_CONTENT} and the child's
* height to {@link ViewGroup.LayoutParams#WRAP_CONTENT}
* when not specified in the XML file.</p>
*
* @param a the styled attributes set
* @param widthAttr the width attribute to fetch
* @param heightAttr the height attribute to fetch
*/
@Override
protected void setBaseAttributes(TypedArray a,
int widthAttr, int heightAttr) {
if (a.hasValue(widthAttr)) {
width = a.getLayoutDimension(widthAttr, "layout_width");
} else {
width = WRAP_CONTENT;
}
if (a.hasValue(heightAttr)) {
height = a.getLayoutDimension(heightAttr, "layout_height");
} else {
height = WRAP_CONTENT;
}
}
}
/**
* <p>Interface definition for a callback to be invoked when the checked
* radio button changed in this group.</p>
*/
public interface OnCheckedChangeListener {
/**
* <p>Called when the checked radio button has changed. When the
* selection is cleared, checkedId is -1.</p>
*
* @param group the group in which the checked radio button has changed
* @param checkedId the unique identifier of the newly checked radio button
*/
void onCheckedChanged(FlexBoxSingleCheckableGroup group, int checkedId);
}
private class CheckedStateTracker implements CompoundButton.OnCheckedChangeListener {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// prevents from infinite recursion
if (mProtectFromCheckedChange) {
return;
}
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
int id = buttonView.getId();
setCheckedId(id);
}
}
/**
* <p>A pass-through listener acts upon the events and dispatches them
* to another listener. This allows the table layout to set its own internal
* hierarchy change listener without preventing the user to setup his.</p>
*/
private class PassThroughHierarchyChangeListener implements
OnHierarchyChangeListener {
private OnHierarchyChangeListener mOnHierarchyChangeListener;
/**
* {@inheritDoc}
*/
public void onChildViewAdded(View parent, View child) {
if (parent == FlexBoxSingleCheckableGroup.this && child instanceof Checkable) {
int id = child.getId();
// generates an id if it's missing
if (id == View.NO_ID) {
id = child.hashCode();
child.setId(id);
}
try {
Method m = child.getClass()
.getMethod("setOnCheckedChangeListener", CompoundButton.OnCheckedChangeListener.class);
m.invoke(child, mChildOnCheckedChangeListener);
} catch (Exception e) {
Log.e(TAG, "");
}
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewAdded(parent, child);
}
}
/**
* {@inheritDoc}
*/
public void onChildViewRemoved(View parent, View child) {
if (parent == FlexBoxSingleCheckableGroup.this && child instanceof Checkable) {
((RadioButton) child).setOnCheckedChangeListener(null);
try {
Method m = child.getClass()
.getMethod("setOnCheckedChangeListener", CompoundButton.OnCheckedChangeListener.class);
m.invoke(child, (Object[]) null);
} catch (Exception e) {
Log.e(TAG, "");
}
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewRemoved(parent, child);
}
}
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_search_select" android:state_checked="true"/>
<item android:drawable="@drawable/bg_search_unselect" android:state_checked="false"/>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#FFFFFF" android:state_checked="true"/>
<item android:color="#333333" android:state_checked="false"/>
</selector>

View File

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

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="62dp" android:height="27dp">
<shape android:shape="rectangle">
<solid android:color="#ffa279e4" />
<corners android:topLeftRadius="14dp" android:topRightRadius="14dp" android:bottomLeftRadius="14dp" android:bottomRightRadius="14dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="62dp" android:height="27dp">
<shape android:shape="rectangle">
<solid android:color="#fff1f1f1" />
<corners android:topLeftRadius="14dp" android:topRightRadius="14dp" android:bottomLeftRadius="14dp" android:bottomRightRadius="14dp" />
</shape>
</item>
</selector>

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<include
android:id="@+id/include3"
layout="@layout/view_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/age_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include3">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="年龄"
android:textColor="#333333"
android:textSize="16sp" />
<com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup
android:id="@+id/age_radio_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal"
app:alignContent="stretch"
app:alignItems="stretch"
app:flexWrap="wrap"
app:justifyContent="flex_start"
app:layout_wrapBefore="true"
app:maxLine="3">
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="全部"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="18-25"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="26-30"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="31-35"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="36-40"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="40以上"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
</com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/sex_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/age_layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="性别"
android:textColor="#333333"
android:textSize="16sp" />
<com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup
android:id="@+id/sex_radio_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal"
app:alignContent="stretch"
app:alignItems="stretch"
app:flexWrap="wrap"
app:justifyContent="flex_start"
app:layout_wrapBefore="true"
app:maxLine="3">
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="全部"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="男"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="女"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
</com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/auth_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sex_layout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="是否完成真人认证"
android:textColor="#333333"
android:textSize="16sp" />
<com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup
android:id="@+id/auth_radio_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal"
app:alignContent="stretch"
app:alignItems="stretch"
app:flexWrap="wrap"
app:justifyContent="flex_start"
app:layout_wrapBefore="true"
app:maxLine="3">
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="已完成"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
<RadioButton
android:layout_width="62dp"
android:layout_height="27dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_home_search_btn"
android:button="@null"
android:gravity="center"
android:text="未完成"
android:textColor="@drawable/bg_home_search_text"
android:textSize="14sp" />
</com.shayu.onetoone.widget.flexboxradiogroup.FlexBoxRadioGroup>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -56,8 +56,10 @@
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_1" android:id="@+id/avatar_1"
android:layout_width="60dp" android:layout_width="50dp"
android:layout_height="60dp" android:src="@drawable/m_chu_xia"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:riv_oval="true" /> app:riv_oval="true" />
@ -69,9 +71,8 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_centerHorizontal="true" android:layout_marginTop="10dp"
android:layout_centerVertical="true" android:src="@mipmap/ic_home_rank_top_1" />
android:layout_marginTop="10dp" />
<RelativeLayout <RelativeLayout
android:layout_width="66dp" android:layout_width="66dp"
@ -188,8 +189,9 @@
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_2" android:id="@+id/avatar_2"
android:layout_width="66dp" android:layout_width="50dp"
android:layout_height="66dp" android:layout_height="50dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:riv_border_color="#B6B6B6" app:riv_border_color="#B6B6B6"
app:riv_border_width="2dp" app:riv_border_width="2dp"
@ -321,8 +323,9 @@
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_3" android:id="@+id/avatar_3"
android:layout_width="66dp" android:layout_width="50dp"
android:layout_height="66dp" android:layout_height="50dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:riv_border_color="#B6B6B6" app:riv_border_color="#B6B6B6"
app:riv_border_width="2dp" app:riv_border_width="2dp"

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="84dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_home_recommend_item">
<TextView
android:id="@+id/rank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:textColor="#53438C"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
tools:text="4" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="60dp"
android:layout_marginStart="12dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/rank"
app:layout_constraintTop_toTopOf="parent">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop"
android:src="@drawable/m_chu_xia"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:riv_oval="true" />
<ImageView
android:id="@+id/sex"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@mipmap/ic_message_tab_woman" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="7dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/follow"
app:layout_constraintStart_toEndOf="@+id/constraintLayout"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:orientation="horizontal">
<TextView
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#333333"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="48dp"
android:layout_height="15dp"
android:layout_marginStart="3dp"
android:background="@mipmap/bg_home_hot_live"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/user_name"
app:layout_constraintStart_toStartOf="@+id/user_name">
<ImageView
android:id="@+id/ic_level"
android:layout_width="10dp"
android:layout_height="12dp"
android:layout_marginStart="5dp"
app:srcCompat="@mipmap/ic_home_hot_woman" />
<TextView
android:id="@+id/level"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:text="LV.21"
android:textColor="#FFF"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center"
app:srcCompat="@mipmap/ic_drill" />
<TextView
android:id="@+id/money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="139999992"
android:textColor="#999999"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/follow"
android:layout_width="54dp"
android:layout_height="23dp"
android:background="@drawable/bg_message_msg_bar_follow"
android:text="关注"
android:textColor="#FFFFFF"
android:layout_marginEnd="34dp"
android:textSize="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -14,10 +14,10 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:src="@mipmap/ic_msg_audio"
app:layout_constraintBottom_toTopOf="@+id/linearLayout2" app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/rc_ext_toggle_voice" />
<EditText <EditText
android:id="@+id/edit_btn" android:id="@+id/edit_btn"

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/btn_back"
android:layout_width="14dp"
android:layout_height="23dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="@+id/linearLayout4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_back" />
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="0dp"
android:layout_marginEnd="17dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="22dp"
android:paddingRight="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/btn_back"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/bg_search_input_2"
android:orientation="horizontal">
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_search" />
<EditText
android:id="@+id/edit"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search_hint"
android:imeActionLabel="@string/search"
android:imeOptions="actionSearch"
android:paddingLeft="8dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="搜索"
android:textColor="#A27AE5"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="FlexBoxRadioGroup">
<!-- The id of the child radio button that should be checked by default
within this radio group. -->
<attr name="uiCheckedButton" format="integer" />
</declare-styleable>
</resources>

View File

@ -24,4 +24,7 @@
<style name="TransparentTheme" parent="Theme.AppCompat.NoActionBar"> <style name="TransparentTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
</style> </style>
<style name="HomeSearchRadio" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/bg_home_search_btn</item>
</style>
</resources> </resources>