Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mod] 상세 피드 댓글 / 1차 릴리즈 QA 피드백 반영 #158

Merged
merged 11 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@
android:name=".presentation.main.feed.upload.loading.LoadingActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.feed.detail.DetailActivity"
android:exported="false"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />

<activity
android:name=".presentation.main.mypage.MypageHelpActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ class CommentAdapter(
private val binding: ItemDetailCommentBinding
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(comment: Comment) {
binding.apply {
this.data = comment

ivCommentMore.setOnClickListener { view ->
onPopupMenuClicked(view, comment.authorId, comment.commentId)
}
binding.data = comment
binding.ivCommentMore.setOnClickListener { view ->
onPopupMenuClicked(view, comment.authorId, comment.commentId)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.android.go.sopt.winey.domain.repository.DataStoreRepository
import com.android.go.sopt.winey.presentation.main.MainActivity
import com.android.go.sopt.winey.util.activity.hideKeyboard
import com.android.go.sopt.winey.util.binding.BindingActivity
import com.android.go.sopt.winey.util.context.colorOf
import com.android.go.sopt.winey.util.context.snackBar
import com.android.go.sopt.winey.util.context.stringOf
import com.android.go.sopt.winey.util.context.wineySnackbar
Expand Down Expand Up @@ -66,11 +67,28 @@ class DetailActivity : BindingActivity<ActivityDetailBinding>(R.layout.activity_
initCommentCreateButtonClickListener()
initPostCommentStateObserver()
initDeleteCommentStateObserver()

initEditTextFocusChangeListener()
updateStatusBarColor()
}

private fun updateStatusBarColor() {
window.statusBarColor = colorOf(R.color.white)
}

private fun initEditTextFocusChangeListener() {
binding.etComment.setOnFocusChangeListener { view, hasFocus ->
if (hasFocus) {
val commentListSize = commentAdapter.currentList.size
binding.rvDetail.smoothScrollToPosition(commentListSize + 1)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분 어떻게 할지 궁금했었는데 setOnFocusChangeListener 방법 너무 좋네요


override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
hideKeyboard()
return super.dispatchTouchEvent(ev)
binding.etComment.clearFocus()
return super.dispatchTouchEvent(event)
}

private fun initBackButtonClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class DetailViewModel @Inject constructor(

private const val PRODUCE_STOP_TIMEOUT = 5000L
private const val MIN_COMMENT_LENGTH = 1
private const val LONG_TEXT_LENGTH = 450
private const val LONG_TEXT_LENGTH = 50
const val MAX_COMMENT_LENGTH = 500
const val MAX_COMMENT_LINE = 4
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/shape_gray100_line_10_rect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="@color/gray_100" />
<solid android:color="@color/white" />
<corners android:radius="10dp" />
</shape>
163 changes: 108 additions & 55 deletions app/src/main/res/layout/activity_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
<import type="android.view.View" />
</data>

<!-- <androidx.coordinatorlayout.widget.CoordinatorLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<!-- -->
<!-- -->

<!-- </androidx.coordinatorlayout.widget.CoordinatorLayout>-->

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down Expand Up @@ -55,74 +63,119 @@
android:orientation="vertical"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/fl_detail_comment"
app:layout_constraintBottom_toTopOf="@id/cl_comment_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider_detail_app_bar" />

<FrameLayout
android:id="@+id/fl_detail_comment"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_comment_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/gray_100"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
<EditText
android:id="@+id/et_comment"
style="?editTextStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_white_fill_10_rect"
android:padding="12dp">

<EditText
android:id="@+id/et_comment"
style="?editTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="22dp"
android:background="@android:color/transparent"
android:hint="@string/comment_hint"
android:importantForAutofill="no"
android:inputType="text|textMultiLine"
android:maxLength="@{vm.MAX_COMMENT_LENGTH}"
android:maxLines="@{vm.MAX_COMMENT_LINE}"
android:scrollbars="vertical"
android:text="@={vm._comment}"
android:textAppearance="@style/TextAppearance.WINEY.body2_m_15"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tv_comment_create"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_comment_create"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:text="@string/comment_upload_btn_text"
android:textAppearance="@style/TextAppearance.WINEY.body_m_14"
android:textColor="@color/purple_400"
android:visibility="@{vm.isValidComment ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_comment_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{@string/comment_counter(vm._comment.length)}"
android:textAppearance="@style/TextAppearance.WINEY.detail_m_11"
android:textColor="?colorError"
android:visibility="@{vm.isLongText ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="@string/comment_counter_preview" />

</androidx.constraintlayout.widget.ConstraintLayout>

</FrameLayout>
android:background="@drawable/shape_gray100_line_10_rect"
android:hint="@string/comment_hint"
android:importantForAutofill="no"
android:inputType="text|textMultiLine"
android:maxLength="@{vm.MAX_COMMENT_LENGTH}"
android:maxLines="@{vm.MAX_COMMENT_LINE}"
android:paddingVertical="20dp"
android:paddingStart="26dp"
android:paddingEnd="54dp"
android:scrollbars="vertical"
android:text="@={vm._comment}"
android:textAppearance="@style/TextAppearance.WINEY.body2_m_15"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_comment_create"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:paddingHorizontal="13dp"
android:paddingVertical="12dp"
android:text="@string/comment_upload_btn_text"
android:textAppearance="@style/TextAppearance.WINEY.body_m_14"
android:textColor="@color/purple_400"
android:visibility="@{vm.isValidComment ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_comment_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="14dp"
android:layout_marginBottom="20dp"
android:text="@{@string/comment_counter(vm._comment.length)}"
android:textAppearance="@style/TextAppearance.WINEY.detail_m_11"
android:textColor="?colorError"
android:visibility="@{vm.isLongText ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="450/500" />

</androidx.constraintlayout.widget.ConstraintLayout>


<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_comment_container"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@drawable/shape_white_fill_10_rect">-->
<!-- -->
<!-- <TextView-->
<!-- android:id="@+id/tv_comment_create"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/comment_upload_btn_text"-->
<!-- android:textAppearance="@style/TextAppearance.WINEY.body_m_14"-->
<!-- android:textColor="@color/purple_400"-->
<!-- android:visibility="@{vm.isValidComment ? View.VISIBLE : View.GONE}"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->

<!-- <TextView-->
<!-- android:id="@+id/tv_comment_counter"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@{@string/comment_counter(vm._comment.length)}"-->
<!-- android:textAppearance="@style/TextAppearance.WINEY.detail_m_11"-->
<!-- android:textColor="?colorError"-->
<!-- android:visibility="@{vm.isLongText ? View.VISIBLE : View.GONE}"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- tools:text="@string/comment_counter_preview" />-->

<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->

<!-- <FrameLayout-->
<!-- android:id="@+id/fl_detail_comment"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@color/gray_100"-->
<!-- android:padding="10dp"-->
<!-- app:layout_constraintTop_toBottomOf="@id/rv_detail"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent">-->

<!-- </FrameLayout>-->

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>