整理布局文件

pull/67/head
pppscn 4 years ago
parent 8f376b6a7b
commit 54380b63d1

@ -1,6 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: 'version.gradle'
android {
buildToolsVersion '29.0.3'
@ -13,8 +14,8 @@ android {
applicationId "com.idormy.sms.forwarder"
minSdkVersion 23
targetSdkVersion 29
versionCode 14
versionName "1.5.1"
versionCode appVersionCode
versionName appVersionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
lintOptions {

@ -3,7 +3,7 @@
package="com.idormy.sms.forwarder">
<application
android:name="com.idormy.sms.forwarder.MyApplication"
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -23,7 +23,7 @@
android:name="UMENG_CHANNEL"
android:value="Umeng" />
<activity android:name="com.idormy.sms.forwarder.MainActivity">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -31,22 +31,27 @@
</intent-filter>
</activity>
<activity android:name="com.idormy.sms.forwarder.SettingActivity" />
<activity
android:name="com.idormy.sms.forwarder.RuleActivity"
android:name=".AboutActivity"
android:label="关于" />
<activity
android:name=".SettingActivity"
android:label="设置" />
<activity
android:name=".RuleActivity"
android:label="转发规则" />
<activity
android:name="com.idormy.sms.forwarder.SenderActivity"
android:name=".SenderActivity"
android:label="发送方" />
<receiver android:name="com.idormy.sms.forwarder.BroadCastReceiver.RebootBroadcastReceiver">
<receiver android:name=".BroadCastReceiver.RebootBroadcastReceiver">
<intent-filter android:priority="2147483647">
<!--重启广播-->
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name="com.idormy.sms.forwarder.BroadCastReceiver.SmsForwarderBroadcastReceiver"
android:name=".BroadCastReceiver.SmsForwarderBroadcastReceiver"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter android:priority="2147483647">
<!--短信广播-->
@ -54,7 +59,7 @@
</intent-filter>
</receiver>
<service android:name="com.idormy.sms.forwarder.FrontService" />
<service android:name=".FrontService" />
</application>
<uses-permission android:name="android.permission.INTERNET" />

@ -0,0 +1,178 @@
package com.idormy.sms.forwarder;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.idormy.sms.forwarder.BroadCastReceiver.RebootBroadcastReceiver;
import com.idormy.sms.forwarder.utils.CacheUtil;
import com.idormy.sms.forwarder.utils.Define;
import com.idormy.sms.forwarder.utils.aUtil;
import com.xuexiang.xupdate.easy.EasyUpdate;
import com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker;
public class AboutActivity extends AppCompatActivity {
private String TAG = "com.idormy.sms.forwarder.AboutActivity";
private Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "oncreate");
super.onCreate(savedInstanceState);
context = AboutActivity.this;
setContentView(R.layout.activity_about);
Log.d(TAG, "onCreate: " + RebootBroadcastReceiver.class.getName());
Switch check_with_reboot = (Switch) findViewById(R.id.switch_with_reboot);
checkWithReboot(check_with_reboot);
Switch switch_help_tip = (Switch) findViewById(R.id.switch_help_tip);
SwitchHelpTip(switch_help_tip);
final TextView version_now = (TextView) findViewById(R.id.version_now);
Button check_version_now = (Button) findViewById(R.id.check_version_now);
try {
version_now.setText(aUtil.getVersionName(AboutActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
check_version_now.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//checkNewVersion();
try {
String updateUrl = "https://xupdate.bms.ink/update/checkVersion?appKey=com.idormy.sms.forwarder&versionCode=";
updateUrl += aUtil.getVersionCode(AboutActivity.this);
EasyUpdate.create(AboutActivity.this, updateUrl)
.updateChecker(new DefaultUpdateChecker() {
@Override
public void onBeforeCheck() {
super.onBeforeCheck();
Toast.makeText(AboutActivity.this, "查询中...", Toast.LENGTH_LONG).show();
}
@Override
public void onAfterCheck() {
super.onAfterCheck();
}
@Override
public void noNewVersion(Throwable throwable) {
super.noNewVersion(throwable);
// 没有最新版本的处理
Toast.makeText(AboutActivity.this, "已是最新版本!", Toast.LENGTH_LONG).show();
}
})
.update();
} catch (Exception e) {
e.printStackTrace();
}
}
});
final TextView cache_size = (TextView) findViewById(R.id.cache_size);
try {
cache_size.setText(CacheUtil.getTotalCacheSize(AboutActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
Button clear_all_cache = (Button) findViewById(R.id.clear_all_cache);
clear_all_cache.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CacheUtil.clearAllCache(AboutActivity.this);
try {
cache_size.setText(CacheUtil.getTotalCacheSize(AboutActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
Toast.makeText(AboutActivity.this, "缓存清理完成", Toast.LENGTH_LONG).show();
}
});
Button join_qq_group = (Button) findViewById(R.id.join_qq_group);
join_qq_group.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String key = "HvroJRfvK7GGfnQgaIQ4Rh1un9O83N7M";
joinQQGroup(key);
}
});
}
//检查重启广播接受器状态并设置
private void checkWithReboot(Switch withrebootSwitch) {
//获取组件
final ComponentName cm = new ComponentName(this.getPackageName(), RebootBroadcastReceiver.class.getName());
final PackageManager pm = getPackageManager();
int state = pm.getComponentEnabledSetting(cm);
if (state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
&& state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
withrebootSwitch.setChecked(true);
} else {
withrebootSwitch.setChecked(false);
}
withrebootSwitch.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int newState = (Boolean) isChecked ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
pm.setComponentEnabledSetting(cm, newState, PackageManager.DONT_KILL_APP);
Log.d(TAG, "onCheckedChanged:" + isChecked);
}
});
}
//页面帮助提示
private void SwitchHelpTip(Switch switchHelpTip) {
switchHelpTip.setChecked(MyApplication.showHelpTip);
switchHelpTip.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
MyApplication.showHelpTip = isChecked;
SharedPreferences sp = context.getSharedPreferences(Define.SP_CONFIG, Context.MODE_PRIVATE);
sp.edit().putBoolean(Define.SP_CONFIG_SWITCH_HELP_TIP, isChecked).apply();
Log.d(TAG, "onCheckedChanged:" + isChecked);
}
});
}
//发起添加群流程
public boolean joinQQGroup(String key) {
Intent intent = new Intent();
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));
// 此Flag可根据具体产品需要自定义如设置则在加群界面按返回返回手Q主界面不设置按返回会返回到呼起产品界面
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
startActivity(intent);
return true;
} catch (Exception e) {
// 未安装手Q或安装的版本不支持
Toast.makeText(AboutActivity.this, "未安装手Q或安装的版本不支持", Toast.LENGTH_LONG).show();
return false;
}
}
}

