Browse Source

[컨텐츠][New] Native API 적용 중 8

hyodong.min 7 năm trước cách đây
mục cha
commit
7ad563505a

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/LifeplusContentsBean.java

@@ -33,8 +33,8 @@ public class LifeplusContentsBean extends JsonBeanBase {
   @SerializedName("lpCntsDtlUrl")
   private String contentsUrl;
 
-  private boolean isLiked;
-  private boolean isBookmarked;
+  private transient boolean isLiked;
+  private transient boolean isBookmarked;
   private transient boolean isSetup = false;  /// 좋아요/북마크 설정을 끝냈는지 표시 해둔다. 북마크 리스트에서 중복 설정을 막기 위한.
 
   public String getItemNumber() {

+ 15 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/model/SuperModel.java

@@ -134,7 +134,11 @@ public final class SuperModel {
    */
   public String getDeviceId() {
     if (StringUtil.isEmpty(deviceUuid)) {
-      deviceUuid = preferences.getDeviceUuid();
+      try {
+        deviceUuid = preferences.getDeviceUuid();
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
     }
     return deviceUuid;
   }
@@ -178,7 +182,11 @@ public final class SuperModel {
    */
   public String getToken() {
     if (null == token) {
-      token = preferences.getToken();
+      try {
+        token = preferences.getToken();
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
     }
     return token;
   }
@@ -195,7 +203,11 @@ public final class SuperModel {
    */
   public String getUserName() {
     if (null == userName) {
-      userName = preferences.getUserName();
+      try {
+        userName = preferences.getUserName();
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
     }
     return userName;
   }

+ 9 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/category/CategoryMainPresenter.java

@@ -140,7 +140,14 @@ public abstract class CategoryMainPresenter<M extends CategoryMainModel, V exten
         break;
       case Event.CONTENTS:
         setContentsHelper(model.getContents().get(event.getIndex()));
-        go(ScreenID.CONTENTS);
+
+        // fixme remove
+        if (StringUtil.getPureVersionString(AppUtil.getVersionName()).equals("4.0.0.19")) {
+          go(ScreenID.CONTENTS_NATIVE);
+        }
+        else {
+          go(ScreenID.CONTENTS);
+        }
         break;
       case Event.BANNER:
         setContentsHelper(model.getBannerBeans().get(event.getIndex()));
@@ -209,6 +216,7 @@ public abstract class CategoryMainPresenter<M extends CategoryMainModel, V exten
             Log.w("APP# CategoryMainPresenter | onResult", "|" + " contents             --> ");
 
             setContentsHelper(model.getSelectedRecommendBean());
+            // fixme remove 
             if (StringUtil.getPureVersionString(AppUtil.getVersionName()).equals("4.0.0.19")) {
               go(ScreenID.CONTENTS_NATIVE);
             }

+ 14 - 5
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsDetailAdapter.java

@@ -91,10 +91,19 @@ public class ContentsDetailAdapter extends RecyclerView.Adapter<ContentsDetailVi
 
   @Override
   public void onBindViewHolder(@NonNull ContentsDetailView holder, int position) {
-    ContentsDetailBean bean = contentsDetailBeans.get(position);
-    holder.bind(position, bean, event -> {
-      listener.onEvent(event);
-    });
+    if (hasSeries() && getItemCount() - 1 == position) {
+      // todo 시리즈 페이지
+//      ContentsDetailBean bean = contentsDetailBeans.get(position);
+//      holder.bind(position, bean, event -> {
+//        listener.onEvent(event);
+//      });
+    }
+    else {
+      ContentsDetailBean bean = contentsDetailBeans.get(position);
+      holder.bind(position, bean, event -> {
+        listener.onEvent(event);
+      });
+    }
   }
 
   @Override
@@ -123,7 +132,7 @@ public class ContentsDetailAdapter extends RecyclerView.Adapter<ContentsDetailVi
   public int getItemViewType(int position) {
     int type = CARD_LISTICLE_COVER;
 
-    if (hasSeries() && getItemCount() == position) {
+    if (hasSeries() && getItemCount() - 1 == position) {
       // 시리즈 페이지
       type = SERIES;
     }

+ 14 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsDetailFragment.java

@@ -1,5 +1,8 @@
 package kr.co.zumo.app.lifeplus.view.screen.contents;
 
+import android.content.ActivityNotFoundException;
+import android.content.Intent;
+import android.net.Uri;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
@@ -16,6 +19,7 @@ import kr.co.zumo.app.lifeplus.bean.api.ContentsDetailBean;
 import kr.co.zumo.app.lifeplus.bean.api.ContentsDetailListBean;
 import kr.co.zumo.app.lifeplus.bean.api.SeriesItemBean;
 import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
+import kr.co.zumo.app.lifeplus.util.AppUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
 import kr.co.zumo.app.lifeplus.view.IEventListener;
 import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
@@ -33,6 +37,7 @@ import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
 public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter> implements IContentsDetailView {
 
   private RecyclerView recyclerViewContentsDetail;
+  private ActionBarHelper actionBarHelper;
 
   @Override
   protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -58,6 +63,7 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
       .white()
       .transparent()
       .show();
+    this.actionBarHelper = actionBarHelper;
   }
 
   @Override
@@ -83,6 +89,12 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
 
   @Override
   public void goGooglePlay() {
+    String appPackageName = AppUtil.getPackageName();
+    try {
+      startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
+    } catch (ActivityNotFoundException e) {
+      startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
+    }
 
   }
 
@@ -93,12 +105,12 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
 
   @Override
   public void setLiked(boolean isChecked) {
-
+    actionBarHelper.setLiked(isChecked);
   }
 
   @Override
   public void setBookmarked(boolean isChecked) {
-
+    actionBarHelper.setBookmarked(isChecked);
   }
 
   @Override
@@ -118,7 +130,6 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
       }
     });
 
-
     recyclerViewContentsDetail.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
     recyclerViewContentsDetail.setAdapter(adapter);
   }

+ 0 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/main/MyMainMemberFragment.java

@@ -25,7 +25,6 @@ public class MyMainMemberFragment extends MyMainFragment {
   @Override
   protected void createMemberOrGuest() {
     layoutMemberHeader.setVisibility(View.VISIBLE);
-    ;
     layoutGuestHeader.setVisibility(View.GONE);
   }