1:修改小时榜入口
2:修改小时榜图片大小 3:修改换麦后清除魅力展示
This commit is contained in:
@@ -447,20 +447,14 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
isHourlyProcessing = false;
|
||||
return;
|
||||
}
|
||||
// 最多处理3条数据
|
||||
int processCount = Math.min(3, hourlyMessageQueue.size());
|
||||
messagesToProcess = new ArrayList<>(hourlyMessageQueue.subList(0, processCount));
|
||||
// 从队列中移除已处理的数据
|
||||
for (int i = 0; i < processCount; i++) {
|
||||
hourlyMessageQueue.remove(0);
|
||||
}
|
||||
// 每次只处理1条数据
|
||||
messagesToProcess = new ArrayList<>();
|
||||
messagesToProcess.add(hourlyMessageQueue.remove(0));
|
||||
}
|
||||
|
||||
// 同时展示多条数据
|
||||
for (int i = 0; i < messagesToProcess.size(); i++) {
|
||||
HourlyBean bean = messagesToProcess.get(i);
|
||||
showHourlyFloatingMessage(bean, i);
|
||||
}
|
||||
// 只展示一条数据
|
||||
HourlyBean bean = messagesToProcess.get(0);
|
||||
showHourlyFloatingMessage(bean, 0);
|
||||
}
|
||||
|
||||
private void showHourlyFloatingMessage(HourlyBean hourlyBean, int positionIndex) {
|
||||
@@ -473,10 +467,9 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
// 根据位置设置不同的垂直间距
|
||||
// 设置固定的垂直位置
|
||||
int baseMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
|
||||
int verticalSpacing = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 50);
|
||||
layoutParams.topMargin = baseMargin + (positionIndex * verticalSpacing);
|
||||
layoutParams.topMargin = baseMargin;
|
||||
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
|
||||
hourlyView.setLayoutParams(layoutParams);
|
||||
|
||||
@@ -501,10 +494,10 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
|
||||
// 检查是否还有更多消息需要处理
|
||||
synchronized (hourlyQueueLock) {
|
||||
if (hourlyMessageQueue.isEmpty() && currentHourlyViews.isEmpty()) {
|
||||
if (hourlyMessageQueue.isEmpty()) {
|
||||
isHourlyProcessing = false;
|
||||
} else if (!hourlyMessageQueue.isEmpty() && currentHourlyViews.isEmpty()) {
|
||||
// 所有当前视图都已消失,处理下一批消息
|
||||
} else {
|
||||
// 当前视图消失后处理下一条消息
|
||||
processHourlyMessages();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
public void onConnectSuccess() {//重连成功
|
||||
if (CommonAppContext.getInstance().playId!=null){
|
||||
LogUtils.e("@@@", "重连成功");
|
||||
LogUtils.e("@@@", ""+CommonAppContext.getInstance().playId);
|
||||
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMSDKListener;
|
||||
@@ -34,6 +35,7 @@ public class IMConnectionService extends Service {
|
||||
public void onConnectSuccess() {//重连成功
|
||||
Log.d(TAG, "IM connect success");
|
||||
if (CommonAppContext.getInstance().playId != null) {
|
||||
LogUtils.e("@@@", ""+CommonAppContext.getInstance().playId);
|
||||
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.xscm.moduleutil.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.widget.LinearLayout;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
|
||||
import static android.opengl.ETC1.getHeight;
|
||||
import static androidx.core.view.ViewCompat.setTranslationX;
|
||||
import static androidx.core.view.ViewCompat.setTranslationY;
|
||||
import static com.xscm.moduleutil.base.CommonAppContext.post;
|
||||
import static com.xscm.moduleutil.utils.SystemUtils.getWidth;
|
||||
|
||||
public class DropHourlView extends LinearLayout {
|
||||
|
||||
private int rightMargin = 0;
|
||||
private float lastX, lastY;
|
||||
private int screenWidth;
|
||||
|
||||
public DropHourlView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public DropHourlView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public DropHourlView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
void init() {
|
||||
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//设置初始位置
|
||||
int sh = ScreenUtils.getScreenHeight();
|
||||
int sw = ScreenUtils.getScreenWidth()-200;
|
||||
// setBackgroundResource(R.drawable.bg_home_drop_view);
|
||||
int y = (int) (0.5f * sh) - getHeight();
|
||||
int x = sw - getWidth();
|
||||
setTranslationX(x);
|
||||
setTranslationY(y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
boolean starDrap = false;
|
||||
float X1;
|
||||
float X2;
|
||||
float Y1;
|
||||
float Y2;
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
if (starDrap) return true;
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
X1 = event.getX();
|
||||
Y1 = event.getY();
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
X2 = event.getX();//当手指抬起时,再次获取屏幕位置的X值
|
||||
Y2 = event.getY();//同理
|
||||
Action(X1, X2, Y1, Y2);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return starDrap;
|
||||
}
|
||||
|
||||
String TAG = "DropHourlView";
|
||||
|
||||
public boolean Action(float X1, float X2, float Y1, float Y2) {
|
||||
float ComparedX = X2 - X1;//第二次的X坐标的位置减去第一次X坐标的位置,代表X坐标上的变化情况
|
||||
float ComparedY = Y2 - Y1;//同理
|
||||
//当X坐标的变化量的绝对值大于Y坐标的变化量的绝对值,以X坐标的变化情况作为判断依据
|
||||
//上下左右的判断,都在一条直线上,但手指的操作不可能划直线,所有选择变化量大的方向上的量
|
||||
//作为判断依据
|
||||
if (Math.abs(ComparedX) > 30 || Math.abs(ComparedY) > 30) {
|
||||
Log.i(TAG, "Action: 拖动");
|
||||
starDrap = true;
|
||||
// setBackgroundResource(R.drawable.bg_home_drop_view);
|
||||
return true;
|
||||
} else {
|
||||
starDrap = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// setBackgroundResource(R.drawable.bg_home_drop_view);
|
||||
setTranslationX(getX() + (event.getX() - X1));
|
||||
setTranslationY(getY() + (event.getY() - Y1));
|
||||
X2 = event.getX();
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
starDrap = false;
|
||||
int sw = ScreenUtils.getScreenWidth();
|
||||
Log.i(TAG, "onTouchEvent: " + sw + "," + X2);
|
||||
boolean isR = getTranslationX() + getWidth() / 2 >= sw / 2;//贴边方向
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "translationX", isR ? sw - getWidth()+10 : 0f).setDuration(200);
|
||||
anim.start();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void doRevealAnimation(View mPuppet, boolean flag) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
int[] vLocation = new int[2];
|
||||
getLocationInWindow(vLocation);
|
||||
int centerX = vLocation[0] + getMeasuredWidth() / 2;
|
||||
int centerY = vLocation[1] + getMeasuredHeight() / 2;
|
||||
|
||||
int height = ScreenUtils.getScreenHeight();
|
||||
int width = ScreenUtils.getScreenWidth();
|
||||
int maxRradius = (int) Math.hypot(height, width);
|
||||
Log.e("hei", maxRradius + "");
|
||||
|
||||
if (flag) {
|
||||
mPuppet.setVisibility(VISIBLE);
|
||||
Animator animator = ViewAnimationUtils.createCircularReveal(mPuppet, centerX, centerY, maxRradius, 0);
|
||||
animator.setDuration(600);
|
||||
animator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
mPuppet.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
animator.start();
|
||||
flag = false;
|
||||
} else {
|
||||
Animator animator = ViewAnimationUtils.createCircularReveal(mPuppet, centerX, centerY, 0, maxRradius);
|
||||
animator.setDuration(1000);
|
||||
animator.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mPuppet.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
animator.start();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
moduleUtil/src/main/res/anim/slide_in_right.xml
Normal file
9
moduleUtil/src/main/res/anim/slide_in_right.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate
|
||||
android:duration="200"
|
||||
android:fromXDelta="100%p"
|
||||
android:toXDelta="0" />
|
||||
|
||||
</set>
|
||||
9
moduleUtil/src/main/res/anim/slide_out_right.xml
Normal file
9
moduleUtil/src/main/res/anim/slide_out_right.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate
|
||||
android:duration="200"
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="100%p" />
|
||||
|
||||
</set>
|
||||
@@ -39,6 +39,7 @@
|
||||
android:textColor="#FFDE77"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_name"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/jiks.png
Normal file
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/jiks.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/jxz.png
Normal file
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/jxz.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -115,6 +115,13 @@
|
||||
<item name="android:windowExitAnimation">@anim/dialog_exit</item>
|
||||
</style>
|
||||
|
||||
<style name="DialogSlideRightAnimation" parent="android:Animation">
|
||||
<!-- 右侧滑入动画 -->
|
||||
<item name="android:windowEnterAnimation">@anim/slide_in_right</item>
|
||||
<!-- 右侧滑出动画 -->
|
||||
<item name="android:windowExitAnimation">@anim/slide_out_right</item>
|
||||
</style>
|
||||
|
||||
<!--全屏dialog-->
|
||||
<style name="Dialog_Fullscreen">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
@@ -270,5 +277,14 @@
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="FullScreenDialogStyle" parent="Theme.AppCompat.Dialog">
|
||||
<!-- 去掉标题栏 -->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!-- 对话框背景透明 -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!-- 去掉对话框默认的边距和阴影 -->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user