| | |
| | | package com.basic.security.fragment; |
| | | |
| | | import android.text.TextUtils; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.AdapterView; |
| | | import android.widget.ArrayAdapter; |
| | | import android.widget.BaseAdapter; |
| | | import android.widget.Button; |
| | |
| | | import android.widget.ImageView; |
| | | import android.widget.RelativeLayout; |
| | | import android.widget.Spinner; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.basic.security.R; |
| | | import com.basic.security.base.BaseFragment; |
| | | import com.basic.security.manager.impl.cblite.BaseManager; |
| | | import com.basic.security.manager.impl.cblite.HintDoorAccessManager; |
| | | import com.basic.security.manager.HintDoorAccessManager; |
| | | import com.basic.security.model.ModelAdapter; |
| | | import com.basic.security.utils.KeyboardUtil; |
| | | import com.basic.security.utils.ToastUtil; |
| | | import com.basic.security.model.ModelAdapter; |
| | | |
| | | import org.androidannotations.annotations.AfterViews; |
| | | import org.androidannotations.annotations.Click; |
| | | import org.androidannotations.annotations.EFragment; |
| | | import org.androidannotations.annotations.ViewById; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | ck_refuse_pass_identity, ck_refuse_pass_name; |
| | | |
| | | @ViewById |
| | | EditText et_access_hint, et_not_reached_time_hint, et_not_reached_time_remind, et_confirm_pass_hint, |
| | | EditText et_no_register_message, et_access_hint, et_not_reached_time_hint, et_not_reached_time_remind, et_confirm_pass_hint, |
| | | et_refuse_pass_hint; |
| | | |
| | | @ViewById |
| | |
| | | private int notReachTimeTag = 1; |
| | | private int confirmPassTag = 2; |
| | | private int refusePassTag = 3; |
| | | private List<String> mList = new ArrayList(); // 添加弹出框中要显示的数据 |
| | | private List<String> currentCheckedMessages = new ArrayList(); // 当前选中的提示语集合,一般只有一个 |
| | | private int temple = -1; |
| | | |
| | | @Override |
| | | public void show() { |
| | |
| | | if (hintDoorAccessDocument == null) { |
| | | hintDoorAccessDocument = HintDoorAccessManager.getHintDoorAccessDocument(); |
| | | } |
| | | et_no_register_message.setText(hintDoorAccessDocument.getString("no_register")); |
| | | if (!TextUtils.isEmpty(hintDoorAccessDocument.getString("access_identity")) && |
| | | "1".equals(hintDoorAccessDocument.getString("access_identity"))) { |
| | | ck_access_identity.setChecked(true); |
| | |
| | | if (hintDoorAccessDocument == null) { |
| | | hintDoorAccessDocument = HintDoorAccessManager.getHintDoorAccessDocument(); |
| | | } |
| | | String no_register_message = et_no_register_message.getText().toString().trim(); |
| | | String access_hint = et_access_hint.getText().toString().trim(); |
| | | String not_reached_time_hint = et_not_reached_time_hint.getText().toString().trim(); |
| | | String not_reached_time_remind = et_not_reached_time_remind.getText().toString().trim(); |
| | | String confirm_pass_hint = et_confirm_pass_hint.getText().toString().trim(); |
| | | String refuse_pass_hint = et_refuse_pass_hint.getText().toString().trim(); |
| | | if (TextUtils.isEmpty(no_register_message)) { |
| | | ToastUtil.show("未注册提示信息不能为空"); |
| | | return; |
| | | } |
| | | |
| | | if (TextUtils.isEmpty(access_hint)) { |
| | | ToastUtil.show("允许通行提示语不能为空"); |
| | | return; |
| | |
| | | ToastUtil.show("拒绝通行提示语不能为空"); |
| | | return; |
| | | } |
| | | hintDoorAccessDocument.setString("no_register", no_register_message); |
| | | hintDoorAccessDocument.setString("access_identity", ck_access_identity.isChecked() ? "1" : "0"); |
| | | hintDoorAccessDocument.setString("access_name", ck_access_name.isChecked() ? "1" : "0"); |
| | | hintDoorAccessDocument.setString("access_hint", access_hint); |
| | |
| | | void btn_pass_hint_cancel() { |
| | | |
| | | } |
| | | |
| | | private List<String> mList = new ArrayList(); // 添加弹出框中要显示的数据 |
| | | private List<String> currentCheckedMessages = new ArrayList(); // 当前选中的提示语集合,一般只有一个 |
| | | |
| | | private void showPopupWindow(int tag) { |
| | | mList.clear(); |
| | |
| | | |
| | | } |
| | | |
| | | private int temple = -1; |
| | | @Click |
| | | void btn_check_message_save() { |
| | | temple = -1; |
| | | if (currentCheckedMessages.size() > 1) { |
| | | ToastUtil.show("只能选一个"); |
| | | return; |
| | | } |
| | | rl_check_hint.setVisibility(View.GONE); |
| | | if (currentCheckedMessages.size() == 1) { |
| | | if (intTag == accessPassTag) { |
| | | et_access_hint.setText(currentCheckedMessages.get(0)); |
| | | } else if (intTag == notReachTimeTag) { |
| | | et_not_reached_time_hint.setText(currentCheckedMessages.get(0)); |
| | | } else if (intTag == confirmPassTag) { |
| | | et_confirm_pass_hint.setText(currentCheckedMessages.get(0)); |
| | | } else if (intTag == refusePassTag) { |
| | | et_refuse_pass_hint.setText(currentCheckedMessages.get(0)); |
| | | } |
| | | } |
| | | intTag = -1; |
| | | } |
| | | |
| | | @Click |
| | | void btn_check_message_cancel() { |
| | | temple = -1; |
| | | intTag = -1; |
| | | rl_check_hint.setVisibility(View.GONE); |
| | | } |
| | | |
| | | private class gridViewAdapter extends BaseAdapter { |
| | | |
| | |
| | | //加载子布局 |
| | | convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_identity_list, parent, false); |
| | | viewHolder = new ViewHolder(); |
| | | viewHolder.checkBox = (CheckBox) convertView.findViewById(R.id.item_ck); |
| | | viewHolder.checkBox = convertView.findViewById(R.id.item_ck); |
| | | convertView.setTag(viewHolder); |
| | | |
| | | } else { |
| | |
| | | currentCheckedMessages.clear(); |
| | | currentCheckedMessages.add(mList.get(position)); |
| | | if (temple != -1) { |
| | | CheckBox tempButton = (CheckBox) getActivity().findViewById(temple); |
| | | CheckBox tempButton = getActivity().findViewById(temple); |
| | | if (tempButton != null) { |
| | | tempButton.setChecked(false); |
| | | } |
| | |
| | | private CheckBox checkBox; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Click |
| | | void btn_check_message_save() { |
| | | temple = -1; |
| | | if (currentCheckedMessages.size() > 1) { |
| | | ToastUtil.show("只能选一个"); |
| | | return; |
| | | } |
| | | rl_check_hint.setVisibility(View.GONE); |
| | | if (currentCheckedMessages.size() == 1) { |
| | | if (intTag == accessPassTag) { |
| | | et_access_hint.setText(currentCheckedMessages.get(0)); |
| | | } else if (intTag == notReachTimeTag) { |
| | | et_not_reached_time_hint.setText(currentCheckedMessages.get(0)); |
| | | } else if (intTag == confirmPassTag) { |
| | | et_confirm_pass_hint.setText(currentCheckedMessages.get(0)); |
| | | } else if (intTag == refusePassTag) { |
| | | et_refuse_pass_hint.setText(currentCheckedMessages.get(0)); |
| | | } |
| | | } |
| | | intTag = -1; |
| | | } |
| | | |
| | | |
| | | @Click |
| | | void btn_check_message_cancel() { |
| | | temple = -1; |
| | | intTag = -1; |
| | | rl_check_hint.setVisibility(View.GONE); |
| | | } |
| | | |
| | | } |