From daad95eefa884411112b2fe02b9b19acff25d3bf Mon Sep 17 00:00:00 2001 From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 22 三月 2017 14:31:21 +0800 Subject: [PATCH] --- VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java index 03c36ee..2eef314 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java +++ b/VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/widget/CountrySelectionPopup.java @@ -19,15 +19,26 @@ import com.bsk.zhangbo.demoforbsk.R; import com.bsk.zhangbo.demoforbsk.adapter.MyWheelAdapter; +import com.bsk.zhangbo.demoforbsk.com.bsk.zhangbo.demoforbsk.service.DictionaryService; import com.bsk.zhangbo.demoforbsk.listeners.OkButtonClickedListener; +import com.bsk.zhangbo.demoforbsk.util.AppApi; import com.bsk.zhangbo.demoforbsk.util.CountryPresenter; import com.wx.wheelview.widget.WheelView; + +import net.sourceforge.pinyin4j.PinyinHelper; + +import org.xutils.http.RequestParams; +import org.xutils.x; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; + +import cn.com.basic.face.discern.common.BaseCommonCallBack; +import cn.com.basic.face.discern.common.CommonVariables; +import cn.com.basic.face.discern.entity.Dictionary; /** * Created by Sinoe on 2017/2/28. @@ -44,6 +55,7 @@ private CountryPresenter countryPresenter; public CountrySelectionPopup(Context context) { + this.mContext = context; countryPresenter = new CountryPresenter(context); view = LayoutInflater.from(context).inflate(R.layout.pop_country, null); @@ -56,9 +68,10 @@ mTvCancel.setOnClickListener(this); mTvConfirm.setOnClickListener(this); - String[] countryWordData = countryPresenter.getCountryWordData(); - countryWordList = Arrays.asList(countryWordData); - countryData = countryPresenter.getCountryData(); + String[] countryWordData = DictionaryService.countryWordData; + countryWordList = DictionaryService.countryWordList; + countryData = DictionaryService.countryData; + countryList = countryData.get(countryWordList.get(mWheelViewTitle.getSelection())); mWheelViewTitle.setWheelAdapter(new MyWheelAdapter(context)); @@ -125,9 +138,14 @@ if (view instanceof AppCompatTextView) { if (((AppCompatTextView) view).getText().equals("纭")) { for (OkButtonClickedListener okButtonClickedListener : okButtonClickedListeners) { - countryList = countryData.get(countryWordList.get(mWheelViewTitle.getCurrentPosition())); - okButtonClickedListener.onItemSelected(0, null, countryList.get(mWheelViewName.getCurrentPosition())); + if (mWheelViewTitle.getCurrentPosition() >= 0) { + countryList = countryData.get(countryWordList.get(mWheelViewTitle.getCurrentPosition())); + okButtonClickedListener.onItemSelected(0, null, countryList.get(mWheelViewName.getCurrentPosition())); + } } + dismiss(); + } + if (((AppCompatTextView) view).getText().equals("鍙栨秷")) { dismiss(); } } @@ -144,7 +162,6 @@ mWheelViewTitle.joinDatas(countryData); mWheelViewName.setWheelData(countryList); } - private List<OkButtonClickedListener> okButtonClickedListeners = new ArrayList<OkButtonClickedListener>(); -- Gitblit v1.8.0