Просмотр исходного кода

[이벤트][Common] 이벤트 항목선택형 글자형 커스텀 체크박스 추가

Hasemi 7 лет назад
Родитель
Сommit
c3f8aa3d26

+ 13 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/event/EventCombinedTypeSelectView.java

@@ -37,12 +37,14 @@ public class EventCombinedTypeSelectView extends ConstraintLayout implements Che
     super(context, attrs, defStyleAttr);
   }
 
-  public void init(Context context) {
+  public void init(Context context, String checkBoxText) {
     if (null != context) {
       LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       inflater.inflate(R.layout.event_combined_type_select_view, this);
 
       checkBox = findViewById(R.id.check_box);
+      checkBox.setText(checkBoxText);
+
       checkBox.setOnClickListener(view -> {
         if (null != listener) {
           listener.onClick(this);
@@ -58,11 +60,20 @@ public class EventCombinedTypeSelectView extends ConstraintLayout implements Che
 
   @Override
   public boolean isChecked() {
-    return false;
+    return checkBox.isChecked();
   }
 
   @Override
   public void toggle() {
 
   }
+
+  public void setText(String text) {
+    checkBox.setText(text);
+  }
+
+  @Override
+  public void setOnClickListener(@Nullable OnClickListener listener) {
+    this.listener = listener;
+  }
 }

+ 0 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventSelectCombinedHolder.java

@@ -32,7 +32,6 @@ public class EventSelectCombinedHolder extends EventDetailView {
 
   public EventSelectCombinedHolder(View itemView) {
     super(itemView);
-
     textViewQuestionTitle = itemView.findViewById(R.id.text_view_question_title);
     textViewQuestionSubTitle = itemView.findViewById(R.id.text_view_question_sub_title);
     eventEnterTypeSelectView = itemView.findViewById(R.id.event_select_area);

+ 9 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventSelectTextHolder.java

@@ -2,12 +2,14 @@ package kr.co.zumo.app.lifeplus.view.screen.event;
 
 import android.view.View;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
 import kr.co.zumo.app.lifeplus.view.IEventListener;
+import kr.co.zumo.app.lifeplus.view.custom.event.EventCombinedTypeSelectView;
 
 /**
  * EventSelectTextHolder
@@ -25,7 +27,7 @@ public class EventSelectTextHolder extends EventDetailView {
   private TextView textViewSubQuestion;
   private ImageView imageViewIconConfirm;
   private TextView textViewConfirm;
-
+  private LinearLayout layoutSelectArea;
 
   public EventSelectTextHolder(View itemView) {
     super(itemView);
@@ -33,6 +35,7 @@ public class EventSelectTextHolder extends EventDetailView {
     textViewSubQuestion = itemView.findViewById(R.id.text_view_sub_question);
     imageViewIconConfirm = itemView.findViewById(R.id.icon_info);
     textViewConfirm = itemView.findViewById(R.id.text_view_confirm);
+    layoutSelectArea = itemView.findViewById(R.id.layout_select_area);
     itemView.setPadding(0, ResourceUtil.getStatusBarHeightManual(), 0, 0);
   }
 
@@ -45,5 +48,10 @@ public class EventSelectTextHolder extends EventDetailView {
     imageViewIconConfirm.setOnClickListener(view -> {listener.onEvent(new Event.Builder(Event.DETAIL).build());});
     textViewConfirm.setOnClickListener(view -> {listener.onEvent(new Event.Builder(Event.DETAIL).build());});
 
+    for (int i = 0; i < 2; i++) {
+      EventCombinedTypeSelectView selectView = new EventCombinedTypeSelectView(itemView.getContext());
+      selectView.init(itemView.getContext(), "#조용한");
+      layoutSelectArea.addView(selectView);
+    }
   }
 }

+ 12 - 4
app/src/main/res/layout/event_combined_type_select_view.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<merge
+<android.support.constraint.ConstraintLayout
   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="wrap_content"
   android:layout_height="wrap_content"
@@ -10,10 +11,12 @@
     android:id="@+id/check_box"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
-    android:layout_marginEnd="9dp"
+    android:layout_marginStart="3dp"
+    android:layout_marginTop="4dp"
+    android:layout_marginEnd="3dp"
+    android:layout_marginBottom="4dp"
     android:background="@drawable/event_select_custom_radio_selector"
     android:button="@null"
-    tools:checked="true"
     android:lineSpacingExtra="4sp"
     android:paddingStart="22dp"
     android:paddingTop="12dp"
@@ -22,6 +25,11 @@
     android:textAlignment="center"
     android:textColor="@drawable/event_select_custom_text_selector"
     android:textSize="12sp"
+    app:layout_constraintBottom_toBottomOf="parent"
+    app:layout_constraintEnd_toEndOf="parent"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toTopOf="parent"
+    tools:checked="true"
     tools:text="#따뜻한 분위기"
     />
-</merge>
+</android.support.constraint.ConstraintLayout>

+ 6 - 3
app/src/main/res/layout/event_select_type_recommend_tag.xml

@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                                             android:layout_width="match_parent"
-                                             android:layout_height="match_parent">
+<android.support.constraint.ConstraintLayout
+  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.constraint.ConstraintLayout>

+ 20 - 3
app/src/main/res/layout/event_select_type_text.xml

@@ -42,11 +42,11 @@
     android:layout_marginEnd="25dp"
     android:layout_marginBottom="100dp"
     android:scaleType="centerCrop"
+    android:src="@drawable/img_bookmark_default"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintEnd_toEndOf="parent"
     app:layout_constraintStart_toStartOf="parent"
     app:layout_constraintTop_toTopOf="parent"
-    android:src="@drawable/img_bookmark_default"
     />
 
   <View
@@ -73,12 +73,12 @@
     android:shadowColor="#80000000"
     android:shadowDy="1"
     android:shadowRadius="3"
+    android:text="Q."
     android:textColor="@color/CFFFFFF"
     android:textSize="25sp"
     app:layout_constraintEnd_toEndOf="@+id/image_view_background"
     app:layout_constraintStart_toStartOf="@+id/image_view_background"
-    app:layout_constraintTop_toTopOf="@+id/image_view_background"
-    android:text="Q."/>
+    app:layout_constraintTop_toTopOf="@+id/image_view_background"/>
 
   <TextView
     android:id="@+id/text_view_question"
@@ -112,6 +112,23 @@
     app:layout_constraintTop_toBottomOf="@+id/text_view_question"
     tools:text="나를 잘 표현할 수 있는 태그를 선택해주세요."/>
 
+  <LinearLayout
+    android:id="@+id/layout_select_area"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="33dp"
+    android:layout_marginTop="106dp"
+    android:layout_marginEnd="33dp"
+    android:gravity="center"
+    android:orientation="horizontal"
+    app:layout_constraintEnd_toEndOf="@+id/image_view_background"
+    app:layout_constraintStart_toStartOf="@+id/image_view_background"
+    app:layout_constraintTop_toBottomOf="@+id/text_view_sub_question"
+    tools:background="@color/C999999"
+    tools:layout_height="30dp">
+
+  </LinearLayout>
+
   <ImageView
     android:id="@+id/icon_info"
     android:layout_width="wrap_content"