修改个人主页添加照片、编辑个人添加照片、发布动态添加照片不能多次添加的问题
This commit is contained in:
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
@@ -908,3 +908,9 @@ public static java.lang.String TABLENAME;
|
||||
-keepclassmembers class * {
|
||||
public void displayMessage();
|
||||
}
|
||||
|
||||
|
||||
# 在 proguard-rules.pro 中添加混淆规则
|
||||
-keep class com.petterp.floatingx.** { *; }
|
||||
-keep class com.petterp.floatingx.* { *; }
|
||||
-dontwarn com.petterp.floatingx.**
|
||||
|
||||
@@ -116,7 +116,6 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<application
|
||||
android:name=".AppContext"
|
||||
android:allowBackup="true"
|
||||
|
||||
@@ -18,9 +18,11 @@ public class UserPhotoWallAdapter extends BaseQuickAdapter<String, BaseViewHolde
|
||||
protected void convert(BaseViewHolder helper, String item) {
|
||||
helper.setGone(R.id.iv_close, false);
|
||||
if (item.equals(ADD_PHOTO)) {
|
||||
helper.setVisible(R.id.iv_close, false);
|
||||
// 显示加号图片
|
||||
helper.setImageResource(R.id.riv_user_head, com.xscm.moduleutil.R.mipmap.add_img);
|
||||
} else {
|
||||
helper.setVisible(R.id.iv_close, true);
|
||||
ImageUtils.loadCenterCrop(item, helper.getView(R.id.riv_user_head));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.blankj.utilcode.util.LogUtils;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.petterp.floatingx.FloatingX;
|
||||
import com.petterp.floatingx.assist.FxGravity;
|
||||
import com.petterp.floatingx.assist.FxScopeType;
|
||||
import com.petterp.floatingx.assist.helper.FxAppHelper;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
||||
@@ -106,14 +107,14 @@ public class PiaoPingManager {
|
||||
}
|
||||
|
||||
private void displayMessage(MqttBean mqttBean) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
|
||||
PixelFormat.TRANSLUCENT
|
||||
);
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// WindowManager.LayoutParams params = new WindowManager.LayoutParams(
|
||||
// WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
// WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
// WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
|
||||
// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
|
||||
// PixelFormat.TRANSLUCENT
|
||||
// );
|
||||
|
||||
|
||||
ToastUtils.show("飘屏开始");
|
||||
@@ -128,58 +129,59 @@ public class PiaoPingManager {
|
||||
tv_time.setText("x" + mqttBean.getList().getNumber());
|
||||
ToastUtils.show("飘屏创建");
|
||||
|
||||
WindowManager windowManager = (WindowManager) mContext.getSystemService(WINDOW_SERVICE);
|
||||
windowManager.addView(floatingView, params);
|
||||
}else {
|
||||
|
||||
}
|
||||
// WindowManager windowManager = (WindowManager) mContext.getSystemService(WINDOW_SERVICE);
|
||||
// windowManager.addView(floatingView, params);
|
||||
// }else {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// 先将视图放置在屏幕右侧外部,避免闪现问题
|
||||
// floatingView.setTranslationX(10000); // 先放到屏幕外
|
||||
floatingView.setTranslationX(10000); // 先放到屏幕外
|
||||
// 在 FloatingX 配置中或者通过其他方式设置
|
||||
// FxAppHelper fxAppHelper = FxAppHelper.builder()
|
||||
// .setContext(mContext)
|
||||
// .setLayoutView(floatingView)
|
||||
// .setGravity(FxGravity.RIGHT_OR_TOP)
|
||||
// .setX(0)
|
||||
// .setY(100)
|
||||
// .build();
|
||||
//
|
||||
// FloatingX.install(fxAppHelper).show();
|
||||
FxAppHelper fxAppHelper = FxAppHelper.builder()
|
||||
.setContext(mContext)
|
||||
.setLayoutView(floatingView)
|
||||
.setGravity(FxGravity.RIGHT_OR_TOP)
|
||||
.setX(0)
|
||||
.setY(100)
|
||||
.setScopeType(FxScopeType.SYSTEM_AUTO)
|
||||
.build();
|
||||
|
||||
FloatingX.install(fxAppHelper).show();
|
||||
ToastUtils.show("飘屏创建2");
|
||||
// 首先从右侧滑入到屏幕中央
|
||||
// floatingView.post(() -> {
|
||||
// // 确保初始位置在屏幕右侧外部
|
||||
// floatingView.setTranslationX(floatingView.getWidth());
|
||||
//
|
||||
// // 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
// floatingView.getWidth(), 0f);
|
||||
// animator1.setDuration(1500); // 延长动画时间到1.5秒
|
||||
// animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
// animator1.start();
|
||||
// ToastUtils.show("飘屏创建2第一阶段");
|
||||
// // 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
// floatingView.postDelayed(() -> {
|
||||
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
// 0f, -floatingView.getWidth());
|
||||
// animator2.setDuration(1500); // 延长动画时间到1.5秒
|
||||
// animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
// animator2.addListener(new AnimatorListenerAdapter() {
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// // 动画结束后移除悬浮窗
|
||||
// FloatingX.uninstallAll();
|
||||
floatingView.post(() -> {
|
||||
// 确保初始位置在屏幕右侧外部
|
||||
floatingView.setTranslationX(floatingView.getWidth());
|
||||
|
||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
floatingView.getWidth(), 0f);
|
||||
animator1.setDuration(1500); // 延长动画时间到1.5秒
|
||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
animator1.start();
|
||||
ToastUtils.show("飘屏创建2第一阶段");
|
||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
floatingView.postDelayed(() -> {
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
0f, -floatingView.getWidth());
|
||||
animator2.setDuration(1500); // 延长动画时间到1.5秒
|
||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
animator2.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// 动画结束后移除悬浮窗
|
||||
FloatingX.uninstallAll();
|
||||
// windowManager.removeView(floatingView);
|
||||
// // 处理下一个消息
|
||||
// processNextMessage();
|
||||
// }
|
||||
// });
|
||||
// animator2.start();
|
||||
// }, 3000); // 停留1秒
|
||||
// ToastUtils.show("飘屏创建2第er阶段");
|
||||
// });
|
||||
// 处理下一个消息
|
||||
processNextMessage();
|
||||
}
|
||||
});
|
||||
animator2.start();
|
||||
}, 3000); // 停留1秒
|
||||
ToastUtils.show("飘屏创建2第er阶段");
|
||||
});
|
||||
ToastUtils.show("飘屏结束");
|
||||
}
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ public class DynamicDetailActivity extends BaseMvpActivity<CirclePresenter, Acti
|
||||
@Override
|
||||
public void setLikeZone() {
|
||||
MvpPre.topicId(zone_id, 2);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.example.modulecircle.contacts.ReleaseContract;
|
||||
import com.example.modulecircle.databinding.ActivityReleaseBinding;
|
||||
import com.example.modulecircle.adapter.MultiSelectAdapter;
|
||||
import com.example.modulecircle.presenter.ReleasePresenter;
|
||||
import com.example.modulevocal.activity.EditUserInfoActivity;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.luck.picture.lib.basic.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
@@ -40,6 +41,7 @@ import com.xscm.moduleutil.utils.GlideEngine;
|
||||
import com.xscm.moduleutil.utils.location.LocationProvider;
|
||||
import com.xscm.moduleutil.utils.location.LocationServiceFactory;
|
||||
import com.xscm.moduleutil.widget.Constants;
|
||||
import com.xscm.moduleutil.widget.img.FullScreenUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -90,11 +92,19 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
String item = list.get(position);
|
||||
if (item.equals(UserPhotoWallAdapter.ADD_PHOTO)) {
|
||||
// 点击的是“+”号,启动图片选择
|
||||
startChoosePhoto(1, PictureConfig.CHOOSE_REQUEST, false, 9);
|
||||
int id = view.getId();
|
||||
if (id == com.example.modulevocal.R.id.iv_close) {
|
||||
uploadedUrls.remove(item);
|
||||
updateAdapterData();
|
||||
} else {
|
||||
// 查看大图或其他操作
|
||||
if (item.equals(UserPhotoWallAdapter.ADD_PHOTO)) {
|
||||
// 点击的是“+”号,启动图片选择
|
||||
startChoosePhoto(1, PictureConfig.CHOOSE_REQUEST, false, 9);
|
||||
} else {
|
||||
// 查看大图或其他操作
|
||||
// 查看大图或其他操作
|
||||
FullScreenUtil.showFullScreenDialog(ReleaseActivity.this, position, list);
|
||||
}
|
||||
}
|
||||
|
||||
// int id = view.getId();
|
||||
@@ -225,7 +235,7 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
String path = media.isCompressed() ? media.getCompressPath() : media.getRealPath();
|
||||
imageFiles.add(new File(path));
|
||||
}
|
||||
|
||||
size = uploadedUrls.size();
|
||||
// 开始批量上传
|
||||
MvpPre.batchUploadFiles(imageFiles, 0); // 第二个参数是你原来的 type
|
||||
|
||||
@@ -311,7 +321,7 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
int size=0;
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type, int index, int total) {
|
||||
if (index >= 0 && index < uploadedUrls.size()) {
|
||||
@@ -320,7 +330,7 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
||||
uploadedUrls.add(url); // 添加到最后
|
||||
}
|
||||
|
||||
if (uploadedUrls.size() == total) {
|
||||
if (uploadedUrls.size() == total+size) {
|
||||
updateAdapterData(); // 所有图片上传完成,更新适配器数据
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,13 +241,14 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
|
||||
uploadedUrls.add(url); // 添加到最后
|
||||
}
|
||||
|
||||
if (uploadedUrls.size() == total) {
|
||||
// if (uploadedUrls.size() == total) {
|
||||
updateAdapterData(); // 所有图片上传完成,更新适配器数据
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upAddAlbum() {
|
||||
uploadedUrls.clear();
|
||||
MvpPre.getAlbumDetail(albumId, pwd, page + "", "10");
|
||||
}
|
||||
|
||||
@@ -299,6 +300,12 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
|
||||
updateZanButtonUI(albumBean1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findAlbum() {
|
||||
mBinding.smartRefreshLayout.finishRefresh() ;
|
||||
mBinding.smartRefreshLayout.finishLoadMore() ;
|
||||
}
|
||||
|
||||
private void updateAdapterData() {
|
||||
String imageUrlsString = TextUtils.join(",", uploadedUrls);
|
||||
MvpPre.upAddAlbum(albumId, imageUrlsString, "");
|
||||
@@ -307,6 +314,7 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
page=1;
|
||||
MvpPre.getAlbumDetail(albumId, pwd, "1", "10");
|
||||
}
|
||||
|
||||
@@ -385,9 +393,20 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
|
||||
}
|
||||
mBinding.dyComment.setText(albumBean.getLike_num() != null && !albumBean.getLike_num().isEmpty() ? albumBean.getLike_num() : "0");
|
||||
mBinding.lockComment.setText(albumBean.getRead_num() != null && !albumBean.getRead_num().isEmpty() ? albumBean.getRead_num() : "0");
|
||||
List<AlbumBean.ImageList> allImages = albumBean.getImage_list();
|
||||
List<AlbumBean.ImageList> groupedPhotos = groupPhotos(allImages);
|
||||
adapter.setNewData(groupedPhotos);
|
||||
if (albumBean.getImage_list() != null && !albumBean.getImage_list().isEmpty()) {
|
||||
List<AlbumBean.ImageList> allImages = albumBean.getImage_list();
|
||||
List<AlbumBean.ImageList> groupedPhotos = groupPhotos(allImages);
|
||||
if (page==1) {
|
||||
adapter.setNewData(groupedPhotos);
|
||||
}else {
|
||||
adapter.addData(groupedPhotos);
|
||||
}
|
||||
}else {
|
||||
page=1;
|
||||
if (albumBean.getCount()==null || albumBean.getCount().equals("0")){
|
||||
adapter.setNewData( new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -344,6 +344,7 @@ public class EditUserInfoActivity extends BaseMvpActivity<EditUserPresenter, Act
|
||||
@Override
|
||||
public void editUserInfoSuccess(String s) {
|
||||
ToastUtils.showShort(s);
|
||||
uploadedUrls.clear();
|
||||
MvpPre.getUserHome(SpUtil.getUserId() + "");
|
||||
}
|
||||
|
||||
@@ -366,15 +367,21 @@ public class EditUserInfoActivity extends BaseMvpActivity<EditUserPresenter, Act
|
||||
// list.add(new UserImgList("1", url));
|
||||
// mUserPhotoWallAdapter.setNewData(list);
|
||||
|
||||
if (index >= 0 && index < uploadedUrls.size()) {
|
||||
uploadedUrls.add(index, url); // 插入到对应位置
|
||||
} else {
|
||||
uploadedUrls.add(url); // 添加到最后
|
||||
try {
|
||||
if (index >= 0 && index <= uploadedUrls.size()) {
|
||||
uploadedUrls.add(index, url);
|
||||
LogUtils.d("EditUserInfoActivity", "图片已插入到位置 "+index);
|
||||
} else {
|
||||
uploadedUrls.add(url);
|
||||
LogUtils.d("EditUserInfoActivity", "图片已添加到末尾");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("EditUserInfoActivity", "处理图片URL时出错: " + e.getMessage());
|
||||
uploadedUrls.add(url);
|
||||
}
|
||||
|
||||
if (uploadedUrls.size() == total) {
|
||||
// if (uploadedUrls.size() == total) {
|
||||
updateAdapterData(); // 所有图片上传完成,更新适配器数据
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ public class AlbumDetailConacts {
|
||||
void deleteAlbum();
|
||||
void likeAlbum();
|
||||
|
||||
void findAlbum();
|
||||
|
||||
}
|
||||
public interface IMePre extends IPresenter {
|
||||
void getAlbumDetail(String albumId,String pwd,String page,String page_limit);
|
||||
|
||||
@@ -33,6 +33,7 @@ public class AlbumDetailPresenter extends BasePresenter<AlbumDetailConacts.View>
|
||||
@Override
|
||||
public void onNext(AlbumBean albumBean) {
|
||||
MvpRef.get().getAlbumDetail(albumBean);
|
||||
MvpRef.get().findAlbum();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user