From 10adb603033e9bd0b0fabdbd15ce5d6f0ea87d3f Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Thu, 29 Aug 2024 13:59:11 +0800 Subject: [PATCH] =?UTF-8?q?UI=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/CommonAppConfig.java | 37 +- .../common/views/DividerItemDecoration.java | 55 ++ .../res/layout/rc_conversationlist_item.xml | 57 +- common/src/main/res/values/colors.xml | 2 + .../main/adapter/MainMeBottomAdapter.java | 130 +++++ .../com/yunbao/main/http/MainHttpUtil.java | 37 +- .../yunbao/main/views/MainMeViewHolder.java | 48 +- .../yunbao/main/views/MainMeViewHolder1.java | 502 ------------------ main/src/main/res/layout/item_main_me_2.xml | 6 +- main/src/main/res/layout/item_main_me_3.xml | 33 ++ .../main/res/layout/view_main_home_com.xml | 8 +- main/src/main/res/layout/view_main_me.xml | 52 +- .../src/main/res/layout/view_main_message.xml | 89 ++-- 13 files changed, 424 insertions(+), 632 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/views/DividerItemDecoration.java create mode 100644 main/src/main/java/com/yunbao/main/adapter/MainMeBottomAdapter.java delete mode 100644 main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java create mode 100644 main/src/main/res/layout/item_main_me_3.xml diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index 04756b1b8..647ac2fdb 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.FansMedalBean; +import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.NewCommunityType; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserItemBean; @@ -537,38 +538,32 @@ public class CommonAppConfig { * 个人中心功能列表 */ public List getUserItemList() { - if (mUserItemList == null || mUserItemList.size() == 0) { String userBeanJson = SpUtil.getInstance().getStringValue(SpUtil.USER_INFO); if (!TextUtils.isEmpty(userBeanJson)) { JSONObject obj = JSON.parseObject(userBeanJson); if (obj != null) { - setUserItemList(obj.getString("list")); + setUserItemList(obj.getString("pdl_list")); } } + return mUserItemList; + } + + /** + * 个人中心功能列表 新 + */ + public List getUserItemNewList() { + String userBeanJson = SpUtil.getInstance().getStringValue(SpUtil.USER_INFO); + if (!TextUtils.isEmpty(userBeanJson)) { + JSONObject obj = JSON.parseObject(userBeanJson); + if (obj != null) { + setUserItemList(obj.getString("pdl_settings")); + } } return mUserItemList; } - public void setUserItemList(String listString) { - UserItemBean[][] arr = JSON.parseObject(listString, UserItemBean[][].class); - if (arr != null && arr.length > 0) { - List newList = new ArrayList<>(); - for (int i = 0, length1 = arr.length; i < length1; i++) { - for (int j = 0, length2 = arr[i].length; j < length2; j++) { - UserItemBean bean = arr[i][j]; - if (j == length2 - 1) { - if (i < length1 - 1) { - bean.setGroupLast(true); - } else { - bean.setAllLast(true); - } - } - newList.add(bean); - } - } - mUserItemList = newList; - } + mUserItemList = JSON.parseArray(listString, UserItemBean.class); } diff --git a/common/src/main/java/com/yunbao/common/views/DividerItemDecoration.java b/common/src/main/java/com/yunbao/common/views/DividerItemDecoration.java new file mode 100644 index 000000000..90f1be6db --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/DividerItemDecoration.java @@ -0,0 +1,55 @@ +package com.yunbao.common.views; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.view.View; + +import androidx.recyclerview.widget.RecyclerView; + +/** + * Created by cxf on 2018/1/27. + * RecyclerView顶部渐变的itemDecoration + */ + +public class DividerItemDecoration extends RecyclerView.ItemDecoration { + + private Drawable mDivider; + + public DividerItemDecoration(Context context, int dividerHeight, int dividerColor) { + // 创建一个带有颜色和高度的Drawable作为分割线 + mDivider = new ColorDrawable(dividerColor); + // 如果你想让分割线有一定的内边距(比如左右边距),可以使用LayerDrawable或自定义Drawable + // 这里简单起见,我们只设置高度 + mDivider.setBounds(0, 0, 0, dividerHeight); + } + + @Override + public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { + drawVertical(c, parent); + } + + private void drawVertical(Canvas c, RecyclerView parent) { + final int left = parent.getPaddingLeft(); + final int right = parent.getWidth() - parent.getPaddingRight(); + + final int childCount = parent.getChildCount(); + for (int i = 0; i < childCount - 1; i++) { + final View child = parent.getChildAt(i); + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); + final int top = child.getBottom() + params.bottomMargin; + final int bottom = top + mDivider.getIntrinsicHeight(); + + mDivider.setBounds(left, top, right, bottom); + mDivider.draw(c); + } + } + + @Override + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { + if (mDivider == null) return; + outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); + } +} diff --git a/common/src/main/res/layout/rc_conversationlist_item.xml b/common/src/main/res/layout/rc_conversationlist_item.xml index 30703b211..7b5a808c5 100644 --- a/common/src/main/res/layout/rc_conversationlist_item.xml +++ b/common/src/main/res/layout/rc_conversationlist_item.xml @@ -27,30 +27,6 @@ android:scaleType="centerCrop" android:src="@mipmap/beauty_jingbai" /> - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values/colors.xml b/common/src/main/res/values/colors.xml index 64d247c68..67bdd1d45 100644 --- a/common/src/main/res/values/colors.xml +++ b/common/src/main/res/values/colors.xml @@ -78,4 +78,6 @@ #F6F7FB #F4F4F4 + + #FFEFEFEF diff --git a/main/src/main/java/com/yunbao/main/adapter/MainMeBottomAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainMeBottomAdapter.java new file mode 100644 index 000000000..1efb76f07 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/adapter/MainMeBottomAdapter.java @@ -0,0 +1,130 @@ +package com.yunbao.main.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.bean.UserItemBean; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.main.R; + +import java.util.List; + +/** + * Created by cxf on 2018/9/28. + */ + +public class MainMeBottomAdapter extends RecyclerView.Adapter { + + private static final int NORMAL = 0; + private static final int GROUP_LAST = 1; + private static final int ALL_LAST = 2; + + private Context mContext; + private List mList; + private LayoutInflater mInflater; + private OnItemClickListener mOnItemClickListener; + + public MainMeBottomAdapter(Context context, List list) { + mContext = context; + mList = list; + mInflater = LayoutInflater.from(context); + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + mOnItemClickListener = onItemClickListener; + } + + @Override + public int getItemViewType(int position) { + UserItemBean bean = mList.get(position); + if (bean.isGroupLast()) { + return GROUP_LAST; + } else if (bean.isAllLast()) { + return ALL_LAST; + } else { + return NORMAL; + } + } + + + public void setList(List list) { + if (list == null) { + return; + } + boolean changed = false; + if (mList.size() != list.size()) { + changed = true; + } else { + for (int i = 0, size = mList.size(); i < size; i++) { + if (!mList.get(i).equals(list.get(i))) { + changed = true; + break; + } + } + } + if (changed) { + mList = list; + notifyDataSetChanged(); + } + } + + @NonNull + @Override + public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + int res = 0; +// if (viewType == GROUP_LAST) { +// res = R.layout.item_main_me_1;//竖向单列表 +// } else if (viewType == ALL_LAST) { + res = R.layout.item_main_me_3;//横向4列 +// } else { +// res = R.layout.item_main_me_0; +// } + return new Vh(mInflater.inflate(res, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull Vh vh, int position) { + vh.setData(mList.get(position)); + } + + @Override + public int getItemCount() { + return mList.size(); + } + + class Vh extends RecyclerView.ViewHolder { + + ImageView mThumb; + TextView mName; + + public Vh(View itemView) { + super(itemView); + mThumb = (ImageView) itemView.findViewById(R.id.thumb); + mName = (TextView) itemView.findViewById(R.id.name); + ViewClicksAntiShake.clicksAntiShake(itemView, () -> { + Object tag = itemView.getTag(); + if (tag != null) { + UserItemBean bean = (UserItemBean) tag; + if (mOnItemClickListener != null) { + mOnItemClickListener.onItemClick(bean, 0); + } + } + }); + } + + void setData(UserItemBean bean) { + itemView.setTag(bean); + ImgLoader.display(mContext, bean.getThumb(), mThumb); + mName.setText(bean.getName()); + } + } +} diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index b66332705..0ca7e7658 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -51,7 +51,7 @@ public class MainHttpUtil { .params("pushid", "") .params("lastlogindevice", "Android") .params("uuid_Device", uuid) - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -85,7 +85,7 @@ public class MainHttpUtil { * 第三方登录---增加参数:推广码,手机唯一标识 */ - public static void loginByThird(String UserID,String openid, String promoCode, String uuidDevice, String nicename, String avatar, String type, HttpCallback callback) { + public static void loginByThird(String UserID, String openid, String promoCode, String uuidDevice, String nicename, String avatar, String type, HttpCallback callback) { String sign = MD5Util.getMD5("openid=" + openid + "&" + SALT); String appSource = "2"; if (CommonAppConfig.IS_GOOGLE_PLAY == 0) { @@ -106,7 +106,7 @@ public class MainHttpUtil { .params("sign", sign) .params("lastlogindevice", "Android") .params("pushid", "") - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -255,6 +255,7 @@ public class MainHttpUtil { */ public static void getBaseInfo(String uid, String token, final CommonCallback commonCallback) { HttpClient.getInstance().get("User.getBaseInfos", MainHttpConsts.GET_BASE_INFO) + .params("is_pdl", "1") .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -265,7 +266,7 @@ public class MainHttpUtil { bean.setMedalName(obj.getString("medal_name")); bean.setMedalLevel(obj.getIntValue("medal_level")); CommonAppConfig.getInstance().setUserBean(bean); - CommonAppConfig.getInstance().setUserItemList(obj.getString("list")); + CommonAppConfig.getInstance().setUserItemList(obj.getString("pdl_list")); SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, info[0]); if (commonCallback != null) { commonCallback.callback(bean); @@ -338,7 +339,7 @@ public class MainHttpUtil { public static void getSettingList(HttpCallback callback) { HttpClient.getInstance().get("User.getPerSetting", MainHttpConsts.GET_SETTING_LIST) .params("version", VersionUtil.getVersion()) - .params("package_name","panduo") + .params("package_name", "panduo") .execute(callback); } @@ -352,10 +353,11 @@ public class MainHttpUtil { .params("p", p) .execute(callback); } + /** * 搜索 */ - public static void searchnew(String fan_key, String jian_key,int type, int p, HttpCallback callback) { + public static void searchnew(String fan_key, String jian_key, int type, int p, HttpCallback callback) { HttpClient.getInstance().get("", MainHttpConsts.SEARCH) .params("jian_key", jian_key) .params("fan_key", fan_key) @@ -514,7 +516,7 @@ public class MainHttpUtil { .params("mobile", mobile) .params("sign", sign) .params("source", "1") - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -537,7 +539,7 @@ public class MainHttpUtil { .params("MacAddress", macUitl.getNewMac()) .params("Imei", uuid) .params("source", "1") - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -585,7 +587,7 @@ public class MainHttpUtil { /** * 手机注册接口---增加参数:推广码,手机唯一标识,国家代码 */ - public static void register(String UserID,String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) { + public static void register(String UserID, String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) { String appSource = "2"; if (CommonAppConfig.IS_GOOGLE_PLAY == 0) { appSource = "2"; @@ -608,7 +610,7 @@ public class MainHttpUtil { .params("code", code) .params("source", DEVICE) .params("invitation_code", invitecode) - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -621,7 +623,7 @@ public class MainHttpUtil { .params("user_pass", pass) .params("user_pass2", pass2) .params("code", code) - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -647,7 +649,7 @@ public class MainHttpUtil { .params("mobile", mobile) .params("country_code", country_code) .params("source", "1") - .params("langue", WordUtil.isNewZh()?"chinese":"english") + .params("langue", WordUtil.isNewZh() ? "chinese" : "english") .execute(callback); } @@ -702,7 +704,6 @@ public class MainHttpUtil { } - /** * 是否是主播 */ @@ -742,9 +743,10 @@ public class MainHttpUtil { HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR) .execute(callback); } - // - public static void setMessageReadAll(){ - HttpClient.getInstance().get("User.getUserInstructor","") + + // + public static void setMessageReadAll() { + HttpClient.getInstance().get("User.getUserInstructor", "") .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -752,10 +754,11 @@ public class MainHttpUtil { } }); } + /** * 获取设备号有没有注册过 */ - public static void getDeviceLoginType( HttpCallback callback) { + public static void getDeviceLoginType(HttpCallback callback) { HttpClient.getInstance().get("Login.getDeviceLoginType", "Login.getDeviceLoginType") .params("uuid_Device", DeviceUtils.getUniqueDeviceId()) .execute(callback); diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index 3bc6df0d3..16c05f17c 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -18,6 +18,7 @@ import android.widget.TextView; import android.widget.Toast; import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; @@ -51,6 +52,7 @@ import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsMainViewHolder; +import com.yunbao.common.views.DividerItemDecoration; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.activity.LiveRecordActivity; import com.yunbao.live.activity.RoomManageActivity; @@ -70,6 +72,7 @@ import com.yunbao.main.activity.SettingActivity; import com.yunbao.main.activity.ThreeDistributActivity; import com.yunbao.main.activity.ZhuangBanActivity; import com.yunbao.main.adapter.MainMeAdapter; +import com.yunbao.main.adapter.MainMeBottomAdapter; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; @@ -101,7 +104,9 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi private TextView mFans; private boolean mPaused; private RecyclerView mRecyclerView; + private RecyclerView bottomRecyclerView; private MainMeAdapter mAdapter; + private MainMeBottomAdapter mainMeBottomAdapter; private TextView signature; private TextView coin, gold, star_coin;//金豆,钻石,星币 private TextView btnCopy; @@ -193,6 +198,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)); + banner_me.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { @@ -206,6 +212,11 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); } }); + + bottomRecyclerView = findViewById(R.id.bottomRecyclerView); + bottomRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + bottomRecyclerView.addItemDecoration(new DividerItemDecoration(mContext,1,mContext.getColor(R.color.gray_8A8A8A))); + } @Override @@ -289,15 +300,16 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi @Override public void callback(UserBean bean) { List list = CommonAppConfig.getInstance().getUserItemList(); + List newList = CommonAppConfig.getInstance().getUserItemNewList(); if (bean != null) { - showData(bean, list); + showData(bean, list,newList); } } }; private List mBannerListNew = new ArrayList<>(); - private void showData(UserBean u, List list) { + private void showData(UserBean u, List list,List newList) { mBannerList.clear(); mBannerListNew.clear(); if (!StringUtil.isEmpty(u.getSlide())) { @@ -364,7 +376,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi good_nub_ico.setImageResource(R.mipmap.usercard_good_nub); - ImgLoader.display(mContext, R.mipmap.icon_zhubolv, img_lv_pic); + //ImgLoader.display(mContext, R.mipmap.icon_zhubolv, img_lv_pic); //主播等级 tv_level.setOnClickListener(new View.OnClickListener() { @Override @@ -427,6 +439,14 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } else { mAdapter.setList(listNow); } + + if (mainMeBottomAdapter == null) { + mainMeBottomAdapter = new MainMeBottomAdapter(mContext, newList); + mainMeBottomAdapter.setOnItemClickListener(this); + bottomRecyclerView.setAdapter(mainMeBottomAdapter); + } else { + mainMeBottomAdapter.setList(newList); + } } if (beanKefu != null) { } @@ -472,6 +492,20 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi case 17: RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); break; + case 66: + MobclickAgent.onEvent(mContext, "my_noble", "个人中心点贵族"); + Constants.isTitle = true; + UserBean u = CommonAppConfig.getInstance().getUserBean(); + String url1 = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); + ZhuangBanActivity.forward(mContext, url1, false); + break; + case 67: + MobclickAgent.onEvent(mContext, "my_guard_btn", "我的-守护点击次数及人数"); + Constants.isTitle = true; + String url2 = CommonAppConfig.HOST + "/h5/Guard/index.html?token=" + CommonAppConfig.getInstance().getToken() + + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); + ZhuangBanActivity.forward(mContext, url2, false); + break; } } else { //21 在线客服 @@ -638,7 +672,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi lt_advertisement.setVisibility(View.GONE); return; } - lt_advertisement.setVisibility(View.VISIBLE); + /*lt_advertisement.setVisibility(View.VISIBLE); if (mBannerList.size() == 1) { banner_me.setAutoPlay(false) .setPages(mBannerList, new CustomMyViewHolder()) @@ -685,18 +719,18 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi map_ekv.put("link", url); MobclickAgent.onEvent(mContext, "my_banner", map_ekv); - /*if(bean.getSlide_id().equals("95")){ + *//*if(bean.getSlide_id().equals("95")){ RouteUtil.forwardCustomerService(url); }else { ZhuangBanActivity.forward(mContext, url, false); - }*/ + }*//* } } } } }) .start(); - } + }*/ } } diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java deleted file mode 100644 index 446c466d1..000000000 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java +++ /dev/null @@ -1,502 +0,0 @@ -package com.yunbao.main.views; - -import android.content.ClipboardManager; -import android.content.Context; -import android.content.Intent; -import android.graphics.drawable.Drawable; -import android.text.TextUtils; -import android.util.Log; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.RelativeLayout; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.opensource.svgaplayer.SVGADrawable; -import com.opensource.svgaplayer.SVGAImageView; -import com.opensource.svgaplayer.SVGAParser; -import com.opensource.svgaplayer.SVGAVideoEntity; -import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.Constants; -import com.yunbao.common.activity.WebViewActivity; -import com.yunbao.common.bean.GoogleBean; -import com.yunbao.common.bean.NewLevelModel; -import com.yunbao.common.bean.UserBean; -import com.yunbao.common.bean.UserItemBean; -import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.interfaces.CommonCallback; -import com.yunbao.common.interfaces.OnItemClickListener; -import com.yunbao.common.manager.NewLevelManager; -import com.yunbao.common.utils.RouteUtil; -import com.yunbao.common.utils.SVGAViewUtils; -import com.yunbao.common.utils.WordUtil; -import com.yunbao.common.views.AbsMainViewHolder; -import com.yunbao.live.activity.LiveRecordActivity; -import com.yunbao.live.activity.RoomManageActivity; -import com.yunbao.live.activity.WebViewActivityMedal; -import com.yunbao.live.utils.LiveTextRender; -import com.yunbao.main.R; -import com.yunbao.main.activity.EditProfileActivity; -import com.yunbao.main.activity.FansActivity; -import com.yunbao.main.activity.FollowActivity; -import com.yunbao.main.activity.MyProfitActivity; -import com.yunbao.main.activity.MyVideoActivity; -import com.yunbao.main.activity.MyWalletActivity; -import com.yunbao.main.activity.RewardActivity; -import com.yunbao.main.activity.SettingActivity; -import com.yunbao.main.activity.ThreeDistributActivity; -import com.yunbao.main.activity.ZhuangBanActivity; -import com.yunbao.main.adapter.MainMeAdapter; -import com.yunbao.main.http.MainHttpConsts; -import com.yunbao.main.http.MainHttpUtil; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by cxf on 2018/9/22. - * 我的 - */ - -public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickListener, View.OnClickListener { - - private ImageView mAvatar, mSex, mLevelAnchor, mLevel; - - private TextView mName, tv_level, mID; - private ImageView img_kefu, img_setting; - private RelativeLayout rt_kefu, rt_setting; - private boolean mPaused; - private RecyclerView mRecyclerView; - private MainMeAdapter mAdapter; - private TextView signature; - private TextView coin, gold;//金豆,钻石 - private TextView btnCopy; - private SVGAImageView gift_svga; - private View v_noble; - // private LinearLayout btnUserNoble; - private ImageView user_noble_ico, good_nub_ico; - private TextView user_noble_text, leave; - private UserItemBean beanStetting = null, beanKefu = null; - private boolean firstInto = true; - - public MainMeViewHolder1(Context context, ViewGroup parentView) { - super(context, parentView); - } - - @Override - protected int getLayoutId() { - return R.layout.view_main_me1; - } - - @Override - public void init() { - mAvatar = (ImageView) findViewById(R.id.avatar); - mAvatar.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 0); - } - }); - - mName = (TextView) findViewById(R.id.name); - gift_svga = (SVGAImageView) findViewById(com.yunbao.live.R.id.gift_svga); - gift_svga.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 0); - } - }); - - user_noble_ico = (ImageView) findViewById(R.id.user_noble_ico); -// mSex = (ImageView) findViewById(R.id.sex); - mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); - mLevel = (ImageView) findViewById(R.id.level); - tv_level = (TextView) findViewById(R.id.tv_level); - good_nub_ico = (ImageView) findViewById(R.id.good_nub_ico); - mID = (TextView) findViewById(R.id.id_val); -// mFollow = (TextView) findViewById(R.id.btn_follow); -// mFans = (TextView) findViewById(R.id.btn_fans); - signature = (TextView) findViewById(R.id.signature); - coin = (TextView) findViewById(R.id.coin); - gold = (TextView) findViewById(R.id.gold); - btnCopy = (TextView) findViewById(R.id.btn_copy); -// btnUserNoble = (LinearLayout) findViewById(R.id.btn_user_noble); - user_noble_text = (TextView) findViewById(R.id.user_noble_text); - leave = (TextView) findViewById(R.id.leave); - - img_kefu = (ImageView) findViewById(R.id.img_kefu); - img_setting = (ImageView) findViewById(R.id.img_setting); - rt_kefu = (RelativeLayout) findViewById(R.id.rt_kefu); - rt_setting = (RelativeLayout) findViewById(R.id.rt_setting); - - v_noble = (View) findViewById(R.id.v_noble); - -// mFollow.setOnClickListener(this); -// mFans.setOnClickListener(this); - findViewById(R.id.btn_edit).setOnClickListener(this); -// findViewById(R.id.btn_msg).setOnClickListener(this); - findViewById(R.id.btn_wallet).setOnClickListener(this); - findViewById(R.id.btn_coin).setOnClickListener(this); - findViewById(R.id.btn_gold).setOnClickListener(this); - - findViewById(R.id.rt_kefu).setOnClickListener(this); - findViewById(R.id.rt_setting).setOnClickListener(this); - findViewById(R.id.v_noble).setOnClickListener(this); - - //主播等级 - mLevelAnchor.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Level&a=index" + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0") + "&for"; - WebViewActivity.forward(mContext, url, false); - } - }); - //用户等级 - mLevel.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Level&a=index" + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); - WebViewActivity.forward(mContext, url, false); - } - }); - -// btnUserNoble.setOnClickListener(new View.OnClickListener() { -// @Override -// public void onClick(View v) { -// UserBean u = CommonAppConfig.getInstance().getUserBean(); -// String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid(); -// ZhuangBanActivity.forward(mContext, url, false); -// } -// }); - - btnCopy.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - ClipboardManager cm = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE); - cm.setText(mID.getText() + ""); - Toast.makeText(mContext, "複製成功", Toast.LENGTH_SHORT).show(); - } - }); -// findViewById(R.id.btn_detail).setOnClickListener(this); -// findViewById(R.id.btn_shop).setOnClickListener(this); - mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); - mRecyclerView.setHasFixedSize(true); -// mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); - mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false)); -// EventBus.getDefault().register(this); - } - - @Override - public void onPause() { - super.onPause(); - mPaused = true; - } - - @Override - public void onResume() { - super.onResume(); - if (isShowed() && mPaused) { - loadData(); - } - mPaused = false; -// EventBus.getDefault().unregister(this); - } - - @Override - public void onDestroy() { - super.onDestroy(); - MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO); - } - - @Override - public void loadData() { - if (isFirstLoadData()) { - CommonAppConfig appConfig = CommonAppConfig.getInstance(); - UserBean u = appConfig.getUserBean(); - List list = appConfig.getUserItemList(); - if (u != null && list != null) { - showData(u, list); - } - } - - MainHttpUtil.getGoogle(mCallback1); - MainHttpUtil.getBaseInfo(mCallback); - - } - - - //获取谷歌 - //谷歌支付是否打开 1是打开 0 关闭 - String Is_hide = "1"; - private CommonCallback mCallback1 = new CommonCallback() { - @Override - public void callback(GoogleBean bean) { - if (bean != null) { - Is_hide = bean.getIs_hide(); - } - } - }; - - private CommonCallback mCallback = new CommonCallback() { - @Override - public void callback(UserBean bean) { - List list = CommonAppConfig.getInstance().getUserItemList(); - if (bean != null) { - showData(bean, list); - } - } - }; - - private void showData(UserBean u, List list) { - ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar); -// mTtileView.setText(u.getUserNiceName()); - mName.setText(u.getUserNiceName()); - user_noble_text.setText(u.getNoble_name()); -// mSex.setImageResource(CommonIconUtil.getSexIcon(u.getSex())); - coin.setText(u.getYuanbao()); - gold.setText(u.getCoin()); - signature.setText(u.getSignature()); - CommonAppConfig appConfig = CommonAppConfig.getInstance(); - - - if (u.getDress().getAvatar_frame() != null) { - if (u.getDress().getAvatar_frame().contains("svga")) { - try { - new SVGAParser(mContext).parse(new URL(u.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() { - @Override - public void onComplete(SVGAVideoEntity videoItem) { - SVGADrawable drawable = new SVGADrawable(videoItem); - gift_svga.setImageDrawable(drawable); - SVGAViewUtils.playEndClear(gift_svga); - } - - @Override - public void onError() { - } - }); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } else { - ImgLoader.display(mContext, u.getDress().getAvatar_frame(), gift_svga); - } - } - - if (u.getDress().getMedal() != null) { - Log.e("tag", u.getDress().getMedal()); - ImgLoader.display(mContext, u.getDress().getMedal(), user_noble_ico); - } else { - user_noble_ico.setImageResource(R.mipmap.df_nobe); - } - - List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); - int anchorLevel = 0; - - - anchorLevel = u.getLevelAnchor(); - String imgUrl = ""; - for (NewLevelModel newLevelModel : models) { - if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { - imgUrl = newLevelModel.getThumb(); - } - } - leave.setText(String.valueOf(u.getLevelAnchor())); - ImgLoader.display(mContext, imgUrl, mLevelAnchor); - new LiveTextRender().getLevelImage(mContext, u.getLevel(), new ImgLoader.DrawableCallback() { - @Override - public void onLoadSuccess(Drawable drawable) { - ImgLoader.display2(mContext, drawable, mLevel); - } - - @Override - public void onLoadFailed() { - - } - }); - //修改靓号图标 个人中心 - if (u.getGoodnum() != null && !u.getGoodnum().equals("")) { - good_nub_ico.setVisibility(View.VISIBLE); - mID.setText(" " + u.getGoodnum()); - } else { - good_nub_ico.setVisibility(View.GONE); - mID.setText(u.getLiangNameTip()); - } -// mFollow.setText("" + u.getFollows()); -// mFans.setText("" + u.getFans()); - if (list != null && list.size() > 0) { - List listNow = new ArrayList<>(); - for (UserItemBean userItemBean : list) { - if (userItemBean.getId() != 21 && userItemBean.getId() != 13) { - listNow.add(userItemBean); - } else if (userItemBean.getId() == 21) { - beanKefu = userItemBean; - } else if (userItemBean.getId() == 13) { - beanStetting = userItemBean; - } - } - if (mAdapter == null) { - mAdapter = new MainMeAdapter(mContext, listNow); - mAdapter.setOnItemClickListener(this); - mRecyclerView.setAdapter(mAdapter); - } else { - mAdapter.setList(listNow); - } - } - if (beanKefu != null) { - ImgLoader.display(mContext, beanKefu.getThumb(), img_kefu); - } - if (beanStetting != null) { - ImgLoader.display(mContext, beanStetting.getThumb(), img_setting); - } - Constants.myUid = u.getGoodnum(); - Constants.myAvatar = u.getAvatar(); - } - - @Override - public void onItemClick(UserItemBean bean, int position) { - String url = bean.getHref(); - if (TextUtils.isEmpty(url)) { - switch (bean.getId()) { - case 1: - forwardProfit(); - break; - case 2: - forwardCoin(); - break; - case 13: -// forwardSetting(); - break; - case 19: - forwardMyVideo(); - break; - case 20: - forwardRoomManage(); - break; - } - } else { - //21 在线客服 - Log.i("tag", bean.getId() + ""); - if (bean.getId() == 8) {//三级分销 - ThreeDistributActivity.forward(mContext, bean.getName(), url); - } else { - if (bean.getId() == 31) { - //跳转网页版粉丝徽章 - WebViewActivityMedal.forward(mContext, url); - } else if (bean.getId() == 5) { - ZhuangBanActivity.forward(mContext, CommonAppConfig.HOST + "/h5/Personality.html"); - //獎勵中心 - } else if (bean.getId() == 23) { - Log.i("tsa", url); - RewardActivity.forward(mContext, url); - } else { - WebViewActivity.forward(mContext, url, false); - } - - } - } - } - - - @Override - public void onClick(View v) { - int i = v.getId(); - if (i == R.id.btn_edit) { - mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); - } -// else if (i == R.id.btn_follow) { -// forwardFollow(); -// } - else if (i == R.id.btn_fans) { - forwardFans(); -// } else if (i == R.id.btn_msg) { -// ChatActivity.forward(mContext); - } else if (i == R.id.btn_wallet) { - mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0)); - } else if (i == R.id.btn_coin) { - mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 2)); - } else if (i == R.id.btn_gold) { - mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0)); - } else if (i == R.id.rt_kefu) { - WebViewActivity.forward(mContext, beanKefu.getHref(), false); - } else if (i == R.id.rt_setting) { - forwardSetting(); - } else if (i == R.id.v_noble) { - UserBean u = CommonAppConfig.getInstance().getUserBean(); - String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); - ZhuangBanActivity.forward(mContext, url, false); - } - - - } - - /** - * 编辑个人资料 - */ - private void forwardEditProfile() { - mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); - } - - /** - * 我的关注 - */ - private void forwardFollow() { - FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0); - } - - /** - * 我的粉丝 - */ - private void forwardFans() { - FansActivity.forward(mContext, CommonAppConfig.getInstance().getUid()); - } - - /** - * 直播记录 - */ - private void forwardLiveRecord() { - LiveRecordActivity.forward(mContext, CommonAppConfig.getInstance().getUserBean()); - } - - /** - * 我的收益 - */ - private void forwardProfit() { - mContext.startActivity(new Intent(mContext, MyProfitActivity.class)); - } - - /** - * 我的钻石 - */ - private void forwardCoin() { - RouteUtil.forwardMyCoin(mContext); - - } - - /** - * 设置 - */ - private void forwardSetting() { - mContext.startActivity(new Intent(mContext, SettingActivity.class)); - } - - /** - * 我的视频 - */ - private void forwardMyVideo() { - mContext.startActivity(new Intent(mContext, MyVideoActivity.class)); - } - - /** - * 房间管理 - */ - private void forwardRoomManage() { - mContext.startActivity(new Intent(mContext, RoomManageActivity.class)); - } - -} diff --git a/main/src/main/res/layout/item_main_me_2.xml b/main/src/main/res/layout/item_main_me_2.xml index fc4fcb0cb..e169eaef9 100644 --- a/main/src/main/res/layout/item_main_me_2.xml +++ b/main/src/main/res/layout/item_main_me_2.xml @@ -9,8 +9,8 @@ + android:layout_width="32dp" + android:layout_height="32dp" /> diff --git a/main/src/main/res/layout/item_main_me_3.xml b/main/src/main/res/layout/item_main_me_3.xml new file mode 100644 index 000000000..bf672f1c0 --- /dev/null +++ b/main/src/main/res/layout/item_main_me_3.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/main/src/main/res/layout/view_main_home_com.xml b/main/src/main/res/layout/view_main_home_com.xml index 36ecd6f27..429f9a34b 100644 --- a/main/src/main/res/layout/view_main_home_com.xml +++ b/main/src/main/res/layout/view_main_home_com.xml @@ -19,17 +19,15 @@ diff --git a/main/src/main/res/layout/view_main_me.xml b/main/src/main/res/layout/view_main_me.xml index 976538bb0..95d2002d4 100644 --- a/main/src/main/res/layout/view_main_me.xml +++ b/main/src/main/res/layout/view_main_me.xml @@ -163,7 +163,7 @@ android:ellipsize="end" android:maxLines="1" android:text="这个人很懒,什么也没留下。" - android:textColor="@color/gray_cccccc" + android:textColor="#FF777777" android:textSize="11sp" /> + android:textSize="11sp" /> + android:textSize="11sp" /> @@ -323,8 +323,9 @@ @@ -333,7 +334,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" - android:textColor="@color/textColor" + android:textColor="#FF333333" android:textSize="16sp" android:textStyle="bold" /> @@ -374,7 +375,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/coins" - android:textColor="@color/gray1" + android:layout_marginStart="5dp" + android:textColor="#FF333333" android:textSize="14sp" /> @@ -383,7 +385,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" - android:textColor="@color/textColor" + android:textColor="#FF333333" android:textSize="16sp" android:textStyle="bold" /> @@ -424,7 +426,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/golden_bean" - android:textColor="@color/gray1" + android:layout_marginStart="5dp" + android:textColor="#FF333333" android:textSize="14sp" /> @@ -433,7 +436,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" - android:textColor="@color/textColor" + android:textColor="#FF333333" android:textSize="16sp" android:textStyle="bold" /> @@ -630,7 +633,6 @@ android:id="@+id/lt_guard" android:layout_width="0dp" android:layout_height="81dp" - android:layout_marginTop="12dp" android:layout_marginRight="15dp" android:layout_weight="1" @@ -711,7 +713,29 @@ android:paddingRight="6dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + + + @@ -41,7 +41,6 @@ - + + - + - + - + - -