Browse Source

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

hyodong.min 6 years ago
parent
commit
add01fe2e6

+ 18 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/CommonException.java

@@ -0,0 +1,18 @@
+package kr.co.zumo.app.lifeplus;
+
+/**
+ * CommonException
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2019-03-06]   [최초 작성]
+ * @since 2019-03-06
+ */
+public class CommonException extends RuntimeException {
+
+  public CommonException(String message) {
+    super(message);
+  }
+}

+ 13 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/ContentsItemBean.java

@@ -133,6 +133,19 @@ public class ContentsItemBean extends LifeplusContentsBean {
     return type;
   }
 
+  public boolean hasMovie(){
+    boolean hasMovie = false;
+    if (null != itemImageList && itemImageList.size() > 0) {
+      for (int i = 0; i<itemImageList.size(); ++i){
+        ContentsDetailImageBean bean = itemImageList.get(i);
+        if(bean.getImageType().equals(LifeplusImageBean.TYPE_MOVIE)){
+          hasMovie = true;
+        }
+      }
+    }
+    return hasMovie;
+  }
+
 
   /**
    * 이미지 리스트 중에서 첫 번째 것을 가져온다.

+ 4 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/model/module/APIModuleHelper.java

@@ -3,6 +3,8 @@
  */
 package kr.co.zumo.app.lifeplus.model.module;
 
+import kr.co.zumo.app.lifeplus.CommonException;
+
 /**
  * APIModuleHelper
  * <pre>
@@ -51,12 +53,12 @@ public class APIModuleHelper {
    *
    * @param emergency
    */
-  public static void dispatchEmergencyEvent(IEmergency emergency) throws RuntimeException {
+  public static void dispatchEmergencyEvent(IEmergency emergency) throws CommonException {
     if (null != emergencyHandler) {
       emergencyHandler.onApiEmergency(emergency);
     }
     else {
-      throw new RuntimeException("Unhandled emergency event");
+      throw new CommonException("Unhandled emergency event");
     }
   }
 }

+ 2 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/command/FragmentChangeCommand.java

@@ -5,6 +5,7 @@ package kr.co.zumo.app.lifeplus.view.command;
 
 import android.util.Log;
 
+import kr.co.zumo.app.lifeplus.CommonException;
 import kr.co.zumo.app.lifeplus.helper.ScreenChangerHelper;
 import kr.co.zumo.app.lifeplus.model.Model;
 import kr.co.zumo.app.lifeplus.supervisor.FragmentChanger;
@@ -58,7 +59,7 @@ public class FragmentChangeCommand extends Command<Model, IView, Presenter> {
         result = screenChanger.changeTo(fragmentId);
         break;
       default:
-        throw new RuntimeException("unsupported direction");
+        throw new CommonException("unsupported direction");
     }
 
     if (ScreenChanger.STACK_EMPTY == result) {

+ 2 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/dialog/factory/BasicDialogFactory.java

@@ -3,6 +3,7 @@
  */
 package kr.co.zumo.app.lifeplus.view.dialog.factory;
 
+import kr.co.zumo.app.lifeplus.CommonException;
 import kr.co.zumo.app.lifeplus.view.dialog.AddRegistrationDialog;
 import kr.co.zumo.app.lifeplus.view.dialog.AlertDialog;
 import kr.co.zumo.app.lifeplus.view.dialog.AppReviewDialog;
@@ -91,7 +92,7 @@ public class BasicDialogFactory implements IDialogFactory {
         dialog = new FilterDetailDialog();
         break;
       default:
-        throw new Error("Unsupported dialog.");
+        throw new CommonException("Unsupported dialog.");
     }
 
     return (T) dialog;

+ 2 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/presenter/Presenter.java

@@ -13,6 +13,7 @@ import android.widget.Toast;
 import com.google.gson.Gson;
 
 import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.CommonException;
 import kr.co.zumo.app.lifeplus.ILifeCycle;
 import kr.co.zumo.app.lifeplus.bean.BucketDeliveryBean;
 import kr.co.zumo.app.lifeplus.bean.ContentsDeliveryBean;
@@ -834,7 +835,7 @@ public abstract class Presenter<M extends Model, V extends IView> implements ILi
     기본으로 처리하고 필요한 Presenter 에서 Override 한다.
    */
   private void throwRuntimeException() {
-    throw new RuntimeException(this.getClass().getSimpleName() + ": please, override this method!!!");
+    throw new CommonException(this.getClass().getSimpleName() + ": please, override this method!!!");
   }
 
   /**

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

@@ -66,9 +66,10 @@ public class ContentsOverviewHolder extends RecyclerView.ViewHolder {
     if (null != contentsItemBean) {
       String url = contentsItemBean.getOverviewImageUrl();
       Log.i("APP# ContentsOverviewHolder | attach", "|" + "overview url: " + url);
-      if(LifeplusImageBean.TYPE_MOVIE.equals(contentsItemBean.getImageType())){
+      if (LifeplusImageBean.TYPE_MOVIE.equals(contentsItemBean.getImageType())) {
         imageViewItem.setImageResource(R.drawable.rectangle_2);
-      }else{
+      }
+      else {
         Glide.with(imageViewItem)
           .asBitmap()
           .apply(new RequestOptions().placeholder(ResourceUtil.getDrawable(imageViewItem.getContext(), R.drawable.image_loading_middle)))
@@ -101,7 +102,7 @@ public class ContentsOverviewHolder extends RecyclerView.ViewHolder {
       listener.onEvent(new Event.Builder(Event.CLICK).index(index).build());
     });
 
-    flagVideo.setVisibility(LifeplusImageBean.TYPE_MOVIE.equals(contentsItemBean.getImageType()) ? View.VISIBLE : View.GONE);
+    flagVideo.setVisibility(contentsItemBean.hasMovie() ? View.VISIBLE : View.GONE);
   }
 
   public void detach() {

+ 3 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/factory/FragmentFactory.java

@@ -5,6 +5,7 @@ package kr.co.zumo.app.lifeplus.view.screen.factory;
 
 import android.support.v4.app.Fragment;
 
+import kr.co.zumo.app.lifeplus.CommonException;
 import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
 
 /**
@@ -26,12 +27,12 @@ public abstract class FragmentFactory {
    * @param id ScreenID.MAIN
    * @return new MainFragment()
    */
-  public Fragment getFragment(@ScreenID.ID int id) throws RuntimeException {
+  public Fragment getFragment(@ScreenID.ID int id) throws CommonException {
     Fragment fragmentBase = getFragmentById(id);
 
     if (null == fragmentBase) {
       //에러시 BasicFragmentFactory 추가
-      throw new RuntimeException("Fragment no matched. id: " + id);
+      throw new CommonException("Fragment no matched. id: " + id);
     }
 
     return fragmentBase;