Files
sodalive-android/app/src/main/res/layout/activity_chat_room.xml
klaus ceae25ea06 feat(chat-room): 메시지 입력/전송/실패 처리(6.1~6.3) 구현
- 왜: 채팅방에서 메시지 입력/전송 및 오류 대응 UX 완성을 위해 6.x 과업을 구현했습니다.
- 무엇:
  - 6.1 입력창 UI
    - EditText placeholder 리소스(@string/chat_input_placeholder) 적용, 최대 200자 제한
    - imeOptions(actionSend|flagNoEnterAction)로 IME 전송 액션 지원
    - 전송 버튼 활성/비활성 상태 관리(TextWatcher), 접근성 라벨(@string/action_send)
    - 입력창 포커스/클릭 시 키보드 표시, 전송 후 키보드 숨김
  - 6.2 전송 플로우
    - onSendClicked()/sendMessage() 도입: 즉시 SENDING 상태로 사용자 메시지 추가
    - 타이핑 인디케이터 표시/숨김 제어(ChatMessageAdapter.show/hideTypingIndicator)
    - 성공 시뮬레이션 후 SENT로 상태 업데이트 및 AI 응답 메시지 추가
    - TODO: 실제 TalkApi POST 연동 지점 주석 추가
  - 6.3 전송 실패 처리
    - FAILED 상태 시 사용자 메시지에 재전송 버튼 노출(item_chat_user_message.xml: iv_retry)
    - 어댑터 콜백을 통한 onRetrySend(localId) 처리 → 재시도 시 SENDING → SENT(성공 시)로 전환
    - strings: action_retry 추가, 접근성 라벨 적용
2025-08-13 23:10:32 +09:00

218 lines
9.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_131313">
<!-- 배경 프로필 이미지 -->
<ImageView
android:id="@+id/iv_background_profile"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:contentDescription="프로필 배경 이미지" />
<!-- 딤 처리 (activity_character_detail.xml의 view_character_dim 스타일 참조) -->
<View
android:id="@+id/view_character_dim"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/color_99000000"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- 상태바 영역 배경 -->
<View
android:id="@+id/status_bar_background"
android:layout_width="0dp"
android:layout_height="24dp"
android:background="@android:color/transparent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- 헤더 영역 -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/header_container"
android:layout_width="0dp"
android:layout_height="56dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@android:color/transparent"
app:layout_constraintTop_toBottomOf="@id/status_bar_background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/iv_back"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_back"
android:contentDescription="뒤로가기"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<ImageView
android:id="@+id/iv_profile"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="12dp"
android:src="@drawable/ic_placeholder_profile"
android:contentDescription="프로필 이미지"
app:layout_constraintStart_toEndOf="@id/iv_back"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/tv_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="Character Name"
android:textColor="#FFFFFFFF"
android:textSize="16sp"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintStart_toEndOf="@id/iv_profile"
app:layout_constraintTop_toTopOf="@id/iv_profile"
app:layout_constraintEnd_toStartOf="@id/tv_character_type_badge" />
<TextView
android:id="@+id/tv_character_type_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:text="Clone"
android:textColor="#FFFFFFFF"
android:textSize="12sp"
android:background="@drawable/bg_character_status_clone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/iv_profile" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- 안내 메시지 영역 -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/notice_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:padding="12dp"
android:background="@drawable/bg_chat_notice"
app:layout_constraintTop_toBottomOf="@id/header_container"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/iv_notice_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@android:drawable/ic_dialog_info"
app:tint="#FFFFFFFF"
android:contentDescription="안내"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/tv_notice_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:textColor="#FFFFFFFF"
android:textSize="12sp"
android:text="AI Clone은 크리에이터의 정보를 기반으로 대화하지만, 모든 정보를 완벽하게 반영하거나 실제 대화와 일치하지 않을 수 있습니다."
app:layout_constraintStart_toEndOf="@id/iv_notice_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_collapse" />
<ImageView
android:id="@+id/iv_collapse"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@android:drawable/arrow_up_float"
app:tint="#FFFFFFFF"
android:contentDescription="접기"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- 채팅 메시지 영역 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_messages"
android:layout_width="0dp"
android:layout_height="0dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:clipToPadding="false"
app:layout_constraintTop_toBottomOf="@id/notice_container"
app:layout_constraintBottom_toTopOf="@id/input_container"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- 입력 영역 -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/input_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="12dp"
android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<EditText
android:id="@+id/et_message"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginEnd="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:hint="@string/chat_input_placeholder"
android:maxLength="200"
android:maxLines="4"
android:background="@drawable/bg_chat_input"
android:textColor="#FFFFFFFF"
android:textColorHint="#80FFFFFF"
android:inputType="textMultiLine"
android:imeOptions="actionSend|flagNoEnterAction"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_send"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<ImageView
android:id="@+id/iv_send"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_message_send"
android:contentDescription="전송"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>