Преглед на файлове

[메뉴][New] 레이아웃 및 마진 수정

hyodong.min преди 6 години
родител
ревизия
23e824b016

+ 15 - 20
app/src/main/java/kr/co/zumo/app/lifeplus/activity/ActivityBase.java

@@ -76,7 +76,7 @@ public abstract class ActivityBase extends AppCompatActivity implements IHelperP
   protected FullDrawerLayout drawerLayout;
   private ConstraintLayout drawerView;
   private CoordinatorLayout containerMain;
-  private AllMenuView allMenuView;
+  private AllMenuDriver allMenuDriver;
 
 
   /***********************************
@@ -156,14 +156,14 @@ public abstract class ActivityBase extends AppCompatActivity implements IHelperP
       drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
       addDrawerLayoutAnimation();
 
-      allMenuView = new AllMenuView(this, drawerView, event -> {
+      allMenuDriver = new AllMenuDriver(this, drawerView, event -> {
         final FragmentBase fragment = (FragmentBase) getSupportFragmentManager().findFragmentById(R.id.container_main);
         if (null != fragment) {
           fragment.onMenuEvent(event);
         }
       });
 
-      allMenuView.init();
+      allMenuDriver.init();
 
     }
 
@@ -382,7 +382,7 @@ public abstract class ActivityBase extends AppCompatActivity implements IHelperP
   public void openDrawer() {
     if (false == isDrawerOpen()) {
       drawerLayout.openDrawer(Gravity.END);
-      allMenuView.onOpen();
+      allMenuDriver.onOpen();
     }
 
 
@@ -394,7 +394,7 @@ public abstract class ActivityBase extends AppCompatActivity implements IHelperP
   public void closeDrawer() {
     if (isDrawerOpen()) {
       drawerLayout.closeDrawer(Gravity.END);
-      allMenuView.onClose();
+      allMenuDriver.onClose();
     }
   }
 
@@ -412,21 +412,16 @@ public abstract class ActivityBase extends AppCompatActivity implements IHelperP
    */
   private void addDrawerLayoutAnimation() {
     drawerLayout.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
-                                     @Override
-                                     public void onDrawerSlide(View drawerView, float slideOffset) {
-                                       int half = drawerView.getWidth() >> 1;
-                                       float moveFactor = half * slideOffset;
-                                       containerMain.setTranslationX(-moveFactor);
-
-                                       float menuOffset = -(half - moveFactor);
-                                       allMenuView.getContainer().setTranslationX(menuOffset);
-                                     }
-
-                                     @Override
-                                     public void onDrawerClosed(View drawerView) {
-                                     }
-                                   }
-    );
+      @Override
+      public void onDrawerSlide(View drawerView, float slideOffset) {
+        int half = drawerView.getWidth() >> 1;
+        float moveFactor = half * slideOffset;
+        containerMain.setTranslationX(-moveFactor);
+
+        float menuOffset = -(half - moveFactor);
+        allMenuDriver.getContainer().setTranslationX(menuOffset);
+      }
+    });
   }
 
 

+ 19 - 8
app/src/main/java/kr/co/zumo/app/lifeplus/activity/AllMenuView.java

@@ -30,12 +30,13 @@ import kr.co.zumo.app.lifeplus.view.IEventListener;
  * @history 하세미   [2019-03-06]   [최초 작성]
  * @since 2019-03-06
  */