@ -143,7 +143,7 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
// 将适配器上的数据传递给listView
listView = findViewById(R.id.list_view_log);
listView.setInterface(this);
adapter = new LogAdapter(MainActivity.this, R.layout.tlog_item, logVosN);
adapter = new LogAdapter(MainActivity.this, R.layout.item_log, logVosN);
listView.setAdapter(adapter);
} else {
@ -194,6 +194,11 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
startActivity(intent);
}
public void toAbout() {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
}
public void toRuleSetting(View view) {
Intent intent = new Intent(this, RuleActivity.class);
startActivity(intent);
@ -219,7 +224,6 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
}
});
builder.show();
}
//按返回键不退出回到桌面
@ -271,6 +275,9 @@ public class MainActivity extends AppCompatActivity implements ReFlashListView.I
case R.id.to_setting:
toSetting();
return true;
case R.id.to_about:
toAbout();
return true;
default:
return super.onOptionsItemSelected(item);
}

@ -60,7 +60,7 @@ public class ReFlashListView extends ListView implements AbsListView.OnScrollLis
*/
private void initView(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
header = inflater.inflate(R.layout.header_layout, null);
header = inflater.inflate(R.layout.header, null);
measureView(header);
headerHeight = header.getMeasuredHeight();
Log.i("tag", "headerHeight = " + headerHeight);

@ -75,7 +75,7 @@ public class RuleActivity extends AppCompatActivity {
// 先拿到数据并放在适配器上
initRules(); //初始化数据
adapter = new RuleAdapter(RuleActivity.this, R.layout.rule_item, ruleModels);
adapter = new RuleAdapter(RuleActivity.this, R.layout.item_rule, ruleModels);
// 将适配器上的数据传递给listView
ListView listView = findViewById(R.id.list_view_rule);
@ -137,7 +137,7 @@ public class RuleActivity extends AppCompatActivity {
private void setRule(final RuleModel ruleModel) {
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(RuleActivity.this);
final View view1 = View.inflate(RuleActivity.this, R.layout.activity_alter_dialog_setview_rule, null);
final View view1 = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule, null);
final RadioGroup radioGroupRuleFiled = (RadioGroup) view1.findViewById(R.id.radioGroupRuleFiled);
if (ruleModel != null) radioGroupRuleFiled.check(ruleModel.getRuleFiledCheckId());
@ -326,7 +326,7 @@ public class RuleActivity extends AppCompatActivity {
}
public void testRule(final RuleModel ruleModel, final Long senderId) {
final View view = View.inflate(RuleActivity.this, R.layout.activity_alter_dialog_setview_rule_test, null);
final View view = View.inflate(RuleActivity.this, R.layout.alert_dialog_setview_rule_test, null);
final EditText editTextTestPhone = (EditText) view.findViewById(R.id.editTextTestPhone);
final EditText editTextTestMsgContent = (EditText) view.findViewById(R.id.editTextTestMsgContent);
Button buttonruletest = view.findViewById(R.id.buttonruletest);

@ -88,7 +88,7 @@ public class SenderActivity extends AppCompatActivity {
// 先拿到数据并放在适配器上
initSenders(); //初始化数据
adapter = new SenderAdapter(SenderActivity.this, R.layout.sender_item, senderModels);
adapter = new SenderAdapter(SenderActivity.this, R.layout.item_sender, senderModels);
// 将适配器上的数据传递给listView
ListView listView = findViewById(R.id.list_view_sender);
@ -219,7 +219,7 @@ public class SenderActivity extends AppCompatActivity {
}
}
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
View view1 = View.inflate(SenderActivity.this, R.layout.activity_alter_dialog_setview_dingding, null);
View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_dingding, null);
final EditText editTextDingdingName = view1.findViewById(R.id.editTextDingdingName);
if (senderModel != null)
@ -332,7 +332,7 @@ public class SenderActivity extends AppCompatActivity {
}
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
View view1 = View.inflate(SenderActivity.this, R.layout.activity_alter_dialog_setview_email, null);
View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_email, null);
final EditText editTextEmailName = view1.findViewById(R.id.editTextEmailName);
if (senderModel != null) editTextEmailName.setText(senderModel.getName());
@ -449,7 +449,7 @@ public class SenderActivity extends AppCompatActivity {
}
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
View view1 = View.inflate(SenderActivity.this, R.layout.activity_alter_dialog_setview_bark, null);
View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_bark, null);
final EditText editTextBarkName = view1.findViewById(R.id.editTextBarkName);
if (senderModel != null) editTextBarkName.setText(senderModel.getName());
@ -539,7 +539,7 @@ public class SenderActivity extends AppCompatActivity {
}
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
View view1 = View.inflate(SenderActivity.this, R.layout.activity_alter_dialog_setview_webnotify, null);
View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_webnotify, null);
final EditText editTextWebNotifyName = view1.findViewById(R.id.editTextWebNotifyName);
if (senderModel != null) editTextWebNotifyName.setText(senderModel.getName());
@ -636,7 +636,7 @@ public class SenderActivity extends AppCompatActivity {
}
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
View view1 = View.inflate(SenderActivity.this, R.layout.activity_alter_dialog_setview_qywxgrouprobot, null);
View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_qywxgrouprobot, null);
final EditText editTextQYWXGroupRobotName = view1.findViewById(R.id.editTextQYWXGroupRobotName);
if (senderModel != null) editTextQYWXGroupRobotName.setText(senderModel.getName());
@ -727,7 +727,7 @@ public class SenderActivity extends AppCompatActivity {
}
}
final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
View view1 = View.inflate(SenderActivity.this, R.layout.activity_alter_dialog_setview_qywxapp, null);
View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_qywxapp, null);
final EditText editTextQYWXAppName = view1.findViewById(R.id.editTextQYWXAppName);
if (senderModel != null)

