Browse Source

no message

Hasemi 6 years ago
parent
commit
da7a6802d5
16 changed files with 90 additions and 287 deletions
  1. 0 119
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationAdapter.java
  2. 0 50
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationAgreeViewHolder.java
  3. 0 23
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationNoticeViewHolder.java
  4. 0 36
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationScoreViewHolder.java
  5. 0 45
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationTitleViewHolder.java
  6. 51 0
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionAgreeView.java
  7. 2 2
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationEmailViewHolder.java
  8. 2 2
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationButtonViewHolder.java
  9. 21 4
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationFragment.java
  10. 2 2
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationImageViewHolder.java
  11. 0 0
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionModel.java
  12. 2 2
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationMultipleChoiceViewHolder.java
  13. 0 0
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionPresenter.java
  14. 10 2
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationSingleHolder.java
  15. 0 0
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionView.java
  16. 0 0
      app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/IEventQuestionView.java

+ 0 - 119
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationAdapter.java

@@ -1,119 +0,0 @@
-package kr.co.zumo.app.lifeplus.view.screen.event;
-
-import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import kr.co.zumo.app.R;
-import kr.co.zumo.app.lifeplus.view.IEventListener;
-
-/**
- * EventParticipationAdapter
- * <pre>
- * </pre>
- *
- * @author 하세미
- * @version 1.0
- * @history 하세미   [2019-01-09]   [최초 작성]
- * @since 2019-01-09
- */
-public class EventParticipationAdapter extends RecyclerView.Adapter<EventParticipationView> {
-
-  private Context context;
-  private IEventListener listener;
-  private LayoutInflater inflater;
-
-  private static final int LIST_COUNT = 9;
-
-  private static final int TYPE_TITLE = 0;
-  private static final int TYPE_EMAIL = 1;
-  private static final int TYPE_NICKNAME = 2;
-  private static final int TYPE_SCORE = 3;
-  private static final int TYPE_MULTIPLE_CHOICE = 4;
-  private static final int TYPE_IMAGE = 5;
-  private static final int TYPE_AGREE = 6;
-  private static final int TYPE_BUTTON = 7;
-  private static final int TYPE_NOTICE = 8;
-
-  public EventParticipationAdapter(Context context, IEventListener listener) {
-    this.context = context;
-    this.listener = listener;
-    this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-  }
-
-  @NonNull
-  @Override
-  public EventParticipationView onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
-    View view;
-    switch (viewType) {
-      case TYPE_TITLE:
-        view = inflater.inflate(R.layout.event_participation_item_title, parent, false);
-        return new EventParticipationTitleViewHolder(view);
-      case TYPE_EMAIL:
-        view = inflater.inflate(R.layout.event_participation_item_answer, parent, false);
-        return new EventParticipationEmailViewHolder(view);
-      case TYPE_NICKNAME:
-        view = inflater.inflate(R.layout.event_participation_item_single_choice, parent, false);
-        return new EventParticipationSingleHolder(view);
-//      case TYPE_SCORE:
-//        view = inflater.inflate(R.layout.event_participation_item_score, parent, false);
-//        return new EventParticipationScoreViewHolder(view);
-      case TYPE_MULTIPLE_CHOICE:
-        view = inflater.inflate(R.layout.event_participation_item_multiple_choice, parent, false);
-        return new EventParticipationMultipleChoiceViewHolder(view);
-      case TYPE_IMAGE:
-        view = inflater.inflate(R.layout.event_participation_item_image, parent, false);
-        return new EventParticipationImageViewHolder(view);
-      case TYPE_AGREE:
-        view = inflater.inflate(R.layout.event_participation_item_agree, parent, false);
-        return new EventParticipationAgreeViewHolder(view);
-      case TYPE_BUTTON:
-        view = inflater.inflate(R.layout.event_participation_item_button, parent, false);
-        return new EventParticipationButtonViewHolder(view);
-      case TYPE_NOTICE:
-        view = inflater.inflate(R.layout.event_participation_item_notice, parent, false);
-        return new EventParticipationNoticeViewHolder(view);
-      default:
-        break;
-    }
-    return null;
-  }
-
-  @Override
-  public void onBindViewHolder(@NonNull EventParticipationView holder, int position) {
-    holder.init(listener);
-  }
-
-  @Override
-  public int getItemCount() {
-    return LIST_COUNT;
-  }
-
-  @Override
-  public int getItemViewType(int position) {
-    switch (position) {
-      case 0:
-        return TYPE_TITLE;
-      case 1:
-        return TYPE_EMAIL;
-      case 2:
-        return TYPE_NICKNAME;
-      case 3:
-        return TYPE_SCORE;
-      case 4:
-        return TYPE_MULTIPLE_CHOICE;
-      case 5:
-        return TYPE_IMAGE;
-      case 6:
-        return TYPE_AGREE;
-      case 7:
-        return TYPE_BUTTON;
-      default:
-        return TYPE_NOTICE;
-    }
-  }
-
-}

