浏览代码

[설정][Common] 설정화면 리싸이클러뷰 스위치 수정 및 아코디언 아이콘 높이 조정

Hasemi 7 年之前
父节点
当前提交
295945c959

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

@@ -3,13 +3,11 @@ package kr.co.zumo.app.lifeplus.view.fragment.setting;
 import android.content.Context;
 import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
-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;
+import android.widget.RelativeLayout;
 
 import java.util.ArrayList;
 
@@ -36,16 +34,10 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
     this.context = context;
   }
 
-/*
-  public SettingExpandableListViewAdapter(ArrayList<TextImageBean> settingList) {
-    this.settingList = settingList;
-  }
-*/
 
   @NonNull
   @Override
   public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
-    Log.w("APP# SettingExpandableListViewAdapter | onCreateViewHolder", "|" + viewType);
     View view;
     switch (viewType) {
       case 0:
@@ -56,6 +48,7 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
       case 1:
         view = LayoutInflater
           .from(parent.getContext())
+
           .inflate(R.layout.setting_custom_menu2, parent, false);
         return new codeManageViewHolder(view);
       case 2:
@@ -77,10 +70,8 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
 
   @Override
   public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
-    Log.w("APP# SettingExpandableListViewAdapter | onBindViewHolder", "|" + position);
     switch (position) {
       case 0:
-        ((defaultSettingViewHolder) holder).customLayout.collapse();
         ((defaultSettingViewHolder) holder).itemView.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
@@ -89,7 +80,6 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
         });
         break;
       case 1:
-        ((codeManageViewHolder) holder).customLayout.collapse();
         ((codeManageViewHolder) holder).itemView.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
@@ -98,7 +88,6 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
         });
         break;
       case 2:
-        ((pushAndLocationSettingViewHolder) holder).customLayout.collapse();
         ((pushAndLocationSettingViewHolder) holder).itemView.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
@@ -107,7 +96,6 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
         });
         break;
       case 3:
-        ((agreeInformationViewHolder) holder).customLayout.collapse();
         ((agreeInformationViewHolder) holder).itemView.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
