中通快递.apk(点击下载) / ActivityComplainPhoneSearch.java
package cn.beekee.zhongtong.fragment.main;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import cn.beekee.zhongtong.ActivityBase;
import cn.beekee.zhongtong.R;
import cn.beekee.zhongtong.util.AddressPriceSelect;
import cn.beekee.zhongtong.util.DialogPhoneHelper;
import cn.beekee.zhongtong.util.net.JsonOperate;
import cn.beekee.zhongtong.util.net.NetTaskManager;
import java.util.List;
import java.util.Map;
public class ActivityComplainPhoneSearch extends ActivityBase implements View.OnClickListener, AddressPriceSelect.IAddressPriceSelectListener, AdapterView.OnItemClickListener {
TextView mAddressText;
List<Map<String, String>> mListData;
ListView mListView;
DialogPhoneHelper mPhoneHelper = new DialogPhoneHelper();
AddressPriceSelect mSelect;
/* access modifiers changed from: protected */
@Override // cn.beekee.zhongtong.ActivityBase
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_complain_phone);
findViewById(R.id.back).setOnClickListener(this);
((TextView) findViewById(R.id.title)).setText("投诉电话查询");
this.mAddressText = (TextView) findViewById(R.id.address_input);
this.mAddressText.setOnClickListener(this);
this.mListView = (ListView) findViewById(R.id.list);
this.mListView.setOnItemClickListener(this);
findViewById(R.id.select).setOnClickListener(this);
findViewById(R.id.search).setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.address_input:
case R.id.select:
selectAddress();
return;
case R.id.search:
search();
return;
case R.id.back:
finish();
return;
default:
return;
}
}
private void selectAddress() {
if (this.mSelect == null) {
this.mSelect = new AddressPriceSelect(this, this);
}
this.mSelect.startSelect();
}
private void search() {
String[] addresStrings = this.mAddressText.getText().toString().split(" ");
if (addresStrings.length != 2) {
Toast.makeText(this, "请输入查询的地址", 0).show();
return;
}
NetTaskManager.getInstance().startForceTaskGet(this, "http://ztowebapi.zt-express.com/SiteSearch/PaginConditionSearch?province=" + addresStrings[0] + "&city=" + addresStrings[1] + "&pageSize=1000&index=1", this);
}
@Override // cn.beekee.zhongtong.util.AddressPriceSelect.IAddressPriceSelectListener
public void pickAddressPrice(String province, String city, String cityCode) {
this.mAddressText.setText(province + " " + city);
}
@Override // cn.beekee.zhongtong.util.net.NetTaskManager.INetListener, cn.beekee.zhongtong.ActivityBase
public boolean netResult(int flag, Object result) {
if (!super.netResult(flag, result)) {
return false;
}
List<Map<String, String>> list = JsonOperate.decodeComplainPhone((String) result);
if (list == null) {
Toast.makeText(this, "获取数据有误", 0).show();
return false;
}
setAdapter(list);
return true;
}
private void setAdapter(List<Map<String, String>> list) {
this.mListData = list;
this.mListView.setAdapter((ListAdapter) new SimpleAdapter(this, this.mListData, R.layout.phone_element, new String[]{JsonOperate.COMPLAIN_SITE_NAME, JsonOperate.COMPLAIN_MANAGER, JsonOperate.COMPLAIN_MANAGER_PHONE, JsonOperate.COMPLAIN_SITE_PHONE}, new int[]{R.id.site_name, R.id.site_manager, R.id.manager_phone, R.id.site_phone}));
}
@Override // android.widget.AdapterView.OnItemClickListener
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
Map<String, String> map = this.mListData.get(position);
String sitePhone = map.get(JsonOperate.COMPLAIN_SITE_PHONE);
if (!TextUtils.isEmpty(sitePhone)) {
this.mPhoneHelper.initDialog(this, sitePhone);
} else {
this.mPhoneHelper.initDialog(this, map.get(JsonOperate.COMPLAIN_MANAGER_PHONE));
}
this.mPhoneHelper.showDialog();
}
/* access modifiers changed from: protected */
public void onDestroy() {
super.onDestroy();
this.mPhoneHelper.dismissDialog();
}
}