Selaa lähdekoodia

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

hyodong.min 7 vuotta sitten
vanhempi
commit
5966686ee8

+ 4 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/activity/SettingActivity.java

@@ -1,14 +1,15 @@
 package kr.co.zumo.app.lifeplus.activity;
 
+import android.graphics.Color;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
 import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.DividerItemDecoration;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.view.fragment.setting.SettingExpandableListViewAdapter;
+import kr.co.zumo.app.lifeplus.view.fragment.setting.SettingExpandableListViewDecoration;
 
 /**
  * SettingActivity
@@ -31,7 +32,8 @@ public class SettingActivity extends AppCompatActivity {
     settingRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_setting);
     SettingExpandableListViewAdapter adapter = new SettingExpandableListViewAdapter(this);
     settingRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false));
-    settingRecyclerView.addItemDecoration(new DividerItemDecoration(getApplicationContext(),DividerItemDecoration.VERTICAL ));
+    SettingExpandableListViewDecoration decoration = new SettingExpandableListViewDecoration(this, Color.parseColor("#ebebeb"), 1);
+    settingRecyclerView.addItemDecoration(decoration);
     settingRecyclerView.setAdapter(adapter);
   }
 

+ 9 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/setting/SettingExpandableListViewAdapter.java

@@ -7,6 +7,7 @@ import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.ImageView;
 
 import com.github.aakira.expandablelayout.ExpandableRelativeLayout;
 
@@ -133,11 +134,12 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
   private class defaultSettingViewHolder extends RecyclerView.ViewHolder {
 
     private ExpandableRelativeLayout customLayout;
+    private ImageView imageViewAccordion;
 
     public defaultSettingViewHolder(View itemView) {
       super(itemView);
       customLayout = itemView.findViewById(R.id.layout_default_setting);
-
+      imageViewAccordion = itemView.findViewById(R.id.image_view_setting_menu_accordion);
     }
 
     public void onClick() {
@@ -147,11 +149,12 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
 
   private class codeManageViewHolder extends RecyclerView.ViewHolder {
     private ExpandableRelativeLayout customLayout;
+    private ImageView imageViewAccordion;
 
     public codeManageViewHolder(View itemView) {
       super(itemView);
       customLayout = itemView.findViewById(R.id.layout_code_manage);
-
+      imageViewAccordion = itemView.findViewById(R.id.image_view_setting_menu_accordion);
     }
 
     public void onClick() {
@@ -161,10 +164,12 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
 
   private class pushAndLocationSettingViewHolder extends RecyclerView.ViewHolder {
     private ExpandableRelativeLayout customLayout;
+    private ImageView imageViewAccordion;
 
     public pushAndLocationSettingViewHolder(View itemView) {
       super(itemView);
       customLayout = itemView.findViewById(R.id.layout_push_location_setting);
+      imageViewAccordion = itemView.findViewById(R.id.image_view_setting_menu_accordion);
 
     }
 
@@ -175,10 +180,12 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
 
   private class agreeInformationViewHolder extends RecyclerView.ViewHolder {
     private ExpandableRelativeLayout customLayout;
+    private ImageView imageViewAccordion;
 
     public agreeInformationViewHolder(View itemView) {
       super(itemView);
       customLayout = itemView.findViewById(R.id.layout_agree_information);
+      imageViewAccordion = itemView.findViewById(R.id.image_view_setting_menu_accordion);
     }
 
     public void onClick() {

+ 73 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/setting/SettingExpandableListViewDecoration.java

@@ -0,0 +1,73 @@
+package kr.co.zumo.app.lifeplus.view.fragment.setting;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.support.annotation.ColorInt;
+import android.support.annotation.FloatRange;
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.util.TypedValue;
+import android.view.View;
+
+/**
+ * SettingExpandableListViewDecoration
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-10-10]   [최초 작성]
+ * @since 2018-10-10
+ */
+public class SettingExpandableListViewDecoration extends RecyclerView.ItemDecoration {
+  private final Paint mPaint;
+
+  public SettingExpandableListViewDecoration(@NonNull Context context, @ColorInt int color,
+                                             @FloatRange(from = 0, fromInclusive = false) float heightDp) {
+    mPaint = new Paint();
+    mPaint.setColor(color);
+    final float thickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+      heightDp, context.getResources().getDisplayMetrics());
+    mPaint.setStrokeWidth(thickness);
+  }
+
+  @Override
+  public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+    final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams();
+
+    // we want to retrieve the position in the list
+    final int position = params.getViewAdapterPosition();
+
+    // and add a separator to any view but the last one
+    if (position < state.getItemCount()) {
+      outRect.set(0, 0, 0, (int) mPaint.getStrokeWidth()); // left, top, right, bottom
+    }
+    else {
+      outRect.setEmpty(); // 0, 0, 0, 0
+    }
+  }
+
+  @Override
+  public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
+    // we set the stroke width before, so as to correctly draw the line we have to offset by width / 2
+    final int offset = (int) (mPaint.getStrokeWidth() / 2);
+
+    // this will iterate over every visible view
+    for (int i = 0; i < parent.getChildCount(); i++) {
+      // get the view
+      final View view = parent.getChildAt(i);
+      final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams();
+
+      // get the position
+      final int position = params.getViewAdapterPosition();
+
+      // and finally draw the separator
+      if (position < state.getItemCount()-1) {
+        c.drawLine(view.getLeft(), view.getBottom() + offset, view.getRight(), view.getBottom() + offset, mPaint);
+      }
+    }
+  }
+
+}

