1:修改获取网络数据的解析方式

2:修改拍卖房的规则
This commit is contained in:
2025-09-24 15:59:41 +08:00
parent 5f573e607d
commit 407b21c33f
23 changed files with 1790 additions and 344 deletions

View File

@@ -2,6 +2,7 @@ package com.example.modulevocal.activity;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -179,7 +180,7 @@ public class PersonalityActivity extends BaseMvpActivity<PersonalityPresenter, A
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
mBinding.slidingTabLayout.setCurrentTab(0);
mBinding.viewPager.setOffscreenPageLimit(0);
refreshCurrentGiftFragment(personaltyBean.get(0).getId());
refreshCurrentGiftFragment(personaltyBean.get(0).getId(),0);
mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
@@ -189,7 +190,7 @@ public class PersonalityActivity extends BaseMvpActivity<PersonalityPresenter, A
@Override
public void onPageSelected(int position) {
// 当页面切换时,控制 tv_bb_qs 按钮的显示
refreshCurrentGiftFragment(personaltyBean.get(position).getId());
refreshCurrentGiftFragment(personaltyBean.get(position).getId(),position);
}
@Override
@@ -198,9 +199,14 @@ public class PersonalityActivity extends BaseMvpActivity<PersonalityPresenter, A
}
});
}
private void refreshCurrentGiftFragment(String id) {
private void refreshCurrentGiftFragment(String id,int position) {
if (getCurrentGiftFragment()!=null){
getCurrentGiftFragment().loadDataIfNeeded(Integer.parseInt(id));
getCurrentGiftFragment().loadDataIfNeeded(Integer.parseInt(id), position);
if (position==0){
mBinding.ivUser.setVisibility(View.VISIBLE);
}else {
mBinding.ivUser.setVisibility(View.GONE);
}
}
}
private ZhuangBanShangChengFragment getCurrentGiftFragment() {

View File

@@ -18,6 +18,8 @@ import com.example.modulevocal.presenter.SettingPresenter;
import com.xscm.moduleutil.activity.BaseMvpActivity;
import com.xscm.moduleutil.activity.WebViewActivity;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
import com.xscm.moduleutil.dialog.FirstChargeDialog;
import com.xscm.moduleutil.dialog.RealNameDialog;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.SpUtil;
@@ -78,11 +80,22 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
} else {
RealNameDialog realNameDialog = new RealNameDialog(this);
realNameDialog.show();
realNameDialog.setOnDismissListener(dialog -> {
dialog.dismiss();
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
// startActivity(new Intent(SettingActivity.this, RealName1Activity.class));
realNameDialog.setOnFirstChargeListener(new RealNameDialog.OnFirstChargeListener() {
@Override
public void onFirstChargeConfirmed(String giftBean, int type) {
realNameDialog.dismiss();
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
}
@Override
public void onFirstChargeCancelled() {
realNameDialog.dismiss();
}
});
// realNameDialog.setOnDismissListener(dialog -> {
// dialog.dismiss();
// ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
// });
}
} else if (view.getId() == R.id.ll_qhch) {
new AlertDialog.Builder(this).setMessage("确认清理缓存?").setPositiveButton("确定", new DialogInterface.OnClickListener() {

View File

@@ -53,7 +53,7 @@ public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentM
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
userId = getArguments().getString("userId");
userId = getArguments().getString("userId");
}
@Override
@@ -64,7 +64,7 @@ public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentM
@Override
protected void initData() {
MvpPre.getAlbumList("1", "10",userId);
MvpPre.getAlbumList("1", "10", userId);
}
@Override
@@ -78,29 +78,29 @@ public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentM
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
AlbumBean item = mAdapter.getItem(position);
if ("0".equals(item.getId())) {
startActivity(new Intent(getActivity(), CreateAlbumActivity.class));
}
else {
startActivity(new Intent(getActivity(), CreateAlbumActivity.class));
} else {
if (!TextUtils.isEmpty(item.getPwd())) {
if (userId.equals(SpUtil.getUserId() + "")){
if (userId.equals(SpUtil.getUserId() + "")) {
onPasswordCorrect(item);
}else {
} else {
showPasswordInputDialog(item);
}
} else {
ARouter.getInstance().build(ARouteConstants.USER_ALBUM_DETAIL).withString("albumId", item.getId()).withString("pwd", item.getPwd()).withString("target_fragment",ARouteConstants.FRAGMENT_ALBUM).navigation();
ARouter.getInstance().build(ARouteConstants.USER_ALBUM_DETAIL).withString("albumId", item.getId()).withString("pwd", item.getPwd()).withString("target_fragment", ARouteConstants.FRAGMENT_ALBUM).navigation();
}
}
}
});
List<AlbumBean> list = new ArrayList<>();
if (userId.equals(SpUtil.getUserId()+"")){
if (userId.equals(SpUtil.getUserId() + "")) {
AlbumBean albumBean = new AlbumBean();
albumBean.setId("0");
list.add(albumBean);
mAdapter.setNewData(list);
}
}
@SuppressLint({"MissingInflatedId", "LocalSuppress"})
private void showPasswordInputDialog(AlbumBean item) {
// 创建弹出框视图
@@ -108,7 +108,7 @@ public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentM
// 获取弹出框中的控件
final EditText etPassword = dialogView.findViewById(com.xscm.moduleutil.R.id.ed_album_password);
TextView btnCancel = dialogView.findViewById(com.xscm.moduleutil.R.id.tv_cancel);
TextView btnCancel = dialogView.findViewById(com.xscm.moduleutil.R.id.tv_cancel);
TextView btnConfirm = dialogView.findViewById(com.xscm.moduleutil.R.id.tv_confirm);
// 创建并显示弹出框
@@ -150,7 +150,7 @@ public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentM
// 密码正确后的操作方法(示例)
private void onPasswordCorrect(AlbumBean item) {
// 密码正确后的具体操作
ARouter.getInstance().build(ARouteConstants.USER_ALBUM_DETAIL).withString("albumId", item.getId()).withString("pwd", item.getPwd()).navigation();
ARouter.getInstance().build(ARouteConstants.USER_ALBUM_DETAIL).withString("albumId", item.getId()).withString("pwd", item.getPwd()).navigation();
}
@Override
@@ -160,10 +160,13 @@ public class MyAlbumFragment extends BaseMvpFragment<MyAlbumPresenter, FragmentM
@Override
public void getAlbumList(List<AlbumBean> data) {
if (userId.equals(SpUtil.getUserId()+"")){
if (data == null) {
data = new ArrayList<>();
}
if (userId.equals(SpUtil.getUserId() + "")) {
AlbumBean albumBean = new AlbumBean();
albumBean.setId("0");
data.add(0,albumBean);
data.add(0, albumBean);
}
mAdapter.setNewData(data);
}

View File

@@ -11,7 +11,7 @@ import java.util.List;
public class ZhuangBanShangChengConactos {
public interface View extends IView<Activity> {
void getDecorateList(List<ZhuangBanShangChengBean> zhuangBanShangChengBeans);
void getDecorateList(List<ZhuangBanShangChengBean> zhuangBanShangChengBeans,int tabIndex);
void setUserDecorate();
@@ -19,7 +19,7 @@ public class ZhuangBanShangChengConactos {
}
public interface ICreatedRoomPre extends IPresenter {
void getDecorateList(String type);
void getDecorateList(String type,int tabIndex);
void setUserDecorate(String udid);

View File

@@ -1,9 +1,11 @@
package com.example.modulevocal.fragment.zhuangb;
import static android.view.View.GONE;
import static com.xscm.moduleutil.utils.ImageLoader.loadImage;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.recyclerview.widget.GridLayoutManager;
@@ -21,7 +23,9 @@ import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.widget.AvatarFrameView;
import com.tencent.qgame.animplayer.AnimView;
import com.xscm.moduleutil.widget.GiftAnimView;
import java.util.ArrayList;
import java.util.List;
public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangChengPresenter, ZhuangbanRecyclerviewNorefBinding> implements ZhuangBanShangChengConactos.View {
@@ -33,8 +37,11 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
private String did;
ZhuangBanShangChengAdapter adapter;
AvatarFrameView imageBg;
GiftAnimView imageBg2;
AnimView item_animview;
RoundedImageView image_user;
private int tabIndex;
@Override
protected ZhuangBanShangChengPresenter bindPresenter() {
return new ZhuangBanShangChengPresenter(this, getActivity());
@@ -47,22 +54,26 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
fragment.setArguments(args);
return fragment;
}
@Override
public void initArgs(Bundle arguments) {
super.initArgs(arguments);
type = arguments.getInt("type", MyRoomListFragment.TYPE_CREATE);
}
public void loadDataIfNeeded(int type){
if (MvpPre==null){
MvpPre=bindPresenter();
public void loadDataIfNeeded(int type,int tabIndex) {
if (MvpPre == null) {
MvpPre = bindPresenter();
}
MvpPre.getDecorateList(type+"");
this.type = type;
this.tabIndex = tabIndex;
MvpPre.getDecorateList(type + "", tabIndex);
}
@Override
protected void initData() {
MvpPre.getDecorateList(type+"");
MvpPre.getDecorateList(type + "", tabIndex);
// //这里根据传递的type进行数据查询
@@ -77,14 +88,38 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
// zhuangBanShangChengBean.setBase_image("");
// zhuangBanShangChengBeanList.add(zhuangBanShangChengBean);
// }
image_user=(RoundedImageView) getActivity().findViewById(R.id.iv_user);
image_user = (RoundedImageView) getActivity().findViewById(R.id.iv_user);
imageBg = (AvatarFrameView) getActivity().findViewById(R.id.image_headPortrait);
// imageBg2 = (GiftAnimView) getActivity().findViewById(R.id.image_headPortrait2);
imageBg2 = new GiftAnimView(getActivity());
imageBg2.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
));
imageBg2.setVisibility(GONE);
ViewGroup parentLayout = (ViewGroup) getActivity().findViewById(R.id.ccl).getParent(); // 或者其他合适的父布局
parentLayout.addView(imageBg2);
item_animview = (AnimView) getActivity().findViewById(R.id.item_animview);
if (SpUtil.getUserInfo()!=null){
if (SpUtil.getUserInfo().getAvatar() != null){
ImageUtils.loadHeadCC(SpUtil.getUserInfo().getAvatar(),image_user);
if (SpUtil.getUserInfo() != null) {
if (SpUtil.getUserInfo().getAvatar() != null) {
ImageUtils.loadHeadCC(SpUtil.getUserInfo().getAvatar(), image_user);
}
}
// if (type == 1) {
//// image_user.setVisibility(View.VISIBLE);
// imageBg.setVisibility(View.VISIBLE);
// imageBg2.setVisibility(View.GONE);
// } else if (type == 2){
//// image_user.setVisibility(View.GONE);
// imageBg.setVisibility(View.GONE);
// imageBg2.setVisibility(View.VISIBLE);
// }else {
//// image_user.setVisibility(View.GONE);
// imageBg.setVisibility(View.GONE);
// imageBg2.setVisibility(View.GONE);
// }
adapter = new ZhuangBanShangChengAdapter();
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 3);
@@ -93,6 +128,29 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
adapter.setOnItemChildClickListener((adapter1, view, position) -> {
List<ZhuangBanShangChengBean> list = (List<ZhuangBanShangChengBean>) adapter1.getData();
// 清除之前的选择状态
clearPreviousSelection(list);
// // 设置当前选择
// ZhuangBanShangChengBean selectedBean = list.get(position);
// selectedBean.setIs_select(true);
// pSelect = position;
// did = selectedBean.getUdid();
//
// // 更新UI显示
// if (position == 0) { // "无"选项
// mBinding.ll.setVisibility(View.GONE);
// clearDecorations();
// } else {
// mBinding.ll.setVisibility(View.VISIBLE);
//
// if ("svga".equalsIgnoreCase(getFileExtension(selectedBean.getPlay_image()))) {
// imageBg.stopAll();
// imageBg.setSource(selectedBean.getPlay_image(), 2);
// } else if ("mp4".equalsIgnoreCase(getFileExtension(selectedBean.getPlay_image()))) {
// imageBg.stopAll();
// imageBg.setSource(selectedBean.getPlay_image(), 2);
// }
// }
if (pSelect != -1 && pSelect != position) {
list.get(pSelect).setIs_select(false);
@@ -100,38 +158,60 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
pSelect = position;
did = list.get(position).getUdid();
mBinding.ll.setVisibility(View.VISIBLE);
if (list.get( position)!=null && list.get(position).getType()!=null && list.get(position).getPlay_image()!=null) {
if ("svga".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
// imageBg.playSVGA(list.get(position).getPlay_image());
imageBg.stopAll();
imageBg.setSource(list.get(position).getPlay_image(),1);
} else if ("mp4".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
// imageBg.playMP4(Uri.parse(list.get(position).getPlay_image()));
imageBg.stopAll();
imageBg.setSource(list.get(position).getPlay_image(),1);
// if ("svga".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
if (list.get(position).getType().equals("1")) {
imageBg2.setVisibility(View.GONE);
imageBg.stopAll();
imageBg.setSource(list.get(position).getPlay_image(), 2);
} else if (list.get(position).getType().equals("2")) {
// imageBg2.setSource(list.get(position).getPlay_image(), 2);
imageBg2.setVisibility(View.VISIBLE);
imageBg2.previewEffectWith(list.get(position).getPlay_image());
}
}
// } else if ("mp4".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
//// imageBg.playMP4(Uri.parse(list.get(position).getPlay_image()));
// imageBg.stopAll();
// imageBg.setSource(list.get(position).getPlay_image(),2);
// }
} else if (pSelect != -1 && pSelect == position) {
list.get(position).setIs_select(false);
pSelect = -1;
mBinding.ll.setVisibility(View.GONE);
mBinding.ll.setVisibility(GONE);
} else {
list.get(position).setIs_select(true);
did = list.get(position).getUdid();
pSelect = position;
mBinding.ll.setVisibility(View.VISIBLE);
if (list.get( position)!=null && list.get(position).getType()!=null && list.get(position).getPlay_image()!=null) {
if (list.get(position).getType().equals("1")) {
imageBg2.setVisibility(View.GONE);
imageBg.stopAll();
imageBg.setSource(list.get(position).getPlay_image(), 2);
} else if (list.get(position).getType().equals("2")) {
imageBg2.setVisibility(View.VISIBLE);
// imageBg2.stopAll();
// imageBg2.setSource(list.get(position).getPlay_image(), 2);
imageBg2.previewEffectWith(list.get(position).getPlay_image());
}
}
// loadImage(getContext(),imageBg, list.get(position).getPlay_image());
// ImageUtils.loadDecorationAvatar(list.get(position).getPlay_image(), imageBg);
// imageBg.load(list.get(position).getPlay_image());
if ("svga".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
imageBg.stopAll();
imageBg.setSource(list.get(position).getPlay_image(),1);
// imageBg.playSVGA(list.get(position).getPlay_image());
} else if ("mp4".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
imageBg.stopAll();
imageBg.setSource(list.get(position).getPlay_image(), 1);
// imageBg.playMP4(Uri.parse(list.get(position).getPlay_image()));
}
// if ("svga".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
// imageBg.stopAll();
// imageBg.setSource(list.get(position).getPlay_image(), 2);
//// imageBg.playSVGA(list.get(position).getPlay_image());
// } else if ("mp4".equalsIgnoreCase(getFileExtension(list.get(position).getPlay_image()))) {
// imageBg.stopAll();
// imageBg.setSource(list.get(position).getPlay_image(), 2);
//// imageBg.playMP4(Uri.parse(list.get(position).getPlay_image()));
// }
}
@@ -141,6 +221,29 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
adapter.setNewData(zhuangBanShangChengBeanList);
}
/**
* 清除之前的选择状态
*/
private void clearPreviousSelection(List<ZhuangBanShangChengBean> list) {
if (pSelect != -1 && pSelect < list.size()) {
list.get(pSelect).setIs_select(false);
}
pSelect = -1;
}
/**
* 清除装饰效果
*/
private void clearDecorations() {
if (imageBg != null) {
imageBg.stopAll();
}
if (item_animview != null) {
item_animview.stopPlay();
}
}
private String getFileExtension(String url) {
if (url == null || url.isEmpty()) return "";
int dotIndex = url.lastIndexOf(".");
@@ -154,9 +257,9 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
protected void initView() {
mBinding.zhuangbanBuy.setOnClickListener(v -> {
if (did == null || did.isEmpty()){
MvpPre.cancelUserDecorate(type+"");
}else {
if (did == null || did.isEmpty()) {
MvpPre.cancelUserDecorate(type + "");
} else {
MvpPre.setUserDecorate(did);
}
});
@@ -170,15 +273,20 @@ public class ZhuangBanShangChengFragment extends BaseMvpFragment<ZhuangBanShangC
}
@Override
public void getDecorateList(List<ZhuangBanShangChengBean> zhuangBanShangChengBeans) {
if (adapter==null){
public void getDecorateList(List<ZhuangBanShangChengBean> zhuangBanShangChengBeans, int tabIndex) {
if (adapter == null) {
adapter = new ZhuangBanShangChengAdapter();
}
if (zhuangBanShangChengBeans==null){
zhuangBanShangChengBeans=new ArrayList<>();
}
ZhuangBanShangChengBean zhuangBanShangChengBean = new ZhuangBanShangChengBean();
zhuangBanShangChengBean.setTitle("");
zhuangBanShangChengBean.setBase_image("");
zhuangBanShangChengBeans.add(0,zhuangBanShangChengBean);
zhuangBanShangChengBeans.add(0, zhuangBanShangChengBean);
adapter.setNewData(zhuangBanShangChengBeans);
this.tabIndex = tabIndex;
}
@Override

View File

@@ -20,7 +20,7 @@ public class ZhuangBanShangChengPresenter extends BasePresenter<ZhuangBanShangCh
}
@Override
public void getDecorateList(String type) {
public void getDecorateList(String type,int tabIndex) {
api.getDecorateList(type, new BaseObserver<List<ZhuangBanShangChengBean>>() {
@Override
public void onSubscribe(Disposable d) {
@@ -32,7 +32,7 @@ public class ZhuangBanShangChengPresenter extends BasePresenter<ZhuangBanShangCh
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().getDecorateList(zhuangBanShangChengBeans);
MvpRef.get().getDecorateList(zhuangBanShangChengBeans, tabIndex);
}
});
}

View File

@@ -93,7 +93,7 @@
android:layout_weight="1"
android:background="@drawable/bg_r100_hui"
android:gravity="center|left"
android:hint="请输入称"
android:hint="请输入房间名称"
android:maxLength="10"
android:paddingStart="10dp"
android:paddingEnd="@dimen/dp_10"

View File

@@ -9,6 +9,7 @@
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ccl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -85,7 +86,8 @@
<com.tencent.qgame.animplayer.AnimView
android:id="@+id/item_animview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -118,6 +120,11 @@
android:layout_marginTop="@dimen/dp_30"
app:layout_constraintTop_toBottomOf="@+id/cl_2" />
<com.xscm.moduleutil.widget.GiftAnimView
android:id="@+id/image_headPortrait2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_60"

View File

@@ -18,12 +18,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_20">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_10"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintTop_toBottomOf="@+id/tv_title"

View File

@@ -2,9 +2,10 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_78"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_110"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_10"
android:background="#E9E9E9"
android:gravity="center_horizontal"
android:orientation="vertical"