+ 0 - 50
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationAgreeViewHolder.java

@@ -1,50 +0,0 @@
-package kr.co.zumo.app.lifeplus.view.screen.event;
-
-import android.graphics.Bitmap;
-import android.graphics.drawable.StateListDrawable;
-import android.view.View;
-import android.widget.CheckBox;
-
-import kr.co.zumo.app.R;
-import kr.co.zumo.app.lifeplus.view.IEventListener;
-
-/**
- * EventParticipationAgreeViewHolder
- * <pre>
- * </pre>
- *
- * @author 하세미
- * @version 1.0
- * @history 하세미   [2019-01-09]   [최초 작성]
- * @since 2019-01-09
- */
-class EventParticipationAgreeViewHolder extends EventParticipationView {
-
-  private CheckBox checkBoxAll;
-  private CheckBox checkBox1;
-
-  public EventParticipationAgreeViewHolder(View view) {
-    super(view);
-    checkBoxAll = view.findViewById(R.id.checkbox_all_agree);
-    checkBox1 = view.findViewById(R.id.checkbox_agree1);
-
-  }
-
-  @Override
-  public void init(IEventListener listener) {
-    checkBoxAll.setButtonDrawable(getStateListDrawable());
-    checkBox1.setButtonDrawable(getStateListDrawable());
-
-  }
-
-  private StateListDrawable getStateListDrawable() {
-    StateListDrawable stateListDrawable = new StateListDrawable();
-    stateListDrawable.addState(new int[]{android.R.attr.state_checked}, itemView.getContext().getResources().getDrawable(R.drawable.ic_checkbox_on));
-    stateListDrawable.addState(new int[]{-android.R.attr.state_checked}, itemView.getContext().getResources().getDrawable(R.drawable.ic_checkbox_off));
-    return stateListDrawable;
-  }
-
-  @Override
-  public void setUploadImage(Bitmap image) {
-  }
-}

+ 0 - 23
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationNoticeViewHolder.java

@@ -1,23 +0,0 @@
-package kr.co.zumo.app.lifeplus.view.screen.event;
-
-import android.graphics.Bitmap;
-import android.view.View;
-
-/**
- * EventParticipationNoticeViewHolder
- * <pre>
- * </pre>
- *
- * @author 하세미
- * @version 1.0
- * @history 하세미   [2019-01-09]   [최초 작성]
- * @since 2019-01-09
- */
-class EventParticipationNoticeViewHolder extends EventParticipationView {
-  public EventParticipationNoticeViewHolder(View view) {super(view);}
-
-  @Override
-  public void setUploadImage(Bitmap image) {
-
-  }
-}

+ 0 - 36
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationScoreViewHolder.java

@@ -1,36 +0,0 @@
-package kr.co.zumo.app.lifeplus.view.screen.event;
-
-import android.graphics.Bitmap;
-import android.view.View;
-import android.widget.TextView;
-
-import kr.co.zumo.app.R;
-import kr.co.zumo.app.lifeplus.view.custom.ClearEditText;
-
-/**
- * EventParticipationScoreViewHolder
- * <pre>
- * </pre>
- *
- * @author 하세미
- * @version 1.0
- * @history 하세미   [2019-01-09]   [최초 작성]
- * @since 2019-01-09
- */
-public class EventParticipationScoreViewHolder extends EventParticipationView {
-
-  private ClearEditText textScore1;
-  private ClearEditText textScore2;
-  private TextView textViewScoreValidation;
-
-  public EventParticipationScoreViewHolder(View view) {
-    super(view);
-    textScore1 = view.findViewById(R.id.edit_text_score1);
-    textScore2 = view.findViewById(R.id.edit_text_score2);
-    textViewScoreValidation = view.findViewById(R.id.text_view_score_validation);
-  }
-
-  @Override
-  public void setUploadImage(Bitmap image) {
-  }
-}

+ 0 - 45
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationTitleViewHolder.java

