v2.0.13 버전
개방시간 다건 설정, 주말 및 휴무일 연동 기능 추가
This commit is contained in:
parent
566395037b
commit
694bb5718b
@ -18,6 +18,7 @@ import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@ -38,6 +39,8 @@ import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_FINGER_FACE;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_FINGER_PRINT;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN_FACE;
|
||||
import static kr.co.enicom.acs.GlobalInfo.mHolidayList;
|
||||
import static kr.co.enicom.acs.GlobalInfo.queryHolidayByDate;
|
||||
|
||||
import org.opencv.android.Utils;
|
||||
import org.opencv.core.CvType;
|
||||
@ -240,6 +243,8 @@ public class BaseService extends Service {
|
||||
@Override
|
||||
public void run() {
|
||||
mIsAlive = true;
|
||||
LocalDate prevDate = LocalDate.now();
|
||||
LocalDate todayDate = LocalDate.now();
|
||||
|
||||
if (GlobalInfo.mUseDoorControlTime == 1) {
|
||||
try {
|
||||
@ -262,6 +267,12 @@ public class BaseService extends Service {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
prevDate = todayDate;
|
||||
todayDate = LocalDate.now();
|
||||
if(prevDate.getDayOfMonth() != todayDate.getDayOfMonth()) { // 날짜 변경 됨
|
||||
GlobalInfo.updateHolidayList();
|
||||
}
|
||||
|
||||
mAliveCount++;
|
||||
mAliveCount %= 1000;
|
||||
SystemUtil.property_set("sys.acs.alive.check", "" + mAliveCount);
|
||||
@ -353,6 +364,9 @@ public class BaseService extends Service {
|
||||
if(testParam2.length() > 0)
|
||||
msg.doorControlEndTime = testParam2;
|
||||
mServerManager.handleMessage(msg);
|
||||
} else if(testDebug.equals("3")) {
|
||||
SystemUtil.property_set("sys.rito.test", "");
|
||||
GlobalInfo.updateHolidayList();
|
||||
}
|
||||
|
||||
//if(MainActivity.INSTANCE != null) {
|
||||
|
||||
@ -116,6 +116,7 @@ public class GlobalInfo {
|
||||
public static final int TARGET_FLAG_SERVER_INFO = 1;
|
||||
public static final int TARGET_FLAG_DEVICE_INFO = 2;
|
||||
|
||||
|
||||
public static int DOOR_NOT_USE_ACCESS_CONTROL = 0;
|
||||
public static int DOOR_USE_ACCESS_CONTROL = 1;
|
||||
|
||||
@ -268,17 +269,101 @@ public class GlobalInfo {
|
||||
public static int mAttendanceEndTime = DEFAULT_ATTENDANCE_END_TIME;
|
||||
public static int mAttendanceAutoTimeMinute = DEFAULT_ATTENDANCE_AUTO_TIME; // 근태 관리 자동전환 시간. 출근시간전~출근시간, 퇴근시간~퇴근시간후 적용.
|
||||
|
||||
public static class DoorControlTime {
|
||||
// public String startTimeText;
|
||||
// public String endTimeText;
|
||||
public int startTime;
|
||||
public int endTime;
|
||||
}
|
||||
|
||||
public static int mUseDoorControlTime = 1; // 개방시간 사용 여부
|
||||
public static int mDoorControlTimeStatus = -1; // 개방시간 문 상태 보존. -1 : 미제어, 0 : 닫음, 1 : 열림
|
||||
public static long mDoorControlSentLastTime = 0; // 개방시간 문 오픈 명령 보낸 최종 시간
|
||||
public static int mDoorControlTimeStart = 7 * 60 + 41; // 개방시간 시작 시간(Minute) Default = 09:00
|
||||
public static int mDoorControlTimeEnd = 7 * 60 + 41; //18 * 60; // 개방시간 종료 시간(Minute) Default = 18:00
|
||||
public static int mDoorControlTimeStart = 9 * 60; // 개방시간 시작 시간(Minute) Default = 09:00
|
||||
public static int mDoorControlTimeEnd = 18 * 60; //18 * 60; // 개방시간 종료 시간(Minute) Default = 18:00
|
||||
public static int mUseDoorControlTimeHoliday = 0; // 개방시간 주말 및 휴무일 사용 여부
|
||||
public static String mDoorControlTimeData = DEFAULT_DOOR_CONTROL_TIME_DATA;
|
||||
public static ArrayList<HolidayInfo> mHolidayList = null;
|
||||
|
||||
public static ArrayList<UserInfo> mUserList;
|
||||
private static Object mLock = new Object();
|
||||
public static DoorControlTime[] mDoorControlTimeList = null;
|
||||
|
||||
public static void updateHolidayList() {
|
||||
LocalDate today = LocalDate.now();
|
||||
mHolidayList = queryHolidayByDate(today.getYear(), today.getMonthValue());
|
||||
}
|
||||
public static boolean checkIsHoliday() {
|
||||
if(mHolidayList == null) {
|
||||
updateHolidayList();
|
||||
}
|
||||
|
||||
ArrayList<HolidayInfo> infoList = mHolidayList;
|
||||
if(infoList == null || infoList.size() == 0)
|
||||
return false;
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
String dayStr = "" + today.getDayOfMonth();
|
||||
for(int i = 0;i < infoList.size();i++) {
|
||||
HolidayInfo info = infoList.get(i);
|
||||
if(info.mYear == today.getYear() && info.mMonth == today.getMonthValue()) {
|
||||
String daysText = info.mDays;
|
||||
String[] daysList = daysText.split(",");
|
||||
for(String day : daysList) {
|
||||
if(dayStr.equals(day)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static DoorControlTime[] getDoorControlTimeList(String timeData) {
|
||||
String[] timeList = timeData.split(",");
|
||||
int timeCount = timeList.length;
|
||||
|
||||
DoorControlTime[] timeArray = new DoorControlTime[timeCount];
|
||||
for(int i = 0;i < timeCount;i++) {
|
||||
String[] timeInfo = timeList[i].split("~");
|
||||
timeArray[i] = new DoorControlTime();
|
||||
// timeArray[i].startTimeText = timeInfo[0];
|
||||
// timeArray[i].endTimeText = timeInfo[1];
|
||||
timeArray[i].startTime = GlobalInfo.convertSimpleTimeToMinutes(GlobalInfo.convertTimeToSimple(timeInfo[0]));
|
||||
timeArray[i].endTime = GlobalInfo.convertSimpleTimeToMinutes(GlobalInfo.convertTimeToSimple(timeInfo[1]));
|
||||
}
|
||||
|
||||
return timeArray;
|
||||
}
|
||||
|
||||
public static void setDoorControlTimeFromList(DoorControlTime[] timeList) {
|
||||
String newTime = "";
|
||||
for(int i = 0;i < timeList.length;i++) {
|
||||
String startTime = GlobalInfo.convertTimeToLonger(GlobalInfo.convertMinutesToSimpleTime(timeList[i].startTime));
|
||||
String endTime = GlobalInfo.convertTimeToLonger(GlobalInfo.convertMinutesToSimpleTime(timeList[i].endTime));
|
||||
if(i > 0) {
|
||||
newTime += ",";
|
||||
}
|
||||
newTime += (startTime + "~" + endTime);
|
||||
}
|
||||
GlobalInfo.mDoorControlTimeData = newTime;
|
||||
|
||||
updateDoorControlTimeList();
|
||||
}
|
||||
|
||||
public static DoorControlTime[] getDoorControlTimeList() {
|
||||
if(!mDoorControlTimeData.contains("~")) {
|
||||
mDoorControlTimeData = DEFAULT_DOOR_CONTROL_TIME_DATA;
|
||||
}
|
||||
return getDoorControlTimeList(mDoorControlTimeData);
|
||||
}
|
||||
|
||||
public static void updateDoorControlTimeList() {
|
||||
DoorControlTime[] timeList = getDoorControlTimeList();
|
||||
synchronized (mLock) {
|
||||
mDoorControlTimeList = timeList;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getCurrentMinutesInDay() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@ -711,6 +796,14 @@ public class GlobalInfo {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sql = "create table holidayinfo(year integer, month integer, days text)";
|
||||
try {
|
||||
database.execSQL(sql);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
/*sql = "create table logging(idx integer PRIMARY KEY AUTOINCREMENT, log_time text, log_id text, log_name text, verify_method integer)";
|
||||
try {
|
||||
database.execSQL(sql);
|
||||
@ -720,6 +813,68 @@ public class GlobalInfo {
|
||||
//database.close();
|
||||
}
|
||||
|
||||
|
||||
public static boolean insertHolidayInfo(HolidayInfo info) {
|
||||
boolean succeed = true;
|
||||
SQLiteDatabase _database= getDatabase();
|
||||
if(_database == null)
|
||||
return false;
|
||||
|
||||
try {
|
||||
String sql = String.format("delete from holidayinfo where year = %d and month = %d", info.mYear, info.mMonth);
|
||||
_database.execSQL(sql);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(info.mDays.length() > 0) {
|
||||
try {
|
||||
String sql = String.format("insert into holidayinfo (year, month, days) values (%d, %d, '%s')",
|
||||
info.mYear, info.mMonth, info.mDays);
|
||||
_database.execSQL(sql);
|
||||
} catch (Exception e) {
|
||||
succeed = false;
|
||||
}
|
||||
}
|
||||
|
||||
_database.close();
|
||||
return succeed;
|
||||
}
|
||||
|
||||
public static ArrayList<HolidayInfo> queryHolidayByDate(int year, int month) {
|
||||
SQLiteDatabase _database= getDatabase();
|
||||
if(_database == null)
|
||||
return null;
|
||||
|
||||
ArrayList<HolidayInfo> dayList = new ArrayList<HolidayInfo>();
|
||||
String sql = String.format("select year, month, days from holidayinfo where year > %d or (year = %d and month >= %d) order by year, month", year, year, month);
|
||||
|
||||
Log.w(TAG, "Holiday Query : " + sql);
|
||||
try {
|
||||
Cursor cursor = _database.rawQuery(sql, null);
|
||||
if(cursor != null) {
|
||||
int count = cursor.getCount();
|
||||
Log.d(TAG, "Holiday Count : " + count);
|
||||
|
||||
for(int i = 0; i< count ; i++){
|
||||
cursor.moveToNext();
|
||||
HolidayInfo _info = new HolidayInfo();
|
||||
_info.mYear = cursor.getInt(0);
|
||||
_info.mMonth = cursor.getInt(1);
|
||||
_info.mDays = cursor.getString(2);
|
||||
dayList.add(_info);
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
_database.close();
|
||||
return dayList;
|
||||
}
|
||||
|
||||
public static boolean insertLogTempInfo(LogInfo info) {
|
||||
boolean succeed = true;
|
||||
SQLiteDatabase _database= getLogTempDatabase();
|
||||
@ -2517,18 +2672,47 @@ public class GlobalInfo {
|
||||
}
|
||||
}
|
||||
|
||||
public static DoorControlTime getMatchDoorControlOpenTime(int currentMinutes) {
|
||||
DoorControlTime[] timeList;
|
||||
synchronized (mLock) {
|
||||
timeList = mDoorControlTimeList;
|
||||
}
|
||||
|
||||
for(DoorControlTime info : timeList) {
|
||||
if(currentMinutes >= info.startTime && currentMinutes < info.endTime)
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean checkIsDoorControlOpenTime() {
|
||||
if(mUseDoorControlTime == 0)
|
||||
return false;
|
||||
|
||||
if(mUseDoorControlTimeHoliday == 0) {
|
||||
if(SystemUtil.DateTimeUtil.isHoliday())
|
||||
if(SystemUtil.DateTimeUtil.isWeekend())
|
||||
return false;
|
||||
|
||||
if(checkIsHoliday())
|
||||
return false;
|
||||
}
|
||||
|
||||
int currentMinutes = getCurrentMinutesInDay();
|
||||
if(currentMinutes >= mDoorControlTimeStart && currentMinutes < mDoorControlTimeEnd)
|
||||
return true;
|
||||
DoorControlTime[] timeList;
|
||||
synchronized (mLock) {
|
||||
timeList = mDoorControlTimeList;
|
||||
}
|
||||
if(timeList == null || timeList.length == 0)
|
||||
return false;
|
||||
|
||||
for(DoorControlTime info : timeList) {
|
||||
if(currentMinutes >= info.startTime && currentMinutes < info.endTime)
|
||||
return true;
|
||||
}
|
||||
|
||||
// if(currentMinutes >= mDoorControlTimeStart && currentMinutes < mDoorControlTimeEnd)
|
||||
// return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
16
app/src/main/java/kr/co/enicom/acs/HolidayInfo.java
Normal file
16
app/src/main/java/kr/co/enicom/acs/HolidayInfo.java
Normal file
@ -0,0 +1,16 @@
|
||||
package kr.co.enicom.acs;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class HolidayInfo {
|
||||
public int mYear;
|
||||
public int mMonth;
|
||||
public String mDays;
|
||||
|
||||
public HolidayInfo() {
|
||||
mYear = -1;
|
||||
mMonth = -1;
|
||||
mDays = "";
|
||||
}
|
||||
|
||||
}
|
||||
@ -79,6 +79,13 @@ public class MWMessage {
|
||||
public String attendanceAutoTime;
|
||||
|
||||
public String useDoorControlTime;
|
||||
public String useDoorControlTimeHoliday;
|
||||
public String doorControlTimeListCount;
|
||||
public String[] doorControlTimeList;
|
||||
public String doorControlStartTime;
|
||||
public String doorControlEndTime;
|
||||
|
||||
public String yearOfHoliday;
|
||||
public String monthOfHoliday;
|
||||
public String daysOfHoliday;
|
||||
}
|
||||
|
||||
@ -61,6 +61,7 @@ import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_RFID;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN_COMB_RFID;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN_FACE;
|
||||
import static kr.co.enicom.acs.GlobalInfo.getCurrentMinutesInDay;
|
||||
import static kr.co.enicom.acs.GlobalInfo.mVerifyCombination;
|
||||
import static kr.co.enicom.acs.GlobalInfo.mVerifyMethod;
|
||||
|
||||
@ -1109,6 +1110,7 @@ public class MainActivity extends AppCompatActivity implements RfidManager.resul
|
||||
|
||||
GlobalInfo.initInfo();
|
||||
GlobalInfo.reloadUserListWithProgress(this);
|
||||
GlobalInfo.updateDoorControlTimeList();
|
||||
|
||||
//test
|
||||
//GlobalInfo.mVerifyMethod = GlobalInfo.VERIFY_METHOD_FINGER_FACE;
|
||||
@ -2189,7 +2191,7 @@ public class MainActivity extends AppCompatActivity implements RfidManager.resul
|
||||
mMainUiHandler.sendEmptyMessage(MAIN_SELECT_VEIN_FACE);
|
||||
else if(mVerifyMethod == GlobalInfo.VERIFY_METHOD_FINGER_FACE)
|
||||
mMainUiHandler.sendEmptyMessage(MAIN_SELECT_FINGER_FACE);
|
||||
else if(GlobalInfo.isVerifyMethod(VERIFY_METHOD_RFID)){
|
||||
else if(GlobalInfo.isVerifyMethod(VERIFY_METHOD_RFID)) {
|
||||
if(mVerifyMethod == VERIFY_METHOD_VEIN_COMB_RFID && mVerifyCombination == VERIFY_COMBINATION_OR)
|
||||
mMainUiHandler.sendEmptyMessage(MAIN_SELECT_VEIN);
|
||||
else if(mVerifyMethod == VERIFY_METHOD_FINGER_COMB_RFID && mVerifyCombination == VERIFY_COMBINATION_OR)
|
||||
@ -2287,8 +2289,13 @@ public class MainActivity extends AppCompatActivity implements RfidManager.resul
|
||||
}
|
||||
|
||||
TextView tv = findViewById(R.id.doorcontroltimetext);
|
||||
tv.setText(String.format("%d:%02d~%d:%02d", GlobalInfo.mDoorControlTimeStart / 60, GlobalInfo.mDoorControlTimeStart % 60
|
||||
, GlobalInfo.mDoorControlTimeEnd / 60, GlobalInfo.mDoorControlTimeEnd % 60));
|
||||
// tv.setText(String.format("%d:%02d~%d:%02d", GlobalInfo.mDoorControlTimeStart / 60, GlobalInfo.mDoorControlTimeStart % 60
|
||||
// , GlobalInfo.mDoorControlTimeEnd / 60, GlobalInfo.mDoorControlTimeEnd % 60));
|
||||
GlobalInfo.DoorControlTime timeInfo = GlobalInfo.getMatchDoorControlOpenTime(getCurrentMinutesInDay());
|
||||
if(timeInfo != null) {
|
||||
tv.setText(String.format("%02d:%02d~%02d:%02d", timeInfo.startTime / 60, timeInfo.startTime % 60
|
||||
, timeInfo.endTime / 60, timeInfo.endTime % 60));
|
||||
}
|
||||
findViewById(R.id.doorcontrolframe).setVisibility(View.VISIBLE);
|
||||
|
||||
return;
|
||||
@ -2311,7 +2318,8 @@ public class MainActivity extends AppCompatActivity implements RfidManager.resul
|
||||
LayoutSetting(mLoginText[COLOR_WHITE], COLOR_WHITE, 50, 498, 337, 65, R.string.main_text1, View.VISIBLE);
|
||||
LayoutSetting(mLoginText[COLOR_YELLOW], COLOR_YELLOW, 387, 498, 660, 65, R.string.main_text2, View.VISIBLE);
|
||||
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
LayoutSetting(mLoginImage[VEIN], VEIN, image2PosX, 40, imageWidth, imageHeight, R.drawable.main_img2, View.INVISIBLE);
|
||||
LayoutSetting(mLoginImage[FINGER], FINGER, image2PosX, 40, imageWidth, imageHeight, R.drawable.main_fingerprint, View.VISIBLE);
|
||||
|
||||
@ -13,7 +13,9 @@ import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN_COMB_RFID;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN_FACE;
|
||||
import static kr.co.enicom.acs.GlobalInfo.VERIFY_METHOD_VEIN_FACE_COMB_RFID;
|
||||
import static kr.co.enicom.acs.GlobalInfo.mHolidayList;
|
||||
import static kr.co.enicom.acs.GlobalInfo.mVerifyCombination;
|
||||
import static kr.co.enicom.acs.GlobalInfo.queryHolidayByDate;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Environment;
|
||||
@ -44,6 +46,7 @@ import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import inter.cmn.security.egovaria.ARIACipher;
|
||||
@ -470,6 +473,10 @@ public class ServerManager extends Thread {
|
||||
public final static int DATETIME_LENGTH = 14;
|
||||
public final static int DATE_LENGTH = 8;
|
||||
public final static int TIME_LENGTH = 4;
|
||||
public final static int YEAR_LENGTH = 4;
|
||||
public final static int MONTH_LENGTH = 2;
|
||||
public final static int HOLIDAY_DAYS_LENGTH = 100;
|
||||
public final static int TIME_LENGTH_RANGE = 8;
|
||||
public final static int USER_ID_LENGTH = 20;
|
||||
public final static int USER_NAME_LENGTH = 20;
|
||||
public final static int OPRNO_LENGTH = 20;
|
||||
@ -559,6 +566,11 @@ public class ServerManager extends Thread {
|
||||
public final static byte COMMAND_TYPE_ATTENDANCE_LOG_GET = 0x44; // 41. 근태 이력 로그 요청
|
||||
public final static byte COMMAND_TYPE_DELETE_ATTENDANCE_LOG_ALL = 0x45;
|
||||
|
||||
public final static byte COMMAND_TYPE_DOOR_CONTROL_TIME_SET_V2 = 0x46; // 43. 개방시간 저장(2) - 다중저장
|
||||
public final static byte COMMAND_TYPE_DOOR_CONTROL_TIME_GET_V2 = 0x47;
|
||||
public final static byte COMMAND_TYPE_HOLYDAY_SET = 0x48; // 45. 공휴일 저장
|
||||
public final static byte COMMAND_TYPE_HOLYDAY_GET = 0x49;
|
||||
|
||||
boolean callback_progress = true;
|
||||
LogInfo result_handler = new LogInfo();
|
||||
ServerNotify NOTIFY_HANDLER = new ServerNotify() {
|
||||
@ -2400,6 +2412,132 @@ public class ServerManager extends Thread {
|
||||
|
||||
sendPushMessage(message);
|
||||
}
|
||||
} else if(commandMsg[1] == COMMAND_TYPE_DOOR_CONTROL_TIME_SET_V2) { // 43. 개방시간 설정 2
|
||||
if(statusMsgStr.equals(PKT_STATUS_OKAY)) {
|
||||
int parseLen = 1;
|
||||
byte[] parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
msg.useDoorControlTime = new String(parseMsg).trim();
|
||||
Log.i(TAG, "parseMessage. useDoorControlTime : " + msg.useDoorControlTime);
|
||||
|
||||
parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
msg.useDoorControlTimeHoliday = new String(parseMsg).trim();
|
||||
Log.i(TAG, "parseMessage. useDoorControlTimeHoliday : " + msg.useDoorControlTimeHoliday);
|
||||
|
||||
parseLen = TOTAL_COUNT_LENGTH;
|
||||
parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
int totalCount = SystemUtil.fromByteArrayToInt(parseMsg);
|
||||
msg.doorControlTimeListCount = "" + totalCount;
|
||||
|
||||
if(totalCount > 0) {
|
||||
msg.doorControlTimeList = new String[totalCount];
|
||||
for (int i = 0; i < totalCount; i++) {
|
||||
parseLen = TIME_LENGTH_RANGE;
|
||||
parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
try {
|
||||
msg.doorControlTimeList[i] = new String(parseMsg).trim();
|
||||
Log.i(TAG, "parseMessage. doorControlTime : " + msg.doorControlTimeList[i]);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String replyStatus = PKT_STATUS_FAIL;
|
||||
boolean result = handleMessage(msg);
|
||||
if(result)
|
||||
replyStatus = PKT_STATUS_OKAY;
|
||||
|
||||
message = createClientMessage(COMMAND_TYPE_DOOR_CONTROL_TIME_SET_V2, getMsgDeviceId(), replyStatus, null);
|
||||
sendPushMessage(message);
|
||||
}
|
||||
} else if(commandMsg[1] == COMMAND_TYPE_DOOR_CONTROL_TIME_GET_V2) { // 개방시간 정보 조회 2
|
||||
String replyStatus = PKT_STATUS_OKAY;
|
||||
if(statusMsgStr.equals(PKT_STATUS_OKAY)) {
|
||||
GlobalInfo.DoorControlTime[] timeList = GlobalInfo.getDoorControlTimeList();
|
||||
int totalCount = timeList.length;
|
||||
byte[][] dataArray = new byte[3 + totalCount][];
|
||||
dataArray[0] = getPaddingString(GlobalInfo.mUseDoorControlTime == 1 ? "Y" : "N", 1).getBytes();
|
||||
dataArray[1] = getPaddingString(GlobalInfo.mUseDoorControlTimeHoliday == 1 ? "Y" : "N", 1).getBytes();
|
||||
dataArray[2] = intTobyte(totalCount, ByteOrder.LITTLE_ENDIAN);
|
||||
for(int i = 0;i < totalCount;i++) {
|
||||
String timeRange = getPaddingString(GlobalInfo.convertMinutesToSimpleTime(timeList[i].startTime), TIME_LENGTH);
|
||||
timeRange += getPaddingString(GlobalInfo.convertMinutesToSimpleTime(timeList[i].endTime), TIME_LENGTH);
|
||||
dataArray[3 + i] = timeRange.getBytes();
|
||||
}
|
||||
|
||||
message = createClientMessageByte(commandMsg[1], getMsgDeviceId(), replyStatus, dataArray);
|
||||
sendPushMessage(message);
|
||||
} else {
|
||||
replyStatus = PKT_STATUS_FAIL;
|
||||
message = createClientMessage(commandMsg[1], getMsgDeviceId(), replyStatus, null);
|
||||
}
|
||||
|
||||
sendPushMessage(message);
|
||||
} else if(commandMsg[1] == COMMAND_TYPE_HOLYDAY_SET) { // 45. 공휴일 설정
|
||||
if(statusMsgStr.equals(PKT_STATUS_OKAY)) {
|
||||
int parseLen = YEAR_LENGTH;
|
||||
byte[] parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
msg.yearOfHoliday = new String(parseMsg).trim();
|
||||
Log.i(TAG, "parseMessage. yearOfHoliday : " + msg.yearOfHoliday);
|
||||
|
||||
parseLen = MONTH_LENGTH;
|
||||
parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
msg.monthOfHoliday = new String(parseMsg).trim();
|
||||
Log.i(TAG, "parseMessage. monthOfHoliday : " + msg.monthOfHoliday);
|
||||
|
||||
parseLen = HOLIDAY_DAYS_LENGTH;
|
||||
parseMsg = new byte[parseLen];
|
||||
System.arraycopy(message, idx, parseMsg, 0, parseLen);
|
||||
idx += parseLen;
|
||||
msg.daysOfHoliday = new String(parseMsg).trim();
|
||||
|
||||
String replyStatus = PKT_STATUS_FAIL;
|
||||
boolean result = handleMessage(msg);
|
||||
if(result)
|
||||
replyStatus = PKT_STATUS_OKAY;
|
||||
|
||||
message = createClientMessage(COMMAND_TYPE_HOLYDAY_SET, getMsgDeviceId(), replyStatus, null);
|
||||
sendPushMessage(message);
|
||||
}
|
||||
} else if(commandMsg[1] == COMMAND_TYPE_HOLYDAY_GET) { // 46. 공휴일 조회
|
||||
String replyStatus = PKT_STATUS_OKAY;
|
||||
if(statusMsgStr.equals(PKT_STATUS_OKAY)) {
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);
|
||||
int month = Calendar.getInstance().get(Calendar.MONTH);
|
||||
ArrayList<HolidayInfo> dayList = GlobalInfo.queryHolidayByDate(year, month);
|
||||
if(dayList == null) {
|
||||
dayList = new ArrayList<HolidayInfo>();
|
||||
}
|
||||
int totalCount = dayList.size();
|
||||
byte[][] dataArray = new byte[1 + totalCount * 3][];
|
||||
dataArray[0] = intTobyte(totalCount, ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
for(int i = 0;i < totalCount;i++) {
|
||||
HolidayInfo info = dayList.get(i);
|
||||
dataArray[1 + i * 3] = getPaddingString(String.format("%04d", info.mYear), YEAR_LENGTH).getBytes();
|
||||
dataArray[1 + i * 3 + 1] = getPaddingString(String.format("%02d", info.mMonth), MONTH_LENGTH).getBytes();
|
||||
dataArray[1 + i * 3 + 2] = getPaddingString(info.mDays, HOLIDAY_DAYS_LENGTH).getBytes();
|
||||
}
|
||||
|
||||
message = createClientMessageByte(commandMsg[1], getMsgDeviceId(), replyStatus, dataArray);
|
||||
sendPushMessage(message);
|
||||
} else {
|
||||
replyStatus = PKT_STATUS_FAIL;
|
||||
message = createClientMessage(commandMsg[1], getMsgDeviceId(), replyStatus, null);
|
||||
}
|
||||
|
||||
sendPushMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2998,6 +3136,8 @@ public class ServerManager extends Thread {
|
||||
// GlobalInfo.mUseDoorControlTime = msg.useDoorControlTime.equals("Y") ? 1 : 0;
|
||||
GlobalInfo.mDoorControlTimeStart = GlobalInfo.convertSimpleTimeToMinutes(msg.doorControlStartTime);
|
||||
GlobalInfo.mDoorControlTimeEnd = GlobalInfo.convertSimpleTimeToMinutes(msg.doorControlEndTime);
|
||||
GlobalInfo.mDoorControlTimeData = GlobalInfo.convertTimeToLonger(msg.doorControlStartTime) + "~" + GlobalInfo.convertTimeToLonger(msg.doorControlEndTime);
|
||||
GlobalInfo.updateDoorControlTimeList();
|
||||
GlobalInfo.mUseDoorControlTime = nextUse;
|
||||
if(isNeedInvalidate) {
|
||||
if (nextUse == 1) {
|
||||
@ -3010,6 +3150,60 @@ public class ServerManager extends Thread {
|
||||
} catch(Exception e) {
|
||||
ret = false;
|
||||
}
|
||||
} else if(msg.command == COMMAND_TYPE_DOOR_CONTROL_TIME_SET_V2) { // 43. 개방시간 설정 2
|
||||
try {
|
||||
int nextUse = msg.useDoorControlTime.equals("Y") ? 1 : 0;
|
||||
int nextUseHoliday = msg.useDoorControlTimeHoliday.equals("Y") ? 1 : 0;
|
||||
boolean isNeedInvalidate = false;
|
||||
if(nextUse != GlobalInfo.mUseDoorControlTime) {
|
||||
isNeedInvalidate = true;
|
||||
}
|
||||
if(nextUseHoliday != GlobalInfo.mUseDoorControlTimeHoliday) {
|
||||
isNeedInvalidate = true;
|
||||
}
|
||||
|
||||
int totalCount = Integer.parseInt(msg.doorControlTimeListCount);
|
||||
String newTime = "";
|
||||
for(int i = 0;i < totalCount;i++) {
|
||||
String startTime = msg.doorControlTimeList[i].substring(0, 4);
|
||||
String endTime = msg.doorControlTimeList[i].substring(4);
|
||||
if(i > 0) {
|
||||
newTime += ",";
|
||||
}
|
||||
newTime += (GlobalInfo.convertTimeToLonger(startTime) + "~" + GlobalInfo.convertTimeToLonger(endTime));
|
||||
}
|
||||
GlobalInfo.mDoorControlTimeData = newTime;
|
||||
GlobalInfo.updateDoorControlTimeList();
|
||||
GlobalInfo.mUseDoorControlTimeHoliday = nextUseHoliday;
|
||||
GlobalInfo.mUseDoorControlTime = nextUse;
|
||||
if(isNeedInvalidate) {
|
||||
if (nextUse == 1) {
|
||||
GlobalInfo.mDoorControlTimeStatus = -1;
|
||||
} else {
|
||||
GlobalInfo.mDoorControlTimeStatus = 0;
|
||||
}
|
||||
}
|
||||
GlobalInfo.updateDatabase(GlobalInfo.TARGET_FLAG_DEVICE_INFO);
|
||||
} catch(Exception e) {
|
||||
ret = false;
|
||||
}
|
||||
} else if(msg.command == COMMAND_TYPE_HOLYDAY_SET) { // 45. 공휴일 설정
|
||||
try {
|
||||
HolidayInfo info = new HolidayInfo();
|
||||
|
||||
info.mYear = Integer.parseInt(msg.yearOfHoliday);
|
||||
info.mMonth = Integer.parseInt(msg.monthOfHoliday);
|
||||
info.mDays = msg.daysOfHoliday;
|
||||
|
||||
GlobalInfo.insertHolidayInfo(info);
|
||||
GlobalInfo.updateHolidayList();
|
||||
|
||||
if(GlobalInfo.mUseDoorControlTime == 1 && GlobalInfo.mUseDoorControlTimeHoliday == 1) {
|
||||
GlobalInfo.mDoorControlTimeStatus = -1;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,11 @@ import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@ -13,8 +17,11 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.NumberPicker;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -38,6 +45,125 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
private final int DEVICE_ID_POPUP = 0;
|
||||
private final int DEVICE_NAME_POPUP = 1;
|
||||
|
||||
private int modifyIdx = 0;
|
||||
protected void refreshDoorControlTimeList() {
|
||||
String[] timeList = GlobalInfo.mDoorControlTimeData.split(",");
|
||||
LinearLayout parentLayout = findViewById(R.id.frameLayout2);
|
||||
int viewCount = parentLayout.getChildCount();
|
||||
if(viewCount > 3) {
|
||||
parentLayout.removeViews(2, viewCount - 3);
|
||||
}
|
||||
|
||||
int offset = -60;
|
||||
if(timeList.length < 2) {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
for(int i = timeList.length - 1;i >= 0;i--) {
|
||||
FrameLayout newLayout = new FrameLayout(DoorControlTimeActivity.this);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,94);
|
||||
newLayout.setLayoutParams(params);
|
||||
newLayout.setBackgroundResource(R.drawable.layout_border);
|
||||
|
||||
TextView newText = new TextView(DoorControlTimeActivity.this);
|
||||
LinearLayout.LayoutParams textparams =
|
||||
new LinearLayout.LayoutParams(400, 150);
|
||||
textparams.setMargins(40, 23, 0, 0);
|
||||
newText.setLayoutParams(textparams);
|
||||
newText.setTypeface(ResourcesCompat.getFont(DoorControlTimeActivity.this, R.font.nanumbarungothic));
|
||||
if(timeList.length == 1) {
|
||||
newText.setText("설정시간");
|
||||
} else {
|
||||
newText.setText("설정시간" + (i + 1));
|
||||
}
|
||||
newText.setTextSize(TypedValue.COMPLEX_UNIT_PX, 42);
|
||||
newText.setTextColor(Color.parseColor("#333333"));
|
||||
newLayout.addView(newText);
|
||||
|
||||
newText = new TextView(DoorControlTimeActivity.this);
|
||||
newText.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);
|
||||
textparams = new LinearLayout.LayoutParams(386, 144);
|
||||
textparams.setMargins(778 + offset, 23, 0, 0);
|
||||
newText.setLayoutParams(textparams);
|
||||
newText.setTypeface(ResourcesCompat.getFont(DoorControlTimeActivity.this, R.font.nanumbarungothic));
|
||||
newText.setText(timeList[i]);
|
||||
newText.setTextSize(TypedValue.COMPLEX_UNIT_PX, 42);
|
||||
newText.setTextColor(Color.parseColor("#666666"));
|
||||
newLayout.addView(newText);
|
||||
|
||||
ImageView imageView = new ImageView(DoorControlTimeActivity.this);
|
||||
imageView.setImageResource(R.drawable.list_edit_icon);
|
||||
LinearLayout.LayoutParams imgparams =
|
||||
new LinearLayout.LayoutParams(44, 42);
|
||||
imgparams.setMargins(1193 + offset, 26, 0, 0);
|
||||
imageView.setLayoutParams(imgparams);
|
||||
newLayout.addView(imageView);
|
||||
|
||||
Button button = new Button(DoorControlTimeActivity.this);
|
||||
LinearLayout.LayoutParams btnParams = new LinearLayout.LayoutParams(1193 + offset, LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
button.setLayoutParams(btnParams);
|
||||
button.setBackgroundColor(Color.TRANSPARENT);
|
||||
button.setTag("" + i);
|
||||
|
||||
button.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// TODO : click event
|
||||
String buttonTag = (String)view.getTag();
|
||||
Log.w("RITO", "PushTag : " + buttonTag);
|
||||
modifyIdx = Integer.parseInt(buttonTag);
|
||||
numberPicker(1);
|
||||
}
|
||||
});
|
||||
newLayout.addView(button);
|
||||
|
||||
if(timeList.length > 1) {
|
||||
ImageButton imgButton = new ImageButton(DoorControlTimeActivity.this);
|
||||
imgButton.setBackgroundResource(R.drawable.del_btn_small);
|
||||
LinearLayout.LayoutParams imgbtnparams =
|
||||
new LinearLayout.LayoutParams(70, 70);
|
||||
imgbtnparams.setMargins(1193, 12, 0, 0);
|
||||
imgButton.setLayoutParams(imgbtnparams);
|
||||
imgButton.setScaleX(0.8f);
|
||||
imgButton.setScaleY(0.8f);
|
||||
imgButton.setTag("" + i);
|
||||
|
||||
imgButton.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// TODO : click event
|
||||
String buttonTag = (String)view.getTag();
|
||||
String[] timeList = GlobalInfo.mDoorControlTimeData.split(",");
|
||||
String newTime = "";
|
||||
int tagIdx = Integer.parseInt(buttonTag);
|
||||
int cnt = 0;
|
||||
for(int i = 0;i < timeList.length;i++) {
|
||||
if(tagIdx == i)
|
||||
continue;
|
||||
if(cnt > 0) {
|
||||
newTime += ",";
|
||||
}
|
||||
newTime += timeList[i];
|
||||
cnt++;
|
||||
}
|
||||
|
||||
GlobalInfo.mDoorControlTimeData = newTime;
|
||||
refreshDoorControlTimeList();
|
||||
GlobalInfo.updateDoorControlTimeList();
|
||||
}
|
||||
});
|
||||
newLayout.addView(imgButton);
|
||||
}
|
||||
|
||||
int insertIndex = 2; // 원하는 위치
|
||||
parentLayout.addView(newLayout, insertIndex);
|
||||
}
|
||||
|
||||
// ScrollView scrollView = findViewById(R.id.scrollView);
|
||||
// scrollView.post(() -> scrollView.fullScroll(View.FOCUS_DOWN));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -45,7 +171,7 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
|
||||
menuKeySetting();
|
||||
|
||||
mTimeText = findViewById(R.id.doorcontroltimesettext);
|
||||
//mTimeText = findViewById(R.id.doorcontroltimesettext);
|
||||
|
||||
ImageView doorcontroltimeuseimage = (ImageView) findViewById(R.id.doorcontroltimeuseimage);
|
||||
doorcontroltimeuseimage.setOnClickListener(new Button.OnClickListener() {
|
||||
@ -92,16 +218,74 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
|
||||
|
||||
|
||||
Button button = (Button) findViewById(R.id.doorcontroltimesetimagebutton) ;
|
||||
button.setOnClickListener(new Button.OnClickListener() {
|
||||
// Button button = (Button) findViewById(R.id.doorcontroltimesetimagebutton) ;
|
||||
// button.setOnClickListener(new Button.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// // TODO : click event
|
||||
// numberPicker(1);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
ImageButton imgButton = (ImageButton) findViewById(R.id.buttonAddTime);
|
||||
imgButton.setOnClickListener(new Button.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// TODO : click event
|
||||
numberPicker(1);
|
||||
|
||||
GlobalInfo.mDoorControlTimeData += ",09:00~18:00";
|
||||
refreshDoorControlTimeList();
|
||||
ScrollView scrollView = findViewById(R.id.scrollView);
|
||||
scrollView.post(() -> scrollView.fullScroll(View.FOCUS_DOWN));
|
||||
|
||||
// FrameLayout newLayout = new FrameLayout(DoorControlTimeActivity.this);
|
||||
// FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,94);
|
||||
// newLayout.setLayoutParams(params);
|
||||
// newLayout.setBackgroundResource(R.drawable.layout_border);
|
||||
//
|
||||
// TextView newText = new TextView(DoorControlTimeActivity.this);
|
||||
// LinearLayout.LayoutParams textparams =
|
||||
// new LinearLayout.LayoutParams(400, 150);
|
||||
// textparams.setMargins(40, 23, 0, 0);
|
||||
// newText.setLayoutParams(textparams);
|
||||
// newText.setTypeface(ResourcesCompat.getFont(DoorControlTimeActivity.this, R.font.nanumbarungothic));
|
||||
// newText.setText("코끼리아저씨");
|
||||
// newText.setTextSize(TypedValue.COMPLEX_UNIT_PX, 42);
|
||||
// newText.setTextColor(Color.parseColor("#333333"));
|
||||
// newLayout.addView(newText);
|
||||
//
|
||||
// newText = new TextView(DoorControlTimeActivity.this);
|
||||
// newText.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);
|
||||
// textparams = new LinearLayout.LayoutParams(386, 144);
|
||||
// textparams.setMargins(778, 23, 0, 0);
|
||||
// newText.setLayoutParams(textparams);
|
||||
// newText.setTypeface(ResourcesCompat.getFont(DoorControlTimeActivity.this, R.font.nanumbarungothic));
|
||||
// newText.setText("09:00~18:00");
|
||||
// newText.setTextSize(TypedValue.COMPLEX_UNIT_PX, 42);
|
||||
// newText.setTextColor(Color.parseColor("#666666"));
|
||||
// newLayout.addView(newText);
|
||||
//
|
||||
// ImageView imageView = new ImageView(DoorControlTimeActivity.this);
|
||||
// imageView.setImageResource(R.drawable.list_edit_icon);
|
||||
// LinearLayout.LayoutParams imgparams =
|
||||
// new LinearLayout.LayoutParams(44, 42);
|
||||
// imgparams.setMargins(1193, 26, 0, 0);
|
||||
// imageView.setLayoutParams(imgparams);
|
||||
// newLayout.addView(imageView);
|
||||
//
|
||||
// LinearLayout parentLayout = findViewById(R.id.frameLayout2);
|
||||
//
|
||||
// int insertIndex = 3; // 원하는 위치
|
||||
// parentLayout.addView(newLayout, insertIndex);
|
||||
//
|
||||
// ScrollView scrollView = findViewById(R.id.scrollView);
|
||||
// scrollView.post(() -> scrollView.fullScroll(View.FOCUS_DOWN));
|
||||
}
|
||||
});
|
||||
|
||||
updateTimeTextFromGlobal();
|
||||
refreshDoorControlTimeList();
|
||||
}
|
||||
|
||||
private void menuKeySetting()
|
||||
@ -143,7 +327,7 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
|
||||
private final int DATE_POPUP = 0;
|
||||
private final int TIME_POPUP = 1;
|
||||
private TextView mTimeText = null;
|
||||
//private TextView mTimeText = null;
|
||||
private NumberPicker numberpickeryear = null, numberpickermonth = null, numberpickerday = null;
|
||||
private NumberPicker numberpickertime = null, numberpickerminute = null, numberpickertime2 = null, numberpickerminute2 = null;
|
||||
|
||||
@ -305,19 +489,24 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
minuteValues[i] = String.format("%02d", i);
|
||||
}
|
||||
|
||||
GlobalInfo.DoorControlTime[] timeList = GlobalInfo.getDoorControlTimeList();
|
||||
Log.w("RITO", String.format("startTime : %d, endTime : %d", timeList[modifyIdx].startTime, timeList[modifyIdx].endTime));
|
||||
|
||||
numberpickertime.setMinValue(0);
|
||||
numberpickertime.setMaxValue(23);
|
||||
//numberpickertime.setValue(Integer.valueOf(time));
|
||||
numberpickertime.setDisplayedValues(hourValues);
|
||||
numberpickertime.setWrapSelectorWheel(false);
|
||||
numberpickertime.setValue(GlobalInfo.mDoorControlTimeStart / 60);
|
||||
//numberpickertime.setValue(GlobalInfo.mDoorControlTimeStart / 60);
|
||||
numberpickertime.setValue(timeList[modifyIdx].startTime / 60);
|
||||
|
||||
numberpickerminute.setMinValue(0);
|
||||
numberpickerminute.setMaxValue(59);
|
||||
//numberpickerminute.setValue(Integer.valueOf(minute));
|
||||
numberpickerminute.setDisplayedValues(minuteValues);
|
||||
numberpickerminute.setWrapSelectorWheel(false);
|
||||
numberpickerminute.setValue(GlobalInfo.mDoorControlTimeStart % 60);
|
||||
//numberpickerminute.setValue(GlobalInfo.mDoorControlTimeStart % 60);
|
||||
numberpickerminute.setValue(timeList[modifyIdx].startTime % 60);
|
||||
|
||||
|
||||
numberpickertime2.setMinValue(0);
|
||||
@ -325,14 +514,16 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
//numberpickertime2.setValue(Integer.valueOf(time));
|
||||
numberpickertime2.setDisplayedValues(hourValues);
|
||||
numberpickertime2.setWrapSelectorWheel(false);
|
||||
numberpickertime2.setValue(GlobalInfo.mDoorControlTimeEnd / 60);
|
||||
//numberpickertime2.setValue(GlobalInfo.mDoorControlTimeEnd / 60);
|
||||
numberpickertime2.setValue(timeList[modifyIdx].endTime / 60);
|
||||
|
||||
numberpickerminute2.setMinValue(0);
|
||||
numberpickerminute2.setMaxValue(59);
|
||||
//numberpickerminute2.setValue(Integer.valueOf(minute));
|
||||
numberpickerminute2.setDisplayedValues(minuteValues);
|
||||
numberpickerminute2.setWrapSelectorWheel(false);
|
||||
numberpickerminute2.setValue(GlobalInfo.mDoorControlTimeEnd % 60);
|
||||
//numberpickerminute2.setValue(GlobalInfo.mDoorControlTimeEnd % 60);
|
||||
numberpickerminute2.setValue(timeList[modifyIdx].endTime % 60);
|
||||
|
||||
numberpickertime.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
|
||||
setDividerColor(numberpickertime, android.R.color.white);
|
||||
@ -394,10 +585,17 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
GlobalInfo.mDoorControlTimeStart = numberpickertime.getValue() * 60 + numberpickerminute.getValue();
|
||||
GlobalInfo.mDoorControlTimeEnd = numberpickertime2.getValue() * 60 + numberpickerminute2.getValue();
|
||||
|
||||
GlobalInfo.DoorControlTime[] timeList = GlobalInfo.getDoorControlTimeList();
|
||||
timeList[modifyIdx].startTime = numberpickertime.getValue() * 60 + numberpickerminute.getValue();
|
||||
timeList[modifyIdx].endTime = numberpickertime2.getValue() * 60 + numberpickerminute2.getValue();
|
||||
|
||||
GlobalInfo.setDoorControlTimeFromList(timeList);
|
||||
refreshDoorControlTimeList();
|
||||
|
||||
// mTimeText.setText(String.format("%02d:%02d ~ %02d:%02d",
|
||||
// numberpickertime.getValue(), numberpickerminute.getValue(), numberpickertime2.getValue(), numberpickerminute2.getValue()));
|
||||
|
||||
updateTimeTextFromGlobal();
|
||||
//updateTimeTextFromGlobal();
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@ -419,8 +617,9 @@ public class DoorControlTimeActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
void updateTimeTextFromGlobal() {
|
||||
mTimeText.setText(String.format("%02d:%02d ~ %02d:%02d",
|
||||
GlobalInfo.mDoorControlTimeStart / 60, GlobalInfo.mDoorControlTimeStart % 60, GlobalInfo.mDoorControlTimeEnd / 60, GlobalInfo.mDoorControlTimeEnd % 60));
|
||||
|
||||
// mTimeText.setText(String.format("%02d:%02d ~ %02d:%02d",
|
||||
// GlobalInfo.mDoorControlTimeStart / 60, GlobalInfo.mDoorControlTimeStart % 60, GlobalInfo.mDoorControlTimeEnd / 60, GlobalInfo.mDoorControlTimeEnd % 60));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -315,7 +315,7 @@ public class SystemUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHoliday() {
|
||||
public static boolean isWeekend() {
|
||||
LocalDate today = LocalDate.now();
|
||||
DayOfWeek dayOfWeek = today.getDayOfWeek();
|
||||
|
||||
|
||||
6
app/src/main/res/drawable/del_btn_small.xml
Normal file
6
app/src/main/res/drawable/del_btn_small.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/del_btn_small_nor" /> <!-- pressed -->
|
||||
<item android:drawable="@drawable/del_btn_small_nor" /> <!-- default -->
|
||||
</selector>
|
||||
@ -1,19 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/mainLayout"
|
||||
android:orientation="vertical"
|
||||
tools:context=".system.ServerSettingActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/title_bar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/frameLayout2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:background="@drawable/title_bar">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logincard_title_back"
|
||||
@ -46,148 +45,177 @@
|
||||
android:textStyle="bold" />
|
||||
</FrameLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/frameLayout2"
|
||||
android:layout_width="1280px"
|
||||
android:layout_height="626px"
|
||||
android:layout_marginTop="94px"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/frameLayout">
|
||||
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/frameLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/layout_border">
|
||||
android:layout_height="626px"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="400px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginStart="40px"
|
||||
android:layout_marginTop="29px"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:text="@string/mgt_system_door_control_time_use_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="386px"
|
||||
android:layout_height="144px"
|
||||
android:layout_marginStart="778px"
|
||||
android:layout_marginTop="29px"
|
||||
android:textAlignment="viewEnd"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:textColor="#666666"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="19px"
|
||||
android:layout_height="38px"
|
||||
android:layout_marginStart="1217px"
|
||||
android:layout_marginTop="27px"
|
||||
app:srcCompat="@drawable/list_arrow_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/doorcontroltimeuseimage"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="56px"
|
||||
android:layout_marginStart="1135px"
|
||||
android:layout_marginTop="20px"
|
||||
app:srcCompat="@drawable/toggle_pressed" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/layout_border">
|
||||
|
||||
<TextView
|
||||
android:layout_width="400px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginStart="40px"
|
||||
android:layout_marginTop="29px"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:text="@string/mgt_system_door_control_time_use_holiday_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="386px"
|
||||
android:layout_height="144px"
|
||||
android:layout_marginStart="778px"
|
||||
android:layout_marginTop="29px"
|
||||
android:textAlignment="viewEnd"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:textColor="#666666"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="19px"
|
||||
android:layout_height="38px"
|
||||
android:layout_marginStart="1217px"
|
||||
android:layout_marginTop="27px"
|
||||
app:srcCompat="@drawable/list_arrow_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/doorcontroltimeuseholidayimage"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="56px"
|
||||
android:layout_marginStart="1135px"
|
||||
android:layout_marginTop="20px"
|
||||
app:srcCompat="@drawable/toggle_pressed" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/layout_border">
|
||||
|
||||
<TextView
|
||||
android:layout_width="400px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginStart="40px"
|
||||
android:layout_marginTop="29px"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:text="@string/mgt_system_door_control_time_set_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="42px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/doorcontroltimesettext"
|
||||
android:layout_width="386px"
|
||||
android:layout_height="144px"
|
||||
android:layout_marginStart="778px"
|
||||
android:layout_marginTop="29px"
|
||||
android:textAlignment="viewEnd"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:textColor="#666666"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/doorcontroltimesetimage"
|
||||
android:layout_width="44px"
|
||||
android:layout_height="42px"
|
||||
android:layout_marginStart="1193px"
|
||||
android:layout_marginTop="26px"
|
||||
app:srcCompat="@drawable/list_edit_icon" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/doorcontroltimesetimagebutton"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000" />
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/layout_border">
|
||||
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:layout_width="400px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginStart="40px"
|
||||
android:layout_marginTop="23px"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:text="@string/mgt_system_door_control_time_use_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="386px"
|
||||
android:layout_height="144px"
|
||||
android:layout_marginStart="778px"
|
||||
android:layout_marginTop="23px"
|
||||
android:textAlignment="viewEnd"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:textColor="#666666"
|
||||
android:textSize="42px" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="19px"
|
||||
android:layout_height="38px"
|
||||
android:layout_marginStart="1217px"
|
||||
android:layout_marginTop="27px"
|
||||
app:srcCompat="@drawable/list_arrow_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/doorcontroltimeuseimage"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="56px"
|
||||
android:layout_marginStart="1135px"
|
||||
android:layout_marginTop="20px"
|
||||
app:srcCompat="@drawable/toggle_pressed" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/layout_border">
|
||||
|
||||
<TextView
|
||||
android:layout_width="400px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginStart="40px"
|
||||
android:layout_marginTop="23px"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:text="@string/mgt_system_door_control_time_use_holiday_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="386px"
|
||||
android:layout_height="144px"
|
||||
android:layout_marginStart="778px"
|
||||
android:layout_marginTop="23px"
|
||||
android:textAlignment="viewEnd"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:textColor="#666666"
|
||||
android:textSize="42px" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="19px"
|
||||
android:layout_height="38px"
|
||||
android:layout_marginStart="1217px"
|
||||
android:layout_marginTop="27px"
|
||||
app:srcCompat="@drawable/list_arrow_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/doorcontroltimeuseholidayimage"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="56px"
|
||||
android:layout_marginStart="1135px"
|
||||
android:layout_marginTop="20px"
|
||||
app:srcCompat="@drawable/toggle_pressed" />
|
||||
</FrameLayout>
|
||||
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="94px"-->
|
||||
<!-- android:background="@drawable/layout_border">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="400px"-->
|
||||
<!-- android:layout_height="150px"-->
|
||||
<!-- android:layout_marginStart="40px"-->
|
||||
<!-- android:layout_marginTop="23px"-->
|
||||
<!-- android:fontFamily="@font/nanumbarungothic"-->
|
||||
<!-- android:text="@string/mgt_system_door_control_time_set_text"-->
|
||||
<!-- android:textColor="#333333"-->
|
||||
<!-- android:textSize="42px" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/doorcontroltimesettext"-->
|
||||
<!-- android:layout_width="386px"-->
|
||||
<!-- android:layout_height="144px"-->
|
||||
<!-- android:layout_marginStart="778px"-->
|
||||
<!-- android:layout_marginTop="23px"-->
|
||||
<!-- android:textAlignment="viewEnd"-->
|
||||
<!-- android:fontFamily="@font/nanumbarungothic"-->
|
||||
<!-- android:textColor="#666666"-->
|
||||
<!-- android:textSize="42px" />-->
|
||||
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/doorcontroltimesetimage"-->
|
||||
<!-- android:layout_width="44px"-->
|
||||
<!-- android:layout_height="42px"-->
|
||||
<!-- android:layout_marginStart="1193px"-->
|
||||
<!-- android:layout_marginTop="26px"-->
|
||||
<!-- app:srcCompat="@drawable/list_edit_icon" />-->
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/doorcontroltimesetimagebutton"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:background="#00000000" />-->
|
||||
|
||||
<!-- </FrameLayout>-->
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94px"
|
||||
android:background="@drawable/layout_border">
|
||||
|
||||
<TextView
|
||||
android:layout_width="400px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginStart="600px"
|
||||
android:layout_marginTop="23px"
|
||||
android:fontFamily="@font/nanumbarungothic"
|
||||
android:text="@string/mgt_system_door_control_time_add_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="42px" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/buttonAddTime"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="70px"
|
||||
android:layout_marginLeft="520px"
|
||||
android:layout_marginTop="10px"
|
||||
android:background="@drawable/add_btn" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@ -257,6 +257,7 @@
|
||||
<string name="mgt_system_door_control_time_use_text">"개방시간 사용"</string>
|
||||
<string name="mgt_system_door_control_time_use_holiday_text">"주말 및 휴무일 개방"</string>
|
||||
<string name="mgt_system_door_control_time_set_text">"설정시간"</string>
|
||||
<string name="mgt_system_door_control_time_add_text">"시간 추가"</string>
|
||||
|
||||
<string name="mgt_system_attendance_setting_use_text">"근태관리 사용"</string>
|
||||
<string name="mgt_system_attendance_setting_automode_use_text">"근태관리 자동전환 사용"</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user