+ 2 - 0
app/src/main/res/layout/activity_setting.xml

@@ -8,5 +8,7 @@
   android:id="@+id/recycler_view_setting"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
+  android:layout_marginStart="25dp"
+  android:layout_marginEnd="25dp"
   />
 </LinearLayout>

+ 20 - 13
app/src/main/res/layout/setting_custom_menu1.xml

@@ -5,7 +5,9 @@
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
-  android:orientation="vertical">
+  android:layout_marginBottom="1dp"
+  android:orientation="vertical"
+  >
 
   <android.support.constraint.ConstraintLayout
     android:layout_width="match_parent"
@@ -15,7 +17,6 @@
       android:id="@+id/image_view_setting_menu_icon"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_marginStart="24dp"
       android:layout_marginTop="23dp"
       android:layout_marginBottom="26dp"
       app:layout_constraintBottom_toBottomOf="parent"
@@ -30,22 +31,21 @@
       android:layout_marginStart="8dp"
       android:layout_marginTop="23dp"
       android:layout_marginBottom="27dp"
+      android:text="@string/setting_menu1"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintStart_toEndOf="@+id/image_view_setting_menu_icon"
-      app:layout_constraintTop_toTopOf="parent"
-      android:text="@string/setting_menu1"/>
+      app:layout_constraintTop_toTopOf="parent"/>
 
     <ImageView
       android:id="@+id/image_view_setting_menu_accordion"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginTop="31dp"
-      android:layout_marginEnd="30dp"
       android:layout_marginBottom="31dp"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintTop_toTopOf="parent"
-      tools:srcCompat="@drawable/icon_arcordion_open_arrow"/>
+      app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
   <com.github.aakira.expandablelayout.ExpandableRelativeLayout
@@ -61,25 +61,32 @@
       android:layout_height="wrap_content"
       android:layout_alignParentStart="true"
       android:layout_alignParentTop="true"
-      android:layout_marginStart="24dp"
-      android:text="김한화"/>
+      android:lineSpacingExtra="4sp"
+      android:text="김한화"
+      android:textColor="@color/C999999"
+      android:textSize="12sp"/>
 
     <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignParentTop="true"
       android:layout_alignParentEnd="true"
-      android:layout_marginEnd="27dp"
-      android:text="회원확인"/>
+      android:lineSpacingExtra="4sp"
+      android:text="회원확인"
+      android:textColor="@color/C666666"
+      android:textSize="12sp"/>
 
     <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignParentStart="true"
       android:layout_alignParentTop="true"
-      android:layout_marginStart="22dp"
       android:layout_marginTop="40dp"
-      android:text="자동 간편암호 잠금해제"/>
+      android:layout_marginBottom="28dp"
+      android:lineSpacingExtra="4sp"
+      android:text="자동 간편암호 잠금해제"
+      android:textColor="@color/C999999"
+      android:textSize="12sp"/>
 
     <Switch
       android:id="@+id/switch1"
@@ -87,7 +94,7 @@
       android:layout_height="wrap_content"
       android:layout_alignParentEnd="true"
       android:layout_marginTop="30dp"
-      android:layout_marginEnd="39dp"/>
+      android:layout_marginBottom="28dp"/>
   </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
 
 </LinearLayout>

+ 18 - 18
app/src/main/res/layout/setting_custom_menu2.xml

@@ -5,7 +5,9 @@
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
-  android:orientation="vertical">
+  android:layout_marginBottom="1dp"
+  android:orientation="vertical"
+  >
 
   <android.support.constraint.ConstraintLayout
     android:layout_width="match_parent"
