迁移
This commit is contained in:
parent
f3d19e37bb
commit
434474bd98
@ -65,18 +65,6 @@
|
|||||||
android:name="com.yunbao.common.activity.PreviewVideoActivity"
|
android:name="com.yunbao.common.activity.PreviewVideoActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activity.CommunitySendActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activity.CommunityDetailsActivity"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:windowSoftInputMode="adjustResize" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activity.UserHomeActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -1,759 +0,0 @@
|
|||||||
package com.yunbao.common.activity;
|
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Outline;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.util.SparseArray;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewOutlineProvider;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
|
||||||
import com.ms.banner.Banner;
|
|
||||||
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
|
||||||
import com.yunbao.common.Constants;
|
|
||||||
import com.yunbao.common.R;
|
|
||||||
import com.yunbao.common.adapter.LabelTagAdapter;
|
|
||||||
import com.yunbao.common.adapter.UserCommunityAdapter;
|
|
||||||
import com.yunbao.common.adapter.UserHomeImgAdapter;
|
|
||||||
import com.yunbao.common.bean.ActiveBean;
|
|
||||||
import com.yunbao.common.bean.ActiveOtherBean;
|
|
||||||
import com.yunbao.common.bean.HomeUserExhibitInfoBean;
|
|
||||||
import com.yunbao.common.bean.HomeUserInfoBean;
|
|
||||||
import com.yunbao.common.bean.LabelBean;
|
|
||||||
import com.yunbao.common.bean.UserHomeImgBean;
|
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
|
||||||
import com.yunbao.common.upload.UploadBean;
|
|
||||||
import com.yunbao.common.upload.UploadCallback;
|
|
||||||
import com.yunbao.common.upload.UploadQnImpl;
|
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
|
||||||
import com.yunbao.common.utils.FilesUtils;
|
|
||||||
import com.yunbao.common.utils.L;
|
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
|
||||||
import com.yunbao.common.utils.StringUtil;
|
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.common.views.UserHomeImgsViewHolder;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import pl.droidsonroids.gif.GifImageView;
|
|
||||||
|
|
||||||
@Route(path = RouteUtil.PATH_USER_HOME)
|
|
||||||
public class UserHomeActivity extends AbsActivity {
|
|
||||||
private final int CHOOSE_IMG = 100;//Android 5.0以下的
|
|
||||||
public static final int PERMISSION_REQUEST_CODE_IMG = 0;
|
|
||||||
private String uid;
|
|
||||||
private Banner mBanner;
|
|
||||||
private RecyclerView imgsRecyclerView;
|
|
||||||
private UserHomeImgAdapter userHomeImgAdapter;
|
|
||||||
private List<String> bannerImgList = new ArrayList<>();
|
|
||||||
private List<UserHomeImgBean> tempList;
|
|
||||||
private RoundedImageView avatar;
|
|
||||||
private TextView userName;
|
|
||||||
private TextView fansCount;
|
|
||||||
private TextView likeCount;
|
|
||||||
private LinearLayout followLayout;
|
|
||||||
private ImageView followIcon;
|
|
||||||
private TextView followName;
|
|
||||||
private TextView userId;
|
|
||||||
private TextView userStatus;
|
|
||||||
private ImageView userStatusIcon;
|
|
||||||
private ImageView user_sex;
|
|
||||||
private ImageView authorIcon;
|
|
||||||
private ImageView levelIcon;
|
|
||||||
private LinearLayout authenticationLayout;
|
|
||||||
private TextView signature;
|
|
||||||
private LinearLayout moreLayout;
|
|
||||||
private TextView moreText;
|
|
||||||
private ImageView moreIcon;
|
|
||||||
private HomeUserInfoBean userInfo;
|
|
||||||
private RecyclerView communityRecyclerView;
|
|
||||||
private LinearLayout itemLayout01;
|
|
||||||
private LinearLayout itemLayout02;
|
|
||||||
private LinearLayout itemLayout03;
|
|
||||||
private LinearLayout itemLayout04;
|
|
||||||
private FlowTagLayout myFlowTag; //我的标签
|
|
||||||
private LabelTagAdapter myAdapter;
|
|
||||||
private boolean isShowcase;
|
|
||||||
private boolean isAnchor;
|
|
||||||
private boolean isMe;
|
|
||||||
private RelativeLayout userPresidentLayout;
|
|
||||||
private TextView userPresidentName;
|
|
||||||
private RoundedImageView fansImg1;
|
|
||||||
private RoundedImageView fansImg2;
|
|
||||||
private RoundedImageView fansImg3;
|
|
||||||
private List<RoundedImageView> fansImgViewList = new ArrayList<>();
|
|
||||||
private RoundedImageView guardImg1;
|
|
||||||
private RoundedImageView guardImg2;
|
|
||||||
private RoundedImageView guardImg3;
|
|
||||||
private List<RoundedImageView> guardImgViewList = new ArrayList<>();
|
|
||||||
private RoundedImageView giftImg1;
|
|
||||||
private RoundedImageView giftImg2;
|
|
||||||
private RoundedImageView giftImg3;
|
|
||||||
private List<RoundedImageView> giftImgViewList = new ArrayList<>();
|
|
||||||
private RoundedImageView honorImg1;
|
|
||||||
private RoundedImageView honorImg2;
|
|
||||||
private RoundedImageView honorImg3;
|
|
||||||
private List<RoundedImageView> honorImgViewList = new ArrayList<>();
|
|
||||||
private TextView giftCount;
|
|
||||||
private List<String> tagList;
|
|
||||||
private GifImageView liveStatus;
|
|
||||||
private TextView topName;
|
|
||||||
private LinearLayout topLayout;
|
|
||||||
private ScrollView scrollView;
|
|
||||||
private RelativeLayout topImgLayout;
|
|
||||||
private ImageView imgUp;
|
|
||||||
private ImageView imgLabel;
|
|
||||||
private LinearLayout bottomEditLayout;
|
|
||||||
private UploadQnImpl mUploadStrategy;
|
|
||||||
private List<ActiveBean> videoList = new ArrayList<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getLayoutId() {
|
|
||||||
return R.layout.activity_user_home;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void create() {
|
|
||||||
super.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void main() {
|
|
||||||
uid = getIntent().getStringExtra(Constants.TO_UID);
|
|
||||||
if (StringUtil.isEmpty(uid)) {
|
|
||||||
ToastUtil.show("用户不存在");
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
initView();
|
|
||||||
getUseData();
|
|
||||||
getCommunityList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getCommunityList() {
|
|
||||||
CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
|
||||||
List<ActiveOtherBean> beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class);
|
|
||||||
UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList);
|
|
||||||
userCommunityAdapter.setOnItemClickListener(new UserCommunityAdapter.onItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onImgItem(ActiveOtherBean bean, int position) {
|
|
||||||
if (bean.getImg_or_video().equals("1")) {
|
|
||||||
RouteUtil.forwardCommunity(bean.getId());
|
|
||||||
} else {
|
|
||||||
int playPosition = 0;
|
|
||||||
for (int i = 0; i < videoList.size(); i++) {
|
|
||||||
if (videoList.get(i).getId().equals(bean.getId())) {
|
|
||||||
playPosition = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RouteUtil.forwardVideoActivity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onVideoItem(String activeBean, int position) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
communityRecyclerView.setAdapter(userCommunityAdapter);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint({"SetTextI18n", "UseCompatLoadingForDrawables"})
|
|
||||||
private void initData(HomeUserInfoBean userInfoBean) {
|
|
||||||
userInfo = userInfoBean;
|
|
||||||
if (!userInfo.getCheckBlack().get(0).getU2t().equals("0")) {
|
|
||||||
ToastUtil.show("已拉黑,无法查看");
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getUser_president_name())) {
|
|
||||||
userPresidentLayout.setVisibility(View.VISIBLE);
|
|
||||||
userPresidentName.setText(userInfo.getUserHomeTopInfo().getUser_president_name());
|
|
||||||
}
|
|
||||||
isAnchor = userInfo.getUserHomeTopInfo().getIs_anchor() == 1;
|
|
||||||
isMe = CommonAppConfig.getInstance().getUserBean().getId().equals(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()));
|
|
||||||
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_avatar(), avatar);
|
|
||||||
topName.setText(userInfo.getUserHomeTopInfo().getUser_name()); //用户名称-顶部
|
|
||||||
userName.setText(userInfo.getUserHomeTopInfo().getUser_name());//用户名称
|
|
||||||
fansCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_fans_num()));//粉丝数量
|
|
||||||
likeCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_love_num()));//关注数量
|
|
||||||
|
|
||||||
if (isMe) {
|
|
||||||
bottomEditLayout.setVisibility(View.VISIBLE);
|
|
||||||
imgUp.setVisibility(View.VISIBLE);
|
|
||||||
imgLabel.setVisibility(View.VISIBLE);
|
|
||||||
followLayout.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getUser_goodnum())) {
|
|
||||||
userId.setText("靓号:" + userInfo.getUserHomeTopInfo().getUser_goodnum());//用户靓号
|
|
||||||
} else {
|
|
||||||
userId.setText("ID:" + userInfo.getUserHomeTopInfo().getUser_id());//用户ID
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userInfo.getUserHomeTopInfo().getRong_online().equals("0")) {
|
|
||||||
userStatus.setText("在线");
|
|
||||||
userStatusIcon.setImageDrawable(getResources().getDrawable(R.mipmap.icon_green));
|
|
||||||
} else {
|
|
||||||
userStatus.setText("离线");
|
|
||||||
userStatusIcon.setImageDrawable(getResources().getDrawable(R.mipmap.icon_gray));
|
|
||||||
}
|
|
||||||
if (userInfo.getUserHomeTopInfo().getIs_live() == 1) {
|
|
||||||
liveStatus.setVisibility(View.VISIBLE);
|
|
||||||
avatar.setBackground(getResources().getDrawable(R.drawable.bg_live_1));
|
|
||||||
}
|
|
||||||
ImgLoader.display(UserHomeActivity.this, Integer.parseInt(String.valueOf(userInfo.getUserHomeTopInfo().getUser_sex())) == 0 ? R.mipmap.icon_man_new : R.mipmap.icon_wumen, user_sex);
|
|
||||||
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_anchor_img(), authorIcon);
|
|
||||||
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_img(), levelIcon);
|
|
||||||
|
|
||||||
if (isAnchor) {//是否是主播
|
|
||||||
authorIcon.setVisibility(View.VISIBLE);
|
|
||||||
authenticationLayout.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
authorIcon.setVisibility(View.GONE);
|
|
||||||
authenticationLayout.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
signature.setText(userInfo.getUserHomeTopInfo().getUser_signature());//个性签名
|
|
||||||
//标签
|
|
||||||
myAdapter = new LabelTagAdapter(mContext, new LabelTagAdapter.OnSureOnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void sure(LabelBean.Children labelBean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tagList = new ArrayList<>();
|
|
||||||
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getAge())) {
|
|
||||||
tagList.add(userInfo.getUserHomeTopInfo().getAge() + "岁");
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getHeight())) {
|
|
||||||
tagList.add(userInfo.getUserHomeTopInfo().getHeight());
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCareer())) {
|
|
||||||
tagList.add(userInfo.getUserHomeTopInfo().getCareer());
|
|
||||||
}
|
|
||||||
if (userInfo.getUserHomeTopInfo().getCn_label() != null) {
|
|
||||||
if (userInfo.getUserHomeTopInfo().getCn_label().size() > 0) {
|
|
||||||
for (int i = 0; i < userInfo.getUserHomeTopInfo().getCn_label().size(); i++) {
|
|
||||||
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCn_label().get(i))) {
|
|
||||||
tagList.add(userInfo.getUserHomeTopInfo().getCn_label().get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myFlowTag.setAdapter(myAdapter);
|
|
||||||
myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE);
|
|
||||||
myAdapter.setData(tagList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mBanner.setOutlineProvider(new ViewOutlineProvider() {
|
|
||||||
@Override
|
|
||||||
public void getOutline(View view, Outline outline) {
|
|
||||||
outline.setRoundRect(0, 0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageSelected(int position) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bannerImgList = userInfo.getUserHomeTopInfo().getUser_home_banner();
|
|
||||||
tempList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < bannerImgList.size(); i++) {
|
|
||||||
tempList.add(new UserHomeImgBean(bannerImgList.get(i)));
|
|
||||||
}
|
|
||||||
if (tempList.size() > 0) {
|
|
||||||
tempList.get(0).setShow(true);
|
|
||||||
}
|
|
||||||
userHomeImgAdapter = new UserHomeImgAdapter(UserHomeActivity.this, tempList, isMe);
|
|
||||||
imgsRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
|
||||||
imgsRecyclerView.setAdapter(userHomeImgAdapter);
|
|
||||||
|
|
||||||
userHomeImgAdapter.setOnItemClickListener(new UserHomeImgAdapter.onItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onImgItem(UserHomeImgBean activeBean, int position) {
|
|
||||||
L.e("onImgItem:" + position);
|
|
||||||
mBanner.setCurrentPage(position).start();
|
|
||||||
for (int i = 0; i < tempList.size(); i++) {
|
|
||||||
if (i == position) {
|
|
||||||
tempList.get(i).setShow(true);
|
|
||||||
} else {
|
|
||||||
tempList.get(i).setShow(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userHomeImgAdapter.setCommentBeanList(tempList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onImgDel(UserHomeImgBean activeBean, int position) {
|
|
||||||
bannerImgList.remove(position);
|
|
||||||
uploadImg(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mBanner.setAutoPlay(false).setPages(bannerImgList, new UserHomeImgsViewHolder()).setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageSelected(int position) {
|
|
||||||
L.e("onPageSelected:" + position);
|
|
||||||
for (int i = 0; i < tempList.size(); i++) {
|
|
||||||
if (i == position) {
|
|
||||||
tempList.get(i).setShow(true);
|
|
||||||
} else {
|
|
||||||
tempList.get(i).setShow(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userHomeImgAdapter.setCommentBeanList(tempList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mBanner.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initView() {
|
|
||||||
bottomEditLayout = findViewById(R.id.bottomEditLayout);
|
|
||||||
imgUp = findViewById(R.id.imgUp);
|
|
||||||
imgLabel = findViewById(R.id.imgLabel);
|
|
||||||
topImgLayout = findViewById(R.id.topImgLayout);
|
|
||||||
|
|
||||||
topLayout = findViewById(R.id.topLayout);
|
|
||||||
scrollView = findViewById(R.id.scrollView);
|
|
||||||
|
|
||||||
topName = findViewById(R.id.topName);
|
|
||||||
liveStatus = findViewById(R.id.liveStatus);
|
|
||||||
giftCount = findViewById(R.id.giftCount);
|
|
||||||
|
|
||||||
fansImg1 = findViewById(R.id.fansImg1);
|
|
||||||
fansImg2 = findViewById(R.id.fansImg2);
|
|
||||||
fansImg3 = findViewById(R.id.fansImg3);
|
|
||||||
fansImgViewList = new ArrayList<>();
|
|
||||||
fansImgViewList.add(fansImg1);
|
|
||||||
fansImgViewList.add(fansImg2);
|
|
||||||
fansImgViewList.add(fansImg3);
|
|
||||||
|
|
||||||
guardImg1 = findViewById(R.id.guardImg1);
|
|
||||||
guardImg2 = findViewById(R.id.guardImg2);
|
|
||||||
guardImg3 = findViewById(R.id.guardImg3);
|
|
||||||
guardImgViewList = new ArrayList<>();
|
|
||||||
guardImgViewList.add(guardImg1);
|
|
||||||
guardImgViewList.add(guardImg2);
|
|
||||||
guardImgViewList.add(guardImg3);
|
|
||||||
|
|
||||||
giftImg1 = findViewById(R.id.giftImg1);
|
|
||||||
giftImg2 = findViewById(R.id.giftImg2);
|
|
||||||
giftImg3 = findViewById(R.id.giftImg3);
|
|
||||||
giftImgViewList = new ArrayList<>();
|
|
||||||
giftImgViewList.add(giftImg1);
|
|
||||||
giftImgViewList.add(giftImg2);
|
|
||||||
giftImgViewList.add(giftImg3);
|
|
||||||
|
|
||||||
honorImg1 = findViewById(R.id.honorImg1);
|
|
||||||
honorImg2 = findViewById(R.id.honorImg2);
|
|
||||||
honorImg3 = findViewById(R.id.honorImg3);
|
|
||||||
honorImgViewList = new ArrayList<>();
|
|
||||||
honorImgViewList.add(honorImg1);
|
|
||||||
honorImgViewList.add(honorImg2);
|
|
||||||
honorImgViewList.add(honorImg3);
|
|
||||||
|
|
||||||
userPresidentLayout = findViewById(R.id.userPresidentLayout);
|
|
||||||
userPresidentName = findViewById(R.id.userPresidentName);
|
|
||||||
itemLayout01 = findViewById(R.id.itemLayout01);
|
|
||||||
itemLayout02 = findViewById(R.id.itemLayout02);
|
|
||||||
itemLayout03 = findViewById(R.id.itemLayout03);
|
|
||||||
itemLayout04 = findViewById(R.id.itemLayout04);
|
|
||||||
communityRecyclerView = findViewById(R.id.communityRecyclerView);
|
|
||||||
myFlowTag = findViewById(R.id.myFlowTag);
|
|
||||||
avatar = findViewById(R.id.avatar);
|
|
||||||
userName = findViewById(R.id.name);
|
|
||||||
fansCount = findViewById(R.id.fansCount);
|
|
||||||
likeCount = findViewById(R.id.likeCount);
|
|
||||||
followLayout = findViewById(R.id.followLayout);
|
|
||||||
followName = findViewById(R.id.followName);
|
|
||||||
followIcon = findViewById(R.id.followIcon);
|
|
||||||
userId = findViewById(R.id.userId);
|
|
||||||
userStatus = findViewById(R.id.userStatus);
|
|
||||||
userStatusIcon = findViewById(R.id.userStatusIcon);
|
|
||||||
user_sex = findViewById(R.id.user_sex);
|
|
||||||
|
|
||||||
levelIcon = findViewById(R.id.levelIcon);
|
|
||||||
authorIcon = findViewById(R.id.authorlIcon);
|
|
||||||
|
|
||||||
authenticationLayout = findViewById(R.id.authenticationLayout);
|
|
||||||
signature = findViewById(R.id.signature);
|
|
||||||
moreLayout = findViewById(R.id.moreLayout);
|
|
||||||
moreText = findViewById(R.id.moreText);
|
|
||||||
moreIcon = findViewById(R.id.moreIcon);
|
|
||||||
|
|
||||||
mBanner = findViewById(R.id.banner);
|
|
||||||
imgsRecyclerView = findViewById(R.id.imgsRecyclerView);
|
|
||||||
|
|
||||||
communityRecyclerView = findViewById(R.id.communityRecyclerView);
|
|
||||||
communityRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
|
||||||
communityRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
|
||||||
|
|
||||||
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
followLayout.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
CommonHttpUtil.setAttention(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), new CommonCallback<Integer>() {
|
|
||||||
@Override
|
|
||||||
public void callback(Integer isAttention) {
|
|
||||||
if (isAttention == 1) {
|
|
||||||
ImgLoader.display(UserHomeActivity.this, R.mipmap.icon_like_followed, followIcon);
|
|
||||||
followName.setText("已关注");
|
|
||||||
followName.setTextColor(Color.parseColor("#777777"));
|
|
||||||
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type_1));
|
|
||||||
} else {
|
|
||||||
ImgLoader.display(UserHomeActivity.this, R.mipmap.icon_like_follow, followIcon);
|
|
||||||
followName.setText("关注");
|
|
||||||
followName.setTextColor(getResources().getColor(R.color.white));
|
|
||||||
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
moreLayout.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (isShowcase) {
|
|
||||||
if (isAnchor) {
|
|
||||||
itemLayout01.setVisibility(View.GONE);
|
|
||||||
itemLayout02.setVisibility(View.GONE);
|
|
||||||
itemLayout03.setVisibility(View.GONE);
|
|
||||||
itemLayout04.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
itemLayout03.setVisibility(View.GONE);
|
|
||||||
itemLayout04.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
moreText.setText("查看更多");
|
|
||||||
ImgLoader.display(mContext, R.mipmap.icon_down, moreIcon);
|
|
||||||
} else {
|
|
||||||
if (isAnchor) {
|
|
||||||
itemLayout01.setVisibility(View.VISIBLE);
|
|
||||||
itemLayout02.setVisibility(View.VISIBLE);
|
|
||||||
itemLayout03.setVisibility(View.VISIBLE);
|
|
||||||
itemLayout04.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
itemLayout01.setVisibility(View.GONE);
|
|
||||||
itemLayout02.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
moreText.setText("收起");
|
|
||||||
ImgLoader.display(mContext, R.mipmap.icon_up, moreIcon);
|
|
||||||
}
|
|
||||||
isShowcase = !isShowcase;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
|
||||||
int height = (int) (topImgLayout.getMeasuredHeight() * 1.2);
|
|
||||||
if (scrollY <= 0) {
|
|
||||||
//滑动之前,标题栏布局背景颜色为完全透明,标题文字完全透明
|
|
||||||
topLayout.setBackgroundColor(Color.argb(0, 0, 0, 0));
|
|
||||||
topName.setTextColor(Color.argb(0, 255, 255, 255));
|
|
||||||
//让mScrollView滑动的距离在0~height之间时颜色发生渐变
|
|
||||||
} else if (scrollY > 0 && scrollY <= height) {
|
|
||||||
//获取渐变率
|
|
||||||
float scale = (float) scrollY / height;
|
|
||||||
//获取渐变数值
|
|
||||||
float alpha = (255 * scale);
|
|
||||||
//布局文本颜色逐渐发生变化
|
|
||||||
topLayout.setBackgroundColor(Color.argb((int) alpha, 0, 0, 0));
|
|
||||||
topName.setTextColor(Color.argb((int) alpha, 255, 255, 255));
|
|
||||||
} else {
|
|
||||||
//当滑动距离超过height,布局文本颜色完全不透明
|
|
||||||
topLayout.setBackgroundColor(Color.argb(255, 0, 0, 0));
|
|
||||||
topName.setTextColor(Color.argb(255, 255, 255, 255));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
topLayout.setBackgroundColor(Color.argb(0, 0, 0, 0));
|
|
||||||
topName.setTextColor(Color.argb(0, 255, 255, 255));
|
|
||||||
}
|
|
||||||
imgUp.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (bannerImgList.size() < 9) {
|
|
||||||
selectImg();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bottomEditLayout.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
RouteUtil.forwardEditProfileActivity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
SparseArray<String> array = new SparseArray<>();
|
|
||||||
array.append(1, "不感兴趣");
|
|
||||||
array.append(0, "举报");
|
|
||||||
array.append(2, "加入黑名单");
|
|
||||||
DialogUitl.showStringArrayDialog(UserHomeActivity.this, array, new DialogUitl.StringArrayDialogCallback() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(String text, int tag) {
|
|
||||||
if (tag == 0) {
|
|
||||||
CommonHttpUtil.noInterest(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), new com.yunbao.common.http.HttpCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
|
||||||
ToastUtil.show(msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (tag == 1) {
|
|
||||||
RouteUtil.forwardLiveReportActivity(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()));
|
|
||||||
} else {
|
|
||||||
RouteUtil.forwardLiveReportActivity(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectImg() {
|
|
||||||
String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE;
|
|
||||||
String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
permission1 = Manifest.permission.READ_MEDIA_IMAGES;
|
|
||||||
permission2 = Manifest.permission.READ_MEDIA_VIDEO;
|
|
||||||
}
|
|
||||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
|
|
||||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
|
|
||||||
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
openImageChooserActivity();
|
|
||||||
} else {
|
|
||||||
//申请权限
|
|
||||||
ActivityCompat.requestPermissions(UserHomeActivity.this, new String[]{permission1, permission2}, PERMISSION_REQUEST_CODE_IMG);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openImageChooserActivity() {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
intent.setType("image/*");
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
|
|
||||||
startActivityForResult(intent, CHOOSE_IMG);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
||||||
if (requestCode == PERMISSION_REQUEST_CODE_IMG) {
|
|
||||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
openImageChooserActivity();
|
|
||||||
} else {
|
|
||||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE_IMG);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getUseData() {
|
|
||||||
LiveNetManager.get(mContext).getUserHomeInfo(uid, new HttpCallback<HomeUserInfoBean>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(HomeUserInfoBean data) {
|
|
||||||
initData(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
LiveNetManager.get(mContext).getUserExhibitInfoInfo(uid, new HttpCallback<HomeUserExhibitInfoBean>() {
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
@Override
|
|
||||||
public void onSuccess(HomeUserExhibitInfoBean data) {
|
|
||||||
//主播粉丝团
|
|
||||||
if (data.getUserHomeTopInfo().getFans().getList() != null) {
|
|
||||||
if (data.getUserHomeTopInfo().getFans().getList().size() >= 3) {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
ImgLoader.display(mContext, data.getUserHomeTopInfo().getFans().getList().get(i).getAvatar(), fansImgViewList.get(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < data.getUserHomeTopInfo().getFans().getList().size(); i++) {
|
|
||||||
ImgLoader.display(mContext, data.getUserHomeTopInfo().getFans().getList().get(i).getAvatar(), fansImgViewList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//主播守护团
|
|
||||||
if (data.getUserHomeTopInfo().getGuard() != null) {
|
|
||||||
if (data.getUserHomeTopInfo().getGuard().size() >= 3) {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
ImgLoader.display(mContext, data.getUserHomeTopInfo().getGuard().get(i).getAvatar(), guardImgViewList.get(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < data.getUserHomeTopInfo().getGuard().size(); i++) {
|
|
||||||
ImgLoader.display(mContext, data.getUserHomeTopInfo().getGuard().get(i).getAvatar(), guardImgViewList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//礼物墙
|
|
||||||
if (data.getGiftAlreadyWall().getGift_wall() != null) {
|
|
||||||
if (data.getGiftAlreadyWall().getGift_wall().size() >= 3) {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
ImgLoader.display(mContext, data.getGiftAlreadyWall().getGift_wall().get(i).getGifticon(), giftImgViewList.get(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < data.getGiftAlreadyWall().getGift_wall().size(); i++) {
|
|
||||||
ImgLoader.display(mContext, data.getGiftAlreadyWall().getGift_wall().get(i).getGifticon(), giftImgViewList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
giftCount.setText(data.getGiftAlreadyWall().getGift_wall().size() + "/36");
|
|
||||||
}
|
|
||||||
//荣誉墙
|
|
||||||
if (data.getUserHomeTopInfo().getDress() != null) {
|
|
||||||
if (data.getUserHomeTopInfo().getDress().size() >= 3) {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
ImgLoader.display(mContext, data.getUserHomeTopInfo().getDress().get(i).getDisplay_src(), honorImgViewList.get(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < data.getUserHomeTopInfo().getDress().size(); i++) {
|
|
||||||
ImgLoader.display(mContext, data.getUserHomeTopInfo().getDress().get(i).getDisplay_src(), honorImgViewList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
if (resultCode == RESULT_OK && requestCode == CHOOSE_IMG) {
|
|
||||||
// 获取用户选择的图片 URI
|
|
||||||
Uri[] imageUris = null;
|
|
||||||
if (data != null) {
|
|
||||||
imageUris = new Uri[]{data.getData()};
|
|
||||||
File file = new File(Objects.requireNonNull(FilesUtils.getPath(mContext, imageUris[0])));
|
|
||||||
uploadFile(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void uploadFile(File file) {
|
|
||||||
if (mUploadStrategy == null) {
|
|
||||||
mUploadStrategy = new UploadQnImpl(mContext);
|
|
||||||
}
|
|
||||||
List<UploadBean> uploadBeans = new ArrayList<>();
|
|
||||||
UploadBean upVideoBean = new UploadBean(file, UploadBean.IMG);
|
|
||||||
uploadBeans.add(upVideoBean);
|
|
||||||
mUploadStrategy.upload(uploadBeans, true, new UploadCallback() {
|
|
||||||
@Override
|
|
||||||
public void onFinish(List<UploadBean> list, boolean success) {
|
|
||||||
if (!success) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bannerImgList.add("https://downs.yaoulive.com/" + list.get(0).getRemoteAccessUrl());
|
|
||||||
uploadImg(true);
|
|
||||||
L.e(new Gson().toJson(list));
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void uploadImg(boolean isUp) {
|
|
||||||
CommonHttpUtil.uploadUserInfoImg(new Gson().toJson(bannerImgList), new com.yunbao.common.http.HttpCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
|
||||||
if (code == 0 && info != null) {
|
|
||||||
if (isUp) {
|
|
||||||
ToastUtil.show("上传成功");
|
|
||||||
} else {
|
|
||||||
ToastUtil.show("删除成功");
|
|
||||||
}
|
|
||||||
mBanner.setPages(bannerImgList, new UserHomeImgsViewHolder()).start();
|
|
||||||
tempList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < bannerImgList.size(); i++) {
|
|
||||||
tempList.add(new UserHomeImgBean(bannerImgList.get(i)));
|
|
||||||
}
|
|
||||||
if (tempList.size() > 0) {
|
|
||||||
tempList.get(0).setShow(true);
|
|
||||||
}
|
|
||||||
userHomeImgAdapter.setCommentBeanList(tempList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private File uri2File(Uri uri) {
|
|
||||||
String img_path;
|
|
||||||
String[] proj = {MediaStore.Images.Media.DATA};
|
|
||||||
Cursor actualimagecursor = this.managedQuery(uri, proj, null, null, null);
|
|
||||||
if (actualimagecursor == null) {
|
|
||||||
img_path = uri.getPath();
|
|
||||||
} else {
|
|
||||||
int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
|
||||||
actualimagecursor.moveToFirst();
|
|
||||||
img_path = actualimagecursor.getString(actual_image_column_index);
|
|
||||||
}
|
|
||||||
File file = new File(img_path);
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
}
|
|
@ -51,8 +51,8 @@ public class RouteUtil {
|
|||||||
public static final String PATH_SudGameActivity = "/live/SudGameActivity";
|
public static final String PATH_SudGameActivity = "/live/SudGameActivity";
|
||||||
public static final String PATH_COMMUNITY_Activity = "/main/MainHomeCommunityActivity";
|
public static final String PATH_COMMUNITY_Activity = "/main/MainHomeCommunityActivity";
|
||||||
public static final String PATH_VIDEO_ACTIVITY = "/activity/VideoPlayActivity";
|
public static final String PATH_VIDEO_ACTIVITY = "/activity/VideoPlayActivity";
|
||||||
public static final String PATH_COMMUNITY = "/common/CommunityDetailsActivity";
|
public static final String PATH_COMMUNITY = "/main/CommunityDetailsActivity";
|
||||||
public static final String PATH_USER_HOME = "/common/UserHomeActivity";
|
public static final String PATH_USER_HOME = "/main/UserHomeActivity";
|
||||||
|
|
||||||
public static void forwardUserHome(String uid) {
|
public static void forwardUserHome(String uid) {
|
||||||
ARouter.getInstance().build(PATH_USER_HOME)
|
ARouter.getInstance().build(PATH_USER_HOME)
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
android:theme="@style/noAnimationStyle"
|
android:theme="@style/noAnimationStyle"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.UserHomeActivity"
|
android:name=".activity.UserHomeActivityOld"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.SettingActivity"
|
android:name=".activity.SettingActivity"
|
||||||
@ -171,6 +171,20 @@
|
|||||||
<activity android:name=".activity.CompleteUserInfoActivity"
|
<activity android:name=".activity.CompleteUserInfoActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity android:name=".activity.EditUserHobbyActivity" android:screenOrientation="portrait" />
|
<activity android:name=".activity.EditUserHobbyActivity" android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.CommunitySendActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.CommunityDetailsActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.UserHomeActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -1,4 +1,4 @@
|
|||||||
package com.yunbao.common.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -24,6 +24,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.adapter.CommentAdapter;
|
import com.yunbao.common.adapter.CommentAdapter;
|
||||||
import com.yunbao.common.bean.ActiveBean;
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
import com.yunbao.common.bean.CommentBean;
|
import com.yunbao.common.bean.CommentBean;
|
||||||
@ -192,7 +193,7 @@ public class CommunityDetailsActivity extends AbsActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemClick(String text, int tag) {
|
public void onItemClick(String text, int tag) {
|
||||||
if (tag == 0) {
|
if (tag == 0) {
|
||||||
RouteUtil.forwardCommentReportActivity(activeBean.getId(), activeBean.getId());
|
RouteUtil.forwardCommentReportActivity(activeBean.getId(), "0");
|
||||||
} else {
|
} else {
|
||||||
CommonHttpUtil.noInterest(activeBean.getUser_id(), new HttpCallback() {
|
CommonHttpUtil.noInterest(activeBean.getUser_id(), new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -283,9 +284,9 @@ public class CommunityDetailsActivity extends AbsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReport(CommentBean.ReplyComment activeBean) {
|
public void onReport(CommentBean.ReplyComment commentBean) {
|
||||||
//二级回复 举报
|
//二级回复 举报
|
||||||
RouteUtil.forwardCommentReportActivity(activeBean.getId(), activeBean.getId());
|
RouteUtil.forwardCommentReportActivity(activeBean.getId(), commentBean.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,29 +1,24 @@
|
|||||||
package com.yunbao.common.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
import android.widget.VideoView;
|
import android.widget.VideoView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
@ -36,14 +31,13 @@ import com.bigkoo.pickerview.listener.OnTimeSelectListener;
|
|||||||
import com.bigkoo.pickerview.view.OptionsPickerView;
|
import com.bigkoo.pickerview.view.OptionsPickerView;
|
||||||
import com.bigkoo.pickerview.view.TimePickerView;
|
import com.bigkoo.pickerview.view.TimePickerView;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.lzy.okgo.utils.HttpUtils;
|
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.bean.NewCommunityType;
|
import com.yunbao.common.bean.NewCommunityType;
|
||||||
import com.yunbao.common.custom.ItemDecoration;
|
import com.yunbao.common.custom.ItemDecoration;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.manager.CommunityTypeManager;
|
import com.yunbao.common.manager.CommunityTypeManager;
|
||||||
import com.yunbao.common.manager.OpenAdManager;
|
|
||||||
import com.yunbao.common.upload.UploadBean;
|
import com.yunbao.common.upload.UploadBean;
|
||||||
import com.yunbao.common.upload.UploadCallback;
|
import com.yunbao.common.upload.UploadCallback;
|
||||||
import com.yunbao.common.upload.UploadQnImpl;
|
import com.yunbao.common.upload.UploadQnImpl;
|
||||||
@ -51,13 +45,10 @@ import com.yunbao.common.utils.ActiveImageAdapter;
|
|||||||
import com.yunbao.common.utils.DateFormatUtil;
|
import com.yunbao.common.utils.DateFormatUtil;
|
||||||
import com.yunbao.common.utils.FilesUtils;
|
import com.yunbao.common.utils.FilesUtils;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.ProcessImageUtil;
|
|
||||||
import com.yunbao.common.utils.ProcessResultUtil;
|
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,83 +1,765 @@
|
|||||||
package com.yunbao.main.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.text.TextUtils;
|
import android.content.pm.PackageManager;
|
||||||
import android.view.ViewGroup;
|
import android.database.Cursor;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Outline;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewOutlineProvider;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.ScrollView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.ms.banner.Banner;
|
||||||
|
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.adapter.LabelTagAdapter;
|
||||||
|
import com.yunbao.common.adapter.UserCommunityAdapter;
|
||||||
|
import com.yunbao.common.adapter.UserHomeImgAdapter;
|
||||||
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
|
import com.yunbao.common.bean.ActiveOtherBean;
|
||||||
|
import com.yunbao.common.bean.HomeUserExhibitInfoBean;
|
||||||
|
import com.yunbao.common.bean.HomeUserInfoBean;
|
||||||
|
import com.yunbao.common.bean.LabelBean;
|
||||||
|
import com.yunbao.common.bean.UserHomeImgBean;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
|
import com.yunbao.common.upload.UploadBean;
|
||||||
|
import com.yunbao.common.upload.UploadCallback;
|
||||||
|
import com.yunbao.common.upload.UploadQnImpl;
|
||||||
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.FilesUtils;
|
||||||
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.live.activity.LiveAddImpressActivity;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.common.views.UserHomeImgsViewHolder;
|
||||||
import com.yunbao.main.views.UserHomeViewHolder2;
|
|
||||||
|
|
||||||
/**
|
import java.io.File;
|
||||||
* Created by cxf on 2018/9/25.
|
import java.util.ArrayList;
|
||||||
*/
|
import java.util.Arrays;
|
||||||
//@Route(path = RouteUtil.PATH_USER_HOME)
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
|
|
||||||
|
@Route(path = RouteUtil.PATH_USER_HOME)
|
||||||
public class UserHomeActivity extends AbsActivity {
|
public class UserHomeActivity extends AbsActivity {
|
||||||
|
private final int CHOOSE_IMG = 100;//Android 5.0以下的
|
||||||
private UserHomeViewHolder2 mUserHomeViewHolder;
|
public static final int PERMISSION_REQUEST_CODE_IMG = 0;
|
||||||
|
private String uid;
|
||||||
|
private Banner mBanner;
|
||||||
|
private RecyclerView imgsRecyclerView;
|
||||||
|
private UserHomeImgAdapter userHomeImgAdapter;
|
||||||
|
private List<String> bannerImgList = new ArrayList<>();
|
||||||
|
private List<UserHomeImgBean> tempList;
|
||||||
|
private RoundedImageView avatar;
|
||||||
|
private TextView userName;
|
||||||
|
private TextView fansCount;
|
||||||
|
private TextView likeCount;
|
||||||
|
private LinearLayout followLayout;
|
||||||
|
private ImageView followIcon;
|
||||||
|
private TextView followName;
|
||||||
|
private TextView userId;
|
||||||
|
private TextView userStatus;
|
||||||
|
private ImageView userStatusIcon;
|
||||||
|
private ImageView user_sex;
|
||||||
|
private ImageView authorIcon;
|
||||||
|
private ImageView levelIcon;
|
||||||
|
private LinearLayout authenticationLayout;
|
||||||
|
private TextView signature;
|
||||||
|
private LinearLayout moreLayout;
|
||||||
|
private TextView moreText;
|
||||||
|
private ImageView moreIcon;
|
||||||
|
private HomeUserInfoBean userInfo;
|
||||||
|
private RecyclerView communityRecyclerView;
|
||||||
|
private LinearLayout itemLayout01;
|
||||||
|
private LinearLayout itemLayout02;
|
||||||
|
private LinearLayout itemLayout03;
|
||||||
|
private LinearLayout itemLayout04;
|
||||||
|
private FlowTagLayout myFlowTag; //我的标签
|
||||||
|
private LabelTagAdapter myAdapter;
|
||||||
|
private boolean isShowcase;
|
||||||
|
private boolean isAnchor;
|
||||||
|
private boolean isMe;
|
||||||
|
private RelativeLayout userPresidentLayout;
|
||||||
|
private TextView userPresidentName;
|
||||||
|
private RoundedImageView fansImg1;
|
||||||
|
private RoundedImageView fansImg2;
|
||||||
|
private RoundedImageView fansImg3;
|
||||||
|
private List<RoundedImageView> fansImgViewList = new ArrayList<>();
|
||||||
|
private RoundedImageView guardImg1;
|
||||||
|
private RoundedImageView guardImg2;
|
||||||
|
private RoundedImageView guardImg3;
|
||||||
|
private List<RoundedImageView> guardImgViewList = new ArrayList<>();
|
||||||
|
private RoundedImageView giftImg1;
|
||||||
|
private RoundedImageView giftImg2;
|
||||||
|
private RoundedImageView giftImg3;
|
||||||
|
private List<RoundedImageView> giftImgViewList = new ArrayList<>();
|
||||||
|
private RoundedImageView honorImg1;
|
||||||
|
private RoundedImageView honorImg2;
|
||||||
|
private RoundedImageView honorImg3;
|
||||||
|
private List<RoundedImageView> honorImgViewList = new ArrayList<>();
|
||||||
|
private TextView giftCount;
|
||||||
|
private List<String> tagList;
|
||||||
|
private GifImageView liveStatus;
|
||||||
|
private TextView topName;
|
||||||
|
private LinearLayout topLayout;
|
||||||
|
private ScrollView scrollView;
|
||||||
|
private RelativeLayout topImgLayout;
|
||||||
|
private ImageView imgUp;
|
||||||
|
private ImageView imgLabel;
|
||||||
|
private LinearLayout bottomEditLayout;
|
||||||
|
private UploadQnImpl mUploadStrategy;
|
||||||
|
private List<ActiveBean> videoList = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.activity_empty;
|
return R.layout.activity_user_home;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isStatusBarWhite() {
|
protected void create() {
|
||||||
return true;
|
super.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
Intent intent = getIntent();
|
uid = getIntent().getStringExtra(Constants.TO_UID);
|
||||||
String toUid = intent.getStringExtra(Constants.TO_UID);
|
if (StringUtil.isEmpty(uid)) {
|
||||||
if (TextUtils.isEmpty(toUid)) {
|
ToastUtil.show("用户不存在");
|
||||||
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean fromLiveRoom = intent.getBooleanExtra(Constants.FROM_LIVE_ROOM, false);
|
initView();
|
||||||
String fromLiveUid = fromLiveRoom ? intent.getStringExtra(Constants.LIVE_UID) : null;
|
getUseData();
|
||||||
mUserHomeViewHolder = new UserHomeViewHolder2(mContext, (ViewGroup) findViewById(R.id.container), toUid, fromLiveRoom,fromLiveUid);
|
getCommunityList();
|
||||||
mUserHomeViewHolder.addToParent();
|
}
|
||||||
mUserHomeViewHolder.subscribeActivityLifeCycle();
|
|
||||||
mUserHomeViewHolder.loadData();
|
|
||||||
|
|
||||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
private void getCommunityList() {
|
||||||
|
CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void callback(UserBean bean) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
UserBean userBean = CommonAppConfig.getInstance().getUserBean();
|
List<ActiveOtherBean> beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class);
|
||||||
userBean = bean;
|
UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList);
|
||||||
|
userCommunityAdapter.setOnItemClickListener(new UserCommunityAdapter.onItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onImgItem(ActiveOtherBean bean, int position) {
|
||||||
|
if (bean.getImg_or_video().equals("1")) {
|
||||||
|
RouteUtil.forwardCommunity(bean.getId());
|
||||||
|
} else {
|
||||||
|
int playPosition = 0;
|
||||||
|
for (int i = 0; i < videoList.size(); i++) {
|
||||||
|
if (videoList.get(i).getId().equals(bean.getId())) {
|
||||||
|
playPosition = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RouteUtil.forwardVideoActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoItem(String activeBean, int position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
communityRecyclerView.setAdapter(userCommunityAdapter);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint({"SetTextI18n", "UseCompatLoadingForDrawables"})
|
||||||
|
private void initData(HomeUserInfoBean userInfoBean) {
|
||||||
|
userInfo = userInfoBean;
|
||||||
|
if (!userInfo.getCheckBlack().get(0).getU2t().equals("0")) {
|
||||||
|
ToastUtil.show("已拉黑,无法查看");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getUser_president_name())) {
|
||||||
|
userPresidentLayout.setVisibility(View.VISIBLE);
|
||||||
|
userPresidentName.setText(userInfo.getUserHomeTopInfo().getUser_president_name());
|
||||||
|
}
|
||||||
|
isAnchor = userInfo.getUserHomeTopInfo().getIs_anchor() == 1;
|
||||||
|
isMe = CommonAppConfig.getInstance().getUserBean().getId().equals(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()));
|
||||||
|
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_avatar(), avatar);
|
||||||
|
topName.setText(userInfo.getUserHomeTopInfo().getUser_name()); //用户名称-顶部
|
||||||
|
userName.setText(userInfo.getUserHomeTopInfo().getUser_name());//用户名称
|
||||||
|
fansCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_fans_num()));//粉丝数量
|
||||||
|
likeCount.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_love_num()));//关注数量
|
||||||
|
|
||||||
public void addImpress(String toUid) {
|
if (isMe) {
|
||||||
Intent intent = new Intent(mContext, LiveAddImpressActivity.class);
|
bottomEditLayout.setVisibility(View.VISIBLE);
|
||||||
intent.putExtra(Constants.TO_UID, toUid);
|
imgUp.setVisibility(View.VISIBLE);
|
||||||
startActivityForResult(intent, 100);
|
imgLabel.setVisibility(View.VISIBLE);
|
||||||
|
followLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getUser_goodnum())) {
|
||||||
|
userId.setText("靓号:" + userInfo.getUserHomeTopInfo().getUser_goodnum());//用户靓号
|
||||||
|
} else {
|
||||||
|
userId.setText("ID:" + userInfo.getUserHomeTopInfo().getUser_id());//用户ID
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userInfo.getUserHomeTopInfo().getRong_online().equals("0")) {
|
||||||
|
userStatus.setText("在线");
|
||||||
|
userStatusIcon.setImageDrawable(getResources().getDrawable(R.mipmap.icon_green));
|
||||||
|
} else {
|
||||||
|
userStatus.setText("离线");
|
||||||
|
userStatusIcon.setImageDrawable(getResources().getDrawable(R.mipmap.icon_gray));
|
||||||
|
}
|
||||||
|
if (userInfo.getUserHomeTopInfo().getIs_live() == 1) {
|
||||||
|
liveStatus.setVisibility(View.VISIBLE);
|
||||||
|
avatar.setBackground(getResources().getDrawable(R.drawable.bg_live_1));
|
||||||
|
}
|
||||||
|
ImgLoader.display(UserHomeActivity.this, Integer.parseInt(String.valueOf(userInfo.getUserHomeTopInfo().getUser_sex())) == 0 ? R.mipmap.icon_man_new : R.mipmap.icon_wumen, user_sex);
|
||||||
|
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_anchor_img(), authorIcon);
|
||||||
|
ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_img(), levelIcon);
|
||||||
|
|
||||||
|
if (isAnchor) {//是否是主播
|
||||||
|
authorIcon.setVisibility(View.VISIBLE);
|
||||||
|
authenticationLayout.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
authorIcon.setVisibility(View.GONE);
|
||||||
|
authenticationLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
signature.setText(userInfo.getUserHomeTopInfo().getUser_signature());//个性签名
|
||||||
|
//标签
|
||||||
|
myAdapter = new LabelTagAdapter(mContext, new LabelTagAdapter.OnSureOnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void sure(LabelBean.Children labelBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tagList = new ArrayList<>();
|
||||||
|
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getAge())) {
|
||||||
|
tagList.add(userInfo.getUserHomeTopInfo().getAge() + "岁");
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getHeight())) {
|
||||||
|
tagList.add(userInfo.getUserHomeTopInfo().getHeight());
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCareer())) {
|
||||||
|
tagList.add(userInfo.getUserHomeTopInfo().getCareer());
|
||||||
|
}
|
||||||
|
if (userInfo.getUserHomeTopInfo().getCn_label() != null) {
|
||||||
|
if (userInfo.getUserHomeTopInfo().getCn_label().size() > 0) {
|
||||||
|
for (int i = 0; i < userInfo.getUserHomeTopInfo().getCn_label().size(); i++) {
|
||||||
|
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCn_label().get(i))) {
|
||||||
|
tagList.add(userInfo.getUserHomeTopInfo().getCn_label().get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myFlowTag.setAdapter(myAdapter);
|
||||||
|
myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE);
|
||||||
|
myAdapter.setData(tagList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mBanner.setOutlineProvider(new ViewOutlineProvider() {
|
||||||
|
@Override
|
||||||
|
public void getOutline(View view, Outline outline) {
|
||||||
|
outline.setRoundRect(0, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bannerImgList = userInfo.getUserHomeTopInfo().getUser_home_banner();
|
||||||
|
tempList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < bannerImgList.size(); i++) {
|
||||||
|
tempList.add(new UserHomeImgBean(bannerImgList.get(i)));
|
||||||
|
}
|
||||||
|
if (tempList.size() > 0) {
|
||||||
|
tempList.get(0).setShow(true);
|
||||||
|
}
|
||||||
|
userHomeImgAdapter = new UserHomeImgAdapter(UserHomeActivity.this, tempList, isMe);
|
||||||
|
imgsRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
imgsRecyclerView.setAdapter(userHomeImgAdapter);
|
||||||
|
|
||||||
|
userHomeImgAdapter.setOnItemClickListener(new UserHomeImgAdapter.onItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onImgItem(UserHomeImgBean activeBean, int position) {
|
||||||
|
L.e("onImgItem:" + position);
|
||||||
|
mBanner.setCurrentPage(position).start();
|
||||||
|
for (int i = 0; i < tempList.size(); i++) {
|
||||||
|
if (i == position) {
|
||||||
|
tempList.get(i).setShow(true);
|
||||||
|
} else {
|
||||||
|
tempList.get(i).setShow(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userHomeImgAdapter.setCommentBeanList(tempList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onImgDel(UserHomeImgBean activeBean, int position) {
|
||||||
|
bannerImgList.remove(position);
|
||||||
|
uploadImg(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBanner.setAutoPlay(false).setPages(bannerImgList, new UserHomeImgsViewHolder()).setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
L.e("onPageSelected:" + position);
|
||||||
|
for (int i = 0; i < tempList.size(); i++) {
|
||||||
|
if (i == position) {
|
||||||
|
tempList.get(i).setShow(true);
|
||||||
|
} else {
|
||||||
|
tempList.get(i).setShow(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userHomeImgAdapter.setCommentBeanList(tempList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBanner.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
bottomEditLayout = findViewById(R.id.bottomEditLayout);
|
||||||
|
imgUp = findViewById(R.id.imgUp);
|
||||||
|
imgLabel = findViewById(R.id.imgLabel);
|
||||||
|
topImgLayout = findViewById(R.id.topImgLayout);
|
||||||
|
|
||||||
|
topLayout = findViewById(R.id.topLayout);
|
||||||
|
scrollView = findViewById(R.id.scrollView);
|
||||||
|
|
||||||
|
topName = findViewById(R.id.topName);
|
||||||
|
liveStatus = findViewById(R.id.liveStatus);
|
||||||
|
giftCount = findViewById(R.id.giftCount);
|
||||||
|
|
||||||
|
fansImg1 = findViewById(R.id.fansImg1);
|
||||||
|
fansImg2 = findViewById(R.id.fansImg2);
|
||||||
|
fansImg3 = findViewById(R.id.fansImg3);
|
||||||
|
fansImgViewList = new ArrayList<>();
|
||||||
|
fansImgViewList.add(fansImg1);
|
||||||
|
fansImgViewList.add(fansImg2);
|
||||||
|
fansImgViewList.add(fansImg3);
|
||||||
|
|
||||||
|
guardImg1 = findViewById(R.id.guardImg1);
|
||||||
|
guardImg2 = findViewById(R.id.guardImg2);
|
||||||
|
guardImg3 = findViewById(R.id.guardImg3);
|
||||||
|
guardImgViewList = new ArrayList<>();
|
||||||
|
guardImgViewList.add(guardImg1);
|
||||||
|
guardImgViewList.add(guardImg2);
|
||||||
|
guardImgViewList.add(guardImg3);
|
||||||
|
|
||||||
|
giftImg1 = findViewById(R.id.giftImg1);
|
||||||
|
giftImg2 = findViewById(R.id.giftImg2);
|
||||||
|
giftImg3 = findViewById(R.id.giftImg3);
|
||||||
|
giftImgViewList = new ArrayList<>();
|
||||||
|
giftImgViewList.add(giftImg1);
|
||||||
|
giftImgViewList.add(giftImg2);
|
||||||
|
giftImgViewList.add(giftImg3);
|
||||||
|
|
||||||
|
honorImg1 = findViewById(R.id.honorImg1);
|
||||||
|
honorImg2 = findViewById(R.id.honorImg2);
|
||||||
|
honorImg3 = findViewById(R.id.honorImg3);
|
||||||
|
honorImgViewList = new ArrayList<>();
|
||||||
|
honorImgViewList.add(honorImg1);
|
||||||
|
honorImgViewList.add(honorImg2);
|
||||||
|
honorImgViewList.add(honorImg3);
|
||||||
|
|
||||||
|
userPresidentLayout = findViewById(R.id.userPresidentLayout);
|
||||||
|
userPresidentName = findViewById(R.id.userPresidentName);
|
||||||
|
itemLayout01 = findViewById(R.id.itemLayout01);
|
||||||
|
itemLayout02 = findViewById(R.id.itemLayout02);
|
||||||
|
itemLayout03 = findViewById(R.id.itemLayout03);
|
||||||
|
itemLayout04 = findViewById(R.id.itemLayout04);
|
||||||
|
communityRecyclerView = findViewById(R.id.communityRecyclerView);
|
||||||
|
myFlowTag = findViewById(R.id.myFlowTag);
|
||||||
|
avatar = findViewById(R.id.avatar);
|
||||||
|
userName = findViewById(R.id.name);
|
||||||
|
fansCount = findViewById(R.id.fansCount);
|
||||||
|
likeCount = findViewById(R.id.likeCount);
|
||||||
|
followLayout = findViewById(R.id.followLayout);
|
||||||
|
followName = findViewById(R.id.followName);
|
||||||
|
followIcon = findViewById(R.id.followIcon);
|
||||||
|
userId = findViewById(R.id.userId);
|
||||||
|
userStatus = findViewById(R.id.userStatus);
|
||||||
|
userStatusIcon = findViewById(R.id.userStatusIcon);
|
||||||
|
user_sex = findViewById(R.id.user_sex);
|
||||||
|
|
||||||
|
levelIcon = findViewById(R.id.levelIcon);
|
||||||
|
authorIcon = findViewById(R.id.authorlIcon);
|
||||||
|
|
||||||
|
authenticationLayout = findViewById(R.id.authenticationLayout);
|
||||||
|
signature = findViewById(R.id.signature);
|
||||||
|
moreLayout = findViewById(R.id.moreLayout);
|
||||||
|
moreText = findViewById(R.id.moreText);
|
||||||
|
moreIcon = findViewById(R.id.moreIcon);
|
||||||
|
|
||||||
|
mBanner = findViewById(R.id.banner);
|
||||||
|
imgsRecyclerView = findViewById(R.id.imgsRecyclerView);
|
||||||
|
|
||||||
|
communityRecyclerView = findViewById(R.id.communityRecyclerView);
|
||||||
|
communityRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
|
communityRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||||
|
|
||||||
|
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
followLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
CommonHttpUtil.setAttention(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), new CommonCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void callback(Integer isAttention) {
|
||||||
|
if (isAttention == 1) {
|
||||||
|
ImgLoader.display(UserHomeActivity.this, R.mipmap.icon_like_followed, followIcon);
|
||||||
|
followName.setText("已关注");
|
||||||
|
followName.setTextColor(Color.parseColor("#777777"));
|
||||||
|
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type_1));
|
||||||
|
} else {
|
||||||
|
ImgLoader.display(UserHomeActivity.this, R.mipmap.icon_like_follow, followIcon);
|
||||||
|
followName.setText("关注");
|
||||||
|
followName.setTextColor(getResources().getColor(R.color.white));
|
||||||
|
followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moreLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (isShowcase) {
|
||||||
|
if (isAnchor) {
|
||||||
|
itemLayout01.setVisibility(View.GONE);
|
||||||
|
itemLayout02.setVisibility(View.GONE);
|
||||||
|
itemLayout03.setVisibility(View.GONE);
|
||||||
|
itemLayout04.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
itemLayout03.setVisibility(View.GONE);
|
||||||
|
itemLayout04.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
moreText.setText("查看更多");
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_down, moreIcon);
|
||||||
|
} else {
|
||||||
|
if (isAnchor) {
|
||||||
|
itemLayout01.setVisibility(View.VISIBLE);
|
||||||
|
itemLayout02.setVisibility(View.VISIBLE);
|
||||||
|
itemLayout03.setVisibility(View.VISIBLE);
|
||||||
|
itemLayout04.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
itemLayout01.setVisibility(View.GONE);
|
||||||
|
itemLayout02.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
moreText.setText("收起");
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_up, moreIcon);
|
||||||
|
}
|
||||||
|
isShowcase = !isShowcase;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||||
|
int height = (int) (topImgLayout.getMeasuredHeight() * 1.2);
|
||||||
|
if (scrollY <= 0) {
|
||||||
|
//滑动之前,标题栏布局背景颜色为完全透明,标题文字完全透明
|
||||||
|
topLayout.setBackgroundColor(Color.argb(0, 0, 0, 0));
|
||||||
|
topName.setTextColor(Color.argb(0, 255, 255, 255));
|
||||||
|
//让mScrollView滑动的距离在0~height之间时颜色发生渐变
|
||||||
|
} else if (scrollY > 0 && scrollY <= height) {
|
||||||
|
//获取渐变率
|
||||||
|
float scale = (float) scrollY / height;
|
||||||
|
//获取渐变数值
|
||||||
|
float alpha = (255 * scale);
|
||||||
|
//布局文本颜色逐渐发生变化
|
||||||
|
topLayout.setBackgroundColor(Color.argb((int) alpha, 0, 0, 0));
|
||||||
|
topName.setTextColor(Color.argb((int) alpha, 255, 255, 255));
|
||||||
|
} else {
|
||||||
|
//当滑动距离超过height,布局文本颜色完全不透明
|
||||||
|
topLayout.setBackgroundColor(Color.argb(255, 0, 0, 0));
|
||||||
|
topName.setTextColor(Color.argb(255, 255, 255, 255));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
topLayout.setBackgroundColor(Color.argb(0, 0, 0, 0));
|
||||||
|
topName.setTextColor(Color.argb(0, 255, 255, 255));
|
||||||
|
}
|
||||||
|
imgUp.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (bannerImgList.size() < 9) {
|
||||||
|
selectImg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bottomEditLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
RouteUtil.forwardEditProfileActivity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.setting).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SparseArray<String> array = new SparseArray<>();
|
||||||
|
array.append(1, "不感兴趣");
|
||||||
|
array.append(0, "举报");
|
||||||
|
array.append(2, "加入黑名单");
|
||||||
|
DialogUitl.showStringArrayDialog(UserHomeActivity.this, array, new DialogUitl.StringArrayDialogCallback() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(String text, int tag) {
|
||||||
|
if (tag == 0) {
|
||||||
|
RouteUtil.forwardLiveReportActivity(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()));
|
||||||
|
} else if (tag == 1) {
|
||||||
|
CommonHttpUtil.noInterest(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), new com.yunbao.common.http.HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
CommonHttpUtil.noInterest(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), new com.yunbao.common.http.HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectImg() {
|
||||||
|
String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||||
|
String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
permission1 = Manifest.permission.READ_MEDIA_IMAGES;
|
||||||
|
permission2 = Manifest.permission.READ_MEDIA_VIDEO;
|
||||||
|
}
|
||||||
|
int isPermission1 = ContextCompat.checkSelfPermission(mContext, permission1);
|
||||||
|
int isPermission2 = ContextCompat.checkSelfPermission(mContext, permission2);
|
||||||
|
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
openImageChooserActivity();
|
||||||
|
} else {
|
||||||
|
//申请权限
|
||||||
|
ActivityCompat.requestPermissions(UserHomeActivity.this, new String[]{permission1, permission2}, PERMISSION_REQUEST_CODE_IMG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openImageChooserActivity() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
intent.setType("image/*");
|
||||||
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
|
||||||
|
startActivityForResult(intent, CHOOSE_IMG);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
if (requestCode == PERMISSION_REQUEST_CODE_IMG) {
|
||||||
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
openImageChooserActivity();
|
||||||
|
} else {
|
||||||
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE_IMG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getUseData() {
|
||||||
|
LiveNetManager.get(mContext).getUserHomeInfo(uid, new HttpCallback<HomeUserInfoBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(HomeUserInfoBean data) {
|
||||||
|
initData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
LiveNetManager.get(mContext).getUserExhibitInfoInfo(uid, new HttpCallback<HomeUserExhibitInfoBean>() {
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
@Override
|
||||||
|
public void onSuccess(HomeUserExhibitInfoBean data) {
|
||||||
|
//主播粉丝团
|
||||||
|
if (data.getUserHomeTopInfo().getFans().getList() != null) {
|
||||||
|
if (data.getUserHomeTopInfo().getFans().getList().size() >= 3) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
ImgLoader.display(mContext, data.getUserHomeTopInfo().getFans().getList().get(i).getAvatar(), fansImgViewList.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < data.getUserHomeTopInfo().getFans().getList().size(); i++) {
|
||||||
|
ImgLoader.display(mContext, data.getUserHomeTopInfo().getFans().getList().get(i).getAvatar(), fansImgViewList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//主播守护团
|
||||||
|
if (data.getUserHomeTopInfo().getGuard() != null) {
|
||||||
|
if (data.getUserHomeTopInfo().getGuard().size() >= 3) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
ImgLoader.display(mContext, data.getUserHomeTopInfo().getGuard().get(i).getAvatar(), guardImgViewList.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < data.getUserHomeTopInfo().getGuard().size(); i++) {
|
||||||
|
ImgLoader.display(mContext, data.getUserHomeTopInfo().getGuard().get(i).getAvatar(), guardImgViewList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//礼物墙
|
||||||
|
if (data.getGiftAlreadyWall().getGift_wall() != null) {
|
||||||
|
if (data.getGiftAlreadyWall().getGift_wall().size() >= 3) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
ImgLoader.display(mContext, data.getGiftAlreadyWall().getGift_wall().get(i).getGifticon(), giftImgViewList.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < data.getGiftAlreadyWall().getGift_wall().size(); i++) {
|
||||||
|
ImgLoader.display(mContext, data.getGiftAlreadyWall().getGift_wall().get(i).getGifticon(), giftImgViewList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
giftCount.setText(data.getGiftAlreadyWall().getGift_wall().size() + "/36");
|
||||||
|
}
|
||||||
|
//荣誉墙
|
||||||
|
if (data.getUserHomeTopInfo().getDress() != null) {
|
||||||
|
if (data.getUserHomeTopInfo().getDress().size() >= 3) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
ImgLoader.display(mContext, data.getUserHomeTopInfo().getDress().get(i).getDisplay_src(), honorImgViewList.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < data.getUserHomeTopInfo().getDress().size(); i++) {
|
||||||
|
ImgLoader.display(mContext, data.getUserHomeTopInfo().getDress().get(i).getDisplay_src(), honorImgViewList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == 100 && resultCode == RESULT_OK) {
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (mUserHomeViewHolder != null) {
|
if (resultCode == RESULT_OK && requestCode == CHOOSE_IMG) {
|
||||||
mUserHomeViewHolder.refreshImpress();
|
// 获取用户选择的图片 URI
|
||||||
|
Uri[] imageUris = null;
|
||||||
|
if (data != null) {
|
||||||
|
imageUris = new Uri[]{data.getData()};
|
||||||
|
File file = new File(Objects.requireNonNull(FilesUtils.getPath(mContext, imageUris[0])));
|
||||||
|
uploadFile(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void uploadFile(File file) {
|
||||||
protected void onDestroy() {
|
if (mUploadStrategy == null) {
|
||||||
if (mUserHomeViewHolder != null) {
|
mUploadStrategy = new UploadQnImpl(mContext);
|
||||||
mUserHomeViewHolder.release();
|
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
List<UploadBean> uploadBeans = new ArrayList<>();
|
||||||
|
UploadBean upVideoBean = new UploadBean(file, UploadBean.IMG);
|
||||||
|
uploadBeans.add(upVideoBean);
|
||||||
|
mUploadStrategy.upload(uploadBeans, true, new UploadCallback() {
|
||||||
|
@Override
|
||||||
|
public void onFinish(List<UploadBean> list, boolean success) {
|
||||||
|
if (!success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bannerImgList.add("https://downs.yaoulive.com/" + list.get(0).getRemoteAccessUrl());
|
||||||
|
uploadImg(true);
|
||||||
|
L.e(new Gson().toJson(list));
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uploadImg(boolean isUp) {
|
||||||
|
CommonHttpUtil.uploadUserInfoImg(new Gson().toJson(bannerImgList), new com.yunbao.common.http.HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
if (code == 0 && info != null) {
|
||||||
|
if (isUp) {
|
||||||
|
ToastUtil.show("上传成功");
|
||||||
|
} else {
|
||||||
|
ToastUtil.show("删除成功");
|
||||||
|
}
|
||||||
|
mBanner.setPages(bannerImgList, new UserHomeImgsViewHolder()).start();
|
||||||
|
tempList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < bannerImgList.size(); i++) {
|
||||||
|
tempList.add(new UserHomeImgBean(bannerImgList.get(i)));
|
||||||
|
}
|
||||||
|
if (tempList.size() > 0) {
|
||||||
|
tempList.get(0).setShow(true);
|
||||||
|
}
|
||||||
|
userHomeImgAdapter.setCommentBeanList(tempList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private File uri2File(Uri uri) {
|
||||||
|
String img_path;
|
||||||
|
String[] proj = {MediaStore.Images.Media.DATA};
|
||||||
|
Cursor actualimagecursor = this.managedQuery(uri, proj, null, null, null);
|
||||||
|
if (actualimagecursor == null) {
|
||||||
|
img_path = uri.getPath();
|
||||||
|
} else {
|
||||||
|
int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||||
|
actualimagecursor.moveToFirst();
|
||||||
|
img_path = actualimagecursor.getString(actual_image_column_index);
|
||||||
|
}
|
||||||
|
File file = new File(img_path);
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppConfig;
|
||||||
|
import com.yunbao.common.Constants;
|
||||||
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
|
import com.yunbao.common.bean.UserBean;
|
||||||
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
|
import com.yunbao.live.activity.LiveAddImpressActivity;
|
||||||
|
import com.yunbao.main.R;
|
||||||
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
|
import com.yunbao.main.views.UserHomeViewHolder2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cxf on 2018/9/25.
|
||||||
|
*/
|
||||||
|
//@Route(path = RouteUtil.PATH_USER_HOME)
|
||||||
|
public class UserHomeActivityOld extends AbsActivity {
|
||||||
|
|
||||||
|
private UserHomeViewHolder2 mUserHomeViewHolder;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.activity_empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isStatusBarWhite() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void main() {
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String toUid = intent.getStringExtra(Constants.TO_UID);
|
||||||
|
if (TextUtils.isEmpty(toUid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean fromLiveRoom = intent.getBooleanExtra(Constants.FROM_LIVE_ROOM, false);
|
||||||
|
String fromLiveUid = fromLiveRoom ? intent.getStringExtra(Constants.LIVE_UID) : null;
|
||||||
|
mUserHomeViewHolder = new UserHomeViewHolder2(mContext, (ViewGroup) findViewById(R.id.container), toUid, fromLiveRoom,fromLiveUid);
|
||||||
|
mUserHomeViewHolder.addToParent();
|
||||||
|
mUserHomeViewHolder.subscribeActivityLifeCycle();
|
||||||
|
mUserHomeViewHolder.loadData();
|
||||||
|
|
||||||
|
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||||
|
@Override
|
||||||
|
public void callback(UserBean bean) {
|
||||||
|
UserBean userBean = CommonAppConfig.getInstance().getUserBean();
|
||||||
|
userBean = bean;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addImpress(String toUid) {
|
||||||
|
Intent intent = new Intent(mContext, LiveAddImpressActivity.class);
|
||||||
|
intent.putExtra(Constants.TO_UID, toUid);
|
||||||
|
startActivityForResult(intent, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == 100 && resultCode == RESULT_OK) {
|
||||||
|
if (mUserHomeViewHolder != null) {
|
||||||
|
mUserHomeViewHolder.refreshImpress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
if (mUserHomeViewHolder != null) {
|
||||||
|
mUserHomeViewHolder.release();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
@ -9,10 +9,10 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.umeng.analytics.MobclickAgent;
|
import com.umeng.analytics.MobclickAgent;
|
||||||
import com.yunbao.common.activity.CommunitySendActivity;
|
|
||||||
import com.yunbao.common.event.FloatWarOrderEvent;
|
import com.yunbao.common.event.FloatWarOrderEvent;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
import com.yunbao.main.activity.CommunitySendActivity;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ import com.yunbao.common.CommonAppConfig;
|
|||||||
import com.yunbao.common.CommonAppContext;
|
import com.yunbao.common.CommonAppContext;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.HtmlConfig;
|
import com.yunbao.common.HtmlConfig;
|
||||||
import com.yunbao.common.activity.UserHomeActivity;
|
|
||||||
import com.yunbao.common.activity.WebViewActivity;
|
import com.yunbao.common.activity.WebViewActivity;
|
||||||
import com.yunbao.common.bean.GoogleBean;
|
import com.yunbao.common.bean.GoogleBean;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
|
@ -6,7 +6,6 @@ import android.text.TextUtils;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -14,10 +13,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.UserBean;
|
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
|
||||||
import com.yunbao.live.activity.LiveContributeActivity;
|
import com.yunbao.live.activity.LiveContributeActivity;
|
||||||
import com.yunbao.live.activity.LiveGuardListActivity;
|
import com.yunbao.live.activity.LiveGuardListActivity;
|
||||||
import com.yunbao.live.bean.ImpressBean;
|
import com.yunbao.live.bean.ImpressBean;
|
||||||
@ -26,8 +22,7 @@ import com.yunbao.live.custom.MyTextView;
|
|||||||
import com.yunbao.live.views.AbsUserHomeViewHolder;
|
import com.yunbao.live.views.AbsUserHomeViewHolder;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.activity.MyImpressActivity;
|
import com.yunbao.main.activity.MyImpressActivity;
|
||||||
import com.yunbao.main.activity.UserHomeActivity;
|
import com.yunbao.main.activity.UserHomeActivityOld;
|
||||||
import com.yunbao.main.bean.UserHomeConBean;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -128,8 +123,8 @@ public class UserHomeDetailViewHolder extends AbsUserHomeViewHolder implements V
|
|||||||
* 添加印象
|
* 添加印象
|
||||||
*/
|
*/
|
||||||
private void addImpress() {
|
private void addImpress() {
|
||||||
if (mContext instanceof UserHomeActivity) {
|
if (mContext instanceof UserHomeActivityOld) {
|
||||||
((UserHomeActivity) mContext).addImpress(mToUid);
|
((UserHomeActivityOld) mContext).addImpress(mToUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import com.yunbao.live.views.LiveRecordViewHolder;
|
|||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.activity.FansActivity;
|
import com.yunbao.main.activity.FansActivity;
|
||||||
import com.yunbao.main.activity.FollowActivity;
|
import com.yunbao.main.activity.FollowActivity;
|
||||||
import com.yunbao.main.activity.UserHomeActivity;
|
import com.yunbao.main.activity.UserHomeActivityOld;
|
||||||
import com.yunbao.main.bean.UserHomeConBean;
|
import com.yunbao.main.bean.UserHomeConBean;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
@ -543,8 +543,8 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void back() {
|
private void back() {
|
||||||
if (mContext instanceof UserHomeActivity) {
|
if (mContext instanceof UserHomeActivityOld) {
|
||||||
((UserHomeActivity) mContext).onBackPressed();
|
((UserHomeActivityOld) mContext).onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,8 +591,8 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL
|
|||||||
* 添加印象
|
* 添加印象
|
||||||
*/
|
*/
|
||||||
private void addImpress() {
|
private void addImpress() {
|
||||||
if (mContext instanceof UserHomeActivity) {
|
if (mContext instanceof UserHomeActivityOld) {
|
||||||
((UserHomeActivity) mContext).addImpress(mToUid);
|
((UserHomeActivityOld) mContext).addImpress(mToUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,16 +24,12 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.opensource.svgaplayer.SVGADrawable;
|
|
||||||
import com.opensource.svgaplayer.SVGAImageView;
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
import com.opensource.svgaplayer.SVGAParser;
|
|
||||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.adapter.ViewPagerAdapter;
|
import com.yunbao.common.adapter.ViewPagerAdapter;
|
||||||
import com.yunbao.common.bean.ConfigBean;
|
import com.yunbao.common.bean.ConfigBean;
|
||||||
import com.yunbao.common.bean.LevelBean;
|
|
||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.bean.NewLevelModel;
|
import com.yunbao.common.bean.NewLevelModel;
|
||||||
import com.yunbao.common.event.FollowEvent;
|
import com.yunbao.common.event.FollowEvent;
|
||||||
@ -52,7 +48,6 @@ import com.yunbao.common.utils.DpUtil;
|
|||||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||||
import com.yunbao.common.utils.MicStatusManager;
|
import com.yunbao.common.utils.MicStatusManager;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.SVGAViewUtils;
|
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.live.activity.LiveReportActivity;
|
import com.yunbao.live.activity.LiveReportActivity;
|
||||||
@ -68,7 +63,7 @@ import com.yunbao.main.R;
|
|||||||
import com.yunbao.main.activity.EditProfileActivity;
|
import com.yunbao.main.activity.EditProfileActivity;
|
||||||
import com.yunbao.main.activity.FansActivity;
|
import com.yunbao.main.activity.FansActivity;
|
||||||
import com.yunbao.main.activity.FollowActivity;
|
import com.yunbao.main.activity.FollowActivity;
|
||||||
import com.yunbao.main.activity.UserHomeActivity;
|
import com.yunbao.main.activity.UserHomeActivityOld;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
|
|
||||||
@ -86,8 +81,6 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -635,8 +628,8 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void back() {
|
private void back() {
|
||||||
if (mContext instanceof UserHomeActivity) {
|
if (mContext instanceof UserHomeActivityOld) {
|
||||||
((UserHomeActivity) mContext).onBackPressed();
|
((UserHomeActivityOld) mContext).onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,7 +794,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
|
|||||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((UserHomeActivity) mContext).onBackPressed();
|
((UserHomeActivityOld) mContext).onBackPressed();
|
||||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
|
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
|
||||||
} else {
|
} else {
|
||||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||||
|
Loading…
Reference in New Issue
Block a user