@ -1,177 +1,120 @@
package com.idormy.sms.forwarder;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.idormy.sms.forwarder.BroadCastReceiver.RebootBroadcastReceiver;
import com.idormy.sms.forwarder.utils.CacheUtil;
import com.idormy.sms.forwarder.utils.Define;
import com.idormy.sms.forwarder.utils.aUtil;
import com.xuexiang.xupdate.easy.EasyUpdate;
import com.xuexiang.xupdate.proxy.impl.DefaultUpdateChecker;
import com.idormy.sms.forwarder.utils.SettingUtil;
public class SettingActivity extends AppCompatActivity {
private String TAG = "SettingActivity";
private Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "oncreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
context = SettingActivity.this;
Switch switch_add_extra = (Switch) findViewById(R.id.switch_add_extra);
switchAddExtra(switch_add_extra);
setContentView(R.layout.activity_setting);
Log.d(TAG, "onCreate: " + RebootBroadcastReceiver.class.getName());
EditText et_add_extra_device_mark = (EditText) findViewById(R.id.et_add_extra_device_mark);
editAddExtraDeviceMark(et_add_extra_device_mark);
Switch check_with_reboot = (Switch) findViewById(R.id.switch_with_reboot);
checkWithReboot(check_with_reboot);
EditText et_add_extra_sim1 = (EditText) findViewById(R.id.et_add_extra_sim1);
editAddExtraSim1(et_add_extra_sim1);
Switch switch_help_tip = (Switch) findViewById(R.id.switch_help_tip);
SwitchHelpTip(switch_help_tip);
EditText et_add_extra_sim2 = (EditText) findViewById(R.id.et_add_extra_sim2);
editAddExtraSim2(et_add_extra_sim2);
}
final TextView version_now = (TextView) findViewById(R.id.version_now);
Button check_version_now = (Button) findViewById(R.id.check_version_now);
try {
version_now.setText(aUtil.getVersionName(SettingActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
//设置转发附加信息
private void switchAddExtra(Switch switch_add_extra) {
switch_add_extra.setChecked(SettingUtil.getSwitchAddExtra());
check_version_now.setOnClickListener(new View.OnClickListener() {
switch_add_extra.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
@Override
public void onClick(View v) {
//checkNewVersion();
try {
String updateUrl = "https://xupdate.bms.ink/update/checkVersion?appKey=com.idormy.sms.forwarder&versionCode=";
updateUrl += aUtil.getVersionCode(SettingActivity.this);
EasyUpdate.create(SettingActivity.this, updateUrl)
.updateChecker(new DefaultUpdateChecker() {
@Override
public void onBeforeCheck() {
super.onBeforeCheck();
Toast.makeText(SettingActivity.this, "查询中...", Toast.LENGTH_LONG).show();
}
@Override
public void onAfterCheck() {
super.onAfterCheck();
}
@Override
public void noNewVersion(Throwable throwable) {
super.noNewVersion(throwable);
// 没有最新版本的处理
Toast.makeText(SettingActivity.this, "已是最新版本!", Toast.LENGTH_LONG).show();
}
})
.update();
} catch (Exception e) {
e.printStackTrace();
}
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SettingUtil.switchAddExtra(isChecked);
Log.d(TAG, "onCheckedChanged:" + isChecked);
}
});
}
//设置转发附加信息devicemark
private void editAddExtraDeviceMark(final EditText et_add_extra_device_mark) {
et_add_extra_device_mark.setText(SettingUtil.getAddExtraDeviceMark());
final TextView cache_size = (TextView) findViewById(R.id.cache_size);
try {
cache_size.setText(CacheUtil.getTotalCacheSize(SettingActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
Button clear_all_cache = (Button) findViewById(R.id.clear_all_cache);
clear_all_cache.setOnClickListener(new View.OnClickListener() {
et_add_extra_device_mark.addTextChangedListener(new TextWatcher() {
@Override
public void onClick(View v) {
CacheUtil.clearAllCache(SettingActivity.this);
try {
cache_size.setText(CacheUtil.getTotalCacheSize(SettingActivity.this));
} catch (Exception e) {
e.printStackTrace();
}
Toast.makeText(SettingActivity.this, "缓存清理完成", Toast.LENGTH_LONG).show();
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
});
Button join_qq_group = (Button) findViewById(R.id.join_qq_group);
join_qq_group.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String key = "HvroJRfvK7GGfnQgaIQ4Rh1un9O83N7M";
joinQQGroup(key);
}
});
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
}
//检查重启广播接受器状态并设置
private void checkWithReboot(Switch withrebootSwitch) {
//获取组件
final ComponentName cm = new ComponentName(this.getPackageName(), RebootBroadcastReceiver.class.getName());
final PackageManager pm = getPackageManager();
int state = pm.getComponentEnabledSetting(cm);
if (state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
&& state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
withrebootSwitch.setChecked(true);
} else {
withrebootSwitch.setChecked(false);
}
withrebootSwitch.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int newState = (Boolean) isChecked ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
pm.setComponentEnabledSetting(cm, newState, PackageManager.DONT_KILL_APP);
Log.d(TAG, "onCheckedChanged:" + isChecked);
public void afterTextChanged(Editable s) {
SettingUtil.setAddExtraDeviceMark(et_add_extra_device_mark.getText().toString());
}
});
}
//页面帮助提示
private void SwitchHelpTip(Switch switchHelpTip) {
switchHelpTip.setChecked(MyApplication.showHelpTip);
//设置转发附加信息devicemark
private void editAddExtraSim1(final EditText et_add_extra_sim1) {
et_add_extra_sim1.setText(SettingUtil.getAddExtraSim1());
switchHelpTip.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
et_add_extra_sim1.addTextChangedListener(new TextWatcher() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
MyApplication.showHelpTip = isChecked;
SharedPreferences sp = context.getSharedPreferences(Define.SP_CONFIG, Context.MODE_PRIVATE);
sp.edit().putBoolean(Define.SP_CONFIG_SWITCH_HELP_TIP, isChecked).apply();
Log.d(TAG, "onCheckedChanged:" + isChecked);
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
SettingUtil.setAddExtraSim1(et_add_extra_sim1.getText().toString());
}
});
}
//发起添加群流程
public boolean joinQQGroup(String key) {
Intent intent = new Intent();
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));
// 此Flag可根据具体产品需要自定义如设置则在加群界面按返回返回手Q主界面不设置按返回会返回到呼起产品界面
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
startActivity(intent);
return true;
} catch (Exception e) {
// 未安装手Q或安装的版本不支持
Toast.makeText(SettingActivity.this, "未安装手Q或安装的版本不支持", Toast.LENGTH_LONG).show();
return false;
}
//设置转发附加信息devicemark
private void editAddExtraSim2(final EditText et_add_extra_sim2) {
et_add_extra_sim2.setText(SettingUtil.getAddExtraSim2());
et_add_extra_sim2.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
SettingUtil.setAddExtraSim2(et_add_extra_sim2.getText().toString());
}
});
}

