Browse Source

Merge branch 'develop' of https://github.com/swict/LifePlusAndroid into develop

Hasemi 7 years ago
parent
commit
c6a2cbe9e9

+ 5 - 0
app/src/main/AndroidManifest.xml

@@ -73,6 +73,11 @@
       android:screenOrientation="portrait"
       android:windowSoftInputMode="adjustResize">
     </activity>
+    <activity
+      android:name=".lifeplus.activity.ContentsNativeActivity"
+      android:screenOrientation="portrait"
+      android:windowSoftInputMode="adjustResize">
+    </activity>
 
     <activity
       android:name=".lifeplus.activity.LocationActivity"

+ 56 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/activity/ContentsNativeActivity.java

@@ -0,0 +1,56 @@
+/*
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
+ */
+package kr.co.zumo.app.lifeplus.activity;
+
+import android.content.Intent;
+
+import kr.co.zumo.app.lifeplus.bean.ContentsDeliveryBean;
+import kr.co.zumo.app.lifeplus.helper.DeliveryHelper;
+import kr.co.zumo.app.lifeplus.supervisor.ActivityDeliveryHelper;
+import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
+
+/**
+ * ContentsActivity
+ * <pre>
+ * </pre>
+ *
+ * @author 민효동
+ * @version 1.0
+ * @history 민효동   [2018. 9. 5.]   [최초 작성]
+ * @since 2018. 9. 5.
+ */
+public class ContentsNativeActivity extends ActivityBase {
+
+  @Override
+  protected void renderScreen() {
+
+    ContentsDeliveryBean contentsDeliveryBean = ActivityDeliveryHelper.getInstance().getPackaging(ContentsDeliveryBean.class);
+
+    DeliveryHelper deliveryHelper = getHelper(DeliveryHelper.class);
+    deliveryHelper.setPackaging(new ContentsDeliveryBean.Builder(contentsDeliveryBean.getContentsBean()).build());
+
+    ActivityDeliveryHelper.getInstance().clearPackaging();
+
+    // 첫 화면 표시
+    launchScreen(ScreenID.CONTENTS_NATIVE);
+  }
+
+  @Override
+  protected void onAfterNewIntent(Intent intent) {
+
+  }
+
+  @Override
+  protected void onAfterDestroy() {
+
+  }
+
+  @Override
+  protected void onBeforeDestroy() {
+
+  }
+
+}
+
+

+ 12 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/ContentsDetailResultBean.java

@@ -3,6 +3,8 @@
  */
 package kr.co.zumo.app.lifeplus.bean.api;
 
+import com.google.gson.annotations.SerializedName;
+
 /**
  * ContentsDetailResultBean
  * <pre>
@@ -14,4 +16,14 @@ package kr.co.zumo.app.lifeplus.bean.api;
  * @since 2018. 11. 22.
  */
 public class ContentsDetailResultBean extends LifeplusAPIResultObjectBean<ContentsDetailListBean> {
+  @SerializedName("lpCntsDtlUrl")
+  private String contentsUrl;
+
+  public String getContentsUrl() {
+    return contentsUrl;
+  }
+
+  public void setContentsUrl(String contentsUrl) {
+    this.contentsUrl = contentsUrl;
+  }
 }

+ 24 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/model/module/APIContentsDetailModule.java

@@ -3,8 +3,13 @@
  */
 package kr.co.zumo.app.lifeplus.model.module;
 
+import java.util.List;
+
 import io.reactivex.Single;
+import io.reactivex.functions.Function;
+import kr.co.zumo.app.lifeplus.bean.api.ContentsDetailBean;
 import kr.co.zumo.app.lifeplus.bean.api.ContentsDetailResultBean;
+import kr.co.zumo.app.lifeplus.bean.api.SeriesItemBean;
 import kr.co.zumo.app.lifeplus.bean.api.StringRequestBean;
 import kr.co.zumo.app.lifeplus.network.api.LifeplusAPIRepository;
 
