Przeglądaj źródła

[회원가입][New] 회원 가입 디바이더 구현

hyodong.min 7 lat temu
rodzic
commit
71f4f4b35d

+ 14 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/signup/SignUpDividerHolder.java

@@ -4,6 +4,13 @@
 package kr.co.zumo.app.lifeplus.view.fragment.signup;
 
 import android.view.View;
+import android.widget.TextView;
+
+import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.model.SuperModel;
+import kr.co.zumo.app.lifeplus.view.model.SignUpItem;
+import kr.co.zumo.app.lifeplus.view.model.SignUpViewModel;
+import kr.co.zumo.app.lifeplus.view.model.bean.TextBean;
 
 /**
  * SignUpDividerHolder
@@ -23,5 +30,12 @@ public class SignUpDividerHolder extends BaseViewHolder {
   @Override
   void draw(int index) {
 
+    SignUpViewModel model = (SignUpViewModel) SuperModel.getInstance().getViewModel();
+
+    SignUpItem item = model.getItem(index);
+    TextBean bean = item.getBean(TextBean.class);
+    String text = bean.getText();
+
+    ((TextView) itemView.findViewById(R.id.divider_text)).setText(text);
   }
 }

+ 5 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/model/SignUpItem.java

@@ -55,6 +55,11 @@ public class SignUpItem {
     this.alignType = alignType;
   }
 
+  public SignUpItem(int itemType, String jsonString) {
+    this.jsonString = jsonString;
+    this.itemType = itemType;
+  }
+
   public SignUpItem(int itemType) {
     this.itemType = itemType;
   }

+ 11 - 10
app/src/main/res/layout/sign_up_divider.xml

@@ -2,34 +2,35 @@
 <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
-  android:layout_height="wrap_content">
+  android:layout_height="wrap_content"
+  xmlns:tools="http://schemas.android.com/tools">
 
   <LinearLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="horizontal"
-    android:weightSum="5">
+    android:gravity="center"
+    android:orientation="horizontal">
 
     <View
       android:layout_width="0dp"
       android:layout_height="2dp"
-      android:layout_marginTop="5dp"
-      android:layout_weight="2"
+      android:layout_weight="1"
       android:background="@color/colorPrimary"/>
 
     <TextView
-      android:layout_width="0dp"
+      android:id="@+id/divider_text"
+      android:layout_width="wrap_content"
       android:layout_height="wrap_content"
-      android:layout_weight="1"
-      android:text="text"
+      android:layout_marginStart="10dp"
+      android:layout_marginEnd="10dp"
+      tools:text="texsdafasdfasdfasdfasdft"
       android:textAlignment="center"
       />
 
     <View
       android:layout_width="0dp"
       android:layout_height="2dp"
-      android:layout_marginTop="5dp"
-      android:layout_weight="2"
+      android:layout_weight="1"
       android:background="@color/colorPrimary"/>
 
   </LinearLayout>