| | |
| | | import cn.com.basic.face.adapter.MyWheelAdapter;
|
| | |
|
| | | import cn.com.basic.face.util.OkButtonClickedListener;
|
| | | import cn.com.basic.face.util.CountryPresenter;
|
| | |
|
| | | import com.wx.wheelview.widget.WheelView;
|
| | |
|
| | |
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * Created by Sinoe on 2017/2/28.
|
| | | */
|
| | |
|
| | | public class CountrySelectionDialog extends PopupWindow implements View.OnClickListener, WheelView.OnWheelItemSelectedListener {
|
| | |
|
| | | private Context mContext;
|
| | | private View view;
|
| | | private TextView mTvConfirm, mTvCancel;
|
| | |
| | | private HashMap<String, List<String>> countryData;
|
| | | private List<String> countryWordList;
|
| | | private List<String> countryList;
|
| | | private CountryPresenter countryPresenter;
|
| | |
|
| | | public CountrySelectionDialog(Context context, String[] countryWordData, List<String> countryWordList, HashMap<String, List<String>> countryData) {
|
| | |
|
| | | this.mContext = context;
|
| | | countryPresenter = new CountryPresenter(context);
|
| | | view = LayoutInflater.from(context).inflate(R.layout.dialog_country, null);
|
| | | mWheelViewTitle = (WheelView) view.findViewById(R.id.pop_country_title);
|
| | | mWheelViewTitle.setOnWheelItemSelectedListener(this);
|
| | |
| | | mTvConfirm = (TextView) view.findViewById(R.id.pop_country_confirm);
|
| | | mTvCancel.setOnClickListener(this);
|
| | | mTvConfirm.setOnClickListener(this);
|
| | |
|
| | | //String[] countryWordData = DictionaryMng.countryWordData;
|
| | | this.countryWordList = countryWordList;//DictionaryMng.countryWordList;
|
| | | this.countryData = countryData;//DictionaryMng.countryData;
|
| | |
|
| | | this.countryWordList = countryWordList;
|
| | | this.countryData = countryData;
|
| | | countryList = countryData.get(countryWordList.get(mWheelViewTitle.getSelection()));
|
| | |
|
| | | mWheelViewTitle.setWheelAdapter(new MyWheelAdapter(context));
|
| | | mWheelViewTitle.setSkin(WheelView.Skin.Holo);
|
| | | mWheelViewTitle.setWheelSize(5);
|
| | |
| | | mWheelViewTitle.setStyle(style);
|
| | | mWheelViewName.setStyle(style);
|
| | | initData();
|
| | | //外部可点击
|
| | | setOutsideTouchable(true);
|
| | |
|
| | | view.setOnTouchListener(new View.OnTouchListener() {
|
| | | @Override
|
| | | public boolean onTouch(View view, MotionEvent motionEvent) {
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | /*
|
| | | 设置窗口特征
|
| | | */
|
| | | //设置视图
|
| | | this.setContentView(this.view);
|
| | | //设置窗口宽高
|
| | | this.setHeight(RelativeLayout.LayoutParams.MATCH_PARENT);
|
| | | this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT);
|
| | | //设置弹出窗口可点击
|
| | | this.setFocusable(true);
|
| | | //实例化Color
|
| | | ColorDrawable colorDrawable = new ColorDrawable(0x7f000000);
|
| | | this.setBackgroundDrawable(colorDrawable);
|
| | | this.setAnimationStyle(R.style.PopupAnimation);
|