1:给我的页面和设置页面添加点击日志

This commit is contained in:
2025-11-26 16:32:46 +08:00
parent 9887185133
commit 603899ddef
5 changed files with 40 additions and 19 deletions

View File

@@ -106,21 +106,30 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
if (MvpPre == null) {
MvpPre = bindPresenter();
}
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("点击了~" + viewName);
if (view.getId() == R.id.ll_youth) {
if (id == R.id.ll_youth) {
// startActivity(new Intent(this, UnderageActivity.class));
showYouthModelDialog();
} else if (view.getId() == R.id.ll_notification) {
} else if (id == R.id.ll_notification) {
startActivity(new Intent(this, NotificationActivity.class));
} else if (view.getId() == R.id.ll_hmd) {
} else if (id == R.id.ll_hmd) {
Intent intent = new Intent(this, BlacklistActivity.class);
intent.putExtra("type", 1);
startActivity(intent);
} else if (view.getId() == R.id.ll_szmm) {//设置密码
} else if (id == R.id.ll_szmm) {//设置密码
startActivity(new Intent(this, ChangPassActivity.class));
} else if (view.getId() == R.id.ll_shb) {
} else if (id == R.id.ll_shb) {
startActivity(new Intent(this, PhoneReplacementActivity.class));
} else if (view.getId() == R.id.ll_smrz) {//实名认证
} else if (id == R.id.ll_smrz) {//实名认证
if (SpUtil.getRealName()) {
startActivity(new Intent(this, RealDetailActivity.class));
} else {
@@ -143,7 +152,7 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
// ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
// });
}
} else if (view.getId() == R.id.ll_qhch) {
} else if (id == R.id.ll_qhch) {
new AlertDialog.Builder(this).setMessage("确认清理缓存?").setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -154,7 +163,7 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
mBinding.tvCache.setHint(FileUtils.getSize(getCacheDir()));
}
}).setNegativeButton("取消", null).create().show();
} else if (view.getId() == R.id.swit) {
} else if (id == R.id.swit) {
/* if (mBinding.swit.isChecked()) {
ConfigManager.getInstance().switchEnvironment(EnvironmentEnum.PRODUCTION);
EnvironmentEnum selectedEnv = EnvironmentEnum.PRODUCTION;
@@ -171,7 +180,7 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
} else {
MvpPre.getModifyHideStatus("0");
}
} else if (view.getId() == R.id.ll_tcdl) {
} else if (id == R.id.ll_tcdl) {
new AlertDialog.Builder(this).setMessage("确定要退出登录吗?")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
@@ -191,7 +200,7 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
}
})
.setNegativeButton("取消", null).create().show();
}else if (view.getId() == R.id.ll_zhxiao){
}else if (id == R.id.ll_zhxiao){
new AlertDialog.Builder(this).setMessage("确定要注销账号吗?")
.setMessage("注销后您当前的账户金币及钻石将无法找回,\n 30天内本账号将无法登陆请谨慎操作")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@@ -204,9 +213,9 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
}
})
.setNegativeButton("取消", null).create().show();
}else if (view.getId() == R.id.ll_gywm){
}else if (id == R.id.ll_gywm){
startActivity(new Intent(this, AboutUsActivity.class));
} else if (view.getId() == R.id.ll_bbh) {
} else if (id == R.id.ll_bbh) {
if (SpUtil.getShelf()==1) {
// 移除之前的重置任务
handler.removeCallbacks(resetRunnable);
@@ -221,9 +230,9 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
handler.postDelayed(resetRunnable, RESET_DELAY);
}
}
}else if (view.getId() == R.id.ll_send_log){
}else if (id == R.id.ll_send_log){
MvpPre.sendAppLog();
}else if (view.getId() == R.id.tv_share) {
}else if (id == R.id.tv_share) {
showLoading("正在生成分享文件...");
Observable.create(new ObservableOnSubscribe<Boolean>() {
@SuppressLint("CheckResult")

View File

@@ -6,6 +6,7 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
@@ -16,6 +17,7 @@ import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.LogUtils;
import com.stx.xhb.xbanner.XBanner;
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
import com.tencent.mm.opensdk.openapi.IWXAPI;
@@ -175,6 +177,16 @@ public class VocalRangeFragment extends BaseMvpFragment<MePresenter, FragmentVoc
public void onClick(View view) {
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("点击了~" + viewName);
if (id == R.id.ll_visit) {
// ARouter.getInstance().build(ARouteConstants.ME_VISIT).navigation();
// AppLogUtil.reportAppLog(AppLogEvent.C0104);