-public class AllMenuView implements PushMessageBroker.IPushMessageListener {
+public class AllMenuDriver implements PushMessageBroker.IPushMessageListener {
 
   private PushMessageManager pushMessageManager;
 
   private Context context;
   private ConstraintLayout drawerView;
+  private ConstraintLayout menuContainer;
   private ConstraintLayout container;
   private TextView textViewCategory0;
   private TextView textViewCategory1;
@@ -46,21 +47,31 @@ public class AllMenuView implements PushMessageBroker.IPushMessageListener {
   private IEventListener listener;
   private NavigationBar navigationBar;
 
-  public AllMenuView(Context context, ConstraintLayout drawerView, IEventListener listener) {
+  AllMenuDriver(Context context, ConstraintLayout drawerView, IEventListener listener) {
     this.context = context;
     this.drawerView = drawerView;
     this.listener = listener;
   }
 
+  /**
+   * 트랜지션 에니메이션에 이용할 컨테이너
+   *
+   * @return
+   */
   public ConstraintLayout getContainer() {
     return container;
   }
 
+  /**
+   * init
+   */
   public void init() {
 
-    container = this.drawerView.findViewById(R.id.layout_container);
+    container = this.drawerView.findViewById(R.id.layout_animate);
+    menuContainer = this.drawerView.findViewById(R.id.layout_container);
 
-    ((ViewGroup.MarginLayoutParams) this.container.getLayoutParams()).topMargin = ResourceUtil.getDimension(R.dimen.action_bar_height) + ResourceUtil.getStatusBarHeightManual();
+    ((ViewGroup.MarginLayoutParams) this.drawerView.getLayoutParams()).topMargin = ResourceUtil.getStatusBarHeightManual();
+    ((ViewGroup.MarginLayoutParams) this.menuContainer.getLayoutParams()).topMargin = ResourceUtil.getDimension(R.dimen.action_bar_height);
     this.drawerView.setClickable(true);
     setNavigationBar();
 
@@ -92,7 +103,7 @@ public class AllMenuView implements PushMessageBroker.IPushMessageListener {
     this.drawerView.findViewById(R.id.text_coupon).setOnClickListener(view -> listener.onEvent(new Event.Builder(Event.COUPON_MALL).build()));
   }
 
-  public void setDefaultAnimationSetting() {
+  private void setDefaultAnimationSetting() {
     for (int i = 0; i < categoryList.size(); ++i) {
       TextView categoryText = categoryList.get(i);
       categoryText.setTranslationX(ResourceUtil.dpToPx(90));
@@ -103,7 +114,7 @@ public class AllMenuView implements PushMessageBroker.IPushMessageListener {
   /**
    * 메뉴 애니메이션 추가
    */
-  public void showMenuAnimation() {
+  private void showMenuAnimation() {
     final int duration = 600;
     final int delay = 100;
 
@@ -134,7 +145,7 @@ public class AllMenuView implements PushMessageBroker.IPushMessageListener {
       );
   }
 
-  public void onOpen() {
+  void onOpen() {
     setDefaultAnimationSetting();
     showMenuAnimation();
     pushMessageManager = PushMessageManager.getStoredManager();
@@ -143,7 +154,7 @@ public class AllMenuView implements PushMessageBroker.IPushMessageListener {
   }
 
 
-  public void onClose() {
+  void onClose() {
     PushMessageBroker.getInstance().unregisterObserver(this);
     navigationBar.setNotiMarker(false, false);
   }

+ 212 - 205
app/src/main/res/layout/fragment_all_menu.xml

@@ -11,225 +11,232 @@
   android:orientation="vertical">
 
   <android.support.constraint.ConstraintLayout
-    android:id="@+id/container_navigation_bar"
+    android:id="@+id/layout_animate"
     android:layout_width="match_parent"
-    android:layout_height="52dp"
-    app:layout_constraintBottom_toTopOf="@+id/layout_container"
-    app:layout_constraintEnd_toEndOf="parent"
-    app:layout_constraintStart_toStartOf="parent"
-    app:layout_constraintTop_toTopOf="parent"/>
-
-  <android.support.constraint.ConstraintLayout
-    android:id="@+id/layout_container"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_marginTop="20dp"
-    android:layout_marginBottom="70dp"
-    android:orientation="vertical"
-    app:layout_constraintBottom_toBottomOf="@id/view4"
-    app:layout_constraintEnd_toEndOf="parent"
-    app:layout_constraintStart_toStartOf="parent"
-    app:layout_constraintTop_toBottomOf="@+id/container_navigation_bar"
-    app:layout_constraintTop_toTopOf="parent">
-
-
-    <TextView
-      android:id="@+id/text_view_category_0"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_marginBottom="16dp"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center_horizontal"
-      android:padding="10dp"
-      android:text="@string/contents_category1"
-      android:textColor="@color/C000000"
-      android:textSize="21sp"
-      app:layout_constraintBottom_toTopOf="@+id/text_view_category_1"
+    android:layout_height="match_parent">
+
+    <android.support.constraint.ConstraintLayout
+      android:id="@+id/container_navigation_bar"
+      android:layout_width="match_parent"
+      android:layout_height="52dp"
+      app:layout_constraintVertical_bias="0"
+      app:layout_constraintBottom_toTopOf="@+id/layout_container"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toTopOf="parent"
-      app:layout_constraintVertical_chainStyle="spread_inside"/>
-
+      app:layout_constraintTop_toTopOf="parent"/>
 
-    <TextView
-      android:id="@+id/text_view_category_1"
-      android:layout_width="wrap_content"
+    <android.support.constraint.ConstraintLayout
+      android:id="@+id/layout_container"
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_marginBottom="16dp"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center_horizontal"
-      android:padding="10dp"
-      android:text="@string/contents_category2"
-      android:textColor="@color/C000000"
-      android:textSize="21sp"
-      app:layout_constraintBottom_toTopOf="@+id/text_view_category_2"
+      android:layout_marginTop="20dp"
+      android:layout_marginBottom="70dp"
+      android:orientation="vertical"
+      app:layout_constraintBottom_toBottomOf="@id/view4"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toBottomOf="@+id/text_view_category_0"/>
-
-
-    <TextView
-      android:id="@+id/text_view_category_2"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
+      app:layout_constraintTop_toBottomOf="@+id/container_navigation_bar"
+      app:layout_constraintTop_toTopOf="parent">
+
+
+      <TextView
+        android:id="@+id/text_view_category_0"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="16dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center_horizontal"
+        android:padding="10dp"
+        android:text="@string/contents_category1"
+        android:textColor="@color/C000000"
+        android:textSize="21sp"
+        app:layout_constraintBottom_toTopOf="@+id/text_view_category_1"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_chainStyle="spread_inside"/>
+
+
+      <TextView
+        android:id="@+id/text_view_category_1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="16dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center_horizontal"
+        android:padding="10dp"
+        android:text="@string/contents_category2"
+        android:textColor="@color/C000000"
+        android:textSize="21sp"
+        app:layout_constraintBottom_toTopOf="@+id/text_view_category_2"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/text_view_category_0"/>
+
+
+      <TextView
+        android:id="@+id/text_view_category_2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="16dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center_horizontal"
+        android:padding="10dp"
+        android:text="@string/contents_category3"
+        android:textColor="@color/C000000"
+        android:textSize="21sp"
+        app:layout_constraintBottom_toTopOf="@+id/text_view_category_3"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/text_view_category_1"/>
+
+
+      <TextView
+        android:id="@+id/text_view_category_3"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="16dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center_horizontal"
+        android:padding="10dp"
+        android:text="@string/contents_category4"
+        android:textColor="@color/C000000"
+        android:textSize="21sp"
+        app:layout_constraintBottom_toTopOf="@+id/text_view_category_4"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/text_view_category_2"/>
+
+
+      <TextView
+        android:id="@+id/text_view_category_4"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center_horizontal"
+        android:padding="10dp"
+        android:text="@string/contents_category5"
+        android:textColor="@color/C000000"
+        android:textSize="21sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/text_view_category_3"/>
+
+    </android.support.constraint.ConstraintLayout>
+
+    <View
+      android:id="@+id/view4"
+      android:layout_width="match_parent"
+      android:layout_height="1dp"
       android:layout_marginBottom="16dp"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center_horizontal"
-      android:padding="10dp"
-      android:text="@string/contents_category3"
-      android:textColor="@color/C000000"
-      android:textSize="21sp"
-      app:layout_constraintBottom_toTopOf="@+id/text_view_category_3"
-      app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toBottomOf="@+id/text_view_category_1"/>
-
-
-    <TextView
-      android:id="@+id/text_view_category_3"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_marginBottom="16dp"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center_horizontal"
-      android:padding="10dp"
-      android:text="@string/contents_category4"
-      android:textColor="@color/C000000"
-      android:textSize="21sp"
-      app:layout_constraintBottom_toTopOf="@+id/text_view_category_4"
-      app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toBottomOf="@+id/text_view_category_2"/>
-
-
-    <TextView
-      android:id="@+id/text_view_category_4"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center_horizontal"
-      android:padding="10dp"
-      android:text="@string/contents_category5"
-      android:textColor="@color/C000000"
-      android:textSize="21sp"
-      app:layout_constraintBottom_toBottomOf="parent"
-      app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toBottomOf="@+id/text_view_category_3"/>
-
-  </android.support.constraint.ConstraintLayout>
-
-  <View
-    android:id="@+id/view4"
-    android:layout_width="match_parent"
-    android:layout_height="1dp"
-    android:layout_marginBottom="16dp"
-    android:background="@color/CEBEBEB"
-    app:layout_constraintBottom_toTopOf="@+id/layout_menu"/>
+      android:background="@color/CEBEBEB"
+      app:layout_constraintBottom_toTopOf="@+id/layout_menu"/>
 
-  <android.support.constraint.ConstraintLayout
-    android:id="@+id/layout_menu"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:layout_gravity="center"
-    android:gravity="center"
-    android:orientation="horizontal"
-    app:layout_constraintBottom_toTopOf="@+id/layout_buttons"
-    app:layout_constraintEnd_toEndOf="parent"
-    app:layout_constraintStart_toStartOf="parent">
-
-    <TextView
-      android:id="@+id/text_my"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_marginEnd="3dp"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center"
-      android:lineSpacingExtra="6sp"
-      android:padding="10dp"
-      android:text="@string/menu_category1"
-      android:textColor="@color/C000000"
-      android:textSize="15sp"
-      app:layout_constraintEnd_toStartOf="@+id/text_event"
-      app:layout_constraintHorizontal_bias="0.5"
-      app:layout_constraintStart_toStartOf="parent"/>
-
-    <TextView
-      android:id="@+id/text_event"
+    <android.support.constraint.ConstraintLayout
+      android:id="@+id/layout_menu"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_marginStart="3dp"
-      android:layout_marginEnd="3dp"
-      android:background="?android:attr/selectableItemBackground"
+      android:layout_gravity="center"
       android:gravity="center"
-      android:lineSpacingExtra="6sp"
-      android:padding="10dp"
-      android:text="@string/menu_category2"
-      android:textColor="@color/C000000"
-      android:textSize="15sp"
-      app:layout_constraintEnd_toStartOf="@+id/text_coupon"
-      app:layout_constraintHorizontal_bias="0.5"
-      app:layout_constraintStart_toEndOf="@+id/text_my"/>
-
-    <TextView
-      android:id="@+id/text_coupon"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_marginStart="3dp"
-      android:background="?android:attr/selectableItemBackground"
-      android:gravity="center"
-      android:lineSpacingExtra="6sp"
-      android:padding="10dp"
-      android:text="@string/menu_category3"
-      android:textColor="@color/C000000"
-      android:textSize="15sp"
+      android:orientation="horizontal"
+      app:layout_constraintBottom_toTopOf="@+id/layout_buttons"
       app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintHorizontal_bias="0.5"
-      app:layout_constraintStart_toEndOf="@+id/text_event"/>
-  </android.support.constraint.ConstraintLayout>
-
-  <LinearLayout
-    android:id="@+id/layout_buttons"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_marginBottom="25dp"
-    android:gravity="center"
-    android:orientation="horizontal"
-    android:padding="5dp"
-    app:layout_constraintBottom_toBottomOf="parent">
-
-    <TextView
-      android:id="@+id/text_view_life_plus_guide"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:background="?android:attr/selectableItemBackground"
-      android:lineSpacingExtra="3sp"
-      android:padding="10dp"
-      android:text="@string/introduce_life_plus"
-      android:textColor="@color/C999999"
-      android:textSize="12sp"
-      />
-
-    <TextView
-      android:layout_width="wrap_content"
+      app:layout_constraintStart_toStartOf="parent">
+
+      <TextView
+        android:id="@+id/text_my"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="3dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center"
+        android:lineSpacingExtra="6sp"
+        android:padding="10dp"
+        android:text="@string/menu_category1"
+        android:textColor="@color/C000000"
+        android:textSize="15sp"
+        app:layout_constraintEnd_toStartOf="@+id/text_event"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toStartOf="parent"/>
+
+      <TextView
+        android:id="@+id/text_event"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="3dp"
+        android:layout_marginEnd="3dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center"
+        android:lineSpacingExtra="6sp"
+        android:padding="10dp"
+        android:text="@string/menu_category2"
+        android:textColor="@color/C000000"
+        android:textSize="15sp"
+        app:layout_constraintEnd_toStartOf="@+id/text_coupon"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toEndOf="@+id/text_my"/>
+
+      <TextView
+        android:id="@+id/text_coupon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="3dp"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center"
+        android:lineSpacingExtra="6sp"
+        android:padding="10dp"
+        android:text="@string/menu_category3"
+        android:textColor="@color/C000000"
+        android:textSize="15sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toEndOf="@+id/text_event"/>
+    </android.support.constraint.ConstraintLayout>
+
+    <LinearLayout
+      android:id="@+id/layout_buttons"
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
+      android:layout_marginBottom="25dp"
       android:gravity="center"
-      android:lineSpacingExtra="3sp"
-      android:text="|"
-      android:textColor="@color/CEBEBEB"
-      android:textSize="12sp"/>
-
-    <TextView
-      android:id="@+id/text_view_faq"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:background="?android:attr/selectableItemBackground"
-      android:lineSpacingExtra="3sp"
-      android:padding="10dp"
-      android:text="@string/faq"
-      android:textColor="@color/C999999"
-      android:textSize="12sp"/>
-
-  </LinearLayout>
+      android:orientation="horizontal"
+      android:padding="5dp"
+      app:layout_constraintBottom_toBottomOf="parent">
+
+      <TextView
+        android:id="@+id/text_view_life_plus_guide"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="?android:attr/selectableItemBackground"
+        android:lineSpacingExtra="3sp"
+        android:padding="10dp"
+        android:text="@string/introduce_life_plus"
+        android:textColor="@color/C999999"
+        android:textSize="12sp"
+        />
+
+      <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:lineSpacingExtra="3sp"
+        android:text="|"
+        android:textColor="@color/CEBEBEB"
+        android:textSize="12sp"/>
+
+      <TextView
+        android:id="@+id/text_view_faq"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="?android:attr/selectableItemBackground"
+        android:lineSpacingExtra="3sp"
+        android:padding="10dp"
+        android:text="@string/faq"
+        android:textColor="@color/C999999"
+        android:textSize="12sp"/>
+
+    </LinearLayout>
 
+  </android.support.constraint.ConstraintLayout>
 </android.support.constraint.ConstraintLayout>