@@ -19,8 +24,26 @@ import kr.co.zumo.app.lifeplus.network.api.LifeplusAPIRepository;
  * @since 2018. 11. 22.
  */
 public class APIContentsDetailModule extends APIModule<StringRequestBean, ContentsDetailResultBean> {
+
   @Override
   protected Single<ContentsDetailResultBean> getAPI(StringRequestBean requestBean) {
-    return new LifeplusAPIRepository().getContentsDetail(requestBean.getParam());
+    return new LifeplusAPIRepository().getContentsDetail(requestBean.getParam()).map(new Function<ContentsDetailResultBean, ContentsDetailResultBean>() {
+      @Override
+      public ContentsDetailResultBean apply(ContentsDetailResultBean contentsDetailResultBean) throws Exception {
+        String url = contentsDetailResultBean.getContentsUrl();
+        List<SeriesItemBean> seriesItemBeans = contentsDetailResultBean.getData().getSeriesItemList();
+        List<ContentsDetailBean> contentsDetailBeans = contentsDetailResultBean.getData().getItemDetailList();
+
+        // 시리즈 아이템에 ContentsUrl 을 맵핑해준다.
+        for (SeriesItemBean seriesItemBean : seriesItemBeans) {
+          seriesItemBean.setContentsUrl(url);
+        }
+        for (ContentsDetailBean contentsDetailBean : contentsDetailBeans) {
+          contentsDetailBean.setContentsUrl(url);
+        }
+
+        return contentsDetailResultBean;
+      }
+    });
   }
 }

+ 23 - 8
app/src/main/java/kr/co/zumo/app/lifeplus/supervisor/screen/ActivityScreen.java

@@ -9,6 +9,7 @@ import android.util.Log;
 
 import kr.co.zumo.app.lifeplus.activity.CategoryActivity;
 import kr.co.zumo.app.lifeplus.activity.ContentsActivity;
+import kr.co.zumo.app.lifeplus.activity.ContentsNativeActivity;
 import kr.co.zumo.app.lifeplus.activity.ContentsOverviewActivity;
 import kr.co.zumo.app.lifeplus.activity.MenuActivity;
 import kr.co.zumo.app.lifeplus.bean.CategoryDeliveryBean;
@@ -57,15 +58,13 @@ public class ActivityScreen extends Screen {
       case ScreenID.CONTENTS:
         intent = new Intent(context, ContentsActivity.class);
 
-        deliveryHelper = helper.getDeliveryHelper();
-        contentsDeliveryBean = deliveryHelper.getPackaging(ContentsDeliveryBean.class);
-
-        if (null != contentsDeliveryBean.getContentsBean()) {
-          Log.w("APP# ActivityScreen | change", "|" + contentsDeliveryBean.getContentsBean().toPrettyJson());
+        setContentsPackage();
 
-          ActivityDeliveryHelper.getInstance().setPackaging(contentsDeliveryBean);
-          deliveryHelper.clearPackaging();
-        }
+        break;
+      case ScreenID.CONTENTS_NATIVE:
+        intent = new Intent(context, ContentsNativeActivity.class);
+        
+        setContentsPackage();
 
         break;
       case ScreenID.OVER_VIEW:
@@ -91,4 +90,20 @@ public class ActivityScreen extends Screen {
       context.startActivity(intent);
     }
   }
+
+  private void setContentsPackage() {
+
+    DeliveryHelper deliveryHelper;
+    ContentsDeliveryBean contentsDeliveryBean;
+
+    deliveryHelper = helper.getDeliveryHelper();
+    contentsDeliveryBean = deliveryHelper.getPackaging(ContentsDeliveryBean.class);
+
+    if (null != contentsDeliveryBean.getContentsBean()) {
+      Log.w("APP# ActivityScreen | change", "|" + contentsDeliveryBean.getContentsBean().toPrettyJson());
+
+      ActivityDeliveryHelper.getInstance().setPackaging(contentsDeliveryBean);
+      deliveryHelper.clearPackaging();
+    }
+  }
 }

+ 3 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/supervisor/screen/ScreenManager.java

@@ -58,6 +58,9 @@ public class ScreenManager implements IScreen {
         case ScreenID.CONTENTS:
           screen = new ActivityScreen(helper, id, direction, method);
           break;
+        case ScreenID.CONTENTS_NATIVE:
+          screen = new ActivityScreen(helper, id, direction, method);
+          break;
         case ScreenID.OVER_VIEW:
           screen = new ActivityScreen(helper, id, direction, method);
           break;