Selaa lähdekoodia

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

Hasemi 7 vuotta sitten
vanhempi
commit
a98727fdb4

+ 5 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/helper/DeliveryHelper.java

@@ -5,6 +5,8 @@ package kr.co.zumo.app.lifeplus.helper;
 
 import android.util.Log;
 
+import io.reactivex.annotations.Nullable;
+
 /**
  * DeliveryHelper
  * - 스크린 간 데이터 공유를 위해서 Activity 에 저장되어 있는 helper
@@ -27,6 +29,7 @@ public class DeliveryHelper extends Helper {
    * @param nameClass Bean.class
    * @return exist bean object or null
    */
+  @Nullable
   public <T> T getPackaging(Class<T> nameClass) {
     if (null != packaging && packaging.getClass().isAssignableFrom(nameClass)) {
       return (T) packaging;
@@ -41,7 +44,7 @@ public class DeliveryHelper extends Helper {
    * @param packaging
    */
   public void setPackaging(Object packaging) {
-    Log.i("APP# DeliveryHelper | setPackaging", "|" + " packaging: " + packaging);
+    Log.i("APP# DeliveryHelper | setPackaging", "| " + this.getClass().getSimpleName() + " > packaging: " + packaging.getClass().getSimpleName());
     this.packaging = packaging;
   }
 
@@ -49,6 +52,7 @@ public class DeliveryHelper extends Helper {
    * 객체 지움
    */
   public void clearPackaging() {
+    Log.i("APP# DeliveryHelper | clearPackaging", "| " + this.getClass().getSimpleName() + " --> clear packaging");
     packaging = null;
   }
 

+ 12 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsModel.java

@@ -223,6 +223,11 @@ public class ContentsModel extends ContentsBaseModel {
     });
   }
 
+  /**
+   * 전체보기에서 선택된 인덱스 전달.
+   *
+   * @return
+   */
   public int getDeliveredIndex() {
     Integer index = ActivityDeliveryHelper.getInstance().getPackaging(Integer.class);
     if (null == index) {
@@ -231,6 +236,13 @@ public class ContentsModel extends ContentsBaseModel {
     return index;
   }
 
+  /**
+   * 전체보기에서 선택된 인덱스 클리어.
+   */
+  public void clearDeliveredIndex() {
+    ActivityDeliveryHelper.getInstance().clearPackaging();
+  }
+
   public boolean hasFlagChanged() {
     return ContentsFlagHelper.getInstance().hasChanged(hashCode);
   }

+ 4 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsPresenter.java

@@ -79,8 +79,10 @@ public class ContentsPresenter extends ContentsBasePresenter<ContentsModel, ICon
       model.clearFlagChanged();
     }
 
-    if (model.getDeliveredIndex() > -1) {
-      view.setScrollToPosition(model.getDeliveredIndex());
+    int deliveredIndex = model.getDeliveredIndex();
+    if (deliveredIndex > -1) {
+      view.setScrollToPosition(deliveredIndex);
+      model.clearDeliveredIndex();
     }
 
   }