首页添加背景

This commit is contained in:
ningwenqiang 2024-10-31 17:55:27 +08:00
parent 4631bb1a50
commit 7f9d5a5c81
5 changed files with 18 additions and 504 deletions

View File

@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="37dp"> <item android:width="68dp" android:height="37dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#EB6FFF" /> <stroke android:width="1dp" android:color="#FFF5E997" />
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" /> <corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
</shape> </shape>
</item> </item>

View File

@ -54,7 +54,7 @@
android:paddingEnd="3dp" android:paddingEnd="3dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:singleLine="true" android:singleLine="true"
android:textColor="#EC70FD" android:textColor="#FF9C7512"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:textSize="10sp" android:textSize="10sp"
app:layout_constraintTop_toTopOf="@+id/rc_conversation_title" app:layout_constraintTop_toTopOf="@+id/rc_conversation_title"

View File

@ -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<UserItemBean>, 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 + "/h5/Level/index.html?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 + "/h5/Level/index.html?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<UserItemBean> 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<GoogleBean> mCallback1 = new CommonCallback<GoogleBean>() {
@Override
public void callback(GoogleBean bean) {
if (bean != null) {
Is_hide = bean.getIs_hide();
}
}
};
private CommonCallback<UserBean> mCallback = new CommonCallback<UserBean>() {
@Override
public void callback(UserBean bean) {
List<UserItemBean> list = CommonAppConfig.getInstance().getUserItemList();
if (bean != null) {
showData(bean, list);
}
}
};
private void showData(UserBean u, List<UserItemBean> 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<NewLevelModel> 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<UserItemBean> 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));
}
}

View File

@ -7,6 +7,13 @@
android:background="@mipmap/bg_main_home_sub_game" android:background="@mipmap/bg_main_home_sub_game"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@mipmap/bg_yola_index"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/meTitleTv" android:id="@+id/meTitleTv"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -19,12 +19,21 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@mipmap/bg_yola_index"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/meTitleTv" android:id="@+id/meTitleTv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="34dp" android:layout_marginTop="34dp"
android:text="@string/main_me" android:text="@string/main_me"
android:textStyle="bold"
android:textColor="@color/color_111111" android:textColor="@color/color_111111"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"