@ -4,6 +4,12 @@ public class Define {
public static String SP_CONFIG = "forwarder_config";
public static String SP_CONFIG_SWITCH_HELP_TIP = "forwarder_config_switch_help_tip";
public static String SP_CONFIG_SIM_INFO = "forwarder_config_sim_info";
public static String SP_MSG_KEY_SWITCH_ADD_EXTRA = "tsms_msg_key_switch_add_extra";
public static String SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK = "tsms_msg_key_string_add_extra_device_mark";
public static String SP_MSG_KEY_STRING_ADD_EXTRA_SIM1 = "tsms_msg_key_string_add_extra_sim1";
public static String SP_MSG_KEY_STRING_ADD_EXTRA_SIM2 = "tsms_msg_key_string_add_extra_sim2";
public static String SP_MSG = "forwarder_msg";
public static String SP_MSG_SET_KEY = "forwarder_msg_set_key";
public static String SP_MSG_SEND_UTIL_EMAIL_HOST_KEY = "forwarder_msg_send_util_email_host_key";

@ -18,10 +18,53 @@ public class SettingUtil {
context = context1;
Log.d(TAG, "init ");
sp_setting = PreferenceManager.getDefaultSharedPreferences(context1);
}
}
public static void switchAddExtra(Boolean switchAddExtra) {
Log.d(TAG, "switchAddExtra :" + switchAddExtra);
sp_setting.edit()
.putBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, switchAddExtra)
.apply();
}
public static boolean getSwitchAddExtra() {
return sp_setting.getBoolean(Define.SP_MSG_KEY_SWITCH_ADD_EXTRA, false);
}
public static String getAddExtraDeviceMark() {
return sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK, "");
}
public static void setAddExtraDeviceMark(String addExtraDeviceMark) {
Log.d(TAG, "addExtraDeviceMark :" + addExtraDeviceMark);
sp_setting.edit()
.putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_DEVICE_MARK, addExtraDeviceMark)
.apply();
}
public static String getAddExtraSim1() {
return sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, "");
}
public static void setAddExtraSim1(String sim1) {
Log.d(TAG, "sim1 :" + sim1);
sp_setting.edit()
.putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, sim1)
.apply();
}
public static String getAddExtraSim2() {
return sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, "");
}
public static void setAddExtraSim2(String sim2) {
Log.d(TAG, "sim2 :" + sim2);
sp_setting.edit()
.putString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, sim2)
.apply();
}
public static boolean option_withreboot() {
return sp_setting.getBoolean("option_withreboot", false);
}
@ -58,7 +101,7 @@ public class SettingUtil {
}
public static String get_send_util_email(String key) {
Log.d(TAG, "get_send_util_email key" + key);
Log.d(TAG, "get_send_util_email key" + key);
String defaultstt = "";
if (key.equals(Define.SP_MSG_SEND_UTIL_EMAIL_HOST_KEY)) defaultstt = "smtp服务器";
if (key.equals(Define.SP_MSG_SEND_UTIL_EMAIL_PORT_KEY)) defaultstt = "端口";

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当前版本" />
<TextView
android:id="@+id/version_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="v1.0" />
</LinearLayout>
<Button
android:id="@+id/check_version_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="检查新版本" />
</LinearLayout>
<LinearLayout
android:id="@+id/auto_reboot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="开机启动" />
<Switch
android:id="@+id/switch_with_reboot"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="end"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/help_tip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="页面帮助提示" />
<Switch
android:id="@+id/switch_help_tip"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="end"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/about_web"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="作者网站" />
<TextView
android:id="@+id/linkweb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:autoLink="web"
android:gravity="right"
android:text="idormy.com"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_wait_open_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户交流群" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="562854376" />
</LinearLayout>
<Button
android:id="@+id/join_qq_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="加入QQ群" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="缓存大小" />
<TextView
android:id="@+id/cache_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="0KB" />
</LinearLayout>
<Button
android:id="@+id/clear_all_cache"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="清除缓存" />
</LinearLayout>
</LinearLayout>
</ScrollView>

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@ -12,58 +11,20 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当前版本" />
<TextView
android:id="@+id/version_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="v1.0" />
</LinearLayout>
<Button
android:id="@+id/check_version_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="检查新版本" />
</LinearLayout>
<LinearLayout
android:id="@+id/auto_reboot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp">
android:padding="15dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="开机启动" />
android:text="转发时附加卡槽信息"
android:textStyle="bold" />
<Switch
android:id="@+id/switch_with_reboot"
android:id="@+id/switch_add_extra"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
@ -73,163 +34,145 @@
</LinearLayout>
<LinearLayout
android:id="@+id/help_tip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp">
android:padding="15dp">
<TextView
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="页面帮助提示" />
android:text="设备名称"
android:textStyle="bold" />
<Switch
android:id="@+id/switch_help_tip"
android:layout_width="0dp"
<EditText
android:id="@+id/et_add_extra_device_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="end"
android:textSize="18sp" />
android:layout_marginLeft="5dp"
android:ems="16"
android:inputType=""
android:text="" />
</LinearLayout>
<LinearLayout
android:id="@+id/about_web"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp">
android:padding="15dp">
<TextView
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="作者网站" />
android:orientation="vertical">
<TextView
android:id="@+id/linkweb"
android:layout_width="0dp"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIM1备注"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="运营商-手机号"
android:textSize="9dp" />
</LinearLayout>
<EditText
android:id="@+id/et_add_extra_sim1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:autoLink="web"
android:gravity="right"
android:text="idormy.com"
android:textSize="18sp" />
android:layout_marginLeft="5dp"
android:ems="16"
android:inputType=""
android:text="" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_wait_open_time"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp">
android:padding="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户交流群" />
android:text="SIM2备注"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="562854376" />
android:text="运营商-手机号"
android:textSize="9dp" />
</LinearLayout>
<Button
android:id="@+id/join_qq_group"
<EditText
android:id="@+id/et_add_extra_sim2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="加入QQ群" />
android:layout_marginLeft="5dp"
android:ems="16"
android:inputType=""
android:text="" />
</LinearLayout>
<LinearLayout
android:id="@+id/feedback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp"
android:visibility="gone">
android:padding="15dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="建议反馈" />
android:text="转发时启用自定义模版"
android:textStyle="bold" />
<TextView
android:id="@+id/feedback_commit"
<Switch
android:id="@+id/switch_sms_template"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:onClick="feedbackcommit"
android:text="提交反馈"
android:textColor="@color/colorPrimary"
android:layout_weight="3"
android:gravity="end"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
<EditText
android:id="@+id/text_sms_template"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="20dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="缓存大小" />
<TextView
android:id="@+id/cache_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="0KB" />
</LinearLayout>
<Button
android:id="@+id/clear_all_cache"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="清除缓存" />
</LinearLayout>
android:layout_margin="15dp"
android:ems="16"
android:inputType=""
android:maxLines="5"
android:text="" />
</LinearLayout>
</LinearLayout>
</ScrollView>

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

@ -1,28 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/xxxxxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/feedback_et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="16dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="邮箱"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/feedback_et_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"
android:fontFamily="sans-serif"
android:hint="内容" />
</LinearLayout>

@ -7,5 +7,10 @@
android:orderInCategory="100"
android:title="@string/to_setting"
app:showAsAction="never" />
<item
android:id="@+id/to_about"
android:orderInCategory="100"
android:title="@string/to_about"
app:showAsAction="never" />
</menu>

@ -14,6 +14,7 @@
<string name="setbarktitle">设置Bark</string>
<string name="check_new_version">检查更新</string>
<string name="to_setting">设置</string>
<string name="to_about">关于</string>
<string name="log_tips">提示:置顶下拉刷新,长按删除单条记录</string>
<string name="rule_tips">提示:新建规则点击“添加”,长按删除/点击编辑已有</string>
<string name="sender_tips">提示:新建发送方点击“添加”,长按删除/点击编辑已有</string>

@ -0,0 +1,4 @@
ext {
appVersionCode = 15
appVersionName = "1.5.2"
}
Loading…
Cancel
Save