@@ -15,7 +17,7 @@
       android:id="@+id/image_view_setting_menu_icon"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_marginStart="24dp"
+      android:layout_marginStart="0dp"
       android:layout_marginTop="23dp"
       android:layout_marginBottom="26dp"
       app:layout_constraintBottom_toBottomOf="parent"
@@ -30,22 +32,22 @@
       android:layout_marginStart="8dp"
       android:layout_marginTop="23dp"
       android:layout_marginBottom="22dp"
+      android:text="@string/setting_menu2"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintStart_toEndOf="@+id/image_view_setting_menu_icon"
-      app:layout_constraintTop_toTopOf="parent"
-      android:text="@string/setting_menu2"/>
+      app:layout_constraintTop_toTopOf="parent"/>
 
     <ImageView
       android:id="@+id/image_view_setting_menu_accordion"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginTop="31dp"
-      android:layout_marginEnd="30dp"
+      android:layout_marginEnd="0dp"
       android:layout_marginBottom="31dp"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintTop_toTopOf="parent"
-      tools:srcCompat="@drawable/icon_arcordion_open_arrow"/>
+      app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
   <com.github.aakira.expandablelayout.ExpandableRelativeLayout
@@ -61,35 +63,33 @@
       android:layout_height="wrap_content"
       android:layout_alignParentStart="true"
       android:layout_alignParentTop="true"
-      android:layout_marginStart="24dp"
-      android:textSize="12sp"
-      android:textColor="@color/C999999"
+      android:layout_marginStart="0dp"
       android:lineSpacingExtra="3sp"
-      android:text="내 추천인 코드 공유"/>
+      android:text="내 추천인 코드 공유"
+      android:textColor="@color/C999999"
+      android:textSize="12sp"/>
 
     <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignParentTop="true"
       android:layout_alignParentEnd="true"
-      android:layout_marginEnd="27dp"
-      android:textSize="12sp"
-      android:textColor="@color/C666666"
       android:lineSpacingExtra="3sp"
-      android:text="D4KDFJ1F"/>
+      android:text="D4KDFJ1F"
+      android:textColor="@color/C666666"
+      android:textSize="12sp"/>
 
     <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignParentStart="true"
       android:layout_alignParentTop="true"
-      android:layout_marginStart="22dp"
       android:layout_marginTop="40dp"
       android:layout_marginBottom="28dp"
-      android:textSize="12sp"
-      android:textColor="@color/C999999"
       android:lineSpacingExtra="3sp"
-      android:text=" 스페셜/추천인 코드 등록"/>
+      android:text=" 스페셜/추천인 코드 등록"
+      android:textColor="@color/C999999"
+      android:textSize="12sp"/>
 
   </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
 

+ 63 - 50
app/src/main/res/layout/setting_custom_menu3.xml

@@ -5,7 +5,9 @@
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
-  android:orientation="vertical">
+  android:layout_marginBottom="1dp"
+  android:orientation="vertical"
+  >
 
   <android.support.constraint.ConstraintLayout
     android:layout_width="match_parent"
@@ -15,9 +17,6 @@
       android:id="@+id/image_view_setting_menu_icon"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_marginStart="24dp"
-      android:layout_marginTop="23dp"
-      android:layout_marginBottom="26dp"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintStart_toStartOf="parent"
       app:layout_constraintTop_toTopOf="parent"
@@ -28,24 +27,21 @@
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginStart="8dp"
-      android:layout_marginTop="23dp"
-      android:layout_marginBottom="27dp"
+      android:text="@string/setting_menu3"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintStart_toEndOf="@+id/image_view_setting_menu_icon"
-      app:layout_constraintTop_toTopOf="parent"
-      android:text="@string/setting_menu3"/>
+      app:layout_constraintTop_toTopOf="parent"/>
 
     <ImageView
       android:id="@+id/image_view_setting_menu_accordion"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginTop="31dp"
-      android:layout_marginEnd="30dp"
       android:layout_marginBottom="31dp"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintTop_toTopOf="parent"
-      tools:srcCompat="@drawable/icon_arcordion_open_arrow"/>
+      app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
   <com.github.aakira.expandablelayout.ExpandableRelativeLayout
@@ -56,55 +52,72 @@
     app:ael_expanded="false"
     >
 
+    <RelativeLayout
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
 
-    <TextView
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_alignParentStart="true"
-      android:layout_alignParentTop="true"
-      android:layout_marginStart="22dp"
-      android:layout_marginTop="23dp"
-      android:text="PUSH  수신 설정"/>
+      <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:lineSpacingExtra="4sp"
+        android:text="PUSH  수신 설정"
+        android:textColor="@color/C999999"
+        android:textSize="12sp"/>
 
