1、修改背景图、应用log

2、修改房间报错
3、添加青少年模式
This commit is contained in:
2025-09-19 17:40:02 +08:00
parent fc544229fe
commit 867435ee90
85 changed files with 662 additions and 163 deletions

View File

@@ -10,7 +10,10 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.GeolocationPermissions;
import android.webkit.JavascriptInterface;
@@ -21,9 +24,13 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.databinding.ActivityWebViewBinding;
@@ -46,6 +53,8 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public String title;
public String url;
@Autowired
public String type;//type=1:青少年模式
private ValueCallback<Uri> mUploadMessage;
private ValueCallback<Uri[]> mUploadCallbackAboveL;
private final int REQUEST_FILE_PICKER = 1;
@@ -53,6 +62,8 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void initData() {
WebSettings webSettings = mBinding.webView.getSettings();
// 禁用水平滚动
@@ -61,9 +72,9 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
//增加JSBridge
mBinding.webView.addJavascriptInterface(new WebAppInterface(this), "Android");
mBinding.webView.addJavascriptInterface(new WebAppInterface(this, type), "Android");
if (title!=null && !title.isEmpty()){
if (title != null && !title.isEmpty()) {
if (title.contains("协议")) {
webSettings.setDisplayZoomControls(false); // 隐藏默认缩放控件
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); // 使用正常布局算法
@@ -75,10 +86,10 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
// 设置初始缩放
mBinding.webView.setInitialScale(100);
mBinding.webView.getSettings().setUseWideViewPort(false);
}else {
} else {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
}
}else {
} else {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
}
@@ -94,7 +105,6 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.webView.setScrollContainer(true);
mBinding.webView.setWebViewClient(new WebViewClient());
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
@@ -173,6 +183,35 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
});
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getOnBackPressedDispatcher() != null) {
getOnBackPressedDispatcher().addCallback(this, new androidx.activity.OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
// 拦截返回键,显示退出对话框而不是直接退出
showExitRoomDialog();
}
});
}
}
private void showExitRoomDialog() {
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
} else {
finish();
}
}
private void showFileChooser() {
// 这里可以扩展为显示对话框让用户选择“拍照”或“从相册选择”
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
@@ -214,12 +253,74 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
}
@Override
public void onBackPressed() {
// 当type==1时禁止返回键和手势返回
// 不执行任何操作,禁止返回
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
return;
} else {
finish();
}
// 正常处理返回键
super.onBackPressed();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
LogUtils.d("MainActivity", "onKeyDown called, keyCode: " + keyCode);
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
} else {
finish();
}
return true; // 消费事件
}
return super.onKeyDown(keyCode, event);
}
// @Override
// public boolean dispatchTouchEvent(MotionEvent ev) {
// // 当type==1时禁止手势滑动返回
// if (type.equals("1")) {
// // 检查是否是边缘滑动返回手势
// if (ev.getAction() == MotionEvent.ACTION_DOWN) {
// // 如果触摸点在屏幕边缘,拦截事件
// if (ev.getX() < 50) { // 左边缘50像素内
// return true; // 拦截事件不传递给子View
// }
// }
// }
// return super.dispatchTouchEvent(ev);
// }
@Override
protected void initView() {
getWindow().getDecorView().setBackgroundResource(com.xscm.moduleutil.R.color.white);
title = getIntent().getStringExtra("title");
url = getIntent().getStringExtra("url");
if (title!=null) {
type = getIntent().getStringExtra("type");
if (type != null) {
// 当type==1时禁用返回手势滑动
if (type.equals("1")) {
// 禁用边缘滑动返回
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
}
}
}
if (title != null) {
if (title.equals("举报") || title.equals("等级") || title.equals("公会") || title.equals("邀请") || title.equals("反馈")) {
mBinding.topBar.setVisibility(GONE);
// mBinding.webView.setPadding(0,20,0,0);
@@ -227,20 +328,18 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle(title);
}
}else {
if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")){
} else {
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")){
} else if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4")) {
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle("隐私协议");
}else {
} else {
mBinding.topBar.setVisibility(GONE);
}
}
}
@Override
@@ -250,9 +349,11 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public class WebAppInterface {
Context mContext;
String type;
WebAppInterface(Context c) {
WebAppInterface(Context c, String type1) {
mContext = c;
type = type1;
}
// 被 H5 调用的方法
@@ -263,8 +364,15 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@JavascriptInterface
public void closeWeb() {
LogUtils.e("value: ");
finish();
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
} else {
finish();
}
}
@JavascriptInterface
@@ -283,6 +391,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public void jumpRoomPage(String room_id) {
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
}
@JavascriptInterface
public void jumpWebPage(String objects) {
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
@@ -290,7 +399,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
@JavascriptInterface
public void enterGroupChat(String group_id,String cover,String guild_name) {
public void enterGroupChat(String group_id, String cover, String guild_name) {
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
@@ -298,14 +407,15 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
@JavascriptInterface
public void chatWithUser(String user_id,String nickname) {
public void chatWithUser(String user_id, String nickname) {
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
mContext.startActivity(intent);
}
@JavascriptInterface
public void exchange(){
public void exchange() {
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
}
@@ -321,7 +431,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
@JavascriptInterface
public void Recharge(){
public void Recharge() {
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
}
}
@@ -333,6 +443,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
// intent.putExtra("menuName", msg);
// startActivity(intent);
LogUtils.e("closeWeb");
}
}

View File

@@ -18,6 +18,7 @@ public class RoomSettingBean implements MultiItemEntity {
public static final int QXRoomSettingTypeRoomTypeGirl = 13;
///交友 房
public static final int QXRoomSettingTypeRoomTypeJiaoy = 27;
public static final int QXRoomSettingTypeRoomTypeHUYU = 28;
/// 常用工具
/// 房间补贴

View File

@@ -41,7 +41,13 @@ public class YouthModelDialog extends BaseDialog<IndexDialogYouthModelBinding> {
Window window = getWindow();
window.setLayout((int) (ScreenUtils.getScreenWidth() * 315.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
mBinding.ivClose.setOnClickListener(v -> dismiss());
mBinding.tvIKnow.setOnClickListener(v -> dismiss());
mBinding.tvIKnow.setOnClickListener(v -> {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 0).navigation();
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken()).navigation();
// dismiss();
});
mBinding.tvOpen.setOnClickListener(v -> {
// if (teenagerInfo.getHad_password() == 1) {
@@ -49,7 +55,7 @@ public class YouthModelDialog extends BaseDialog<IndexDialogYouthModelBinding> {
// } else {
// ARouter.getInstance().build(ARouteConstants.SET_YOUTH_PWD_ACTIVITY).withInt("type", SetYouthPasswordActivity.SET_TYPE).navigation();
// }
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/teenage?id="+ SpUtil.getToken()).navigation();
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken()).navigation();
dismiss();
});

View File

@@ -25,6 +25,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.bean.MqttXlhEnd;
import com.xscm.moduleutil.bean.RoomMessageEvent;
import com.xscm.moduleutil.bean.WalletBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
@@ -36,6 +37,7 @@ import com.xscm.moduleutil.event.LotteryEvent;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.widget.CircularProgressView;
import com.xscm.moduleutil.widget.GiftCardView;
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -131,7 +133,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
userIdType = LotteryEvent.fromLotteryEvent(giftBagId);
heart_id=getArguments().getString("heart_id");
if (!EventBus.getDefault().isRegistered( this)){
EventBus.getDefault().register(this);
}
}
@Override
@@ -567,7 +571,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
mBinding.pinnacleTime.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageReceived(MqttXlhEnd event) {
BlindBoxBean.XlhData xlhData =new BlindBoxBean.XlhData();
xlhData.setCurrent_num(0);
xlhData.setCurrent_num(0);
xlhData.setStatus(0);
UpView(xlhData);
}
/// 定时器
public void startFastAnimate() {
if (allViewsArray.isEmpty()) {
@@ -1016,6 +1027,11 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
player.release();
player = null;
}
if (EventBus.getDefault().isRegistered( this)){
EventBus.getDefault().unregister(this);
}
// 建议进行垃圾回收
System.gc();
}

View File

@@ -296,7 +296,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
private void upTitle(int boxPrice) {
mBinding.tvOne.setText(boxPrice + "币一次");
mBinding.tvTen.setText((boxPrice * 10) + "币十次");
mBinding.tvHundred.setText((boxPrice * 20) + "二十");
mBinding.tvHundred.setText((boxPrice * 100) + "");
}
// TODO: 2025/8/29 接收im推送过来的消息

View File

@@ -1471,6 +1471,10 @@ public class AgoraManager {
}
}
public void setmSongCode(long songCode) {
mSongCode = songCode;
}
public void loadLrc(long songCode) {
mSongCode = songCode;
if (musicContentCenter != null) {

View File

@@ -9,6 +9,7 @@ public class ARouteConstants {
public static final String USER_ALBUM_DETAIL = "/modulevocal/AlbumDetailActivity";
public static final String CREATE_ALBUM = "/modulevocal/CreateAlbumActivity";
public static final String ROOM_DETAILS = "/moduleroom/RoomActivity";
public static final String UNDERAGE_ACTIVITY = "/modulevocal/UnderageActivity";
public static final String MY_ROOM = "/modulevocal/MyRoomActivity";
public static final String MY_ROOM_DETAILS = "/modulevocal/RoomDetailsActivity";

View File

@@ -123,6 +123,8 @@ public class SpUtil {
}
/**
* 保存一个布尔值
*/
@@ -251,6 +253,14 @@ public class SpUtil {
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put("musicVolume", musicVolume, true);
}
public static void setUnderagePassword(String password){
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put("underagePassword", password, true);
}
public static String getUnderagePassword(){
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getString("underagePassword");
}
public static Integer getMusicVolume() {
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt("musicVolume", 50);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

View File

@@ -66,7 +66,8 @@
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_content" />
app:layout_constraintTop_toBottomOf="@+id/tv_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/tv_i_know"
@@ -75,7 +76,7 @@
android:layout_marginTop="@dimen/dp_20"
android:background="@drawable/cs"
android:gravity="center"
android:text="我知道了"
android:text="开启青少年模式"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16"
android:textStyle="bold"

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 0 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 0 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB