Compare commits
6 Commits
mymessagem
...
mymessagem
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ecec3515f | |||
| 0a4922f767 | |||
| faf8e3b8f7 | |||
| 6b3388ec2a | |||
| 52c005feab | |||
| d4e319aae4 |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Dec 09 15:29:43 HKT 2025
|
||||
stageCount=3
|
||||
#Sat Dec 13 21:13:49 HKT 2025
|
||||
stageCount=6
|
||||
libraryProject=
|
||||
baseVersion=15.12
|
||||
publishVersion=15.12.2
|
||||
publishVersion=15.12.5
|
||||
buildCount=0
|
||||
baseBetaVersion=15.12.3
|
||||
baseBetaVersion=15.12.6
|
||||
|
||||
@@ -5,28 +5,31 @@ package cc.winboll.studio.mymessagemanager.activitys;
|
||||
* @Date 2024/05/12 20:03:42
|
||||
* @Describe 应用设置窗口
|
||||
*/
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
import cc.winboll.studio.libaes.dialogs.YesNoAlertDialog;
|
||||
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
|
||||
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
||||
import cc.winboll.studio.libaes.views.AToolbar;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.mymessagemanager.R;
|
||||
import cc.winboll.studio.mymessagemanager.activitys.AppSettingsActivity;
|
||||
import cc.winboll.studio.mymessagemanager.dialogs.CharsetRefuseEditDialog;
|
||||
import cc.winboll.studio.mymessagemanager.utils.AppConfigUtil;
|
||||
import cc.winboll.studio.mymessagemanager.utils.NotificationHelper;
|
||||
import cc.winboll.studio.mymessagemanager.utils.PermissionUtil;
|
||||
import android.app.Activity;
|
||||
|
||||
public class AppSettingsActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
||||
|
||||
public static final String TAG = "AppSettingsActivity";
|
||||
|
||||
// 讯飞语记官网下载页链接
|
||||
private static final String XUNFEI_YUJI_DOWNLOAD_URL = "https://iflynote.com/h/share-download-app.html";
|
||||
|
||||
AppConfigUtil mAppConfigUtil;
|
||||
AToolbar mAToolbar;
|
||||
AOHPCTCSeekBar mAOHPCTCSeekBar;
|
||||
@@ -34,8 +37,9 @@ public class AppSettingsActivity extends WinBoLLActivity implements IWinBoLLActi
|
||||
EditText metPhoneMergePrefix;
|
||||
Switch mswMergePrefixPhone;
|
||||
Switch mswSMSRecycleProtectMode;
|
||||
EditText metProtectModerRefuseChars;
|
||||
//EditText metProtectModerRefuseChars;
|
||||
EditText metProtectModerReplaceChars;
|
||||
String mszProtectModerRefuseChars = "";
|
||||
|
||||
@Override
|
||||
public Activity getActivity() {
|
||||
@@ -72,8 +76,9 @@ public class AppSettingsActivity extends WinBoLLActivity implements IWinBoLLActi
|
||||
mswSMSRecycleProtectMode = findViewById(R.id.activityappsettingsSwitch3);
|
||||
mswSMSRecycleProtectMode.setChecked(mAppConfigUtil.mAppConfigBean.isSMSRecycleProtectMode());
|
||||
|
||||
metProtectModerRefuseChars = findViewById(R.id.activityappsettingsEditText3);
|
||||
metProtectModerRefuseChars.setText(mAppConfigUtil.mAppConfigBean.getProtectModerRefuseChars());
|
||||
//metProtectModerRefuseChars = findViewById(R.id.activityappsettingsEditText3);
|
||||
//metProtectModerRefuseChars.setText(mAppConfigUtil.mAppConfigBean.getProtectModerRefuseChars());
|
||||
mszProtectModerRefuseChars = mAppConfigUtil.mAppConfigBean.getProtectModerRefuseChars();
|
||||
|
||||
metProtectModerReplaceChars = findViewById(R.id.activityappsettingsEditText4);
|
||||
metProtectModerReplaceChars.setText(mAppConfigUtil.mAppConfigBean.getProtectModerReplaceChars());
|
||||
@@ -87,7 +92,8 @@ public class AppSettingsActivity extends WinBoLLActivity implements IWinBoLLActi
|
||||
public void onOHPCommit() {
|
||||
mAppConfigUtil.reLoadConfig();
|
||||
mAppConfigUtil.mAppConfigBean.setIsSMSRecycleProtectMode(mswSMSRecycleProtectMode.isChecked());
|
||||
mAppConfigUtil.mAppConfigBean.setProtectModerRefuseChars(metProtectModerRefuseChars.getText().toString());
|
||||
//mAppConfigUtil.mAppConfigBean.setProtectModerRefuseChars(metProtectModerRefuseChars.getText().toString());
|
||||
mAppConfigUtil.mAppConfigBean.setProtectModerRefuseChars(mszProtectModerRefuseChars);
|
||||
mAppConfigUtil.mAppConfigBean.setProtectModerReplaceChars(metProtectModerReplaceChars.getText().toString());
|
||||
mAppConfigUtil.mAppConfigBean.setCountryCode(metPhoneMergePrefix.getText().toString());
|
||||
mAppConfigUtil.mAppConfigBean.setIsMergeCountryCodePrefix(mswMergePrefixPhone.isChecked());
|
||||
@@ -112,17 +118,33 @@ public class AppSettingsActivity extends WinBoLLActivity implements IWinBoLLActi
|
||||
}
|
||||
}
|
||||
|
||||
public void onCleanOldChannels(View view) {
|
||||
YesNoAlertDialog.show(this, "通知设置清理", "是否清理旧的通知设置?", new YesNoAlertDialog.OnDialogResultListener(){
|
||||
@Override
|
||||
public void onNo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onYes() {
|
||||
NotificationHelper notificationHelper = new NotificationHelper(AppSettingsActivity.this);
|
||||
notificationHelper.cleanOldChannels();
|
||||
}
|
||||
});
|
||||
public void onAddTTSSupport(View view) {
|
||||
try {
|
||||
// 1. 创建Intent,Action为“打开网页”
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
// 2. 设置要跳转的URL
|
||||
intent.setData(Uri.parse(XUNFEI_YUJI_DOWNLOAD_URL));
|
||||
// 3. 确保Intent可被解析(避免无浏览器时崩溃)
|
||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(intent); // 跳转至浏览器打开下载页
|
||||
} else {
|
||||
// 无浏览器时的提示
|
||||
Toast.makeText(this, "未找到浏览器应用,请安装后重试", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, "无法打开下载页面,请稍后再试", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void onCharsetRefuseEditDialog(View view) {
|
||||
CharsetRefuseEditDialog dlg = new CharsetRefuseEditDialog(this, new CharsetRefuseEditDialog.OnTextConfirmListener(){
|
||||
@Override
|
||||
public void onTextConfirmed(String editText) {
|
||||
//ToastUtils.show(editText);
|
||||
mszProtectModerRefuseChars = editText;
|
||||
}
|
||||
}, mszProtectModerRefuseChars);
|
||||
dlg.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package cc.winboll.studio.mymessagemanager.dialogs;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||
* @Date 2025/12/13 17:04
|
||||
* @Describe 字符集编辑拒绝对话框
|
||||
* 包含标题、300dp×300dp多行编辑框、确定/取消按钮(确定在右,取消在左)
|
||||
* 支持预制文本初始化、编辑内容回传
|
||||
*/
|
||||
public class CharsetRefuseEditDialog extends Dialog {
|
||||
public static final String TAG = "CharsetRefuseEditDialog";
|
||||
// 文本回传接口
|
||||
public interface OnTextConfirmListener {
|
||||
void onTextConfirmed(String editText); // 确定按钮点击时回传编辑后的文本
|
||||
}
|
||||
|
||||
private final OnTextConfirmListener mListener; // 外部传入的回传接口
|
||||
private final String mPreText; // 预制文本框的内容
|
||||
private EditText mEditText; // 多行文本编辑框
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param context 上下文
|
||||
* @param listener 文本回传接口(外部实现)
|
||||
* @param preText 预制的编辑框初始文本
|
||||
*/
|
||||
public CharsetRefuseEditDialog(Context context, OnTextConfirmListener listener, String preText) {
|
||||
super(context);
|
||||
this.mListener = listener;
|
||||
this.mPreText = preText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// 禁用对话框默认标题,使用自定义标题
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
// 初始化对话框布局
|
||||
initView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化对话框布局(标题+编辑框+按钮)
|
||||
*/
|
||||
private void initView() {
|
||||
// 根布局:垂直线性布局
|
||||
LinearLayout rootLayout = new LinearLayout(getContext());
|
||||
rootLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
rootLayout.setPadding(20, 20, 20, 20);
|
||||
rootLayout.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
|
||||
// 1. 添加标题栏
|
||||
TextView titleTv = new TextView(getContext());
|
||||
titleTv.setText("拒绝显示字符集编辑");
|
||||
titleTv.setTextSize(18);
|
||||
titleTv.setTextColor(Color.BLACK);
|
||||
titleTv.setGravity(Gravity.CENTER);
|
||||
titleTv.setPadding(0, 0, 0, 20); // 标题与编辑框间距
|
||||
rootLayout.addView(titleTv);
|
||||
|
||||
// 2. 添加多行编辑框(300dp×300dp)
|
||||
mEditText = new EditText(getContext());
|
||||
// 转换dp为px(适配不同屏幕密度)
|
||||
int dp300 = dp2px(getContext(), 300);
|
||||
LinearLayout.LayoutParams editParams = new LinearLayout.LayoutParams(dp300, dp300);
|
||||
mEditText.setLayoutParams(editParams);
|
||||
mEditText.setLines(5); // 多行显示
|
||||
mEditText.setHint("请输入内容");
|
||||
mEditText.setText(mPreText); // 设置预制文本
|
||||
mEditText.setSelection(mPreText.length()); // 光标定位到文本末尾
|
||||
rootLayout.addView(mEditText);
|
||||
|
||||
// 3. 添加按钮栏(水平布局,确定在右、取消在左)
|
||||
LinearLayout btnLayout = new LinearLayout(getContext());
|
||||
btnLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
btnLayout.setGravity(Gravity.RIGHT); // 整体右对齐,实现确定在右、取消在左
|
||||
btnLayout.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
btnLayout.setPadding(0, 20, 0, 0); // 按钮栏与编辑框间距
|
||||
rootLayout.addView(btnLayout);
|
||||
|
||||
// 3.1 取消按钮(左侧)
|
||||
TextView cancelBtn = new TextView(getContext());
|
||||
cancelBtn.setText("取消");
|
||||
cancelBtn.setTextSize(16);
|
||||
cancelBtn.setTextColor(Color.parseColor("#666666"));
|
||||
cancelBtn.setPadding(20, 10, 20, 10);
|
||||
cancelBtn.setOnClickListener(new View.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
}); // 关闭对话框
|
||||
btnLayout.addView(cancelBtn);
|
||||
|
||||
// 3.2 确定按钮(右侧)
|
||||
TextView confirmBtn = new TextView(getContext());
|
||||
confirmBtn.setText("确定");
|
||||
confirmBtn.setTextSize(16);
|
||||
confirmBtn.setTextColor(Color.parseColor("#0066CC"));
|
||||
confirmBtn.setPadding(20, 10, 20, 10);
|
||||
confirmBtn.setOnClickListener(new View.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mListener != null) {
|
||||
// 回传编辑后的文本
|
||||
mListener.onTextConfirmed(mEditText.getText().toString().trim());
|
||||
}
|
||||
dismiss(); // 关闭对话框
|
||||
}
|
||||
});
|
||||
btnLayout.addView(confirmBtn);
|
||||
|
||||
// 设置对话框内容布局
|
||||
setContentView(rootLayout);
|
||||
}
|
||||
|
||||
/**
|
||||
* dp转px工具方法
|
||||
* @param context 上下文
|
||||
* @param dpValue dp值
|
||||
* @return 对应的px值
|
||||
*/
|
||||
private int dp2px(Context context, float dpValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dpValue * scale + 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,12 +62,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="拒绝显示的字符集:"/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:ems="10"
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:id="@+id/activityappsettingsEditText3"/>
|
||||
android:text="点击编辑"
|
||||
android:onClick="onCharsetRefuseEditDialog"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -216,8 +215,8 @@
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="清理通知设置"
|
||||
android:onClick="onCleanOldChannels"/>
|
||||
android:text="安装TTS语音支持"
|
||||
android:onClick="onAddTTSSupport"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user