Skip to content

Commit

Permalink
v363
Browse files Browse the repository at this point in the history
1,转发消息添加设备和卡备注相关信息。
  • Loading branch information
xiaoyuanhost committed Mar 9, 2021
1 parent 833f815 commit cea1546
Show file tree
Hide file tree
Showing 53 changed files with 763 additions and 559 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ APP下载 [https://pan.baidu.com/s/1kbelTFIf5nwkOY9g6itkvA]
![添加编辑发送方邮箱](pic/sendersetemail.jpg "添加编辑发送方邮箱")
![添加编辑发送方网页通知](pic/sendersetwebnotify.jpg "添加编辑发送方网页通知")
![状态栏运行状态](pic/taskbar.jpg "状态栏运行状态")
![应用设置](pic/setting.jpg "应用设置")
![应用设置](pic/setting.jpg "转发设置")
![应用设置](pic/about.jpg "关于")
![意见反馈](pic/settingfeedback.jpg "意见反馈")
![应用更新](pic/update-dingdingsecret.jpg "应用更新")

### 更新记录:
> [v3.6.3](app/release/TSMS_release_20210309_3.6.3.apk) 1,转发消息添加设备和卡备注相关信息。
> [v3.6.2](app/release/TSMS_release_20210307_3.6.2.apk) 1,修复设置发送方、转发规则弹框分辨率页面遮挡问题。
> [v3.6.1](app/release/TSMS_release_20210303_3.6.1.apk) 1,添加多重规则。\r\n2,添加规则测试按钮。\r\n3,转发规则发送方列表页面支持长按删除。\r\n4,整合逻辑。\r\n5,修复部分错误文字。
Expand All @@ -95,7 +98,7 @@ APP下载 [https://pan.baidu.com/s/1kbelTFIf5nwkOY9g6itkvA]
> v1.1 减少手动配置启动参数:自启动配置、自动开启热点配置(设置好后手机重启也不用重新打开了,还能自动为pad开启热点)
<u>热点管理
可设置跟随设备启动时启动热点,并且在热点关闭后10秒自动重启热点(所以想关闭热点先把设置页码的开启热点关掉)</u>
(热点助手功能会在后期2020/07/29转移到单独的APP)详见[https://www.jianshu.com/p/f70cf475eddc]
(热点助手功能会在后期2020/07/29转移到单独的APP)详见[https://linkhelper.allmything.com]

> v1.0 项目初始化,实现转发
Expand Down
Binary file added app/release/TSMS_release_20210309_3.6.3.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":363,"versionName":"3.6.3","enabled":true,"outputFile":"TSMS_release_20210307_3.6.3.apk","fullName":"release","baseName":"release"},"path":"TSMS_release_20210307_3.6.3.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":363,"versionName":"3.6.3","enabled":true,"outputFile":"TSMS_release_20210309_3.6.3.apk","fullName":"release","baseName":"release"},"path":"TSMS_release_20210309_3.6.3.apk","properties":{}}]
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
</intent-filter>
</activity>

<activity android:name=".SettingActivity" />
<activity android:name=".AboutActivity" android:label="关于" />
<activity android:name=".SettingActivity" android:label="设置" />
<activity android:name=".RuleActivity" android:label="转发规则" />
<activity android:name=".SenderActivity" android:label="发送方设置" />

Expand Down
183 changes: 183 additions & 0 deletions app/src/main/java/com/tim/tsms/transpondsms/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
package com.tim.tsms.transpondsms;

import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tim.tsms.transpondsms.BroadCastReceiver.RebootBroadcastReceiver;
import com.tim.tsms.transpondsms.model.vo.FeedBackResult;
import com.tim.tsms.transpondsms.utils.HttpI;
import com.tim.tsms.transpondsms.utils.HttpUtil;
import com.tim.tsms.transpondsms.utils.UpdateAppHttpUtil;
import com.tim.tsms.transpondsms.utils.aUtil;
import com.vector.update_app.UpdateAppManager;
import com.vector.update_app.UpdateCallback;
import com.vector.update_app.listener.ExceptionHandler;

import java.util.HashMap;
import java.util.Map;


public class AboutActivity extends AppCompatActivity {
private String TAG = "AboutActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG,"oncreate");
super.onCreate(savedInstanceState);
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);

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();
}
});

}

