private void showRoomList(View v) { List<MachineCode> machineCodeList = BoardRoomDB.getMachineCodeList(); if (machineCodeList == null || machineCodeList.size() == 0) { return; } areaMenu = new AreaMenu(this); areaMenu.addItemList(machineCodeList); areaMenu.showAsDropDown(v); areaMenu.setOnItemClickListener(this); }
/** 初始化参数 */ private void initParameter(int position) { mEquipList = new ArrayList<Integer>(); machineCodeList = BoardRoomDB.getMachineCodeList(); if (machineCodeList == null || machineCodeList.size() == 0) { return; } int i = SPdata.readSelectBoardRoomPosition(this); int size = machineCodeList.size(); BoardRoomEntity oneBoardRoom; MachineCode machineCode; if (size < i) { machineCode = machineCodeList.get(position); SPdata.writeSendIp(this, machineCode.getIp()); oneBoardRoom = BoardRoomDB.getOneBoardRoom(machineCode.getTypeId()); } else { machineCode = machineCodeList.get(i); SPdata.writeSendIp(this, machineCode.getIp()); oneBoardRoom = BoardRoomDB.getOneBoardRoom(machineCode.getTypeId()); } if (oneBoardRoom == null) { return; } MyApplication application = (MyApplication) getApplication(); application.setNowRoomId(machineCode.getRoomId()); mTVHeader.setText(machineCode.getBoardRoomName()); mEquipList.add(Constants.EQUIPMENT.CTR_MODE); // List<ModelEntity> model = BoardRoomDB.getModel(oneBoardRoom.getTypeId()); // if (model != null && model.size() != 0) { // // } List<CurtainEntity> curtain = BoardRoomDB.getCurtain(oneBoardRoom.getTypeId()); if (curtain != null && curtain.size() != 0) { mEquipList.add(Constants.EQUIPMENT.CTR_WINDOW); } List<TvEntity> tv = BoardRoomDB.getTv(oneBoardRoom.getTypeId()); if (tv != null && tv.size() != 0) { // mEquipList.add(Constants.EQUIPMENT.CTR_TV); } List<ProjectorEntity> projector = BoardRoomDB.getProjector(oneBoardRoom.getTypeId()); if (projector != null && projector.size() != 0) { mEquipList.add(Constants.EQUIPMENT.CTR_PROJECTION); } List<AirEntity> air = BoardRoomDB.getAir(oneBoardRoom.getTypeId()); if (air != null && air.size() != 0) { mEquipList.add(Constants.EQUIPMENT.CTR_AIR); } mEquipList.add(Constants.EQUIPMENT.CTR_TV); mEquipList.add(Constants.EQUIPMENT.CTR_MUSIC); // mEquipList.add(Constants.EQUIPMENT.CTR_PPT); }