-    <Switch
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_alignParentEnd="true"
-      android:layout_marginTop="23dp"
-      android:layout_marginEnd="39dp"/>
+      <Switch
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentEnd="true"/>
 
-    <TextView
-      android:layout_width="wrap_content"
+    </RelativeLayout>
+
+    <RelativeLayout
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentStart="true"
-      android:layout_alignParentTop="true"
-      android:layout_marginStart="22dp"
-      android:layout_marginTop="64dp"
-      android:text="PUSH 마케팅 수신 설정"/>
+      android:layout_marginTop="45dp">
 
-    <Switch
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_alignParentEnd="true"
-      android:layout_marginTop="64dp"
-      android:layout_marginEnd="39dp"/>
+      <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentTop="true"
+        android:lineSpacingExtra="4sp"
+        android:text="PUSH 마케팅 수신 설정"
+        android:textColor="@color/C999999"
+        android:textSize="12sp"/>
 
-    <TextView
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_alignParentStart="true"
-      android:layout_alignParentTop="true"
-      android:layout_marginStart="22dp"
-      android:layout_marginTop="104dp"
-      android:text="위치기반서비스 이용 설정"/>
+      <Switch
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentEnd="true"
+        />
+    </RelativeLayout>
 
-    <Switch
-      android:id="@+id/switch1"
-      android:layout_width="wrap_content"
+    <RelativeLayout
+      android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_alignParentEnd="true"
-      android:layout_marginTop="104dp"
-      android:layout_marginEnd="39dp"/>
+      android:layout_marginTop="85dp"
+      android:layout_marginBottom="28dp"
+      >
+
+      <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentTop="true"
+        android:lineSpacingExtra="4sp"
+        android:text="위치기반서비스 이용 설정"
+        android:textColor="@color/C999999"
+        android:textSize="12sp"/>
+
+      <Switch
+        android:id="@+id/switch1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentEnd="true"/>
+    </RelativeLayout>
+
 
   </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
 

+ 15 - 10
app/src/main/res/layout/setting_custom_menu4.xml

@@ -5,7 +5,9 @@
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
-  android:orientation="vertical">
+  android:layout_marginBottom="1dp"
+  android:orientation="vertical"
+  >
 
   <android.support.constraint.ConstraintLayout
     android:layout_width="match_parent"
@@ -15,7 +17,6 @@
       android:id="@+id/image_view_setting_menu_icon"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_marginStart="24dp"
       android:layout_marginTop="23dp"
       android:layout_marginBottom="26dp"
       app:layout_constraintBottom_toBottomOf="parent"
@@ -30,22 +31,21 @@
       android:layout_marginStart="8dp"
       android:layout_marginTop="23dp"
       android:layout_marginBottom="27dp"
+      android:text="@string/setting_menu4"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintStart_toEndOf="@+id/image_view_setting_menu_icon"
-      app:layout_constraintTop_toTopOf="parent"
-      android:text="@string/setting_menu4"/>
+      app:layout_constraintTop_toTopOf="parent"/>
 
     <ImageView
       android:id="@+id/image_view_setting_menu_accordion"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginTop="31dp"
-      android:layout_marginEnd="30dp"
       android:layout_marginBottom="31dp"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintTop_toTopOf="parent"
-      tools:srcCompat="@drawable/icon_arcordion_open_arrow"/>
+      app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
   <com.github.aakira.expandablelayout.ExpandableRelativeLayout
@@ -61,8 +61,10 @@
       android:layout_height="wrap_content"
       android:layout_alignParentStart="true"
       android:layout_alignParentTop="true"
-      android:layout_marginStart="24dp"
-      android:text="이용 약관"/>
+      android:lineSpacingExtra="4sp"
+      android:text="이용 약관"
+      android:textColor="@color/C999999"
+      android:textSize="12sp"/>
 
     <TextView
       android:layout_width="wrap_content"
@@ -70,8 +72,11 @@
       android:layout_alignParentStart="true"
       android:layout_alignParentTop="true"
       android:layout_marginTop="30dp"
-      android:layout_marginStart="24dp"
-      android:text="이용안내"/>
+      android:layout_marginBottom="28dp"
+      android:lineSpacingExtra="4sp"
+      android:text="이용안내"
+      android:textColor="@color/C999999"
+      android:textSize="12sp"/>
 
 
   </com.github.aakira.expandablelayout.ExpandableRelativeLayout>