Compare commits
7 Commits
mymessagem
...
mymessagem
Author | SHA1 | Date | |
---|---|---|---|
![]() |
33b7b65239 | ||
![]() |
664d14ad84 | ||
![]() |
47cb393f76 | ||
![]() |
6495f1c66e | ||
![]() |
f0c52d1e02 | ||
![]() |
d948f31331 | ||
![]() |
e1b3087020 |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Feb 25 20:51:01 HKT 2025
|
||||
stageCount=16
|
||||
#Sat Mar 01 14:11:49 HKT 2025
|
||||
stageCount=19
|
||||
libraryProject=
|
||||
baseVersion=4.1
|
||||
publishVersion=4.1.15
|
||||
publishVersion=4.1.18
|
||||
buildCount=0
|
||||
baseBetaVersion=4.1.16
|
||||
baseBetaVersion=4.1.19
|
||||
|
@@ -18,10 +18,10 @@ import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
||||
import cc.winboll.studio.mymessagemanager.R;
|
||||
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
|
||||
import cc.winboll.studio.mymessagemanager.adapters.SMSArrayAdapter;
|
||||
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
|
||||
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
|
||||
import cc.winboll.studio.mymessagemanager.utils.ViewUtil;
|
||||
import cc.winboll.studio.mymessagemanager.views.SMSListViewForScrollView;
|
||||
import cc.winboll.studio.mymessagemanager.views.SMSView;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class SMSActivity extends BaseActivity {
|
||||
@@ -102,7 +102,7 @@ public class SMSActivity extends BaseActivity {
|
||||
|
||||
// 初始化标题栏
|
||||
mToolbar = findViewById(R.id.activitysmsASupportToolbar1);
|
||||
mToolbar.setSubtitle(getString(R.string.activity_name_smsinphone) + " < Phone : " + mszPhoneTo + " >");
|
||||
mToolbar.setSubtitle(getString(R.string.activity_name_smsinphone) + " < Phone : " + AddressUtils.getFormattedAddress(mszPhoneTo) + " >");
|
||||
setActionBar(mToolbar);
|
||||
|
||||
// 初始化滚动窗口
|
||||
|
@@ -13,6 +13,7 @@ import cc.winboll.studio.mymessagemanager.R;
|
||||
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
|
||||
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
|
||||
import cc.winboll.studio.mymessagemanager.beans.SMSBean;
|
||||
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
|
||||
import cc.winboll.studio.mymessagemanager.utils.PhoneUtil;
|
||||
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
|
||||
import cc.winboll.studio.shared.log.LogUtils;
|
||||
@@ -74,9 +75,9 @@ public class PhoneArrayAdapter extends BaseAdapter {
|
||||
viewHolder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
String szAddress = ((SMSBean)getItem(position)).getAddress();
|
||||
final String szAddress = ((SMSBean)getItem(position)).getAddress();
|
||||
|
||||
viewHolder.tvAddress.setText(szAddress);
|
||||
viewHolder.tvAddress.setText(AddressUtils.getFormattedAddress(szAddress));
|
||||
viewHolder.tvName.setText(getName(szAddress));
|
||||
|
||||
//Drawable drawableFrame = AppCompatResources.getDrawable(mContext, R.drawable.bg_frame);
|
||||
@@ -87,7 +88,7 @@ public class PhoneArrayAdapter extends BaseAdapter {
|
||||
|
||||
//Toast.makeText(mContext, tv.getText(), Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(mContext, SMSActivity.class);
|
||||
intent.putExtra(SMSActivity.EXTRA_PHONE, viewHolder.tvAddress.getText());
|
||||
intent.putExtra(SMSActivity.EXTRA_PHONE, szAddress);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,7 @@ import cc.winboll.studio.mymessagemanager.views.DateAgoTextView;
|
||||
import cc.winboll.studio.mymessagemanager.views.SMSView;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import java.util.ArrayList;
|
||||
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
|
||||
|
||||
public class SMSRecycleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
@@ -154,7 +155,7 @@ public class SMSRecycleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
final SMSRecycleBean item = mDataList.get(position);
|
||||
if (holder.getItemViewType() == 0) {
|
||||
SimpleViewHolder viewHolder = (SimpleViewHolder) holder;
|
||||
viewHolder.mtvAddress.setText(item.getAddress());
|
||||
viewHolder.mtvAddress.setText(AddressUtils.getFormattedAddress(item.getAddress()));
|
||||
viewHolder.mbtnViewBody.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -179,7 +180,7 @@ public class SMSRecycleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
viewHolder.mvRight.setVisibility(View.GONE);
|
||||
viewHolder.mSMSView.setSMSType(SMSView.SMSType.SEND);
|
||||
}
|
||||
viewHolder.mtvAddress.setText(item.getAddress());
|
||||
viewHolder.mtvAddress.setText(AddressUtils.getFormattedAddress(item.getAddress()));
|
||||
viewHolder.mdatvDeleteDate.setDate(item.getDeleteDate());
|
||||
viewHolder.mdatvDate.setDate(item.getDate());
|
||||
if(mAppConfigUtil.mAppConfigBean.isSMSRecycleProtectMode()) {
|
||||
|
@@ -77,21 +77,30 @@ public class SMSRecevier extends BroadcastReceiver {
|
||||
PhoneUtil phoneUtil = new PhoneUtil(context);
|
||||
boolean isPhoneInContacts = phoneUtil.isPhoneInContacts(szSmsAddress);
|
||||
LogUtils.d(TAG, String.format("isPhoneInContacts %s", isPhoneInContacts));
|
||||
|
||||
|
||||
boolean isPhoneByDigit = phoneUtil.isPhoneByDigit(szSmsAddress);
|
||||
LogUtils.d(TAG, String.format("isPhoneByDigit %s", isPhoneByDigit));
|
||||
|
||||
|
||||
AppConfigUtil configUtil = AppConfigUtil.getInstance(context);
|
||||
boolean isOnlyReceiveContacts = configUtil.mAppConfigBean.isEnableOnlyReceiveContacts();
|
||||
LogUtils.d(TAG, String.format("isOnlyReceiveContacts %s", isOnlyReceiveContacts));
|
||||
|
||||
|
||||
boolean isInSMSAcceptRule = SMSReceiveRuleUtil.getInstance(context, false).checkIsSMSAcceptInRule(context, szSmsBody);
|
||||
LogUtils.d(TAG, String.format("isInSMSAcceptRule %s", isInSMSAcceptRule));
|
||||
|
||||
if (isPhoneByDigit
|
||||
&& (!isOnlyReceiveContacts || isPhoneInContacts || isInSMSAcceptRule)) {
|
||||
|
||||
// 启用了只接受通讯录,通讯录里有记录
|
||||
if (isOnlyReceiveContacts && isPhoneInContacts) {
|
||||
return true;
|
||||
}
|
||||
// 如果不是数字通讯地址,但是在通讯录内
|
||||
if (!isPhoneByDigit && isPhoneInContacts) {
|
||||
return true;
|
||||
}
|
||||
// 通讯地址是数字,并且在短信接收规则内。
|
||||
if (isPhoneByDigit && isInSMSAcceptRule) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,28 @@
|
||||
package cc.winboll.studio.mymessagemanager.unittest;
|
||||
import cc.winboll.studio.shared.log.LogUtils;
|
||||
import android.content.Context;
|
||||
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/01 13:07:32
|
||||
* @Describe AddressUtils Test
|
||||
*/
|
||||
public class AddressUtils_Test {
|
||||
|
||||
public static final String TAG = "AddressUtils_Test";
|
||||
|
||||
public static void main(Context context) {
|
||||
String szSmsBody = "无影无迹";
|
||||
String szSmsAddress = "无名小辈";
|
||||
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
|
||||
szSmsAddress = "13172887736";
|
||||
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
|
||||
szSmsAddress = "+8613172887736";
|
||||
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
|
||||
szSmsAddress = "8613172887736";
|
||||
LogUtils.d(TAG, String.format("szSmsAddress %s\n getFormattedAddress : %s", szSmsAddress, AddressUtils.getFormattedAddress(szSmsAddress)));
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -19,6 +19,10 @@ public class SMSRecevier_Test {
|
||||
String szSmsAddress = "无名小辈";
|
||||
test1(context, szSmsBody, szSmsAddress);
|
||||
|
||||
szSmsBody = "无影无迹";
|
||||
szSmsAddress = "淘宝物流";
|
||||
test1(context, szSmsBody, szSmsAddress);
|
||||
|
||||
szSmsBody = "无影无迹";
|
||||
szSmsAddress = "1?0";
|
||||
test1(context, szSmsBody, szSmsAddress);
|
||||
|
@@ -5,11 +5,11 @@ package cc.winboll.studio.mymessagemanager.unittest;
|
||||
* @Date 2025/02/25 19:00:10
|
||||
* @Describe 应用单元测试窗口
|
||||
*/
|
||||
import cc.winboll.studio.mymessagemanager.unittest.*;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import cc.winboll.studio.mymessagemanager.R;
|
||||
import android.view.View;
|
||||
import cc.winboll.studio.mymessagemanager.R;
|
||||
import cc.winboll.studio.shared.log.LogUtils;
|
||||
import cc.winboll.studio.shared.log.LogView;
|
||||
|
||||
public class UnitTestActivity extends Activity {
|
||||
@@ -28,6 +28,9 @@ public class UnitTestActivity extends Activity {
|
||||
}
|
||||
|
||||
public void onMain(View view) {
|
||||
LogUtils.d(TAG, "SMSRecevier_Test");
|
||||
SMSRecevier_Test.main(this);
|
||||
LogUtils.d(TAG, "AddressUtils_Test");
|
||||
AddressUtils_Test.main(this);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package cc.winboll.studio.mymessagemanager.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/01 13:03:16
|
||||
* @Describe 通信录地址工具
|
||||
*/
|
||||
public class AddressUtils {
|
||||
|
||||
public static final String TAG = "AddressUtils";
|
||||
|
||||
public static String getFormattedAddress(String address) {
|
||||
if (address != null && address.matches("[+]?\\d+")) {
|
||||
return address;
|
||||
} else {
|
||||
return "【" + address + "】";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user