@@ -1,45 +0,0 @@
-package kr.co.zumo.app.lifeplus.view.screen.event;
-
-import android.graphics.Bitmap;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import kr.co.zumo.app.R;
-import kr.co.zumo.app.lifeplus.view.IEventListener;
-
-/**
- * EventParticipationTitleViewHolder
- * <pre>
- * </pre>
- *
- * @author 하세미
- * @version 1.0
- * @history 하세미   [2019-01-09]   [최초 작성]
- * @since 2019-01-09
- */
-public class EventParticipationTitleViewHolder extends EventParticipationView {
-
-  private ImageView imageViewBackground;
-  private TextView textViewTitle;
-  private TextView textViewSubTitle;
-
-  public EventParticipationTitleViewHolder(View itemView) {
-    super(itemView);
-    imageViewBackground = itemView.findViewById(R.id.image_view_background);
-    textViewTitle = itemView.findViewById(R.id.text_view_title);
-    textViewSubTitle = itemView.findViewById(R.id.text_view_sub_title);
-  }
-
-  @Override
-  public void init(IEventListener listener) {
-    imageViewBackground.setImageDrawable(itemView.getResources().getDrawable(R.drawable.banner_bg_1));
-    textViewTitle.setText("앱 후기 남기고 \n1,000코인 득템하자!");
-    textViewSubTitle.setText("2018.07.15 ~ 2018.07.22");
-  }
-
-  @Override
-  public void setUploadImage(Bitmap image) {
-
-  }
-}

+ 51 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionAgreeView.java

@@ -0,0 +1,51 @@
+package kr.co.zumo.app.lifeplus.view.screen.event;
+
+import android.view.View;
+import android.widget.CheckBox;
+
+import kr.co.zumo.app.lifeplus.bean.api.EventQuestionBean;
+
+/**
+ * EventParticipationAgreeViewHolder
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2019-01-09]   [최초 작성]
+ * @since 2019-01-09
+ */
+class EventQuestionAgreeViewHolder extends EventQuestionView {
+
+  private CheckBox checkBoxAll;
+  private CheckBox checkBox1;
+
+  public EventQuestionAgreeViewHolder(View itemView, EventQuestionBean bean) {
+    super(itemView, bean);
+  }
+//
+//  public EventQuestionAgreeViewHolder(View view) {
+//    super(view);
+//    checkBoxAll = view.findViewById(R.id.checkbox_all_agree);
+//    checkBox1 = view.findViewById(R.id.checkbox_agree1);
+//
+//  }
+//
+//  @Override
+//  public void init(IEventListener listener) {
+//    checkBoxAll.setButtonDrawable(getStateListDrawable());
+//    checkBox1.setButtonDrawable(getStateListDrawable());
+//
+//  }
+//
+//  private StateListDrawable getStateListDrawable() {
+//    StateListDrawable stateListDrawable = new StateListDrawable();
+//    stateListDrawable.addState(new int[]{android.R.attr.state_checked}, itemView.getContext().getResources().getDrawable(R.drawable.ic_checkbox_on));
+//    stateListDrawable.addState(new int[]{-android.R.attr.state_checked}, itemView.getContext().getResources().getDrawable(R.drawable.ic_checkbox_off));
+//    return stateListDrawable;
+//  }
+//
+//  @Override
+//  public void setUploadImage(Bitmap image) {
+//  }
+}

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationEmailViewHolder.java

@@ -18,12 +18,12 @@ import kr.co.zumo.app.lifeplus.view.custom.ClearEditText;
  * @history 하세미   [2019-01-09]   [최초 작성]
  * @since 2019-01-09
  */
