Pārlūkot izejas kodu

[공통][New] Event 클래스에 boolean 속성 추가

hyodong.min 7 gadi atpakaļ
vecāks
revīzija
b3667be2f5

+ 37 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/Event.java

@@ -80,6 +80,7 @@ public class Event {
   public static final int THIRD_CATEGORY = 52;
   public static final int FOURTH_CATEGORY = 53;
   public static final int FIFTH_CATEGORY = 54;
+  public static final int SWITCH = 55;
 
   @Retention(RetentionPolicy.SOURCE)
   @IntDef({
@@ -88,7 +89,8 @@ public class Event {
     SUCCESS, FAIL, CANCEL, EMAIL_CLICK, SPECIAL_CODE_CLICK, CONFIRM, RESULT, FAQ, DELETE,
     COMPLETED, TUTORIAL_END, EXIT, START, SETTING, BUCKET, MY_COIN, MY, TOGGLE, MY_BUCKET,
     ACTION_BAR_HOME, ACTION_BAR_ALARM, ACTION_BAR_SETTING, ACTION_BAR_CLOSE, ACTION_BAR_BACK,
-    ACTION_BAR_SEARCH, ACTION_BAR_MENU, ACTION_BAR_TITLE, FIRST_CATEGORY, SECOND_CATEGORY, THIRD_CATEGORY, FOURTH_CATEGORY, FIFTH_CATEGORY
+    ACTION_BAR_SEARCH, ACTION_BAR_MENU, ACTION_BAR_TITLE, FIRST_CATEGORY, SECOND_CATEGORY, THIRD_CATEGORY, FOURTH_CATEGORY, FIFTH_CATEGORY,
+    SWITCH,
   })
   public @interface ID {}
 
@@ -104,6 +106,10 @@ public class Event {
   public static final int MEMBER_UNDER_14YEARS = 1008;
   public static final int MEMBER_ALREADY_MEMBER = 1009;
 
+  // boolean
+  public static final String TRUE = "TRUE";
+  public static final String FALSE = "FALSE";
+
   /***********************************
    * Object
    ***********************************/
@@ -111,12 +117,14 @@ public class Event {
   private final int integer;
   private final String string;
   private final String json;
+  private final boolean bool;
 
   private Event(Builder builder) {
     this.eventId = builder.eventId;
     this.integer = builder.integer;
     this.string = builder.string;
     this.json = builder.json;
+    this.bool = builder.bool;
   }
 
   /**
@@ -146,6 +154,15 @@ public class Event {
     return string;
   }
 
+  /**
+   * boolean value
+   *
+   * @return
+   */
+  public boolean getBool() {
+    return bool;
+  }
+
   /**
    * json value
    *
@@ -166,6 +183,13 @@ public class Event {
     return new Gson().fromJson(json, beanClass);
   }
 
+  @Override
+  public String toString() {
+    StringBuilder builder = new StringBuilder();
+    builder.append("id: ").append(eventId).append(", int: ").append(integer).append(", str: ").append(string).append(", bool: ").append(bool).append(", json: ").append(json);
+
+    return builder.toString();
+  }
 
   /***********************************
    * Builder
@@ -178,6 +202,7 @@ public class Event {
     private int integer = NONE;
     private String string = null;
     private String json = null;
+    private boolean bool = false;
 
     /**
      * 필수 항목인 eventId 를 전달 받는다.
@@ -221,6 +246,17 @@ public class Event {
       return this;
     }
 
+    /**
+     * boolean 설정
+     *
+     * @param value
+     * @return
+     */
+    public Builder bool(boolean value) {
+      this.bool = value;
+      return this;
+    }
+
     /**
      * Event 객체 반환
      *