package com.jqyd.son;
import com.jqyd.app.MyApp;
import com.jqyd.manager.R;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class LxrInfo extends Activity {
private Button say;
private Button sms;
private TextView userName;
private TextView userTel;
private TextView userComp;
private TextView userAddr;
private TextView userDepart;
private TextView userPosition;
private TextView userEmail;
private View companyLine;
private View departLine;
private View positionLine;
private View emailLine;
private String company =" ";
private String lxr = " ";
private String lxrtel = " ";
private String addr = " ";
private String department = " ";
private String position = " ";
private String email = " ";
private MyApp myApp;
private String param;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.lxrinfo);
say = (Button) this.findViewById(R.id.say);
sms = (Button) this.findViewById(R.id.sms);
userName = (TextView) this.findViewById(R.id.lxrName);
userTel = (TextView) this.findViewById(R.id.lxrTel);
userComp = (TextView) this.findViewById(R.id.company);
userAddr = (TextView) this.findViewById(R.id.lxrAddr);
userDepart = (TextView) this.findViewById(R.id.lxrDepart);
userPosition = (TextView) this.findViewById(R.id.lxrPosition);
userEmail = (TextView) this.findViewById(R.id.lxrEmail);
companyLine =(View) this.findViewById(R.id.companyLine);
departLine =(View) this.findViewById(R.id.departLine);
positionLine =(View) this.findViewById(R.id.positionLine);
emailLine =(View) this.findViewById(R.id.emailLine);
myApp = (MyApp) this.getApplication();
param = myApp.getModuleName();
Bundle bundle = this.getIntent().getExtras();
if(param.equals("ygtxl")){
lxr = bundle.getString("xm");
lxrtel = bundle.getString("dwhm");
addr = "";
department = bundle.getString("department");
position = bundle.getString("honor");
email = bundle.getString("email");
}else if(param.equals("khtxl")){
company = bundle.getString("cname");
lxr = bundle.getString("linkman");
lxrtel = bundle.getString("link_sim");
addr = bundle.getString("address");
}else if(param.equals("qzkhtxl")){
company = bundle.getString("cname");
lxr = bundle.getString("linkman");
lxrtel = bundle.getString("link_sim");
addr = bundle.getString("address");
}
initView();
}
public void initView(){
userName.setText("姓名: "+lxr);
userTel.setText("电话: "+lxrtel);
userComp.setText("公司名称: "+company);
userAddr.setText("家庭地址: "+addr);
userDepart.setText("部门: "+department);
userPosition.setText("职位: "+position);
userEmail.setText("邮箱: "+email);
if(param.equals("ygtxl")){
userComp.setVisibility(TextView.GONE);
departLine.setVisibility(View.GONE);
}else if(param.equals("khtxl") || param.equals("qzkhtxl")){
userDepart.setVisibility(TextView.GONE);
userPosition.setVisibility(TextView.GONE);
userEmail.setVisibility(TextView.GONE);
departLine.setVisibility(View.GONE);
positionLine.setVisibility(View.GONE);
emailLine.setVisibility(View.GONE);
userAddr.setText("公司地址: "+addr);
}
say.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dialTelAndSms(0,lxrtel);
}
});
sms.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dialTelAndSms(1,lxrtel);
}
});
}
/**
* 打电话、发短信
*
* @param queryIntent
*/
public void dialTelAndSms(int flag, String tel) {
if (flag == 0) {
// 直接发起呼叫
Intent intent1 = new Intent(Intent.ACTION_CALL, Uri.parse("tel://"
+ tel));
startActivity(intent1);
} else {
// 执行发短信功能,调用系统接口
Uri smsToUri = Uri.parse("smsto:" + tel);
Intent intent2 = new Intent(android.content.Intent.ACTION_SENDTO,
smsToUri);
intent2.putExtra("sms_body", "");
startActivity(intent2);
}
}
}