//检查重启广播接受器状态并设置
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 checkNewVersion(){
String geturl = "http://api.allmything.com/api/version/hasnew?versioncode=";

try {
geturl+= aUtil.getVersionCode(AboutActivity.this);

Log.i("SettingActivity",geturl);
new UpdateAppManager
.Builder()
//当前Activity
.setActivity(AboutActivity.this)
//更新地址
.setUpdateUrl(geturl)
//全局异常捕获
.handleException(new ExceptionHandler() {
@Override
public void onException(Exception e) {
Log.e(TAG, "onException: ",e );
Toast.makeText(AboutActivity.this, "更新失败:"+e.getMessage(), Toast.LENGTH_SHORT).show();
}
})
//实现httpManager接口的对象
.setHttpManager(new UpdateAppHttpUtil())
.build()
.checkNewApp(new UpdateCallback(){
/**
* 没有新版本
*/
protected void noNewApp(String error) {
Toast.makeText(AboutActivity.this, "没有新版本", Toast.LENGTH_SHORT).show();
}
});
// .update();
} catch (Exception e) {
e.printStackTrace();
}
}

public void feedbackcommit(View view) {
final AlertDialog.Builder builder = new AlertDialog.Builder(AboutActivity.this);
View view1 = View.inflate(AboutActivity.this, R.layout.dialog_feedback, null);

final EditText feedback_et_email = view1.findViewById(R.id.feedback_et_email);
final EditText feedback_et_text = view1.findViewById(R.id.feedback_et_text);

builder
.setTitle(R.string.feedback_input_text)
.setView(view1)
.create();
builder.setPositiveButton("提交反馈",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

try {
Map<String,String> feedBackData=new HashMap<>();
feedBackData.put("email",feedback_et_email.getText().toString());
feedBackData.put("text",feedback_et_text.getText().toString());
new HttpUtil().asyncPost("https://api.sl.willanddo.com/api/tsms/feedBack", feedBackData, new HttpI.Callback() {
@Override
public void onResponse(String result) {
Log.i(TAG, "onResponse: "+result);
if(result!=null){
FeedBackResult feedBackResult= JSON.parseObject(result, FeedBackResult.class);
Log.i(TAG, "feedBackResult: "+feedBackResult);

if(feedBackResult!=null){
JSONObject feedBackResultObject= JSON.parseObject(result);
Toast.makeText(AboutActivity.this,feedBackResultObject.getString("message"),Toast.LENGTH_LONG).show();
}else {
Toast.makeText(AboutActivity.this,"感谢您的反馈,我们将尽快处理!",Toast.LENGTH_LONG).show();

}
}else {
Toast.makeText(AboutActivity.this,"感谢您的反馈,我们将尽快处理!",Toast.LENGTH_LONG).show();

}

}
@Override
public void onError(String error) {
Log.i(TAG, "onError: "+error);
Toast.makeText(AboutActivity.this,error,Toast.LENGTH_LONG).show();

}
});

}catch (Exception e){
Toast.makeText(AboutActivity.this,e.getMessage(),Toast.LENGTH_LONG).show();
Log.d(TAG,"feedback e: "+e.getMessage());
}


}
}).show();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
import android.telephony.SmsMessage;
import android.util.Log;

import com.tim.tsms.transpondsms.model.vo.SmsExtraVo;
import com.tim.tsms.transpondsms.model.vo.SmsVo;
import com.tim.tsms.transpondsms.utils.SendUtil;
import com.tim.tsms.transpondsms.utils.SettingUtil;
import com.tim.tsms.transpondsms.utils.SimUtil;
import com.tim.tsms.transpondsms.utils.sender.SendUtil;

