| | |
| | | |
| | | import static android.view.Gravity.CENTER; |
| | | |
| | | import static com.dayu.baselibrary.utils.BaseCommon.Generalv1Library; |
| | | import static com.dayu.baselibrary.utils.BaseCommon.HeNanLibrary; |
| | | import static com.dayu.baselibrary.utils.BaseCommon.QHAloneLibrary; |
| | | import static com.dayu.baselibrary.utils.BaseCommon.QHOnLineLibrary; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.Dialog; |
| | | import android.view.Gravity; |
| | |
| | | getWindow().setGravity(CENTER); |
| | | setContentView(R.layout.library_dialog); |
| | | setCanceledOnTouchOutside(false); |
| | | setCancelable(false); |
| | | RadioGroup radioGroup = findViewById(R.id.radioLibrary); |
| | | libraryDao = BaseDaoSingleton.getInstance(mContext).libraryDao(); |
| | | libraryBean = libraryDao.findFirst(); |
| | | if (libraryBean == null) { |
| | | libraryBean = new LibraryBean(); |
| | | if (libraryDao != null) { |
| | | libraryBean = libraryDao.findFirst(); |
| | | if (libraryBean == null) { |
| | | libraryBean = new LibraryBean(); |
| | | } |
| | | |
| | | radioGroup.setOnCheckedChangeListener((group, checkedId) -> { |
| | | ischose = true; |
| | | // 当选中的RadioButton发生变化时调用 |
| | | if (checkedId == R.id.henanLibrary) { |
| | | type = HeNanLibrary; |
| | | libraryBean.setType(type); |
| | | data = "确认选择河南版本吗?"; |
| | | } else if (checkedId == R.id.qhAloneLibrary) {// 处理选中Option 2的逻辑 |
| | | type = QHAloneLibrary; |
| | | libraryBean.setType(type); |
| | | data = "确认选择齐河单机版本吗?"; |
| | | } else if (checkedId == R.id.qhOnLineLibrary) {// 处理选中Option 2的逻辑 |
| | | type = QHOnLineLibrary; |
| | | libraryBean.setType(type); |
| | | data = "确认选择齐河联网版本吗?"; |
| | | } else if (checkedId == R.id.generav1Library) {// 处理选中Option 2的逻辑 |
| | | type = Generalv1Library; |
| | | libraryBean.setType(type); |
| | | data = "确认选择通用1.0版本吗?"; |
| | | } |
| | | |
| | | }); |
| | | TextView okBtn = findViewById(R.id.ok); |
| | | okBtn.setOnClickListener(v -> { |
| | | if (ischose) { |
| | | //二次确认 |
| | | confirmDialog = new ConfirmDialog(mContext, data, new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | libraryDao.insert(libraryBean); |
| | | mLibraryBack.listener(type); |
| | | LibraryDialog.this.dismiss(); |
| | | confirmDialog.dismiss(); |
| | | |
| | | } |
| | | }); |
| | | confirmDialog.show(); |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | radioGroup.setOnCheckedChangeListener((group, checkedId) -> { |
| | | ischose = true; |
| | | // 当选中的RadioButton发生变化时调用 |
| | | if (checkedId == R.id.henanLibrary) { |
| | | type = 0; |
| | | libraryBean.setType(type); |
| | | data = "确认选择河南版本吗?"; |
| | | } else if (checkedId == R.id.qhAloneLibrary) {// 处理选中Option 2的逻辑 |
| | | type = 1; |
| | | libraryBean.setType(type); |
| | | data = "确认选择齐河单机版本吗?"; |
| | | } |
| | | }); |
| | | TextView okBtn = findViewById(R.id.ok); |
| | | okBtn.setOnClickListener(v -> { |
| | | if (ischose) { |
| | | //二次确认 |
| | | confirmDialog = new ConfirmDialog(mContext, data, new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | libraryDao.insert(libraryBean); |
| | | mLibraryBack.listener(type); |
| | | LibraryDialog.this.dismiss(); |
| | | confirmDialog.dismiss(); |
| | | } |
| | | }); |
| | | confirmDialog.show(); |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |