|
@@ -0,0 +1,775 @@
|
|
|
+package kr.co.icontrols.wallpadaddservice.screen;
|
|
|
+
|
|
|
+import android.annotation.SuppressLint;
|
|
|
+import android.content.Context;
|
|
|
+import android.graphics.Color;
|
|
|
+import android.os.Handler;
|
|
|
+import android.os.Message;
|
|
|
+import android.util.Log;
|
|
|
+import android.view.Gravity;
|
|
|
+import android.view.MotionEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.RelativeLayout;
|
|
|
+
|
|
|
+import com.artncore.wallpadapi.WallPadAPI;
|
|
|
+import com.artncore.wallpadimap.RetProci;
|
|
|
+import com.util.LogUtil;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+
|
|
|
+import kr.co.icontrols.wallpadaddservice.MainActivity;
|
|
|
+import kr.co.icontrols.wallpadaddservice.R;
|
|
|
+import kr.co.icontrols.wallpadaddservice.declare.Common;
|
|
|
+import kr.co.icontrols.wallpadaddservice.declare.ID;
|
|
|
+import kr.co.icontrols.wallpadaddservice.declare.ID.ElecCarMainScreenID;
|
|
|
+import kr.co.icontrols.wallpadaddservice.imap.iMAPElecCarChargerInfo;
|
|
|
+import kr.co.icontrols.wallpadaddservice.imap.iMAPElecCarChargingInfo;
|
|
|
+import kr.co.icontrols.wallpadaddservice.imap.iMAPElecCarHistoryInfo;
|
|
|
+import kr.co.icontrols.wallpadsupport.WpadImageView;
|
|
|
+import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
|
|
|
+import kr.co.icontrols.wallpadsupport.WpadScreen;
|
|
|
+import kr.co.icontrols.wallpadsupport.WpadSound.SND;
|
|
|
+import kr.co.icontrols.wallpadsupport.WpadTextView;
|
|
|
+
|
|
|
+public class VIPElecCarMainScreen extends WpadScreen {
|
|
|
+
|
|
|
+ private final String TAG = "VIPElecCarMainScreen";
|
|
|
+
|
|
|
+ Context mContext;
|
|
|
+
|
|
|
+ private final boolean DEBUG_LOG_ON = true;
|
|
|
+
|
|
|
+ private void DebugLogOutput(String s) {
|
|
|
+ if (DEBUG_LOG_ON) Log.d(TAG, s);
|
|
|
+ }
|
|
|
+
|
|
|
+ private int m_SampleMode = Common.MODE;
|
|
|
+
|
|
|
+ WpadImageView BG;
|
|
|
+ WpadImageView ELEC_CAR_1;
|
|
|
+ WpadImageView ELEC_CAR_2;
|
|
|
+ WpadImageView ELEC_CHARGER[] = new WpadImageView[2];
|
|
|
+
|
|
|
+ public static int CurrentIndex = 0;
|
|
|
+
|
|
|
+
|
|
|
+ // button
|
|
|
+ WpadImageView Page1_BACK;
|
|
|
+ WpadImageView Page1_NEXT;
|
|
|
+
|
|
|
+ WpadTextView Page1_RemainTime;
|
|
|
+ WpadTextView TXT_ChargerStatus[] = new WpadTextView[2];
|
|
|
+ WpadTextView TXT_ChargingInfo[] = new WpadTextView[2];
|
|
|
+
|
|
|
+ // button
|
|
|
+ WpadImageView Page3_PageBack;
|
|
|
+ WpadImageView Page3_PageNext;
|
|
|
+
|
|
|
+
|
|
|
+ private final int PageMode3_Charger_All = 2;
|
|
|
+
|
|
|
+ // [Information Page - 1]
|
|
|
+ CAR_CHARGING_INFO Car_Charging_Info;
|
|
|
+ iMAPElecCarChargingInfo imapElecCarChargingInfo;
|
|
|
+ int Page1_CarIdx = 0; // current page = car index + 1
|
|
|
+
|
|
|
+ private int[] mChargerImg = new int[]
|
|
|
+ {R.drawable.plug_green, R.drawable.plug_red};
|
|
|
+
|
|
|
+ // [Information Page - 2]
|
|
|
+ CHARGING_HISTORY_INFO Charging_History_Info;
|
|
|
+ Calendar mCal;
|
|
|
+ SimpleDateFormat monthFormat = new SimpleDateFormat("MM");
|
|
|
+ iMAPElecCarHistoryInfo imapElecCarHistoryInfo;
|
|
|
+
|
|
|
+ int Page2_Request_Year;
|
|
|
+ int nPage2_Request_Month;
|
|
|
+ String sPage2_Request_Month;
|
|
|
+ int Page2_Request_Date;
|
|
|
+
|
|
|
+ // [Information Page - 3]
|
|
|
+ CHARGER_INFO Charger_Info;
|
|
|
+ iMAPElecCarChargerInfo imapElecCarChargerInfo;
|
|
|
+
|
|
|
+ int Page3_Request_ChargerType = PageMode3_Charger_All;
|
|
|
+
|
|
|
+
|
|
|
+ boolean bEasyModeUse = false;
|
|
|
+ int idx = 0;
|
|
|
+
|
|
|
+ int chargingRatio[] = new int[2];
|
|
|
+
|
|
|
+ class CAR_CHARGING_INFO {
|
|
|
+ class ITEM {
|
|
|
+ private String card_num;
|
|
|
+ private String car_num;
|
|
|
+ private String charger_num;
|
|
|
+ private String charger_loc;
|
|
|
+ private String charger_sort;
|
|
|
+ private String charging_ratio;
|
|
|
+ private String start_time;
|
|
|
+ private String remain_time;
|
|
|
+ private String unit_price;
|
|
|
+ private String c_msg;
|
|
|
+
|
|
|
+ public ITEM(String Card_num, String Car_num, String Charger_num, String Charger_loc, String Charger_sort,
|
|
|
+ String Charging_ratio, String Start_time, String Remain_time, String Unit_price, String C_msg) {
|
|
|
+ card_num = Card_num;
|
|
|
+ car_num = Car_num;
|
|
|
+ charger_num = Charger_num;
|
|
|
+ charger_loc = Charger_loc;
|
|
|
+ charger_sort = Charger_sort;
|
|
|
+ charging_ratio = Charging_ratio;
|
|
|
+ start_time = Start_time;
|
|
|
+ remain_time = Remain_time;
|
|
|
+ unit_price = Unit_price;
|
|
|
+ c_msg = C_msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_card_num() {
|
|
|
+ return card_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_car_num() {
|
|
|
+ return car_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_num() {
|
|
|
+ return charger_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_loc() {
|
|
|
+ return charger_loc;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_sort() {
|
|
|
+ return charger_sort;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charging_ratio() {
|
|
|
+ return charging_ratio;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_start_time() {
|
|
|
+ return start_time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_remain_time() {
|
|
|
+ return remain_time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_unit_price() {
|
|
|
+ return unit_price;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_c_msg() {
|
|
|
+ return c_msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private ArrayList<ITEM> arraylist = new ArrayList<ITEM>();
|
|
|
+ private String message;
|
|
|
+ private int num;
|
|
|
+
|
|
|
+ public CAR_CHARGING_INFO(int Num, String Message) {
|
|
|
+ message = Message;
|
|
|
+ num = Num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMessage() {
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getnum() {
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+
|
|
|
+ void inputArrayMethod(String Card_num, String Car_num, String Charger_num, String Charger_loc, String Charger_sort,
|
|
|
+ String Charging_ratio, String Start_time, String Remain_time, String Unit_price, String C_msg) {
|
|
|
+ arraylist.add(new ITEM(Card_num, Car_num, Charger_num, Charger_loc, Charger_sort,
|
|
|
+ Charging_ratio, Start_time, Remain_time, Unit_price, C_msg));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ class CHARGER_INFO {
|
|
|
+ class ITEM {
|
|
|
+ private String charger_num;
|
|
|
+ private String charger_loc;
|
|
|
+ private String charger_sort;
|
|
|
+ private String charger_status;
|
|
|
+ private String unit_price;
|
|
|
+ private String c_msg;
|
|
|
+
|
|
|
+ public ITEM(String Charger_num, String Charger_loc, String Charger_sort,
|
|
|
+ String Charger_status, String Unit_price, String C_msg) {
|
|
|
+ charger_num = Charger_num;
|
|
|
+ charger_loc = Charger_loc;
|
|
|
+ charger_sort = Charger_sort;
|
|
|
+ charger_status = Charger_status;
|
|
|
+ unit_price = Unit_price;
|
|
|
+ c_msg = C_msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_num() {
|
|
|
+ return charger_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_loc() {
|
|
|
+ return charger_loc;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_sort() {
|
|
|
+ return charger_sort;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_charger_status() {
|
|
|
+ return charger_status;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_unit_price() {
|
|
|
+ return unit_price;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_c_msg() {
|
|
|
+ return c_msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private ArrayList<ITEM> arraylist = new ArrayList<ITEM>();
|
|
|
+ private String message;
|
|
|
+ private int num;
|
|
|
+
|
|
|
+ public CHARGER_INFO(int Num, String Message) {
|
|
|
+ message = Message;
|
|
|
+ num = Num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMessage() {
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getnum() {
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+
|
|
|
+ void inputArrayMethod(String Charger_num, String Charger_loc, String Charger_sort,
|
|
|
+ String Charger_status, String Unit_price, String C_msg) {
|
|
|
+ arraylist.add(new ITEM(Charger_num, Charger_loc, Charger_sort,
|
|
|
+ Charger_status, Unit_price, C_msg));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ class CHARGING_HISTORY_INFO {
|
|
|
+ class ITEM {
|
|
|
+ private String card_num;
|
|
|
+ private String car_num;
|
|
|
+ private String charger_sum_cnt;
|
|
|
+ private String charger_sum_cost;
|
|
|
+ private String charger_sum_kwh;
|
|
|
+ private String c_msg;
|
|
|
+
|
|
|
+ public ITEM(String Card_num, String Car_num, String Charger_sum_cnt,
|
|
|
+ String Charger_sum_cost, String Charger_sum_kwh, String C_msg) {
|
|
|
+ card_num = Card_num;
|
|
|
+ car_num = Car_num;
|
|
|
+ charger_sum_cnt = Charger_sum_cnt;
|
|
|
+ charger_sum_cost = Charger_sum_cost;
|
|
|
+ charger_sum_kwh = Charger_sum_kwh;
|
|
|
+ c_msg = C_msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ArrayList<INNER_ITEM> Inner_arraylist = new ArrayList<INNER_ITEM>();
|
|
|
+
|
|
|
+ public String get_Card_num() {
|
|
|
+ return card_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Car_num() {
|
|
|
+ return car_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Charger_sum_cnt() {
|
|
|
+ return charger_sum_cnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Charger_sum_cost() {
|
|
|
+ return charger_sum_cost;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Charger_sum_kwh() {
|
|
|
+ return charger_sum_kwh;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_C_msg() {
|
|
|
+ return c_msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ class INNER_ITEM {
|
|
|
+ private String start_time;
|
|
|
+ private String end_time;
|
|
|
+ private String charge_cost;
|
|
|
+ private String charge_kwh;
|
|
|
+ private String charge_num;
|
|
|
+
|
|
|
+ public INNER_ITEM(String Start_time, String End_time, String Charge_cost, String Charge_kwh, String Charge_num) {
|
|
|
+ start_time = Start_time;
|
|
|
+ end_time = End_time;
|
|
|
+ charge_cost = Charge_cost;
|
|
|
+ charge_kwh = Charge_kwh;
|
|
|
+ charge_num = Charge_num;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Start_time() {
|
|
|
+ return start_time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_End_time() {
|
|
|
+ return end_time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Charge_cost() {
|
|
|
+ return charge_cost;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Charge_kwh() {
|
|
|
+ return charge_kwh;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String get_Charge_num() {
|
|
|
+ return charge_num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void inputInner_ArrayMethod(String Start_time, String End_time, String Charge_cost, String Charge_kwh, String Charge_num) {
|
|
|
+ Inner_arraylist.add(new INNER_ITEM(Start_time, End_time, Charge_cost, Charge_kwh, Charge_num));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ArrayList<ITEM> arraylist = new ArrayList<ITEM>();
|
|
|
+
|
|
|
+ private String distinguish;
|
|
|
+ private String year;
|
|
|
+ private String month;
|
|
|
+ private String day;
|
|
|
+ private String classify;
|
|
|
+ private int history_cnt;
|
|
|
+ private String message;
|
|
|
+
|
|
|
+ public CHARGING_HISTORY_INFO(String Distinguish, String Year, String Month, String Day, String Classify, int History_Cnt, String Message) {
|
|
|
+ distinguish = Distinguish;
|
|
|
+ year = Year;
|
|
|
+ month = Month;
|
|
|
+ day = Day;
|
|
|
+ classify = Classify;
|
|
|
+ history_cnt = History_Cnt;
|
|
|
+ message = Message;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getDistinguish() {
|
|
|
+ return distinguish;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getYear() {
|
|
|
+ return year;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMonth() {
|
|
|
+ return month;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getDay() {
|
|
|
+ return day;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getClassify() {
|
|
|
+ return classify;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getHistory_cnt() {
|
|
|
+ return history_cnt;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMessage() {
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ void inputArrayMethod(String Card_num, String Car_num, String Charge_sum_cnt,
|
|
|
+ String Charge_sum_cost, String Charge_sum_kwh, String C_msg) {
|
|
|
+ arraylist.add(new ITEM(Card_num, Car_num, Charge_sum_cnt,
|
|
|
+ Charge_sum_cost, Charge_sum_kwh, C_msg));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public VIPElecCarMainScreen(Context context, RelativeLayout layout, WallPadAPI wpapi, int operationMode) {
|
|
|
+ super(context, layout);
|
|
|
+ mContext = context;
|
|
|
+ DebugLogOutput("[ElecCarMainScreen] START");
|
|
|
+
|
|
|
+ ((MainActivity) mContext).setManualBtnVisible(((MainActivity) mContext).getManualUse(), 1019);
|
|
|
+
|
|
|
+ if (Common.GetAddFuncSampleMode(context)) m_SampleMode = Common.MODE_BUSINESS_SAMPLE;
|
|
|
+ else m_SampleMode = Common.MODE_NORMAL;
|
|
|
+
|
|
|
+ //for test
|
|
|
+ m_SampleMode = Common.MODE_BUSINESS_SAMPLE;
|
|
|
+
|
|
|
+ bEasyModeUse = Common.GetEasyModeUXUse(this.getContext());
|
|
|
+ if (bEasyModeUse) idx = 1;
|
|
|
+ Log.d(TAG, "[ElecCarMainScreen] bEasyModeUse [" + bEasyModeUse + "], idx [" + idx + "]");
|
|
|
+
|
|
|
+ BG = new WpadImageView(context, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.BACKGROUND);
|
|
|
+ ViewRegistration(layout, BG, 0, 0);
|
|
|
+ ELEC_CAR_1 = new WpadImageView(context, TOUCH_KIND.NONE, 547, 544, R.drawable.bg_car_1, R.drawable.bg_car_1, ElecCarMainScreenID.image.CAR1_IMAGE);
|
|
|
+ ViewRegistration(layout, ELEC_CAR_1, Common.ImgPosition.GetX(93), Common.ImgPosition.GetY(169));
|
|
|
+ ELEC_CAR_2 = new WpadImageView(context, TOUCH_KIND.NONE, 547, 544, R.drawable.bg_car_2, R.drawable.bg_car_2, ID.ElecCarMainScreenID.image.CAR2_IMAGE);
|
|
|
+ ViewRegistration(layout, ELEC_CAR_2, Common.ImgPosition.GetX(640), Common.ImgPosition.GetY(169));
|
|
|
+
|
|
|
+ ELEC_CHARGER[0] = new WpadImageView(context, TOUCH_KIND.NONE, 46, 44, mChargerImg[0], mChargerImg[0], ElecCarMainScreenID.image.CHARGER1_IMAGE);
|
|
|
+ ViewRegistration(layout, ELEC_CHARGER[0], Common.ImgPosition.GetX(344), Common.ImgPosition.GetY(422));
|
|
|
+ ELEC_CHARGER[1] = new WpadImageView(context, TOUCH_KIND.NONE, 46, 44, mChargerImg[0], mChargerImg[0], ID.ElecCarMainScreenID.image.CHARGER2_IMAGE);
|
|
|
+ ViewRegistration(layout, ELEC_CHARGER[1], Common.ImgPosition.GetX(891), Common.ImgPosition.GetY(422));
|
|
|
+
|
|
|
+ TXT_ChargerStatus[0] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._36, true, ElecCarMainScreenID.text.CHARGER1_STATUS);
|
|
|
+ ViewRegistration(getLayout(), TXT_ChargerStatus[0], Common.ImgPosition.GetX(93), Common.ImgPosition.GetY(575));
|
|
|
+ TXT_ChargerStatus[0].setText("충전중");
|
|
|
+
|
|
|
+ TXT_ChargerStatus[1] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._36, true, ElecCarMainScreenID.text.CHARGER2_STATUS);
|
|
|
+ ViewRegistration(getLayout(), TXT_ChargerStatus[1], Common.ImgPosition.GetX(640), Common.ImgPosition.GetY(575));
|
|
|
+ TXT_ChargerStatus[1].setText("충전중");
|
|
|
+
|
|
|
+ TXT_ChargingInfo[0] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._30, false, ElecCarMainScreenID.text.CHARGER1_INFO);
|
|
|
+ ViewRegistration(getLayout(), TXT_ChargingInfo[0], Common.ImgPosition.GetX(93), Common.ImgPosition.GetY(624));
|
|
|
+ TXT_ChargingInfo[0].setText("12:30");
|
|
|
+
|
|
|
+ TXT_ChargingInfo[1] = new WpadTextView(getContext(), false, 547, 46, Gravity.CENTER, Color.WHITE, Common.fontsize._30, false, ElecCarMainScreenID.text.CHARGER2_INFO);
|
|
|
+ ViewRegistration(getLayout(), TXT_ChargingInfo[1], Common.ImgPosition.GetX(640), Common.ImgPosition.GetY(624));
|
|
|
+ TXT_ChargingInfo[1].setText("12.3kWh");
|
|
|
+
|
|
|
+
|
|
|
+ //변수 초기화
|
|
|
+ mCal = Calendar.getInstance();
|
|
|
+ Page2_Request_Year = mCal.get(Calendar.YEAR);
|
|
|
+ nPage2_Request_Month = mCal.get(Calendar.MONTH) + 1;
|
|
|
+ sPage2_Request_Month = monthFormat.format(mCal.getTime());
|
|
|
+ Page2_Request_Date = mCal.get(Calendar.DATE);
|
|
|
+
|
|
|
+ //서버
|
|
|
+ imapElecCarChargingInfo = new iMAPElecCarChargingInfo(context);
|
|
|
+ imapElecCarChargerInfo = new iMAPElecCarChargerInfo(context);
|
|
|
+ imapElecCarHistoryInfo = new iMAPElecCarHistoryInfo(context);
|
|
|
+
|
|
|
+ MakeContent();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onClose() {
|
|
|
+ CurrentIndex = 0;
|
|
|
+ super.onClose();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onTouchEvent(View v, MotionEvent event) {
|
|
|
+ super.onTouchEvent(v, event);
|
|
|
+
|
|
|
+ int TargetId = v.getId();
|
|
|
+ int MoveEvent = event.getAction();
|
|
|
+
|
|
|
+ if (MoveEvent == MotionEvent.ACTION_UP) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void ViewRegistration(RelativeLayout ParentsLayout, WpadImageView nImageView, int MarginLeft, int MarginTop) {
|
|
|
+ super.ViewRegistration(ParentsLayout, nImageView, MarginLeft, MarginTop);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void ViewRegistration(RelativeLayout ParentsLayout, WpadTextView nTextView, int MarginLeft, int MarginTop) {
|
|
|
+ super.ViewRegistration(ParentsLayout, nTextView, MarginLeft, MarginTop);
|
|
|
+ }
|
|
|
+
|
|
|
+ void MakeContent() {
|
|
|
+ if (m_SampleMode == Common.MODE_BUSINESS_SAMPLE) {
|
|
|
+ LoadSampleData_Page1();
|
|
|
+ MakeContentPage1_Image();
|
|
|
+ LoadSampleData_Page3();
|
|
|
+ MakeContentPage3_Image();
|
|
|
+ } else {
|
|
|
+ LoadDataFromServerCharging();
|
|
|
+ LoadDataFromServerCharger();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ void LoadSampleData_Page1() {
|
|
|
+ Car_Charging_Info = new CAR_CHARGING_INFO(6, "This is Test Message");
|
|
|
+ Car_Charging_Info.inputArrayMethod(
|
|
|
+ "1111-1111", "57부 9719", "1",
|
|
|
+ "1단지", "slow", "10",
|
|
|
+ "2015.06.22.08.10", "90", "10,000",
|
|
|
+ "Car Index 1");
|
|
|
+
|
|
|
+ Car_Charging_Info.inputArrayMethod(
|
|
|
+ "1111-1111", "4 즈 1111", "2",
|
|
|
+ "1단지", "fast", "30",
|
|
|
+ "2015.06.22.09.10", "60", "11,000",
|
|
|
+ "Car Index 2");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 통신데이터 가져온 이후 그 데이터에 맞게 이미지 그리는 작업
|
|
|
+ * RemoveContentPage1()에 반드시 view마다 추가해야 함.
|
|
|
+ **/
|
|
|
+ void MakeContentPage1_Image() {
|
|
|
+ DebugLogOutput("MakeContentPage1_Image");
|
|
|
+ try {
|
|
|
+ if (Car_Charging_Info == null) return;
|
|
|
+ if (Car_Charging_Info.arraylist.size() == 0) {
|
|
|
+ TXT_ChargerStatus[0].setText("정보없음");
|
|
|
+ TXT_ChargerStatus[1].setText("정보없음");
|
|
|
+ TXT_ChargingInfo[0].setText("");
|
|
|
+ TXT_ChargingInfo[1].setText("");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DebugLogOutput("Car_Charging_Info.arraylist.size(): " + Car_Charging_Info.arraylist.size());
|
|
|
+ DebugLogOutput("Page1_CarIdx: " + Page1_CarIdx);
|
|
|
+ for (int i = 0; i < 2; i++) {
|
|
|
+ if (Car_Charging_Info.arraylist.get(i).get_charging_ratio().equals("no_service")) {
|
|
|
+ //정보 없는 경우...
|
|
|
+ TXT_ChargingInfo[i].setText("");
|
|
|
+ } else {
|
|
|
+ String tempString = Car_Charging_Info.arraylist.get(i).get_charging_ratio();
|
|
|
+ chargingRatio[i] = Integer.parseInt(tempString);
|
|
|
+ TXT_ChargerStatus[i].setText("충전중(" + chargingRatio[i] + "%)");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ for (int i = 0; i < 2; i++) {
|
|
|
+ String[] SplitedString = Car_Charging_Info.arraylist.get(i).start_time.split("\\.");
|
|
|
+ if (SplitedString != null) {
|
|
|
+ if (SplitedString.length == 5) {
|
|
|
+ String CompleteString = SplitedString[0] + "년 " + SplitedString[1] + "월" + SplitedString[2] + "일 " +
|
|
|
+ SplitedString[3] + "시" + SplitedString[4] + "분";
|
|
|
+ if (TXT_ChargingInfo[i] != null)
|
|
|
+ TXT_ChargingInfo[i].setText(CompleteString);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.e(TAG, "[Exception] MakeContentPage1_Image");
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
+ }
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.e(TAG, "[Exception] MakeContentPage1_Image");
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
+ TXT_ChargerStatus[0].setText("정보없음");
|
|
|
+ TXT_ChargerStatus[1].setText("정보없음");
|
|
|
+ TXT_ChargingInfo[0].setText("");
|
|
|
+ TXT_ChargingInfo[1].setText("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void LoadDataFromServerCharging() {
|
|
|
+ DebugLogOutput("LoadDataFromServerCharging");
|
|
|
+ Page1_BACK.setImageResource(R.drawable.btn_back_disabled); // imap 통신 이후 이미지 바뀌는 현상 방지하기 위해
|
|
|
+ Page1_NEXT.setImageResource(R.drawable.btn_next_disabled);
|
|
|
+
|
|
|
+ imapElecCarChargingInfo.DoWork();
|
|
|
+ imapElecCarChargingInfo.SetRetCtr(new RetProci() {
|
|
|
+ @Override
|
|
|
+ public void ProcSuccess() {
|
|
|
+ Log.i(TAG, "[ProcSuccess]");
|
|
|
+ try {
|
|
|
+ int SetItemResult = imapElecCarChargingInfo.SetItem("charging_cnt");
|
|
|
+ if (SetItemResult != 1) {
|
|
|
+ Log.w(TAG, "[ProcSuccess] Error 1 -> SetItemResult [" + SetItemResult + "]");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String sChargingCount = imapElecCarChargingInfo.GetItemVal(0);
|
|
|
+ int intChargingCount = Integer.parseInt(sChargingCount);
|
|
|
+ if (intChargingCount < 1) {
|
|
|
+ Page1_RemainTime.setText("현재 충전 중인 차량 정보가 없습니다.");
|
|
|
+ Log.w(TAG, "[ProcSuccess] Error 2 -> intChargingCount [" + intChargingCount + "]");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ SetItemResult = imapElecCarChargingInfo.SetItem("charging_info");
|
|
|
+
|
|
|
+ if (SetItemResult != intChargingCount) {
|
|
|
+ Log.w(TAG, "[ProcSuccess] Error 3 -> SetItemResult [" + SetItemResult + "]");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Car_Charging_Info = new CAR_CHARGING_INFO(intChargingCount, "null");
|
|
|
+
|
|
|
+ for (int i = 0; i < intChargingCount; i++) {
|
|
|
+ Car_Charging_Info.inputArrayMethod(
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "card_num"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "car_num"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "charger_num"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "charger_loc"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "charger_sort"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "charging_ratio"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "start_time"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "remain_time"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "unit_price"),
|
|
|
+ imapElecCarChargingInfo.GetAttributeVal(i, "c_msg"));
|
|
|
+ }
|
|
|
+ imapElecCarChargingInfo.SetItem("message");
|
|
|
+ Car_Charging_Info.message = imapElecCarChargingInfo.GetItemVal(0);
|
|
|
+
|
|
|
+ if (Car_Charging_Info.arraylist.size() != 0) {
|
|
|
+ Page1_BACK.setImageResource(R.drawable.btn_back_normal);
|
|
|
+ Page1_NEXT.setImageResource(R.drawable.btn_next_normal);
|
|
|
+ MakeContentPage1_Image();
|
|
|
+ } else {
|
|
|
+ Page1_BACK.setButtonEventOffEnable(R.drawable.btn_back_disabled);
|
|
|
+ Page1_NEXT.setButtonEventOffEnable(R.drawable.btn_next_disabled);
|
|
|
+ }
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ } catch (Exception e) {
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void ProcError() {
|
|
|
+ DebugLogOutput("ProcError");
|
|
|
+ Page1_BACK.setButtonEventOffEnable(R.drawable.btn_back_disabled);
|
|
|
+ Page1_NEXT.setButtonEventOffEnable(R.drawable.btn_next_disabled);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void ProcDoing() {
|
|
|
+ DebugLogOutput("ProcDoing");
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ void LoadSampleData_Page3() {
|
|
|
+ Charger_Info = new CHARGER_INFO(5, "This is Charger Info");
|
|
|
+ Charger_Info.inputArrayMethod("1", "B-1", "slow", "charged", "5,400", "this is 1");
|
|
|
+ Charger_Info.inputArrayMethod("2", "B-2", "fast", "charging", "5,500", "this is 2");
|
|
|
+ }
|
|
|
+
|
|
|
+ void MakeContentPage3_Image() {
|
|
|
+ for (int i = 0; i < 2; i++) {
|
|
|
+ String tempString;
|
|
|
+ String tempResultString;
|
|
|
+
|
|
|
+ tempString = Charger_Info.arraylist.get(i).get_charger_status();
|
|
|
+ if (tempString.equalsIgnoreCase("charging")) {
|
|
|
+ tempResultString = "충전중(" + chargingRatio[i] + "%)";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[1]);
|
|
|
+ } else if (tempString.equalsIgnoreCase("ready")) {
|
|
|
+ tempResultString = "충전 대기";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[1]);
|
|
|
+ } else if (tempString.equalsIgnoreCase("full")) {
|
|
|
+ tempResultString = "충전 완료";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[0]);
|
|
|
+ TXT_ChargingInfo[i].setText("");
|
|
|
+ } else if (tempString.equalsIgnoreCase("charged")) {
|
|
|
+ tempResultString = "충전 완료 지속";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[0]);
|
|
|
+ } else if (tempString.equalsIgnoreCase("stop")) {
|
|
|
+ tempResultString = "충전 중지";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[0]);
|
|
|
+ } else if (tempString.equalsIgnoreCase("service_out")) {
|
|
|
+ tempResultString = "운영 정지";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[1]);
|
|
|
+ } else if (tempString.equalsIgnoreCase("check")) {
|
|
|
+ tempResultString = "점검 중";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[1]);
|
|
|
+ } else if (tempString.equalsIgnoreCase("commerror")) {
|
|
|
+ tempResultString = "통신 미 연결";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[1]);
|
|
|
+ } else {
|
|
|
+ tempResultString = "에러";
|
|
|
+ ELEC_CHARGER[i].setImageResource(mChargerImg[1]);
|
|
|
+ }
|
|
|
+ TXT_ChargerStatus[i].setText(tempResultString);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void LoadDataFromServerCharger() {
|
|
|
+ DebugLogOutput("LoadDataFromServerCharger");
|
|
|
+ Page3_PageBack.setImageResource(R.drawable.btn_back_disabled); // imap 통신 이후 이미지 바뀌는 현상 방지하기 위해
|
|
|
+ Page3_PageNext.setImageResource(R.drawable.btn_next_disabled);
|
|
|
+
|
|
|
+ Charger_Info = new CHARGER_INFO(0, "null");
|
|
|
+
|
|
|
+ imapElecCarChargerInfo.DoWork(Page3_Request_ChargerType);
|
|
|
+ imapElecCarChargerInfo.SetRetCtr(new RetProci() {
|
|
|
+ @Override
|
|
|
+ public void ProcSuccess() {
|
|
|
+ DebugLogOutput("ProcSuccess");
|
|
|
+
|
|
|
+ try {
|
|
|
+ int SetItemResult = imapElecCarChargerInfo.SetItem("charger_cnt");
|
|
|
+ if (SetItemResult != 1) {
|
|
|
+ DebugLogOutput("Error1 - SetItemResult : " + SetItemResult);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String sChargingCount = imapElecCarChargerInfo.GetItemVal(0);
|
|
|
+ int intChargingCount = Integer.parseInt(sChargingCount);
|
|
|
+ if (intChargingCount < 1) {
|
|
|
+ DebugLogOutput("Error2 - intChargingCount : " + intChargingCount);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SetItemResult = imapElecCarChargerInfo.SetItem("charger_info");
|
|
|
+
|
|
|
+ if (SetItemResult != intChargingCount) {
|
|
|
+ DebugLogOutput("Error3 - SetItemResult : " + SetItemResult);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Charger_Info = new CHARGER_INFO(intChargingCount, "null");
|
|
|
+
|
|
|
+ for (int i = 0; i < intChargingCount; i++) {
|
|
|
+ Charger_Info.inputArrayMethod(
|
|
|
+ imapElecCarChargerInfo.GetAttributeVal(i, "charger_num"),
|
|
|
+ imapElecCarChargerInfo.GetAttributeVal(i, "charger_loc"),
|
|
|
+ imapElecCarChargerInfo.GetAttributeVal(i, "charger_sort"),
|
|
|
+ imapElecCarChargerInfo.GetAttributeVal(i, "charger_status"),
|
|
|
+ imapElecCarChargerInfo.GetAttributeVal(i, "unit_price"),
|
|
|
+ imapElecCarChargerInfo.GetAttributeVal(i, "c_mst"));
|
|
|
+ }
|
|
|
+ imapElecCarChargerInfo.SetItem("message");
|
|
|
+ Charger_Info.message = imapElecCarChargerInfo.GetItemVal(0);
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", TAG, re);
|
|
|
+ } catch (Exception e) {
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", TAG, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void ProcError() {
|
|
|
+ DebugLogOutput("ProcError");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void ProcDoing() {
|
|
|
+ DebugLogOutput("ProcDoing");
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|