import java.util.ArrayList;
import java.util.Date;
Expand All @@ -22,9 +25,23 @@ public class TSMSBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String receiveAction = intent.getAction();
Log.d(TAG,"onReceive intent "+receiveAction);
if(receiveAction.equals("android.provider.Telephony.SMS_RECEIVED")){
if("android.provider.Telephony.SMS_RECEIVED".equals(receiveAction)){
try {

SmsExtraVo smsExtraVo=new SmsExtraVo();

if(SettingUtil.getSwitchAddExtra()){
int simId = SimUtil.getSimId(intent.getExtras());
smsExtraVo.setSimId(simId);
smsExtraVo.setDeviceMark(SettingUtil.getAddExtraDeviceMark());
if(simId==1){
smsExtraVo.setSimDesc(SettingUtil.getAddExtraSim1());
}
if(simId==2){
smsExtraVo.setSimDesc(SettingUtil.getAddExtraSim2());
}
}

Object[] object=(Object[]) Objects.requireNonNull(intent.getExtras()).get("pdus");
if(object!=null){
List<SmsVo> smsVoList = new ArrayList<>();
Expand All @@ -49,7 +66,7 @@ public void onReceive(Context context, Intent intent) {

}
for (String mobile:mobileToContent.keySet()){
smsVoList.add(new SmsVo(mobile,mobileToContent.get(mobile),date));
smsVoList.add(new SmsVo(mobile,mobileToContent.get(mobile),date,smsExtraVo));
}
Log.d(TAG,"短信:"+smsVoList);
SendUtil.send_msg_list(context,smsVoList);
Expand Down
42 changes: 17 additions & 25 deletions app/src/main/java/com/tim/tsms/transpondsms/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,19 @@
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;


import com.alibaba.fastjson.JSON;
import com.tim.tsms.transpondsms.BroadCastReceiver.TSMSBroadcastReceiver;
import com.tim.tsms.transpondsms.adapter.LogAdapter;
import com.tim.tsms.transpondsms.adapter.RuleAdapter;
import com.tim.tsms.transpondsms.model.LogModel;
import com.tim.tsms.transpondsms.model.vo.LogVo;
import com.tim.tsms.transpondsms.model.vo.SmsExtraVo;
import com.tim.tsms.transpondsms.utils.LogUtil;
import com.tim.tsms.transpondsms.utils.RuleUtil;
import com.tim.tsms.transpondsms.utils.SendHistory;
import com.tim.tsms.transpondsms.utils.SendUtil;
import com.tim.tsms.transpondsms.utils.UpdateAppHttpUtil;
import com.tim.tsms.transpondsms.utils.aUtil;
import com.umeng.analytics.MobclickAgent;
import com.vector.update_app.UpdateAppManager;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import static com.tim.tsms.transpondsms.model.SenderModel.TYPE_DINGDING;
import static com.tim.tsms.transpondsms.model.SenderModel.TYPE_EMAIL;

public class MainActivity extends AppCompatActivity implements ReFlashListView.IReflashListener {

private IntentFilter intentFilter;
Expand Down Expand Up @@ -135,10 +121,21 @@ protected void onDestroy() {
public void logDetail(LogVo logVo) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("详情");
builder.setMessage(logVo.getFrom()+"\n"+logVo.getContent()+"\n"+logVo.getRule()+"\n"+logVo.getTime());
SmsExtraVo smsExtraVo = JSON.parseObject(logVo.getJsonExtra(), SmsExtraVo.class);
String extraStr="";
if(smsExtraVo!=null && smsExtraVo.getSimDesc()!=null){
extraStr="卡:"+smsExtraVo.getSimDesc()+"\n";
}

builder.setMessage(logVo.getFrom()+"\n"+logVo.getContent()+"\n"+logVo.getRule()+"\n"+extraStr+logVo.getTime());
builder.show();
}

public void toAbout(){
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
}

public void toSetting(){
Intent intent = new Intent(this, SettingActivity.class);
startActivity(intent);
Expand Down Expand Up @@ -172,14 +169,6 @@ public void onClick(DialogInterface dialog,

}

public void addLog(View view){
Log.d(TAG,"refreshLog");
LogModel newModel=new LogModel("199999","content"+(new SimpleDateFormat("YYYY-MM-dd HH:mm:ss").format(new Date())), 1l);
LogUtil.addLog(newModel);
// initTLogs();
// adapter.add(logVos);
}

//按返回键不退出回到桌面
@Override
public void onBackPressed() {
Expand Down Expand Up @@ -210,6 +199,9 @@ private void checkPermission()
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.to_about:
toAbout();
return true;
case R.id.to_setting:
toSetting();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import android.text.TextUtils;
import android.util.Log;

import com.tim.tsms.transpondsms.utils.SendHistory;
import com.tim.tsms.transpondsms.utils.sender.SendHistory;
import com.tim.tsms.transpondsms.utils.SettingUtil;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/tim/tsms/transpondsms/RuleActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
import com.tim.tsms.transpondsms.adapter.RuleAdapter;
import com.tim.tsms.transpondsms.model.RuleModel;
import com.tim.tsms.transpondsms.model.SenderModel;
import com.tim.tsms.transpondsms.model.vo.SmsExtraVo;
import com.tim.tsms.transpondsms.model.vo.SmsVo;
import com.tim.tsms.transpondsms.utils.RuleUtil;
import com.tim.tsms.transpondsms.utils.SendUtil;
import com.tim.tsms.transpondsms.utils.SenderUtil;
import com.tim.tsms.transpondsms.utils.sender.SendUtil;
import com.tim.tsms.transpondsms.utils.sender.SenderUtil;
import com.umeng.analytics.MobclickAgent;

import java.util.ArrayList;
Expand Down Expand Up @@ -325,7 +326,7 @@ public void onClick(View v) {
Log.i("editTextTestMsgContent", editTextTestMsgContent.getText().toString());

try{
SmsVo testSmsVo=new SmsVo(editTextTestPhone.getText().toString(),editTextTestMsgContent.getText().toString(),new Date());
SmsVo testSmsVo=new SmsVo(editTextTestPhone.getText().toString(),editTextTestMsgContent.getText().toString(),new Date(),new SmsExtraVo(1,"卡哇伊","红色白皮手机"));
SendUtil.sendMsgByRuleModelSenderId(handler,ruleModel,testSmsVo,senderId);

}catch (Exception e){
Expand Down
Loading

0 comments on commit cea1546

Please sign in to comment.