diff --git a/BaseModule/src/main/res/mipmap-hdpi/icon_guild_bg.png b/BaseModule/src/main/res/mipmap-hdpi/icon_guild_bg.png new file mode 100644 index 00000000..cb3e3466 Binary files /dev/null and b/BaseModule/src/main/res/mipmap-hdpi/icon_guild_bg.png differ diff --git a/BaseModule/src/main/res/mipmap-xhdpi/icon_guild_bg.png b/BaseModule/src/main/res/mipmap-xhdpi/icon_guild_bg.png new file mode 100644 index 00000000..edc3ab31 Binary files /dev/null and b/BaseModule/src/main/res/mipmap-xhdpi/icon_guild_bg.png differ diff --git a/BaseModule/src/main/res/mipmap-xxhdpi/icon_guild_bg.png b/BaseModule/src/main/res/mipmap-xxhdpi/icon_guild_bg.png new file mode 100644 index 00000000..746ade11 Binary files /dev/null and b/BaseModule/src/main/res/mipmap-xxhdpi/icon_guild_bg.png differ diff --git a/MainModule/src/main/java/com/xscm/modulemain/activity/user/fragment/UserHomepageFragment.java b/MainModule/src/main/java/com/xscm/modulemain/activity/user/fragment/UserHomepageFragment.java index 826a1ff3..355384f1 100644 --- a/MainModule/src/main/java/com/xscm/modulemain/activity/user/fragment/UserHomepageFragment.java +++ b/MainModule/src/main/java/com/xscm/modulemain/activity/user/fragment/UserHomepageFragment.java @@ -1,13 +1,20 @@ package com.xscm.modulemain.activity.user.fragment; +import static android.view.View.GONE; +import static android.view.View.VISIBLE; + import android.content.Intent; +import android.content.res.ColorStateList; import android.graphics.Color; import android.os.Bundle; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -16,6 +23,8 @@ import androidx.recyclerview.widget.GridLayoutManager; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; +import com.google.android.flexbox.FlexboxLayout; +import com.xscm.modulemain.Application; import com.xscm.modulemain.R; import com.xscm.modulemain.databinding.FragmentUserHompageBinding; import com.tencent.imsdk.v2.V2TIMConversation; @@ -46,8 +55,6 @@ public class UserHomepageFragment extends BaseMvpFragment list; private String userId; private UserInfo userInfo; - private BaseQuickAdapter adapter; - private List userTagBeans = new ArrayList<>(); private int type; @Override @@ -107,7 +114,7 @@ public class UserHomepageFragment extends BaseMvpFragment images = userInfo.getIcon(); // 获取图片列表 - - for (String url : images) { - if (url.contains("http")) { - ImageView imageView = new ImageView(getContext()); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( - getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_57), - getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15) - ); - params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距 - imageView.setLayoutParams(params); - imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); - - // 使用 Glide 加载图片 - ImageUtils.loadHeadCC(url, imageView); - - llContainer.addView(imageView); + // 使用 Glide 加载图片 + ImageUtils.loadHeadCC(url, imageView1,params); + mBinding.headerInfo.flexEntry.addView(imageView1); + } } + }else { + mBinding.headerInfo.flexEntry.setVisibility(GONE); } - mBinding.headerInfo.recycleView2.setLayoutManager(new GridLayoutManager(getContext(), 3)); - adapter = new BaseQuickAdapter(R.layout.item_tag, userTagBeans) { - - - @Override - protected void convert(BaseViewHolder helper, UserTagBean item) { - helper.setText(R.id.tv, item.getTag_name()); - - } - - }; - mBinding.headerInfo.recycleView2.setAdapter(adapter); if (userInfo != null) { - if (userInfo.getTag_list() != null && !userInfo.getTag_list().isEmpty()) { - adapter.setNewData(userInfo.getTag_list()); + for (UserTagBean tagBean : userInfo.getTag_list()) { + TextView textView = new TextView(Application.getInstance()); + textView.setBackground(getResources().getDrawable(R.drawable.shape_15)); + textView.setTextSize(12); + textView.setPadding(30, 10, 30, 10); + textView.setText(tagBean.getTag_name()); + textView.setTextColor(Color.parseColor("#FF3ABC6D")); + textView.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#1A3ABC6D"))); + + FlexboxLayout.LayoutParams params = new FlexboxLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ); + + params.setMargins(0, 15, 15, 0); + textView.setLayoutParams( params); + mBinding.headerInfo.flexText.addView(textView); + } } } @@ -185,19 +195,91 @@ public class UserHomepageFragment extends BaseMvpFragment= 10000) { + mBinding.headerInfo.tvCpNum.setText(String.format("%.2fw", xd / 10000.0f)); + } else { + mBinding.headerInfo.tvCpNum.setText(String.valueOf(xd)); + } + + mBinding.headerInfo.cpAnim.setSource(userInfo.getCp_info().pendant, 1); + + + ImageUtils.loadHeadCC(userInfo.getCp_info().user_info1.avatar, mBinding.headerInfo.ivCp1); + ImageUtils.loadHeadCC(userInfo.getCp_info().user_info2.avatar, mBinding.headerInfo.ivCp2); + ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.WRAP_CONTENT, + ConstraintLayout.LayoutParams.WRAP_CONTENT); + //挂件上的头像位置:0-上,1-右上,2-右,3-右下,4-下,5-左下,6-左,7-左上' + switch (Integer.parseInt(userInfo.getCp_info().direction)) { + case 0: + params.startToStart = ConstraintLayout.LayoutParams.PARENT_ID; + params.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID; + params.bottomToTop = mBinding.headerInfo.topGuideline.getId(); + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.HORIZONTAL); + break; + case 1: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.VERTICAL); + params.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID; + params.topToTop = ConstraintLayout.LayoutParams.PARENT_ID; + break; + case 2: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.VERTICAL); + params.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID; + params.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID; + params.topToTop = ConstraintLayout.LayoutParams.PARENT_ID; + break; + case 3: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.VERTICAL); + params.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID; + params.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID; + break; + case 4: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.HORIZONTAL); + params.startToStart = ConstraintLayout.LayoutParams.PARENT_ID; + params.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID; + params.topToBottom = mBinding.headerInfo.bottomGuideline.getId(); + params.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID; + break; + case 5: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.VERTICAL); + params.startToStart = ConstraintLayout.LayoutParams.PARENT_ID; + params.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID; + break; + case 6: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.VERTICAL); + params.startToStart = ConstraintLayout.LayoutParams.PARENT_ID; + params.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID; + params.topToTop = ConstraintLayout.LayoutParams.PARENT_ID; + break; + case 7: + mBinding.headerInfo.llCpAnimAvatar.setOrientation(LinearLayout.VERTICAL); + params.startToStart = ConstraintLayout.LayoutParams.PARENT_ID; + params.topToTop = ConstraintLayout.LayoutParams.PARENT_ID; + break; + } + mBinding.headerInfo.llCpAnimAvatar.setLayoutParams(params); + } + } private void refreshView() { if (SpUtil.getUserId() == userInfo.getUser_id()) { mBinding.headerInfo.tvGsSx.setVisibility(View.GONE); @@ -207,19 +289,18 @@ public class UserHomepageFragment extends BaseMvpFragment= 10000) { + mBinding.tvCpNum.setText(String.format("%.2fw", xd / 10000.0f)); + } else { + mBinding.tvCpNum.setText(String.valueOf(xd)); + } mBinding.cpAnim.setSource(userInfo.getCp_info().pendant, 1); diff --git a/MainModule/src/main/res/layout/fragment_room_user_info.xml b/MainModule/src/main/res/layout/fragment_room_user_info.xml index 5baa7585..0a9d7529 100644 --- a/MainModule/src/main/res/layout/fragment_room_user_info.xml +++ b/MainModule/src/main/res/layout/fragment_room_user_info.xml @@ -295,7 +295,7 @@ android:id="@+id/bottom_guideline" android:layout_width="@dimen/dp_1" android:orientation="horizontal" - app:layout_constraintGuide_percent="0.65" + app:layout_constraintGuide_percent="0.62" android:layout_height="0dp"/> diff --git a/MainModule/src/main/res/layout/fragment_user_hompage.xml b/MainModule/src/main/res/layout/fragment_user_hompage.xml index 7e574f41..010c11ba 100644 --- a/MainModule/src/main/res/layout/fragment_user_hompage.xml +++ b/MainModule/src/main/res/layout/fragment_user_hompage.xml @@ -10,7 +10,6 @@ diff --git a/MainModule/src/main/res/layout/user_top.xml b/MainModule/src/main/res/layout/user_top.xml index b0a7d885..fb9bbeaf 100644 --- a/MainModule/src/main/res/layout/user_top.xml +++ b/MainModule/src/main/res/layout/user_top.xml @@ -7,65 +7,102 @@ - + android:clipChildren="false" + android:orientation="vertical"> - - + android:background="@drawable/bg_r16_fff" + android:clipChildren="false" + android:clipToPadding="false" + android:paddingHorizontal="@dimen/dp_15" + android:paddingBottom="@dimen/dp_10"> + android:layout_height="@dimen/dp_74" + android:layout_marginTop="-20dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + app:isShine="false" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/riv_user_head" + tools:text="User Name" /> - + + + + + + + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tv_nick_name" + app:layout_goneMarginTop="@dimen/dp_5"> + android:visibility="gone" /> + android:src="@mipmap/beautiful" + app:layout_constraintStart_toEndOf="@+id/tv_copy" + app:layout_constraintTop_toTopOf="@+id/tv_copy" /> - - - - - - - - - - - - + app:alignContent="flex_start" + app:alignItems="flex_start" + app:flexWrap="wrap" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/ll_id" /> - - android:id="@+id/recycle_view2" + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_height="wrap_content" + android:background="@mipmap/icon_dialog_u_cp_left_top" + android:gravity="center" + android:text="CP" + android:textColor="@color/white" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file