修改个人主页添加照片、编辑个人添加照片、发布动态添加照片不能多次添加的问题
This commit is contained in:
@@ -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("飘屏结束");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user