فهرست منبع

[이벤트][New] 응모형 이벤트 종료

hyodong.min 6 سال پیش
والد
کامیت
6883a14173

+ 10 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/EventEntryBean.java

@@ -90,6 +90,15 @@ public class EventEntryBean extends EventBean {
     return isLast;
   }
 
+  /**
+   * 당첨자 발표 여부
+   *
+   * @return
+   */
+  public boolean hasWinner() {
+    return APIData.isTrue(APIData.TRUE.equals(getWinner()) ? APIData.TRUE : APIData.FALSE);
+  }
+
   public static EventEntryBean copyOf(EventDetailBean eventDetailBean) {
 
     EventEntryBean entryBean = new EventEntryBean();
@@ -99,6 +108,7 @@ public class EventEntryBean extends EventBean {
     entryBean.setButtonLinkType(eventDetailBean.getButtonLinkType());
     entryBean.setTitle(eventDetailBean.getTitle());
     entryBean.setSubTitle(eventDetailBean.getSubTitle());
+    entryBean.setWinner(eventDetailBean.getWinner());
     entryBean.setAvailableEntry(APIData.isTrue(eventDetailBean.getEntryAvailable()));
 
     entryBean.setImageUrl(eventDetailBean.getImageUrl());

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

@@ -15,7 +15,6 @@ import kr.co.zumo.app.lifeplus.view.dialog.EventNoticeDialog;
 import kr.co.zumo.app.lifeplus.view.dialog.IAttribute;
 import kr.co.zumo.app.lifeplus.view.dialog.ICustomDialogListener;
 import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
-import kr.co.zumo.app.lifeplus.view.screen.common.CoinPopupDriver;
 
 /**
  * EventDetailEntryPresenter
@@ -67,6 +66,7 @@ public class EventDetailEntryPresenter extends Presenter<EventDetailModel, IEven
 
   @Override
   protected void startInternal() {
+    // 이벤트 참여 여부 확인
     String eventResponseNo = model.getResultPackaging(String.class);
     if (null != eventResponseNo) {
       model.clearResultPackaging();
@@ -120,6 +120,13 @@ public class EventDetailEntryPresenter extends Presenter<EventDetailModel, IEven
           showPopupForGuest();
         }
         break;
+      case Event.WINNER_ANNOUNCEMENT:
+        // 당첨자 발표
+        if (model.hasWinner()) {
+          model.setDeliveryPackaging(model.getEventNo());
+          go(ScreenID.EVENT_WINNER);
+        }
+        break;
       case Event.RECOMMEND:
         // TODO: 사용자 선택 값에 따른 추천 컨텐츠 보여주기 
         view.setScrollToPosition(event.getIndex() + 1);
@@ -200,15 +207,6 @@ public class EventDetailEntryPresenter extends Presenter<EventDetailModel, IEven
       .show();
   }
 
-  private void showCoinSavingDialog() {
-
-    CoinPopupDriver coinPopupDriver = new CoinPopupDriver(getFragmentManager(), () -> {}, () -> {});
-
-    // fixme 코인 값 수정
-    coinPopupDriver.show(10000, 800, R.string.coin_event_completed);
-
-  }
-
   public void onChangedPageIndex(int index) {
     //참여형 이벤트일 때 페이지 번호 노출
     int len = model.getEventEntryList().size();

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

@@ -160,4 +160,22 @@ public class EventDetailModel extends Model {
       }
     }
   }
+
+  /**
+   * 당첨자 발표 여부
+   *
+   * @return
+   */
+  public boolean hasWinner() {
+    return APIData.isTrue(eventDetailBean.getWinner());
+  }
+
+  /**
+   * 이벤트 종료 여부
+   *
+   * @return
+   */
+  public boolean isEventEnd() {
+    return eventDetailBean.isEventEnd();
+  }
 }

+ 26 - 15
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventDetailView.java

@@ -2,7 +2,7 @@ package kr.co.zumo.app.lifeplus.view.screen.event;
 
 import android.support.v7.widget.RecyclerView;
 import android.view.View;
-import android.widget.TextView;
+import android.widget.Button;
 
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.bean.api.EventEntryBean;
@@ -21,34 +21,45 @@ import kr.co.zumo.app.lifeplus.view.IEventListener;
  */
 public abstract class EventDetailView<T extends EventEntryBean> extends RecyclerView.ViewHolder {
 
-  protected View viewEntry;
-  protected TextView textEntry;
+  protected Button buttonEntry;
 
   public EventDetailView(View itemView) {
     super(itemView);
-    viewEntry = itemView.findViewById(R.id.layout_bottom_button);
-    textEntry = itemView.findViewById(R.id.text_entry);
+    buttonEntry = itemView.findViewById(R.id.button_entry);
   }
 
   public final void init(T bean, IEventListener listener) {
-    if (null != bean && null != viewEntry) {
+    if (null != bean && null != buttonEntry) {
       if (bean.isLast()) {
-        viewEntry.setVisibility(View.VISIBLE);
-        textEntry.setText(bean.getButtonName());
+        buttonEntry.setVisibility(View.VISIBLE);
 
-        if (bean.isAvailableEntry()) {
-          viewEntry.setEnabled(true);
-          viewEntry.setOnClickListener(view -> {
-            listener.onEvent(new Event.Builder(Event.ENTRY).build());
+        if (bean.hasWinner()) {
+          buttonEntry.setText(R.string.winner_announcement);
+          buttonEntry.setEnabled(true);
+          buttonEntry.setOnClickListener(view -> {
+            listener.onEvent(new Event.Builder(Event.WINNER_ANNOUNCEMENT).build());
           });
         }
+        else if (bean.isEventEnd()) {
+          buttonEntry.setText(R.string.event_end_button);
+          buttonEntry.setEnabled(false);
+        }
         else {
-          viewEntry.setEnabled(false);
+          buttonEntry.setText(bean.getButtonName());
+          if (bean.isAvailableEntry()) {
+            buttonEntry.setEnabled(true);
+            buttonEntry.setOnClickListener(view -> {
+              listener.onEvent(new Event.Builder(Event.ENTRY).build());
+            });
+          }
+          else {
+            buttonEntry.setEnabled(false);
+          }
         }
 
       }
       else {
-        viewEntry.setVisibility(View.GONE);
+        buttonEntry.setVisibility(View.GONE);
       }
     }
 
@@ -63,6 +74,6 @@ public abstract class EventDetailView<T extends EventEntryBean> extends Recycler
    * 참여하기 버튼 비활성
    */
   public void setDisableButton() {
-    viewEntry.setEnabled(false);
+    buttonEntry.setEnabled(false);
   }
 }

+ 1 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/question/EventQuestionModel.java

@@ -218,7 +218,7 @@ public class EventQuestionModel extends CoinModel implements IUriListProvider {
       public void onApiSuccess(EventAnswerResultBean resultBean) {
         eventAnswerResultBean = resultBean;
         setGivenCoin(eventAnswerResultBean.getGivenCoin());
-        
+
         onResult(new Event.Builder(Event.SUCCESS).integer(Event.LOADED_EVENT_ANSWER).build());
       }
 

+ 10 - 0
app/src/main/res/drawable/white_grey_background.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+  <item
+    android:drawable="@color/C999999"
+    android:state_enabled="false"/>
+  <item
+    android:drawable="@color/CFFFFFF"
+    android:state_enabled="true"/>
+
+</selector>

+ 10 - 26
app/src/main/res/layout/event_enter_type_image.xml

@@ -30,39 +30,23 @@
     android:background="@drawable/card_dim_bottom_12"
     app:layout_constraintBottom_toBottomOf="parent"/>
 
-  <android.support.constraint.ConstraintLayout
-    android:id="@+id/layout_bottom_button"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_marginStart="25dp"
-    android:layout_marginEnd="25dp"
-    android:layout_marginBottom="25dp"
-    android:background="@drawable/rectangle_cffffff_radius_2"
-    android:visibility="gone"
-    app:layout_constraintBottom_toBottomOf="parent"
-    app:layout_constraintEnd_toEndOf="parent"
-    app:layout_constraintHorizontal_bias="1.0"
-    app:layout_constraintStart_toStartOf="parent">
-
-    <TextView
-      android:id="@+id/text_entry"
-      android:layout_width="wrap_content"
+    <Button
+      android:id="@+id/button_entry"
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_marginStart="106dp"
-      android:layout_marginTop="11dp"
-      android:layout_marginEnd="106dp"
-      android:layout_marginBottom="11dp"
-      android:gravity="center_horizontal"
-      android:lineSpacingExtra="6sp"
+      android:layout_marginStart="25dp"
+      android:layout_marginEnd="25dp"
+      android:layout_marginBottom="25dp"
+      android:lineSpacingExtra="0dp"
       android:text="@string/enter"
       android:textColor="@color/C000000"
       android:textSize="15sp"
+      android:background="@drawable/white_grey_background"
+      android:visibility="gone"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toTopOf="parent"
-
+      tools:visibility="visible"
       />
 
-  </android.support.constraint.ConstraintLayout>
 </android.support.constraint.ConstraintLayout>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -599,6 +599,7 @@
   <string name="event_ing">진행중인 이벤트</string>
   <string name="winner_announcement">당첨자 발표</string>
   <string name="event_none">참여하신 이벤트가 없습니다</string>
+  <string name="event_end_button">이벤트 종료</string>
   <string name="show_event">이벤트 보기</string>
   <string name="event_date">2018.08.13. 11:24</string>
   <string name="event_title">디뮤지엄 전시회 티켓 증정 이벤트</string>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
app/src/sandbox/java/kr/co/zumo/app/lifeplus/network/api/LifeplusAPIService.java