添加飘屏和访客功能

This commit is contained in:
2025-08-11 17:12:10 +08:00
parent 4f09ec38c1
commit eb1c3807cb
46 changed files with 1119312 additions and 922130 deletions

View File

@@ -10,8 +10,6 @@ android {
defaultConfig {
minSdk 24
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE"))
versionName project.findProperty("APP_VERSION_NAME")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"

View File

@@ -25,7 +25,13 @@
<activity
android:name=".activity.WebViewActivity"
android:exported="false" />
android:exported="false">
<intent-filter>
<action android:name="com.qxcm.qxlive.PROTOCOL_WEBVIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.news.OfficialNoticeActivity"
android:exported="false" />
@@ -34,7 +40,7 @@
<!-- android:enabled="true" -->
<!-- android:exported="true" -->
<!-- tools:ignore="Instantiatable" /> -->
<service android:name=".service.EMqttService" />
<!-- <service android:name=".service.EMqttService" />-->
<service
android:name=".service.MyMqttService"
android:foregroundServiceType="dataSync" />

View File

@@ -116,22 +116,6 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
@Override
public void onSuccess() {
LogUtils.e("@@@", "成功");
// V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
// @Override
// public void onSuccess(Long aLong) {
// if (aLong == 0) {
// EventBus.getDefault().post(new UnreadCountEvent(aLong));
// } else {
// mBinding.tvMessage.setVisibility(View.VISIBLE);
// }
// mBinding.tvMessage.setText(String.valueOf(aLong));
// }
// @Override
// public void onError(int code, String desc) {
//
// }
// });
}
@Override
@@ -140,20 +124,6 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
}
});
initLocation();
// V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
// @Override
// public void onSuccess(Long aLong) {
// Log.i("imsdk", "success");
//// EventBus.getDefault().post(new UnreadCountEvent(aLong));
// }
//
// @Override
// public void onError(int code, String desc) {
// Log.i("imsdk", "failure, code:" + code + ", desc:" + desc);
// }
// });
}
});

View File

@@ -199,8 +199,19 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.topBar.setTitle(title);
}
}else {
mBinding.topBar.setVisibility(GONE);
if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")){
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle("用户协议");
}else if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4")){
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle("隐私协议");
}else {
mBinding.topBar.setVisibility(GONE);
}
}
}
@Override

View File