-public class EventParticipationEmailViewHolder extends EventParticipationView {
+public class EventQuestionEmailViewHolder extends EventQuestionView {
 
   private ClearEditText editTextEmail;
   private TextView textViewValidation;
 
-  public EventParticipationEmailViewHolder(View view) {
+  public EventQuestionEmailViewHolder(View view) {
     super(view);
     editTextEmail = view.findViewById(R.id.edit_text_email);
     textViewValidation = view.findViewById(R.id.text_recommend_validation);

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationButtonViewHolder.java

@@ -16,11 +16,11 @@ import kr.co.zumo.app.R;
  * @history 하세미   [2019-01-09]   [최초 작성]
  * @since 2019-01-09
  */
-public class EventParticipationButtonViewHolder extends EventParticipationView {
+public class EventQuestionButtonViewHolder extends EventQuestionView {
 
   private ConstraintLayout layoutButton;
 
-  public EventParticipationButtonViewHolder(View view) {
+  public EventQuestionButtonViewHolder(View view) {
     super(view);
     layoutButton = view.findViewById(R.id.layout_button);
   }

+ 21 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationFragment.java

@@ -42,7 +42,7 @@ import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
  * @history 하세미   [2019-01-09]   [최초 작성]
  * @since 2019-01-09
  */
-public class EventParticipationFragment extends FragmentBase<EventParticipationPresenter> implements IEventParticipationView {
+public class EventParticipationFragment extends FragmentBase<EventQuestionPresenter> implements IEventParticipationView {
 
   private static final int GET_ALBUM_PHOTO = 1;
   private Bitmap uploadImage;
@@ -71,8 +71,8 @@ public class EventParticipationFragment extends FragmentBase<EventParticipationP
   }
 
   @Override
-  protected EventParticipationPresenter definePresenter() {
-    return new EventParticipationPresenter(getModel(EventParticipationModel.class), this);
+  protected EventQuestionPresenter definePresenter() {
+    return new EventQuestionPresenter(getModel(EventQuestionModel.class), this);
   }
 
   @Override
@@ -136,8 +136,25 @@ public class EventParticipationFragment extends FragmentBase<EventParticipationP
 
 
     for (int i = 0; i < detailBean.getEventQuestionList().size(); ++i) {
+      View questionItemView = null;
       EventQuestionBean eventQuestionBean = detailBean.getEventQuestionList().get(i);
-      Log.e("APP#  EventParticipationFragment | drawList", "|" + detailBean.getEventQuestionList().size());
+      if (eventQuestionBean.getQuestionType().equals(EventQuestionBean.QUESTION_TYPE_SINGLE)) {
+        questionItemView = inflater.inflate(R.layout.event_participation_item_single_choice, null);
+        EventQuestionSingleHolder eventParticipationSingleHolder = new EventQuestionSingleHolder(questionItemView, eventQuestionBean);
+
+      }
+      else if (eventQuestionBean.getQuestionType().equals(EventQuestionBean.QUESTION_TYPE_MULTI)) {
+        questionItemView = inflater.inflate(R.layout.event_participation_item_multiple_choice, null);
+
+      }
+      else if (eventQuestionBean.getQuestionType().equals(EventQuestionBean.QUESTION_TYPE_ANSWER)) {
+        questionItemView = inflater.inflate(R.layout.event_participation_item_answer, null);
+
+      }
+      else {
+
+        questionItemView = inflater.inflate(R.layout.event_participation_item_image, null);
+      }
     }
 
   }

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationImageViewHolder.java

@@ -26,14 +26,14 @@ import kr.co.zumo.app.lifeplus.view.IEventListener;
  * @history 하세미   [2019-01-09]   [최초 작성]
  * @since 2019-01-09
  */
-public class EventParticipationImageViewHolder extends EventParticipationView {
+public class EventQuestionImageViewHolder extends EventQuestionView {
 
   private ConstraintLayout layoutCamera;
   private FlowLayout container;
   private IEventListener listener;
   private int count;
 
-  public EventParticipationImageViewHolder(View view) {
+  public EventQuestionImageViewHolder(View view) {
     super(view);
     layoutCamera = view.findViewById(R.id.layout_camera);
     container = view.findViewById(R.id.layout_container);

app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationModel.java → app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionModel.java


+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationMultipleChoiceViewHolder.java

@@ -22,12 +22,12 @@ import kr.co.zumo.app.lifeplus.view.custom.EventParticipationCheckbox;
  * @history 하세미   [2019-01-16]   [최초 작성]
  * @since 2019-01-16
  */
-class EventParticipationMultipleChoiceViewHolder extends EventParticipationView {
+class EventQuestionMultipleChoiceViewHolder extends EventQuestionView {
 
   private TextView textViewTitle;
   private LinearLayout layoutChoiceView;
 
-  public EventParticipationMultipleChoiceViewHolder(View view) {
+  public EventQuestionMultipleChoiceViewHolder(View view) {
     super(view);
     textViewTitle = view.findViewById(R.id.text_view_title);
     layoutChoiceView = view.findViewById(R.id.choice_view);

app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationPresenter.java → app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionPresenter.java


+ 10 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationSingleHolder.java

@@ -6,6 +6,9 @@ import android.widget.RadioGroup;
 import android.widget.TextView;
 
 import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.bean.api.EventDetailBean;
+import kr.co.zumo.app.lifeplus.bean.api.EventQuestionBean;
+import kr.co.zumo.app.lifeplus.view.IEventListener;
 import kr.co.zumo.app.lifeplus.view.custom.ClearEditText;
 
 /**
@@ -18,18 +21,23 @@ import kr.co.zumo.app.lifeplus.view.custom.ClearEditText;
  * @history 하세미   [2019-01-09]   [최초 작성]
  * @since 2019-01-09
  */
-public class EventParticipationSingleHolder extends EventParticipationView {
+public class EventQuestionSingleHolder extends EventQuestionView {
 
   private RadioGroup radioGroupStore;
   private ClearEditText editTextNickName;
   private TextView textViewNickNameValidation;
 
-  public EventParticipationSingleHolder(View view) {
+  public EventQuestionSingleHolder(View view, EventQuestionBean bean) {
     super(view);
     radioGroupStore = view.findViewById(R.id.radio_group_store);
     editTextNickName = view.findViewById(R.id.edit_text_nickname);
   }
 
+  @Override
+  public void init(IEventListener listener, EventDetailBean bean) {
+    super.init(listener, bean);
+  }
+
   @Override
   public void setUploadImage(Bitmap image) {
   }

app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventParticipationView.java → app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventQuestionView.java


app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/IEventParticipationView.java → app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/IEventQuestionView.java