@@ -133,7 +121,7 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
 
   private class defaultSettingViewHolder extends RecyclerView.ViewHolder {
 
-    private ExpandableRelativeLayout customLayout;
+    private RelativeLayout customLayout;
     private ImageView imageViewAccordion;
 
     public defaultSettingViewHolder(View itemView) {
@@ -143,27 +131,33 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
     }
 
     public void onClick() {
-      customLayout.toggle();
+      customLayout.setVisibility(customLayout.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
+      imageViewAccordion.setImageResource(customLayout.getVisibility() == View.GONE ? R.drawable.icon_arcordion_open_arrow : R.drawable.icon_arcordion_close_arrow);
+
     }
+
+
   }
 
   private class codeManageViewHolder extends RecyclerView.ViewHolder {
-    private ExpandableRelativeLayout customLayout;
+    private RelativeLayout 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() {
-      customLayout.toggle();
+      customLayout.setVisibility(customLayout.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
+      imageViewAccordion.setImageResource(customLayout.getVisibility() == View.GONE ? R.drawable.icon_arcordion_open_arrow : R.drawable.icon_arcordion_close_arrow);
     }
   }
 
   private class pushAndLocationSettingViewHolder extends RecyclerView.ViewHolder {
-    private ExpandableRelativeLayout customLayout;
+    private RelativeLayout customLayout;
     private ImageView imageViewAccordion;
 
     public pushAndLocationSettingViewHolder(View itemView) {
@@ -174,12 +168,13 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
     }
 
     public void onClick() {
-      customLayout.toggle();
+      customLayout.setVisibility(customLayout.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
+      imageViewAccordion.setImageResource(customLayout.getVisibility() == View.GONE ? R.drawable.icon_arcordion_open_arrow : R.drawable.icon_arcordion_close_arrow);
     }
   }
 
   private class agreeInformationViewHolder extends RecyclerView.ViewHolder {
-    private ExpandableRelativeLayout customLayout;
+    private RelativeLayout customLayout;
     private ImageView imageViewAccordion;
 
     public agreeInformationViewHolder(View itemView) {
@@ -189,7 +184,8 @@ public class SettingExpandableListViewAdapter extends RecyclerView.Adapter<Recyc
     }
 
     public void onClick() {
-      customLayout.toggle();
+      customLayout.setVisibility(customLayout.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
+      imageViewAccordion.setImageResource(customLayout.getVisibility() == View.GONE ? R.drawable.icon_arcordion_open_arrow : R.drawable.icon_arcordion_close_arrow);
     }
   }
 }

+ 2 - 2
app/src/main/res/drawable/icon_arcordion_close_arrow.xml

@@ -1,5 +1,5 @@
-<vector android:height="5dp" android:viewportHeight="43"
-    android:viewportWidth="42" android:width="9dp" xmlns:android="http://schemas.android.com/apk/res/android">
+<vector android:height="11dp" android:viewportHeight="43"
+    android:viewportWidth="42" android:width="11dp" xmlns:android="http://schemas.android.com/apk/res/android">
     <path android:fillColor="#00000000" android:fillType="evenOdd"
         android:pathData="M39,31L21,13 3,31" android:strokeColor="#000" android:strokeWidth="4"/>
 </vector>

+ 2 - 2
app/src/main/res/drawable/icon_arcordion_open_arrow.xml

@@ -1,5 +1,5 @@
-<vector android:height="9dp" android:viewportHeight="42"
-    android:viewportWidth="42" android:width="9dp" xmlns:android="http://schemas.android.com/apk/res/android">
+<vector android:height="11dp" android:viewportHeight="42"
+    android:viewportWidth="42" android:width="11dp" xmlns:android="http://schemas.android.com/apk/res/android">
     <path android:fillColor="#00000000" android:fillType="evenOdd"
         android:pathData="M39,12L21,30 3,12" android:strokeColor="#000" android:strokeWidth="4"/>
 </vector>

+ 17 - 0
app/src/main/res/drawable/switch_thumb_off.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:shape="oval">
+
+  <size
+    android:width="20dp"
+    android:height="20dp" />
+
+  <solid
+    android:color="#ffffff" />
+
+  <stroke
+    android:width="2dp"
+    android:color="#e5e5e5" />
+
+</shape>

+ 17 - 0
app/src/main/res/drawable/switch_thumb_on.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:shape="oval">
+
+  <size
+    android:width="20dp"
+    android:height="20dp" />
+
+  <solid
+    android:color="#ffffff" />
+
+  <stroke
+    android:width="2dp"
+    android:color="#333333" />
+
+</shape>

+ 10 - 0
app/src/main/res/drawable/switch_thumb_selector.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+  <item
+    android:drawable="@drawable/switch_thumb_off"
+    android:state_checked="false"/>
+  <item
+    android:drawable="@drawable/switch_thumb_on"
+    android:state_checked="true"/>
+
+</selector>

+ 15 - 0
app/src/main/res/drawable/switch_track_off.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:shape="rectangle">
+
+  <corners
+    android:radius="15dp"/>
+
+  <size
+    android:width="44dp"
+    android:height="18dp"/>
+  <solid
+    android:color="#e5e5e5"/>
+
+</shape>

+ 16 - 0
app/src/main/res/drawable/switch_track_on.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:shape="rectangle" >
+
+  <corners
+    android:radius="15dp" />
+
+  <size
+    android:width="44dp"
+    android:height="18dp" />
+
+  <solid
+    android:color="#333333" />
+
+</shape>

+ 10 - 0
app/src/main/res/drawable/switch_track_selector.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+  <item
+    android:drawable="@drawable/switch_track_off"
+    android:state_checked="false"/>
+  <item
+    android:drawable="@drawable/switch_track_on"
+    android:state_checked="true"/>
+
+</selector>

+ 72 - 7
app/src/main/res/layout/activity_setting.xml

@@ -1,14 +1,79 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
-  android:layout_height="match_parent">
-<android.support.v7.widget.RecyclerView
-  android:id="@+id/recycler_view_setting"
-  android:layout_width="match_parent"
   android:layout_height="match_parent"
-  android:layout_marginStart="25dp"
-  android:layout_marginEnd="25dp"
-  />
+  android:orientation="vertical"
+  >
+
+  <android.support.v7.widget.RecyclerView
+    android:id="@+id/recycler_view_setting"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="25dp"
+    android:layout_marginEnd="25dp"
+    />
+
+  <!--<android.support.constraint.ConstraintLayout
+    android:id="@+id/relative_layout"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    >
+
+    <LinearLayout
+      android:id="@+id/linearLayout"
+      android:layout_width="0dp"
+      android:layout_height="wrap_content"
+      android:layout_alignParentEnd="true"
+      android:layout_alignParentBottom="true"
+      android:orientation="vertical"
+      app:layout_constraintBottom_toTopOf="parent"
+      app:layout_constraintEnd_toEndOf="parent"
+      app:layout_constraintStart_toStartOf="parent"
+      app:layout_constraintTop_toTopOf="parent">
+
+      <view
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="@color/CEBEBEB"/>
+
+    </LinearLayout>
+
+
+    <LinearLayout
+      android:id="@+id/linearLayout2"
+      android:layout_width="0dp"
+      android:layout_height="wrap_content"
+      android:layout_alignParentStart="true"
+      android:layout_alignParentTop="true"
+      android:orientation="horizontal"
+      android:weightSum="4"
+      app:layout_constraintEnd_toEndOf="parent"
+      app:layout_constraintStart_toStartOf="parent">
+
+      <TextView
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="2"
+        android:lineSpacingExtra="3.5sp"
+        android:text="현재버전 v4.1.1"
+        android:textColor="#666666"
+        android:textSize="12sp"/>
+
+      <TextView
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="2"
+        android:gravity="end"
+        android:lineSpacingExtra="3.5sp"
+        android:text="최신버전입니다."
+        android:textColor="#999999"
+        android:textSize="12sp"
+        />
+
+    </LinearLayout>
+
+  </android.support.constraint.ConstraintLayout>-->
 </LinearLayout>

+ 7 - 6
app/src/main/res/layout/setting_custom_menu1.xml

@@ -48,12 +48,11 @@
       app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
-  <com.github.aakira.expandablelayout.ExpandableRelativeLayout
+  <RelativeLayout
     android:id="@+id/layout_default_setting"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:ael_expanded="false"
+    android:visibility="visible"
     >
 
     <TextView
@@ -89,12 +88,14 @@
       android:textSize="12sp"/>
 
     <Switch
-      android:id="@+id/switch1"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignParentEnd="true"
       android:layout_marginTop="30dp"
-      android:layout_marginBottom="28dp"/>
-  </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
+      android:layout_marginBottom="28dp"
+      android:thumb="@drawable/switch_thumb_selector"
+      android:track="@drawable/switch_track_selector"
+      />
+  </RelativeLayout>
 
 </LinearLayout>

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

@@ -50,12 +50,12 @@
       app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
-  <com.github.aakira.expandablelayout.ExpandableRelativeLayout
+  <RelativeLayout
     android:id="@+id/layout_code_manage"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
-    app:ael_expanded="false"
+    android:visibility="gone"
     >
 
     <TextView
@@ -91,6 +91,6 @@
       android:textColor="@color/C999999"
       android:textSize="12sp"/>
 
-  </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
+  </RelativeLayout>
 
 </LinearLayout>

+ 3 - 3
app/src/main/res/layout/setting_custom_menu3.xml

@@ -44,12 +44,12 @@
       app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
-  <com.github.aakira.expandablelayout.ExpandableRelativeLayout
+  <RelativeLayout
     android:id="@+id/layout_push_location_setting"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
-    app:ael_expanded="false"
+    android:visibility="gone"
     >
 
     <RelativeLayout
@@ -119,6 +119,6 @@
     </RelativeLayout>
 
 
-  </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
+  </RelativeLayout>
 
 </LinearLayout>

+ 3 - 3
app/src/main/res/layout/setting_custom_menu4.xml

@@ -48,12 +48,12 @@
       app:srcCompat="@drawable/icon_arcordion_open_arrow"/>
   </android.support.constraint.ConstraintLayout>
 
-  <com.github.aakira.expandablelayout.ExpandableRelativeLayout
+  <RelativeLayout
     android:id="@+id/layout_agree_information"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
-    app:ael_expanded="false"
+    android:visibility="gone"
     >
 
     <TextView
@@ -79,6 +79,6 @@
       android:textSize="12sp"/>
 
 
-  </com.github.aakira.expandablelayout.ExpandableRelativeLayout>
+  </RelativeLayout>
 
 </LinearLayout>