NoticeTakePicture.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package kr.co.icontrols.wallpadcall.popup;
  2. import android.content.Context;
  3. import android.graphics.Color;
  4. import android.util.Log;
  5. import android.view.Gravity;
  6. import android.view.MotionEvent;
  7. import android.view.View;
  8. import android.widget.RelativeLayout;
  9. import com.util.LogUtil;
  10. import kr.co.icontrols.wallpadcall.MainActivity;
  11. import kr.co.icontrols.wallpadcall.R;
  12. import kr.co.icontrols.wallpadcall.declare.Common;
  13. import kr.co.icontrols.wallpadcall.declare.ID;
  14. import kr.co.icontrols.wallpadsupport.WpadImageView;
  15. import kr.co.icontrols.wallpadsupport.WpadScreen;
  16. import kr.co.icontrols.wallpadsupport.WpadSound;
  17. import kr.co.icontrols.wallpadsupport.WpadTextView;
  18. /**
  19. * 스마트현관카메라 거동수상자 사진촬영상 알림 팝업
  20. */
  21. public class NoticeTakePicture extends WpadScreen {
  22. private final String TAG = "NoticeTakePicture";
  23. Context mContext;
  24. WpadImageView IMG_BACKGROUND;
  25. WpadImageView IMG_ICON;
  26. WpadImageView BTN_END;
  27. WpadTextView TXT_INSTRUCTION;
  28. WpadTextView TXT_INSTRUCTION2;
  29. String strINSTRUCTION = "거동수상자 사진 촬영중입니다.";
  30. String strINSTRUCTION2 = "사진 촬영을 종료하려면 종료버튼을 누르세요. 현재까지 촬영된 파일만 저장됩니다.";
  31. public NoticeTakePicture(Context context, RelativeLayout layout) {
  32. super(context, layout);
  33. try {
  34. mContext = context;
  35. IMG_BACKGROUND = new WpadImageView(context, WpadImageView.TOUCH_KIND.NONE, 990, 576, R.drawable.bg_popupalarm, 0, ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.IMAGE.BACKGROUND);
  36. ViewRegistration(layout, IMG_BACKGROUND, 0, 0);
  37. IMG_ICON = new WpadImageView(context, WpadImageView.TOUCH_KIND.NONE, 180, 180, R.drawable.icon_recording, 0, ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.IMAGE.ICON);
  38. ViewRegistration(layout, IMG_ICON, Common.PopupAlarmMarginLEFT(550), Common.PopupAlarmMarginTOP(283));
  39. BTN_END = new WpadImageView(context, WpadImageView.TOUCH_KIND.BUTTON, 360, 80, R.drawable.popup_btn_end_normal, R.drawable.popup_btn_end_pressed,ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.BUTTON.END);
  40. ViewRegistration(layout, BTN_END, Common.PopupAlarmMarginLEFT(460), Common.PopupAlarmMarginTOP(585));
  41. TXT_INSTRUCTION = new WpadTextView(context, false, 984, 90, Gravity.CENTER, Color.WHITE, Common.fontsize._44, true, ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.TEXT.INSTRUCTION);
  42. ViewRegistration(layout, TXT_INSTRUCTION, Common.PopupAlarmMarginLEFT(147), Common.PopupAlarmMarginTOP(119));
  43. TXT_INSTRUCTION.setText(strINSTRUCTION);
  44. TXT_INSTRUCTION2 = new WpadTextView(context, false, 984, 90, Gravity.CENTER, Color.GRAY, Common.fontsize._20, false, ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.TEXT.INSTRUCTION2);
  45. ViewRegistration(layout, TXT_INSTRUCTION2, Common.PopupAlarmMarginLEFT(147), Common.PopupAlarmMarginTOP(500));
  46. TXT_INSTRUCTION2.setText(strINSTRUCTION2);
  47. } catch (RuntimeException re) {
  48. LogUtil.errorLogInfo("", TAG, re);
  49. } catch (Exception e) {
  50. Log.e(TAG, "[Exception] NoticeTakePicture(Context context, RelativeLayout layout)");
  51. //e.printStackTrace();
  52. LogUtil.errorLogInfo("", TAG, e);
  53. }
  54. }
  55. @Override
  56. protected void onClose() {
  57. super.onClose();
  58. try {
  59. Log.d(TAG, "[onClose]");
  60. } catch (RuntimeException re) {
  61. LogUtil.errorLogInfo("", TAG, re);
  62. } catch (Exception e) {
  63. Log.e(TAG, "[Exception] onClose()");
  64. //e.printStackTrace();
  65. LogUtil.errorLogInfo("", TAG, e);
  66. }
  67. }
  68. @Override
  69. protected void onTouchEvent(View v, MotionEvent event) {
  70. super.onTouchEvent(v, event);
  71. try {
  72. int nEvent = event.getAction();
  73. int nID = v.getId();
  74. if (nEvent == MotionEvent.ACTION_UP) {
  75. if (nID == ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.BUTTON.END) {
  76. Log.d(TAG, "[onTouchEvent] ID.POPUP.NOTICE_TAKEPICTURE.ELEMENT.BUTTON.END");
  77. MainActivity.mSound.Play(WpadSound.SND.effect.TOUCH_LATCHED);
  78. finish();
  79. }
  80. }
  81. } catch (RuntimeException re) {
  82. LogUtil.errorLogInfo("", TAG, re);
  83. } catch (Exception e) {
  84. Log.e(TAG, "[Exception] onTouchEvent(View v, MotionEvent event)");
  85. //e.printStackTrace();
  86. LogUtil.errorLogInfo("", TAG, e);
  87. }
  88. }
  89. }