@@ -36,6 +36,7 @@ import com.alibaba.android.arouter.facade.template.IRouteGroup;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.BuildConfig;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils;
import com.blankj.utilcode.util.ServiceUtils;
@@ -47,6 +48,7 @@ import com.qxcm.moduleutil.event.AppLifecycleEvent;
import com.qxcm.moduleutil.interfaces.AppLifecycleUtil;
import com.qxcm.moduleutil.listener.MessageListenerSingleton;
import com.qxcm.moduleutil.rtc.AgoraManager;
import com.qxcm.moduleutil.service.MyMqttService;
import com.qxcm.moduleutil.utils.FloatWindowHelper;
import com.qxcm.moduleutil.utils.ImageUtils;
import com.qxcm.moduleutil.utils.SpUtil;
@@ -121,10 +123,6 @@ public class CommonAppContext extends MultiDexApplication {
UtilConfig.checkInEmulator();
}
}
// ServiceUtils.startService(EMqttService.class);
// MyMqttService.startService(getApplicationContext());
// ServiceUtils.startService(MyMqttService.class);
// RtcManager.instance(this);
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
currentEnvironment = prefs.getSelectedEnvironment();
piaoPingManager = PiaoPingManager.getInstance(this);
@@ -132,9 +130,10 @@ public class CommonAppContext extends MultiDexApplication {
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
MessageListenerSingleton.getInstance();
CrashReport.initCrashReport(this, "865cfe9555", true);
// CrashReport.testJavaCrash();
// startInitSdk();
CrashReport.initCrashReport(this, "865cfe9555", true);/*bugly初始化*/
ServiceUtils.startService(MyMqttService.class);/*Mqtt初始化*/
}
private PiaoPingManager piaoPingManager;
private void initARouter() {
@@ -373,6 +372,8 @@ private PiaoPingManager piaoPingManager;
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
piaoPingManager.unsubscribe();
FileUtils.deleteAllInDir(getCacheDir());
FileUtils.deleteAllInDir(getExternalCacheDir());
}
public static boolean isAlipayInstalled(Context context) {

View File

@@ -6,10 +6,14 @@ import android.view.WindowManager;
import androidx.annotation.NonNull;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ScreenUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.TeenagerInfo;
import com.qxcm.moduleutil.databinding.IndexDialogYouthModelBinding;
import com.qxcm.moduleutil.utils.ARouteConstants;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.widget.dialog.BaseDialog;
/**
@@ -37,11 +41,14 @@ public class YouthModelDialog extends BaseDialog<IndexDialogYouthModelBinding> {
mBinding.ivClose.setOnClickListener(v -> dismiss());
mBinding.tvIKnow.setOnClickListener(v -> dismiss());
mBinding.tvOpen.setOnClickListener(v -> {
if (teenagerInfo.getHad_password() == 1) {
// if (teenagerInfo.getHad_password() == 1) {
// ARouter.getInstance().build(ARouteConstants.SET_YOUTH_PWD_ACTIVITY).withInt("type", SetYouthPasswordActivity.TYPE_OPEN).navigation();
} else {
// } else {
// ARouter.getInstance().build(ARouteConstants.SET_YOUTH_PWD_ACTIVITY).withInt("type", SetYouthPasswordActivity.SET_TYPE).navigation();
}
// }
ARouter.getInstance().build(ARouteConstants.H5).withString("url","https://vespa.qxmier.com/web/index.html#/pages/feedback/teenage?id="+ SpUtil.getToken()).navigation();
dismiss();
});
}

View File

@@ -8,7 +8,7 @@ import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.google.gson.Gson;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.service.EMqttService;
import com.qxcm.moduleutil.service.FloatingWindow;
import org.greenrobot.eventbus.EventBus;
@@ -41,6 +41,7 @@ public class RoomGiftRunable implements Runnable {
mqttCache.add(mqttBean); // 添加新数据
}
EventBus.getDefault().post(mqttBean);
new FloatingWindow(CommonAppContext.getInstance(),mqttBean);
}

View File

@@ -281,6 +281,9 @@ public interface ApiServer {
@FormUrlEncoded
@POST(Constants.POST_BLACK_LIST)
Observable<BaseModel<List<BlackUserBean>>> getBlacklist(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.POST_LOCK_MI_LIST)
Observable<BaseModel<List<BlackUserBean>>> getLockMiniList(@Field("page") String page, @Field("page_limit") String page_limit);
@FormUrlEncoded
@POST(Constants.GET_MY_ROOM)

View File

@@ -732,6 +732,10 @@ public class RetrofitClient {
sApiServer.getBlacklist(page, page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
}
public void getLockMiniList(String page, String page_limit, BaseObserver<List<BlackUserBean>> observer){
sApiServer.getLockMiniList(page, page_limit).compose(new DefaultTransformer<>()).subscribe(observer);
}
public void realName(String real_name, String card_number, BaseObserver<RealNameBean> observer) {
sApiServer.realName(real_name, card_number).compose(new DefaultTransformer<>()).subscribe(observer);
}

View File

@@ -60,16 +60,16 @@ public class EMqttService extends Service {
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int screenHeight = getResources().getDisplayMetrics().heightPixels;
//
// WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
// WindowManager.LayoutParams.MATCH_PARENT,
// WindowManager.LayoutParams.WRAP_CONTENT,
// Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
// WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
// WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
// WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
// WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
// PixelFormat.TRANSLUCENT);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
PixelFormat.TRANSLUCENT);
//
// // 设置 Gravity 为左上角
// layoutParams.gravity = Gravity.TOP | Gravity.START;
@@ -80,12 +80,13 @@ public class EMqttService extends Service {
// // 初始 X 设为负值,确保 View 在屏幕左侧外
// layoutParams.x = -screenWidth;
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
// FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
// FrameLayout.LayoutParams.MATCH_PARENT,
// FrameLayout.LayoutParams.WRAP_CONTENT);
//
// 设置随机 Y 轴位置
layoutParams.topMargin = (int) (Math.random() * (screenHeight - 200));
// layoutParams.topMargin = (int) (Math.random() * (screenHeight - 200));
piaoPingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);

View File

@@ -0,0 +1,96 @@
package com.qxcm.moduleutil.service;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.PixelFormat;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.TextView;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.event.MqttBean;
import com.qxcm.moduleutil.utils.ImageUtils;
/**
*@author qx
*@data 2025/8/8
*@description: 全局悬浮框管理类
*/
public class FloatingWindow {
private WindowManager windowManager;
private View piaoPingView;
public FloatingWindow(Context context, MqttBean mqttBean){
int screenWidth =context.getResources().getDisplayMetrics().widthPixels;
windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
piaoPingView = LayoutInflater.from(context).inflate(R.layout.item_piaoping, null);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
PixelFormat.TRANSLUCENT);
TextView textView = piaoPingView.findViewById(R.id.tv_name);
textView.setText(mqttBean.getList().getText());
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), piaoPingView.findViewById(R.id.iv_piaoping));
TextView tv_time = piaoPingView.findViewById(R.id.tv_num);
tv_time.setText(mqttBean.getList().getNumber());
windowManager.addView(piaoPingView, layoutParams);
piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// 设置锚点为左上角,避免偏移干扰
piaoPingView.setPivotX(0);
piaoPingView.setPivotY(0);
// 启动动画:从左外滑入 -> 右外滑出
ObjectAnimator animator = ObjectAnimator.ofFloat(
piaoPingView,
"translationX",
0f, // 初始偏移为 0此时 View 在左侧外)
screenWidth // 向右移动整个屏幕宽度
);
animator.setDuration(2000); // 整个动画的时长为2秒
// 强制 GPU 渲染
piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
// 延迟显示2秒后开始滑出屏幕的动画
piaoPingView.postDelayed(new Runnable() {
@Override
public void run() {
animator.start();
}
}, 2000);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
windowManager.removeView(piaoPingView);
stopSelf();
}
});
}
});
}
public void stopSelf(){
if (piaoPingView != null) {
windowManager.removeView(piaoPingView);
piaoPingView = null;
}
}
}

