号簿助手 v4.6.31版本的 MD5 值为:9d7ff98a6bb5cc178eac2df4d1b2f0e0
以下内容为反编译后的 CallLogDetailViewAdapter.java 源代码,内容仅作参考
package com.chinatelecom.pim.ui.adapter;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.chinatelecom.pim.R;
import com.chinatelecom.pim.core.CoreManagerFactory;
import com.chinatelecom.pim.core.IConstant;
import com.chinatelecom.pim.core.adapter.Device;
import com.chinatelecom.pim.core.manager.AddressBookManager;
import com.chinatelecom.pim.core.manager.CacheManager;
import com.chinatelecom.pim.core.manager.CallBookManager;
import com.chinatelecom.pim.core.manager.CalllogManager;
import com.chinatelecom.pim.core.manager.MarkNumManager;
import com.chinatelecom.pim.core.manager.PhotoManager;
import com.chinatelecom.pim.core.sqlite.SuperNumCallLogConstants;
import com.chinatelecom.pim.core.sqlite.SuperNumCallLogSqlite;
import com.chinatelecom.pim.core.utils.IntentFactory;
import com.chinatelecom.pim.foundation.common.view.ViewAdapter;
import com.chinatelecom.pim.foundation.common.view.ViewModel;
import com.chinatelecom.pim.foundation.lang.log.Log;
import com.chinatelecom.pim.foundation.lang.model.CallBook;
import com.chinatelecom.pim.foundation.lang.model.Calllog;
import com.chinatelecom.pim.foundation.lang.model.MarkNum;
import com.chinatelecom.pim.foundation.lang.model.Theme;
import com.chinatelecom.pim.foundation.lang.model.contact.Contact;
import com.chinatelecom.pim.foundation.lang.sqlite.ListCursor;
import com.chinatelecom.pim.foundation.lang.ui.FoundationListAdapter;
import com.chinatelecom.pim.foundation.lang.utils.BitmapUtils;
import com.chinatelecom.pim.foundation.lang.utils.CacheImageLoader;
import com.chinatelecom.pim.foundation.lang.utils.DateUtils;
import com.chinatelecom.pim.foundation.lang.utils.FileUtils;
import com.chinatelecom.pim.foundation.lang.utils.StringUtils;
import com.chinatelecom.pim.foundation.lang.utils.ToastTool;
import com.chinatelecom.pim.ui.utils.CallUtils;
import com.chinatelecom.pim.ui.view.CallLogDetailItemView;
import com.chinatelecom.pim.ui.view.FoundationNoScroll;
import com.chinatelecom.pim.ui.view.HeaderView;
import com.chinatelecom.pim.ui.view.dialog.CustomLoadingDialog;
import com.chinatelecom.pim.ui.view.dialog.DialogFactory;
import com.yulore.superyellowpage.impl.YuloreApiFactory;
import com.yulore.superyellowpage.modelbean.RecognitionTelephone;
import java.io.File;
import java.util.Date;
public class CallLogDetailViewAdapter extends ViewAdapter<CallLogDetailModel> {
public static final String ROOT_DIRECTORY = "ctpim";
private AddressBookManager addressBookManager;
private CacheManager cacheManager;
private CallBookManager callBookManager;
private Calllog calllog;
private CalllogManager calllogManager;
private Contact contact;
private Context context;
private RecognitionTelephone data;
private String finalDisplayName;
private TextView footerView;
private Log logger;
private Activity mActivity;
private String markName;
private MarkNumManager markNumManager;
private String number;
private ToastTool toastTool;
public CallLogDetailViewAdapter(Activity activity, Theme theme) {
super(activity, theme);
this.calllogManager = CoreManagerFactory.getInstance().getCalllogManager();
this.callBookManager = CoreManagerFactory.getInstance().getCallBookManager();
this.markNumManager = CoreManagerFactory.getInstance().getMarkNumManager();
this.addressBookManager = CoreManagerFactory.getInstance().getAddressBookManager();
this.cacheManager = CoreManagerFactory.getInstance().getCacheManager();
this.logger = Log.build(CallLogDetailViewAdapter.class);
this.mActivity = activity;
}
@Override
public CallLogDetailModel doSetup() {
Activity activity = getActivity();
this.toastTool = ToastTool.getToast(activity);
activity.setContentView(R.layout.call_log_details_activity_new);
CallLogDetailModel model = new CallLogDetailModel();
model.setScrollView((ScrollView) activity.findViewById(R.id.sv_call_log_detail));
model.setHeaderViewPanel((HeaderView) activity.findViewById(R.id.call_log_detail_header_view));
model.setListView((FoundationNoScroll) activity.findViewById(R.id.call_log_detail_listview));
model.getListView().setDividerHeight(0);
model.getScrollView().smoothScrollTo(0, 20);
model.setNumberText((TextView) activity.findViewById(R.id.text_name));
model.setNumberTopText((TextView) activity.findViewById(R.id.text_name_top));
model.setAttributeText((TextView) activity.findViewById(R.id.text_attribute));
model.setAttributeTopText((TextView) activity.findViewById(R.id.text_attribute_top));
model.setSendImage((ImageView) activity.findViewById(R.id.image_send));
model.setSendTopImage((ImageView) activity.findViewById(R.id.image_send_top));
model.setLocationText((TextView) activity.findViewById(R.id.text_location));
model.setLocationLayout((LinearLayout) activity.findViewById(R.id.layout_all_location));
model.setYuloreshow((TextView) activity.findViewById(R.id.tv_yulore_desc));
model.setBusinessWeb((RelativeLayout) activity.findViewById(R.id.web_address));
model.setJoinYulore((TextView) activity.findViewById(R.id.tv_yulore_join));
model.setBusinessInfo((TextView) activity.findViewById(R.id.tv_business_info));
model.setOfficialSite((TextView) activity.findViewById(R.id.tv_off_site));
model.setNearSite((TextView) activity.findViewById(R.id.tv_near_site));
model.setPhoneCall((TextView) activity.findViewById(R.id.text_name2));
model.setSmsSend((ImageView) activity.findViewById(R.id.image_send2));
model.setLlcontact2((RelativeLayout) activity.findViewById(R.id.ll_contect_2));
model.setLocation2((TextView) activity.findViewById(R.id.text_attribute2));
model.setYuloreVip((ImageView) activity.findViewById(R.id.iv_yulore_vip));
model.setCallPhoneImage((ImageView) activity.findViewById(R.id.call_phone_image));
model.setCallPhoneLayout((LinearLayout) activity.findViewById(R.id.text_name_layout));
model.setCallPhone2Layout((LinearLayout) activity.findViewById(R.id.text_name2_layout));
return model;
}
public void listViewDataBind(Cursor cursor) {
if (this.footerView == null && cursor.getCount() >= 5) {
this.footerView = new TextView(getActivity());
this.footerView.setLayoutParams(new AbsListView.LayoutParams(-2, -2));
this.footerView.setTextSize(1, 16.0f);
this.footerView.setText("查看所有");
this.footerView.setTextColor(getActivity().getResources().getColor(R.color.green_main_normal_color));
getModel().setCheckAllText(this.footerView);
getModel().getListView().addFooterView(this.footerView, null, false);
}
getModel().getListView().setAdapter((ListAdapter) new CallLogDetailAdapter(getActivity(), cursor));
}
public class CallLogDetailAdapter extends FoundationListAdapter<CallLogDetailItemView, Long> {
public CallLogDetailAdapter(Activity activity, Cursor cursor) {
super(activity, cursor, R.layout.call_detail_item);
}
@Override
public Long populateListItem(CallLogDetailItemView listItem, Context context, Cursor cursor) {
ListCursor<Calllog> listCursor = (ListCursor) cursor;
Calllog calllog = listCursor.getItem();
listItem.getCallDateView().setText(DateUtils.currentDataFormat(new Date(calllog.getTime().longValue())));
listItem.getCallDateTimeView().setText(DateUtils.currentTimeFormat(new Date(calllog.getTime().longValue())));
listItem.getDurationView().setText(CallUtils.getCallTimes(calllog.getDuration()));
listItem.getCallTextType().setText(CallUtils.getCallTypeString(calllog.getType()));
if (Device.isDualSimSupport()) {
Drawable sim1 = CallLogDetailViewAdapter.this.getActivity().getResources().getDrawable(R.drawable.ic_sim_type_f_on);
Drawable sim2 = CallLogDetailViewAdapter.this.getActivity().getResources().getDrawable(R.drawable.ic_sim_type_s_on);
int index = CoreManagerFactory.getInstance().getDeviceFactory().GetIndexFromSubId(calllog.getSubId());
ImageView simTypeView = listItem.getSimTypeView();
if (index != 1) {
sim1 = sim2;
}
simTypeView.setImageDrawable(sim1);
listItem.getSimTypeView().setVisibility(0);
}
CallLogDetailViewAdapter.this.setupCallBook(listItem, calllog, calllog.getDisplayName());
return null;
}
}
public void setupCallBook(final CallLogDetailItemView listItem, final Calllog calllog, final String name) {
final String id = calllog.getId();
new AsyncTask<Void, Void, Void>() {
CallBook callBook = null;
@Override
public Void doInBackground(Void... params) {
this.callBook = CallLogDetailViewAdapter.this.callBookManager.findCallBookItemByLogId(id);
return null;
}
@Override
public void onPostExecute(Void aVoid) {
if (StringUtils.isEmpty(calllog.getDisplayName()) && this.callBook != null && StringUtils.isNotEmpty(this.callBook.getLocationAddress()) && StringUtils.isEmpty(CallLogDetailViewAdapter.this.getModel().getLocationText().getText().toString())) {
CallLogDetailViewAdapter.this.setupLoaction(this.callBook.getLocationAddress());
}
listItem.getCallRecordView().setVisibility((this.callBook == null || !StringUtils.isNotEmpty(this.callBook.getRecordFile())) ? 8 : 0);
listItem.getCallBookView().setVisibility((this.callBook == null || !CallLogDetailViewAdapter.this.getFileName(this.callBook.getId()).booleanValue()) ? 8 : 0);
if (this.callBook != null && StringUtils.isNotEmpty(this.callBook.getRecordFile())) {
this.callBook.setDisplayName(name);
listItem.getCallRecordView().setTag(this.callBook);
listItem.getCallRecordView().setOnClickListener(CallLogDetailViewAdapter.this.getModel().getOnRecordClickListener());
}
if (this.callBook != null && CallLogDetailViewAdapter.this.getFileName(this.callBook.getId()).booleanValue()) {
this.callBook.setDisplayName(name);
listItem.getCallBookView().setTag(this.callBook);
listItem.getCallBookView().setOnClickListener(CallLogDetailViewAdapter.this.getModel().getOnBookClickListener());
}
}
}.execute(new Void[0]);
}
public Boolean getFileName(long idName) {
File file = new File(getEditorDirectory().toString());
File[] files = file.listFiles();
for (File fl : files) {
String fileName = fl.getName();
String[] usNumber = fileName.split("u");
if (usNumber[0].equals(idName + "")) {
this.logger.debug("文件存在");
return true;
}
}
return false;
}
private File getEditorDirectory() {
return mkdirs(new File("ctpim" + File.separator + IConstant.Upgrade.FOLDER_NAME));
}
private File mkdirs(File directory) {
if (!directory.exists()) {
if (!FileUtils.isCardMounted()) {
throw new RuntimeException("SD卡未装载");
}
return FileUtils.createFolder(directory.getAbsolutePath());
}
return directory;
}
public void setViewData(Calllog calllog, Calllog aVoid, RecognitionTelephone data) {
boolean flag = StringUtils.isEmpty(calllog.getDisplayName());
this.data = data;
this.calllog = calllog;
this.contact = this.addressBookManager.findContactByPhoneNumber(calllog.getNumber());
this.number = calllog.getNumber();
this.context = this.mActivity.getBaseContext();
MarkNum markNum = this.markNumManager.findMarkByNum(calllog.getNumber());
if (markNum != null) {
this.markName = markNum.getContent();
}
String displayName = calllog.getDisplayName();
if (this.contact != null && this.contact.getDisplayName() != null) {
displayName = this.contact.getDisplayName();
}
if (StringUtils.isBlank(displayName)) {
if (data != null && StringUtils.isNotEmpty(data.getName())) {
displayName = data.getName();
} else {
displayName = calllog.getNumber();
}
}
calllog.setDisplayName(displayName);
if (data != null) {
if (this.contact != null) {
this.finalDisplayName = this.contact.getDisplayName();
} else {
this.finalDisplayName = data.getName();
}
flag = true;
} else {
this.finalDisplayName = displayName;
}
if (!flag || this.contact != null) {
setCViewData(aVoid);
} else if (data != null && StringUtils.isNotEmpty(data.getId())) {
setPViewData();
} else {
setSViewData();
}
}
public void setCViewData(final Calllog aVoid) {
getModel().getNumberText().setText(this.calllog.getNumber());
getModel().getNumberTopText().setText(this.calllog.getDisplayName());
loadContactPhoto();
if (this.data == null) {
getModel().getAttributeText().setText("未知");
getModel().getAttributeTopText().setText("未知");
} else {
String address = StringUtils.isEmpty(this.data.getLocation()) ? "未知" : this.data.getLocation();
if (this.data.getFlag() != null && this.data.getFlag().getNum() != 0) {
StringBuffer sb = new StringBuffer();
sb.append("被").append(this.data.getFlag().getNum()).append("人标记为").append(this.data.getFlag().getType());
getModel().getAttributeText().setText(sb.toString());
getModel().getAttributeTopText().setText(address);
} else {
getModel().getAttributeText().setText(address);
getModel().getAttributeTopText().setText(address);
}
}
getModel().getCallPhoneImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.calllog.getNumber());
}
}
});
getModel().getCallPhoneLayout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.calllog.getNumber());
}
}
});
getModel().getSendImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
Intent intent = IntentFactory.createSendSMSIntentByName(CallLogDetailViewAdapter.this.calllog.getNumber(), CallLogDetailViewAdapter.this.finalDisplayName, "");
intent.putExtra("focus", true);
intent.setFlags(276824064);
CallLogDetailViewAdapter.this.context.startActivity(intent);
}
}
});
if (aVoid != null && StringUtils.isNotEmpty(aVoid.getNumber())) {
getModel().getLlcontact2().setVisibility(0);
getModel().getPhoneCall().setText(aVoid.getNumber());
getModel().getLocation2().setText(aVoid.getDisplayName());
getModel().getCallPhoneImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (StringUtils.isNotEmpty(aVoid.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), aVoid.getNumber());
}
}
});
getModel().getCallPhone2Layout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(aVoid.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), aVoid.getNumber());
}
}
});
getModel().getSmsSend().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(aVoid.getNumber())) {
Intent intent = IntentFactory.createSendSMSIntentByName(CallLogDetailViewAdapter.this.calllog.getNumber(), CallLogDetailViewAdapter.this.finalDisplayName, "");
intent.putExtra("focus", true);
CallLogDetailViewAdapter.this.context.startActivity(intent);
}
}
});
}
}
private void loadContactPhoto() {
Bitmap contactPhoto;
PhotoManager photoManager = CoreManagerFactory.getInstance().getPhotoManager();
Bitmap bitmap = BitmapUtils.drawable2Bitmap(this.context.getResources().getDrawable(R.drawable.ic_call_detail_default));
if (this.contact != null && (contactPhoto = photoManager.loadPhtoByContactRawId(this.contact.getRawContactId().longValue())) != null) {
bitmap = contactPhoto;
}
getModel().getSendTopImage().setImageBitmap(bitmap);
}
public void setSViewData() {
getModel().getNumberText().setText(this.calllog.getNumber());
String address = this.data == null ? "未知" : this.data.getLocation();
getModel().getNumberTopText().setText(this.calllog.getDisplayName());
if (this.data != null) {
if (!StringUtils.isEmpty(this.data.getName())) {
getModel().getNumberTopText().setText(this.data.getName());
}
if (this.data.getFlag() != null && this.data.getFlag().getNum() != 0) {
if (StringUtils.isNotBlank(this.markName)) {
getModel().getAttributeTopText().setText(this.markName);
} else {
StringBuffer sb = new StringBuffer();
sb.append("被").append(this.data.getFlag().getNum()).append("人标记为").append(this.data.getFlag().getType());
getModel().getAttributeTopText().setText(sb.toString());
}
TextView attributeText = getModel().getAttributeText();
if (StringUtils.isEmpty(address)) {
address = "未知";
}
attributeText.setText(address);
} else {
if (StringUtils.isNotBlank(this.markName)) {
getModel().getAttributeTopText().setText(this.markName);
} else {
getModel().getAttributeTopText().setText(StringUtils.isEmpty(address) ? "未知" : address);
}
TextView attributeText2 = getModel().getAttributeText();
if (StringUtils.isEmpty(address)) {
address = "未知";
}
attributeText2.setText(address);
}
getModel().getYuloreshow().setVisibility(0);
getModel().getYuloreshow().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName(CallLogDetailViewAdapter.this.mActivity, "com.chinatelecom.pim.activity.setting.WebViewActivity");
intent.putExtra(IConstant.Intent.INTENT_WEB_URL, "http://www.dianhua.cn/beijing");
intent.putExtra(IConstant.Intent.INTENT_WEB_TITLE, "电话邦官网");
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
});
if (this.data != null && this.data.getUrl() != null) {
getModel().getYuloreshow().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName(CallLogDetailViewAdapter.this.mActivity, "com.chinatelecom.pim.activity.setting.WebViewActivity");
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
intent.putExtra(IConstant.Intent.INTENT_WEB_URL, CallLogDetailViewAdapter.this.data.getUrl());
intent.putExtra(IConstant.Intent.INTENT_WEB_TITLE, "电话网详情");
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
});
}
} else {
getModel().getAttributeText().setText(address);
getModel().getAttributeTopText().setText(address);
}
getModel().getCallPhoneImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.calllog.getNumber());
}
}
});
getModel().getCallPhoneLayout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.calllog.getNumber());
}
}
});
getModel().getSendImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
Intent intent = IntentFactory.createSendSMSIntentByName(CallLogDetailViewAdapter.this.calllog.getNumber(), CallLogDetailViewAdapter.this.finalDisplayName, "");
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
intent.setFlags(276824064);
CallLogDetailViewAdapter.this.context.startActivity(intent);
}
}
});
}
public void setPViewData() {
getModel().getNumberText().setText(this.calllog.getNumber());
getModel().getCallPhoneImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.calllog.getNumber());
}
}
});
getModel().getCallPhoneLayout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
IntentFactory.createCallIntent(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.calllog.getNumber());
}
}
});
getModel().getSendImage().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (StringUtils.isNotEmpty(CallLogDetailViewAdapter.this.calllog.getNumber())) {
Intent intent = IntentFactory.createSendSMSIntentByName(CallLogDetailViewAdapter.this.calllog.getNumber(), CallLogDetailViewAdapter.this.finalDisplayName, "");
intent.putExtra("focus", true);
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
}
});
if (StringUtils.isNotEmpty(this.data.getName())) {
getModel().getNumberTopText().setText(this.data.getName());
} else {
getModel().getNumberTopText().setText(this.calllog.getNumber());
}
new Thread(new Runnable() {
@Override
public void run() {
new CacheImageLoader(CallLogDetailViewAdapter.this.context).DisplayImage(CallLogDetailViewAdapter.this.data.getLogo(), CallLogDetailViewAdapter.this.getModel().getSendTopImage(), false);
if (CallLogDetailViewAdapter.this.data != null && !StringUtils.isEmpty(CallLogDetailViewAdapter.this.data.getSloganImg())) {
CallLogDetailViewAdapter.this.getModel().getYuloreVip().setVisibility(0);
new CacheImageLoader(CallLogDetailViewAdapter.this.context).DisplayImage(CallLogDetailViewAdapter.this.data.getSloganImg(), CallLogDetailViewAdapter.this.getModel().getYuloreVip(), false);
}
}
}).start();
if (this.data != null) {
if (StringUtils.isEmpty(this.data.getName())) {
getModel().getAttributeText().setText(StringUtils.isEmpty(this.data.getLocation()) ? "未知" : this.data.getLocation());
} else {
getModel().getAttributeText().setText(this.data.getName());
}
} else {
getModel().getAttributeText().setText(this.number);
}
if (StringUtils.isNotBlank(this.markName)) {
getModel().getAttributeTopText().setText(this.markName);
} else {
getModel().getAttributeTopText().setText(this.number);
}
getModel().getBusinessWeb().setVisibility(0);
getModel().getOfficialSite().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName(CallLogDetailViewAdapter.this.mActivity, "com.chinatelecom.pim.activity.setting.WebViewActivity");
intent.putExtra(IConstant.Intent.INTENT_WEB_URL, CallLogDetailViewAdapter.this.data.getWebsite());
intent.putExtra(IConstant.Intent.INTENT_WEB_TITLE, CallLogDetailViewAdapter.this.data.getName());
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
});
getModel().getNearSite().setVisibility(8);
getModel().getNearSite().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
getModel().getBusinessInfo().setVisibility(0);
getModel().getBusinessInfo().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName(CallLogDetailViewAdapter.this.mActivity, "com.chinatelecom.pim.activity.setting.WebViewActivity");
intent.putExtra(IConstant.Intent.INTENT_WEB_URL, CallLogDetailViewAdapter.this.data.getUrl());
intent.putExtra(IConstant.Intent.INTENT_WEB_TITLE, CallLogDetailViewAdapter.this.data.getName());
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
});
getModel().getYuloreshow().setVisibility(0);
getModel().getYuloreshow().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName(CallLogDetailViewAdapter.this.mActivity, "com.chinatelecom.pim.activity.setting.WebViewActivity");
intent.putExtra(IConstant.Intent.INTENT_WEB_URL, "http://www.dianhua.cn/beijing");
intent.putExtra(IConstant.Intent.INTENT_WEB_TITLE, "电话邦官网");
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
});
final String web_url = YuloreApiFactory.createYellowPageApi(this.mActivity.getBaseContext()).getEnterCentreUrl(this.data.getId(), null);
getModel().getJoinYulore().setVisibility(0);
getModel().getJoinYulore().getPaint().setFlags(8);
getModel().getJoinYulore().getPaint().setAntiAlias(true);
getModel().getJoinYulore().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setClassName(CallLogDetailViewAdapter.this.mActivity, "com.chinatelecom.pim.activity.setting.WebViewActivity");
intent.putExtra(IConstant.Intent.INTENT_WEB_URL, web_url);
intent.putExtra(IConstant.Params.IS_CALL_LOG, true);
intent.putExtra(IConstant.Intent.INTENT_WEB_TITLE, "入驻");
CallLogDetailViewAdapter.this.mActivity.startActivity(intent);
}
});
}
public Contact getContact() {
return this.contact;
}
public void setupLoaction(String adress) {
getModel().getLocationLayout().setVisibility(StringUtils.isEmpty(adress) ? 8 : 0);
if (StringUtils.isNotEmpty(adress)) {
getModel().getLocationText().setText(adress);
}
}
public void setupClearCallLog(final String number) {
if (Device.isSamsung()) {
this.toastTool.showMessage("因终端限制,无法删除通话记录,请切换至手机电话簿删除!");
} else {
DialogFactory.createMessageDialog(getActivity(), 0, "提示", getActivity().getString(R.string.message_delete_confirm), "确定", "取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
dialogInterface.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
DialogFactory.createLoadingDialog(CallLogDetailViewAdapter.this.getActivity(), CallLogDetailViewAdapter.this.getActivity().getResources().getString(R.string.message_delete_calllogs), new DialogFactory.LoadingDialogCallback.Adapter() {
@Override
public void onShow(CustomLoadingDialog dialog) {
CallLogDetailViewAdapter.this.calllogManager.deleteLogs((CalllogManager) number);
CallLogDetailViewAdapter.this.callBookManager.delItemByNum(number);
CallLogDetailViewAdapter.this.delSuperNumForDB(number);
}
@Override
public void onDismiss(CustomLoadingDialog dialog) {
CallLogDetailViewAdapter.this.toastTool.showMessage("删除成功!");
CallLogDetailViewAdapter.this.getActivity().finish();
}
}).show();
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).show();
}
}
public void delSuperNumForDB(String number) {
SuperNumCallLogSqlite superNumCallLogSqlite = new SuperNumCallLogSqlite(getActivity());
SQLiteDatabase callLogDB = superNumCallLogSqlite.getWritableDatabase();
Boolean isTrue = querySuperNumIsTrue(callLogDB, number);
if (isTrue.booleanValue()) {
delNumberForDB(callLogDB, number);
}
callLogDB.close();
}
private Boolean querySuperNumIsTrue(SQLiteDatabase callLogDB, String number) {
boolean isTrue;
Cursor query = callLogDB.query(SuperNumCallLogConstants.TAB_NAME, new String[]{"phone"}, "phone=?", new String[]{number}, null, null, null);
if (query != null && query.getCount() > 0) {
isTrue = true;
} else {
isTrue = false;
}
query.close();
return isTrue;
}
private void delNumberForDB(SQLiteDatabase callLogDB, String number) {
callLogDB.delete(SuperNumCallLogConstants.TAB_NAME, "phone=?", new String[]{number});
callLogDB.close();
}
public static class CallLogDetailModel extends ViewModel {
private TextView attributeText;
private TextView attributeTopText;
private TextView businessInfo;
private RelativeLayout businessWeb;
private LinearLayout callPhone2Layout;
private ImageView callPhoneImage;
private LinearLayout callPhoneLayout;
private TextView checkAllText;
private HeaderView headerViewPanel;
private TextView joinYulore;
private FoundationNoScroll listView;
private RelativeLayout llcontact2;
private TextView location2;
private LinearLayout locationLayout;
private TextView locationText;
private TextView nearSite;
private TextView numberText;
private TextView numberTopText;
private TextView officialSite;
private View.OnClickListener onBookClickListener;
private View.OnClickListener onRecordClickListener;
private TextView phoneCall;
private ScrollView scrollView;
private ImageView sendImage;
private ImageView sendTopImage;
private ImageView smsSend;
private ImageView yuloreVip;
private TextView yuloreshow;
public ImageView getYuloreVip() {
return this.yuloreVip;
}
public void setYuloreVip(ImageView yuloreVip) {
this.yuloreVip = yuloreVip;
}
public ScrollView getScrollView() {
return this.scrollView;
}
public void setScrollView(ScrollView scrollView) {
this.scrollView = scrollView;
}
public ImageView getSmsSend() {
return this.smsSend;
}
public TextView getLocation2() {
return this.location2;
}
public void setLocation2(TextView location2) {
this.location2 = location2;
}
public void setSmsSend(ImageView smsSend) {
this.smsSend = smsSend;
}
public TextView getPhoneCall() {
return this.phoneCall;
}
public void setPhoneCall(TextView phoneCall) {
this.phoneCall = phoneCall;
}
public TextView getOfficialSite() {
return this.officialSite;
}
public void setOfficialSite(TextView officialSite) {
this.officialSite = officialSite;
}
public TextView getNearSite() {
return this.nearSite;
}
public void setNearSite(TextView nearSite) {
this.nearSite = nearSite;
}
public TextView getBusinessInfo() {
return this.businessInfo;
}
public void setBusinessInfo(TextView businessInfo) {
this.businessInfo = businessInfo;
}
public TextView getJoinYulore() {
return this.joinYulore;
}
public void setJoinYulore(TextView joinYulore) {
this.joinYulore = joinYulore;
}
public TextView getYuloreshow() {
return this.yuloreshow;
}
public void setYuloreshow(TextView yuloreshow) {
this.yuloreshow = yuloreshow;
}
public RelativeLayout getBusinessWeb() {
return this.businessWeb;
}
public void setBusinessWeb(RelativeLayout businessWeb) {
this.businessWeb = businessWeb;
}
public TextView getNumberText() {
return this.numberText;
}
public View.OnClickListener getOnRecordClickListener() {
return this.onRecordClickListener;
}
public void setOnRecordClickListener(View.OnClickListener onRecordClickListener) {
this.onRecordClickListener = onRecordClickListener;
}
public View.OnClickListener getOnBookClickListener() {
return this.onBookClickListener;
}
public void setOnBookClickListener(View.OnClickListener onBookClickListener) {
this.onBookClickListener = onBookClickListener;
}
public LinearLayout getLocationLayout() {
return this.locationLayout;
}
public void setLocationLayout(LinearLayout locationLayout) {
this.locationLayout = locationLayout;
}
public void setNumberText(TextView numberText) {
this.numberText = numberText;
}
public TextView getAttributeText() {
return this.attributeText;
}
public void setAttributeText(TextView attributeText) {
this.attributeText = attributeText;
}
public TextView getCheckAllText() {
return this.checkAllText;
}
public void setCheckAllText(TextView checkAllText) {
this.checkAllText = checkAllText;
}
public TextView getLocationText() {
return this.locationText;
}
public void setLocationText(TextView locationText) {
this.locationText = locationText;
}
public ImageView getSendImage() {
return this.sendImage;
}
public void setSendImage(ImageView sendImage) {
this.sendImage = sendImage;
}
public HeaderView getHeaderViewPanel() {
return this.headerViewPanel;
}
public void setHeaderViewPanel(HeaderView headerViewPanel) {
this.headerViewPanel = headerViewPanel;
}
public FoundationNoScroll getListView() {
return this.listView;
}
public void setListView(FoundationNoScroll listView) {
this.listView = listView;
}
public TextView getNumberTopText() {
return this.numberTopText;
}
public void setNumberTopText(TextView numberTopText) {
this.numberTopText = numberTopText;
}
public TextView getAttributeTopText() {
return this.attributeTopText;
}
public void setAttributeTopText(TextView attributeTopText) {
this.attributeTopText = attributeTopText;
}
public ImageView getSendTopImage() {
return this.sendTopImage;
}
public void setSendTopImage(ImageView sendTopImage) {
this.sendTopImage = sendTopImage;
}
public RelativeLayout getLlcontact2() {
return this.llcontact2;
}
public void setLlcontact2(RelativeLayout llcontact2) {
this.llcontact2 = llcontact2;
}
public void setCallPhoneImage(ImageView callPhoneImage) {
this.callPhoneImage = callPhoneImage;
}
public ImageView getCallPhoneImage() {
return this.callPhoneImage;
}
public LinearLayout getCallPhoneLayout() {
return this.callPhoneLayout;
}
public void setCallPhoneLayout(LinearLayout callPhoneLayout) {
this.callPhoneLayout = callPhoneLayout;
}
public LinearLayout getCallPhone2Layout() {
return this.callPhone2Layout;
}
public void setCallPhone2Layout(LinearLayout callPhone2Layout) {
this.callPhone2Layout = callPhone2Layout;
}
}
}