格式化通讯地址显示
This commit is contained in:
parent
03e21ab81c
commit
e1b3087020
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Feb 25 20:51:01 HKT 2025
|
||||
#Sat Mar 01 05:24:02 GMT 2025
|
||||
stageCount=16
|
||||
libraryProject=
|
||||
baseVersion=4.1
|
||||
publishVersion=4.1.15
|
||||
buildCount=0
|
||||
buildCount=4
|
||||
baseBetaVersion=4.1.16
|
||||
|
@ -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;
|
||||
@ -76,7 +77,7 @@ public class PhoneArrayAdapter extends BaseAdapter {
|
||||
|
||||
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);
|
||||
|
@ -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()) {
|
||||
|
@ -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)));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -28,6 +28,7 @@ public class UnitTestActivity extends Activity {
|
||||
}
|
||||
|
||||
public void onMain(View view) {
|
||||
SMSRecevier_Test.main(this);
|
||||
//SMSRecevier_Test.main(this);
|
||||
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 + "】";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user