package cn.sharp.android.ncr.display;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.provider.Contacts;
import android.text.InputType;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import cn.sharp.android.ncr.MessageId;
import cn.sharp.android.ncr.R;
import cn.sharp.android.ncr.display.domain.Address;
import cn.sharp.android.ncr.display.domain.BaseDomain;
import cn.sharp.android.ncr.display.domain.Email;
import cn.sharp.android.ncr.display.domain.Organization;
import cn.sharp.android.ncr.display.domain.Phone;
import cn.sharp.android.ncr.display.domain.Url;
import cn.sharp.android.ncr.ocr.OCRItems;
public class ContactPerson {
private final static String TAG = "ContactPerson";
public final static int ITEM_NAME = 1;
public final static int ITEM_PHONE = 2;
public final static int ITEM_EMAIL = 3;
public final static int ITEM_ADDRESS = 4;
public final static int ITEM_ORG = 5;
public final static int ITEM_URL = 6;
public final static int ITEM_NOTE = 7;
public final static int TYPE_HOME = 1;
public final static int TYPE_WORK = 2;
public final static int TYPE_OTHER = 3;
public final static int TYPE_PAGER = 4;
public final static int TYPE_MOBILE = 5;
public final static int TYPE_FAX_HOME = 6;
public final static int TYPE_FAX_WORK = 7;
private long groupId;
private String name;
private List<Email> emails;
private List<Phone> phones;
private List<Organization> orgs;
private List<Address> addresses;
private List<Url> urls;
private String note;
public String typeHome, typeWork, typeOther, typePager, typeMobile,
typeFaxHome, typeFaxWork;
private int[] supportedItemTypes1;
private int[] supportedItemTypes2;
private int[] supportedItemTypes3;
private String[] supportedItemTypeStr1;
private String[] supportedItemTypeStr2;
private String[] supportedItemTypeStr3;
private OnSelectItemType onSelectItemType;
private ContentResolver contentResolver;
private SelectItemTypeListener onSelectTypeListener;
private RemoveItemListener removeItemListener;
private EditText nameView, noteView;
private ViewGroup phoneViewGroup, emailViewGroup, addressViewGroup,
orgViewGroup, urlViewGroup;
private Button itemType;
private EditText itemValue, itemValue2;
private ImageButton removeItem;
private LayoutInflater inflater;
/**
* remove all Context reference, or it will result in memory leak
*/
public void removeAllContextObject() {
onSelectItemType = null;
contentResolver = null;
onSelectTypeListener = null;
removeItemListener = null;
nameView = null;
noteView = null;
phoneViewGroup = emailViewGroup = addressViewGroup = orgViewGroup = urlViewGroup = null;
inflater = null;
itemType = null;
itemValue = null;
itemValue2 = null;
removeItem = null;
}
public void registerNewContext(Context context) {
init(context);
}
private void initPrimitiveObj() {
groupId = -1;
phones = new ArrayList<Phone>();
orgs = new ArrayList<Organization>();
emails = new ArrayList<Email>();
addresses = new ArrayList<Address>();
urls = new ArrayList<Url>();
supportedItemTypes1 = new int[] { TYPE_HOME, TYPE_WORK, TYPE_MOBILE,
TYPE_OTHER, TYPE_PAGER, TYPE_FAX_HOME, TYPE_FAX_WORK };
supportedItemTypes2 = new int[] { TYPE_WORK, TYPE_OTHER };
supportedItemTypes3 = new int[] { TYPE_WORK, TYPE_HOME, TYPE_OTHER };
supportedItemTypeStr1 = new String[] { typeHome, typeWork, typeMobile,
typeOther, typePager, typeFaxHome, typeFaxWork };
supportedItemTypeStr2 = new String[] { typeWork, typeOther };
supportedItemTypeStr3 = new String[] { typeWork, typeHome, typeOther };
onSelectTypeListener = new SelectItemTypeListener();
removeItemListener = new RemoveItemListener();
}
private void init(Context context) {
inflater = LayoutInflater.from(context);
contentResolver = context.getContentResolver();
Resources resources = context.getResources();
typeHome = resources.getString(R.string.type_home);
typeWork = resources.getString(R.string.type_work);
typeOther = resources.getString(R.string.type_other);
typePager = resources.getString(R.string.type_pager);
typeMobile = resources.getString(R.string.type_mobile);
typeFaxHome = resources.getString(R.string.type_fax_home);
typeFaxWork = resources.getString(R.string.type_fax_work);
}
public ContactPerson(Context context) {
init(context);
initPrimitiveObj();
}
public ContactPerson(Context context, OCRItems items) {
init(context);
initPrimitiveObj();
if (items.name != null) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < items.name.length; i++) {
sb.append(items.name[i]);
}
name = sb.toString();
}
if (items.fax != null) {
for (int i = 0; i < items.fax.length; i++) {
Phone phone = new Phone();
phone.type = TYPE_FAX_WORK;
phone.value = items.fax[i];
phones.add(phone);
}
}
if (items.telephone != null) {
for (int i = 0; i < items.telephone.length; i++) {
Phone phone = new Phone();
phone.type = TYPE_MOBILE;
phone.value = items.telephone[i];
phones.add(phone);
}
}
if (items.cellphone != null) {
for (int i = 0; i < items.cellphone.length; i++) {
Phone phone = new Phone();
phone.type = TYPE_MOBILE;
phone.value = items.cellphone[i];
phones.add(phone);
}
}
if (items.organization != null) {
for (int i = 0; i < items.organization.length; i++) {
Organization org = new Organization();
org.company = items.organization[i];
org.type = TYPE_WORK;
if (items.department != null && items.department.length > i) {
org.company += "," + items.department[i];
}
if (items.title != null && items.title.length > i) {
org.title = items.title[i];
} else {
org.title = "";
}
orgs.add(org);
}
/**
* add the remained items.department fields
*/
if (items.department != null) {
for (int i = items.organization.length; i < items.department.length; i++) {
Organization org = new Organization();
org.company = items.department[i];
org.type = TYPE_WORK;
if (items.title != null && items.title.length > i) {
org.title = items.title[i];
} else {
org.title = "";
}
orgs.add(org);
}
}
} else if (items.department != null) {
/**
* if items.orgnization==null&&items.department!=null, treat
* items.department as org.company value
*/
for (int i = 0; i < items.department.length; i++) {
Organization org = new Organization();
org.company = items.department[i];
org.type = TYPE_WORK;
if (items.title != null && items.title.length > i) {
org.title = items.title[i];
} else {
org.title = "";
}
orgs.add(org);
}
}
if (items.email != null) {
for (int i = 0; i < items.email.length; i++) {
Email email = new Email();
email.type = TYPE_WORK;
email.value = items.email[i];
emails.add(email);
}
}
if (items.address != null) {
for (int i = 0; i < items.address.length; i++) {
Address address = new Address();
address.type = TYPE_WORK;
address.value = items.address[i];
addresses.add(address);
if (items.postcode != null && items.postcode.length > i) {
address.postcode = items.postcode[i];
} else {
address.postcode = "";
}
}
}
if (items.url != null) {
for (int i = 0; i < items.url.length; i++) {
Url url = new Url();
url.type = TYPE_WORK;
url.value = items.url[i];
urls.add(url);
}
}
}
/**
* bind the data to corresponding views
*
* @param nameView
* @param phoneViewG
没有合适的资源?快使用搜索试试~ 我知道了~
Android应用源码之夏普名片扫描.zip项目安卓应用源码下载
共207个文件
class:76个
png:56个
java:29个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 188 浏览量
2022-03-08
20:52:30
上传
评论
收藏 7.74MB ZIP 举报
温馨提示
Android应用源码之夏普名片扫描.zip项目安卓应用源码下载Android应用源码之夏普名片扫描.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
资源推荐
资源详情
资源评论
收起资源包目录
Android应用源码之夏普名片扫描.zip项目安卓应用源码下载 (207个子文件)
resources.ap_ 253KB
NameCardRec.apk 2.6MB
jarlist.cache 120B
ContactPerson.class 25KB
DisplayRecResult.class 18KB
StaticRecFromCamera.class 17KB
NamecardImageGallery.class 14KB
PgmImage.class 8KB
OCRItems.class 6KB
OriginalImageView.class 6KB
RecFromSdcard.class 5KB
StaticRecFromCamera$1.class 4KB
StaticRecFromCamera$JpegPictureCallback.class 4KB
NamecardImageGallery$ThumbImageAdapter.class 3KB
NameCardRec.class 3KB
StaticRecFromCamera$SaveJpegThread.class 3KB
ScannerAnimation.class 3KB
DisplayRecResult$DialogClickListener.class 3KB
OCRManager.class 3KB
ContactPerson$SelectItemTypeListener.class 3KB
RecThread.class 3KB
NamecardImageGallery$1.class 3KB
StaticRecFromCamera$AutoFocusCallback.class 3KB
ContactPerson$RemoveItemListener.class 2KB
PrefSettings.class 2KB
R$string.class 2KB
StaticRecFromCamera$4.class 2KB
NamecardImageGallery$5.class 2KB
NamecardImageGallery$MyGestureListener.class 2KB
DisplayRecResult$ContactInfoAdapter.class 2KB
RecInProgress.class 2KB
RecFromSdcard$1.class 2KB
StaticRecFromCamera$PreviewCallback.class 2KB
RecFromFileThread.class 2KB
ContactPerson$SaveContactThread.class 2KB
StaticRecFromCamera$5.class 2KB
R$id.class 2KB
OCRManager$PgmOCRThread.class 2KB
ImageHelper.class 2KB
R$drawable.class 2KB
ScannerView.class 1KB
NamecardImageGallery$4.class 1KB
StaticRecFromCamera$3.class 1KB
StaticRecFromCamera$RawPictureCallback.class 1KB
NamecardImageGallery$2.class 1KB
NamecardImageGallery$3.class 1KB
NamecardImageGallery$6.class 1KB
RecFromSdcard$PgmFileFilter.class 1KB
StaticRecFromCamera$2.class 1KB
DisplayRecResult$2.class 1KB
DisplayRecResult$4.class 1KB
StopWorkThread.class 1KB
DisplayRecResult$1.class 1KB
NamecardImageGallery$JpgFileFilter.class 1KB
DisplayRecResult$DataHolder.class 1023B
DisplayRecResult$3.class 926B
StaticRecFromCamera$ShutterCallback.class 897B
R$layout.class 858B
Constants.class 851B
R.class 751B
NativeOCRItems.class 691B
ContactPerson$ItemIdentifier.class 652B
DisplayRecResult$ContactGroup.class 621B
R$styleable.class 597B
MessageId.class 560B
Organization.class 542B
Address.class 528B
Email.class 503B
Phone.class 503B
Url.class 497B
R$array.class 467B
BaseDomain.class 459B
R$anim.class 453B
R$style.class 436B
BuildConfig.class 349B
ContactPerson$OnSelectItemType.class 347B
R$attr.class 346B
OriginalImageView$OnZoomOutToMinListener.class 300B
OriginalImageView$OnZoomInToMaxListener.class 297B
.classpath 475B
Thumbs.db 92KB
classes.dex 126KB
logo_sharp.gif 804B
rec_selected_card.ico 4KB
settings.ico 2KB
contact_discard.ico 2KB
contact_save.ico 2KB
annotations-06d845c7c56427b837a7ef31a3a7a9b9.jar 943B
ContactPerson.java 33KB
DisplayRecResult.java 25KB
StaticRecFromCamera.java 19KB
NamecardImageGallery.java 14KB
PgmImage.java 11KB
R.java 10KB
OCRItems.java 9KB
OriginalImageView.java 6KB
RecFromSdcard.java 4KB
OCRManager.java 4KB
NameCardRec.java 3KB
ScannerAnimation.java 3KB
共 207 条
- 1
- 2
- 3
资源评论
yxkfw
- 粉丝: 81
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 金盾信安杯-河南网络与数据安全大赛‘金盾信安杯’详解:参赛形式与价值
- 数据分析案例-社交媒体情绪数据集可视化分析(数据集+代码).rar
- 【python毕业设计】信息隐藏算法实现源码(完整前后端+mysql+说明文档+LW).zip
- TongWeb7快速使用手册PDF
- 【python毕业设计】高校社团学生会管理系统(django)源码(完整前后端+mysql+说明文档+LW).zip
- 数据分析案例-2023年TOP100国外电影数据可视化(数据集+代码).rar
- 数据分析案例-基于亚马逊智能产品评论的探索性数据分析(4500字实验报告+数据集+代码).rar
- 鲲鹏麒麟MySQL5.7.22离线安装包
- Vue.js 的通用选择,多选,标记组件.zip
- 数据挖掘实战-基于决策树算法构建北京市空气质量预测模型(数据集+代码).rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功