View File

@@ -22,7 +22,7 @@ import java.util.Map;
public class SpUtil {
private static SpUtil sInstance;
private SharedPreferences mSharedPreferences;
private static SharedPreferences mSharedPreferences;
public static final String UID = "uid";
public static final String TOKEN = "token";
@@ -127,7 +127,7 @@ public class SpUtil {
/**
* 保存一个布尔值
*/
public void setBooleanValue(String key, boolean value) {
public static void setBooleanValue(String key, boolean value) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putBoolean(key, value);
editor.apply();
@@ -143,7 +143,7 @@ public class SpUtil {
/**
* 获取一个布尔值
*/
public boolean getBooleanValue(String key, boolean defaultValue) {
public static boolean getBooleanValue(String key, boolean defaultValue) {
return mSharedPreferences.getBoolean(key, defaultValue);
}
@@ -232,6 +232,14 @@ public class SpUtil {
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getString(SPConstants.TOKEN);
}
public static void setBoolean(String key, boolean value) {
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(key, value, true);
}
public static boolean getBoolean(String key, boolean defaultValue) {
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getBoolean(key, defaultValue);
}
public static int getUserId() {
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.USER_ID);
}

View File

@@ -309,6 +309,7 @@ public class Constants {
public static final String POST_FOLLOW_LIST = "/api/User/get_user_follow_list";//关注列表
public static final String POST_FANS_LIST = "/api/User/get_user_fans_list";//粉丝列表
public static final String POST_BLACK_LIST = "/api/User/get_blacklist";//黑名单
public static final String POST_LOCK_MI_LIST = "/api/User/get_look_me_list";//看过我的,访客
public static final String REMOVE_BLACK_LIST = "/api/User/remove_blacklist";//移除黑名单
public static final String POST_CHANGE_ROOM_TYPE = "/api/Room/change_room_type";//修改房间类型
public static final String POST_ROOM_RELATION_LIST = "/api/RoomAuction/room_relation_list";//房间关系列表