Skip to content

Commit

Permalink
Merge branch 'develop' into feature/mod-mypage-toucharea
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangwook123 committed Aug 27, 2023
2 parents 9f22e60 + 5c3356f commit de20143
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 122 deletions.
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 @@ -4,6 +4,7 @@ import CommentAdapter
import android.content.Intent
import android.os.Bundle
import android.view.Gravity
import android.view.MotionEvent
import android.view.View
import androidx.activity.viewModels
import androidx.lifecycle.flowWithLifecycle
Expand All @@ -16,7 +17,9 @@ import com.android.go.sopt.winey.domain.entity.Comment
import com.android.go.sopt.winey.domain.entity.DetailFeed
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 @@ -64,6 +67,29 @@ class DetailActivity : BindingActivity<ActivityDetailBinding>(R.layout.activity_
initCommentCreateButtonClickListener()
initPostCommentStateObserver()
initDeleteCommentStateObserver()

initEditTextFocusChangeListener()
updateStatusBarColor()
binding.tvCommentCreate.bringToFront()
}

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)
}
}
}

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

private fun initBackButtonClickListener() {
Expand Down Expand Up @@ -314,7 +340,9 @@ class DetailActivity : BindingActivity<ActivityDetailBinding>(R.layout.activity_

val commentNumber = commentAdapter.addItem(comment)
detailFeedAdapter.updateCommentNumber(commentNumber.toLong())

binding.etComment.text.clear()
binding.rvDetail.smoothScrollToPosition(commentNumber + 1)
}

is UiState.Failure -> {
Expand Down Expand Up @@ -390,19 +418,15 @@ class DetailActivity : BindingActivity<ActivityDetailBinding>(R.layout.activity_
companion object {
private const val KEY_FEED_ID = "feedId"
private const val KEY_FEED_WRITER_ID = "feedWriterId"

private const val TAG_FEED_DELETE_DIALOG = "FEED_DELETE_DIALOG"
private const val TAG_COMMENT_DELETE_DIALOG = "COMMENT_DELETE_DIALOG"
private const val TAG_REPORT_DIALOG = "REPORT_DIALOG"

private const val POPUP_MENU_POS_OFFSET = 65
private const val MSG_DETAIL_ERROR = "ERROR"
private const val EXTRA_DELETE_KEY = "delete"
private const val EXTRA_REPORT_KEY = "report"

private const val TARGET_DETAIL_FEED = "detailFeed"
private const val TARGET_COMMENT = "comment"

private const val ACTION_COMMENT_POST = "POST"
private const val ACTION_COMMENT_DELETE = "DELETE"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ 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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
}

private fun initWithdrawButtonClickListener() {
binding.ivMypageWithdraw.setOnClickListener {
binding.tvMypageWithdraw.setOnClickListener {
val dialog = WineyDialogFragment(
stringOf(R.string.mypage_withdraw_dialog_title),
stringOf(R.string.mypage_withdraw_dialog_subtitle),
Expand Down Expand Up @@ -281,7 +281,7 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
private const val LEVEL_KING = "황제"
private const val ONE_ON_ONE_URL = "https://open.kakao.com/o/s751Susf"
private const val TERMS_URL =
"https://empty-weaver-a9f.notion.site/62b37962c661488ba5f60958c24753e1?pvs=4"
"https://empty-weaver-a9f.notion.site/iney-9dbfe130c7df4fb9a0903481c3e377e6?pvs=4"
private const val EXTRA_KEY = "PREV_SCREEN_NAME"
private const val EXTRA_VALUE = "MyPageFragment"
private const val TAG_LOGOUT_DIALOG = "LOGOUT_DIALOG"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fun ImageView.setRoundedImage(imageUri: Uri?, drawable: Drawable) {
@BindingAdapter("setUploadContentBackground")
fun EditText.setUploadContentBackground(inputUiState: InputUiState) {
background = if (inputUiState is Empty || inputUiState is Success) {
context.drawableOf(R.drawable.sel_nickname_edittext_focus_color)
context.drawableOf(R.drawable.sel_upload_edittext_focus_color)
} else {
context.drawableOf(R.drawable.shape_red_line_5_rect)
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/drawable/sel_upload_edittext_focus_color.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_gray_line_10_rect" android:state_focused="false" />
<item android:drawable="@drawable/shape_purple_line_10_rect" android:state_focused="true" />
</selector>
<item android:drawable="@drawable/shape_gray200_line_5_rect" android:state_focused="false" />
<item android:drawable="@drawable/shape_purple_line_5_rect" android:state_focused="true" />
</selector>
Original file line number Diff line number Diff line change
@@ -1,11 +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="1dp"
android:color="@color/gray_200" />

android:width="10dp"
android:color="@color/gray_100" />
<solid android:color="@color/white" />
<corners android:radius="10dp" />

</shape>
</shape>
11 changes: 0 additions & 11 deletions app/src/main/res/drawable/shape_purple_line_10_rect.xml

This file was deleted.

117 changes: 64 additions & 53 deletions app/src/main/res/layout/activity_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:layout_height="match_parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_app_bar"
android:id="@+id/cl_detail_app_bar"
android:layout_width="0dp"
android:layout_height="56dp"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -35,8 +35,18 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<com.google.android.material.divider.MaterialDivider
android:id="@+id/divider_detail_app_bar"
android:layout_width="0dp"
android:layout_height="2dp"
app:dividerColor="@color/gray_50"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_detail_app_bar" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_detail"
android:layout_width="0dp"
Expand All @@ -45,73 +55,74 @@
android:orientation="vertical"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/fl_comment_input"
app:layout_constraintBottom_toTopOf="@id/cl_comment_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cl_app_bar" />
app:layout_constraintTop_toBottomOf="@id/divider_detail_app_bar" />

<FrameLayout
android:id="@+id/fl_comment_input"
<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: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" />
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_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" />
<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" />

</androidx.constraintlayout.widget.ConstraintLayout>
<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" />

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

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
13 changes: 6 additions & 7 deletions app/src/main/res/layout/fragment_amount.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
android:id="@+id/iv_amount_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="16dp"
android:paddingHorizontal="12dp"
android:paddingVertical="16dp"
android:src="@drawable/ic_upload_back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand All @@ -30,8 +30,8 @@
android:id="@+id/ll_upload_indicators"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="36dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -63,12 +63,11 @@
android:id="@+id/tv_amount_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="18dp"
android:text="@string/upload_amount_title"
android:textAppearance="@style/TextAppearance.WINEY.Headline_b_24_xxl"
android:textColor="@color/gray_900"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toStartOf="@id/ll_upload_indicators"
app:layout_constraintTop_toBottomOf="@id/ll_upload_indicators" />

<TextView
Expand All @@ -87,7 +86,7 @@
style="?editTextStyle"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_marginHorizontal="16dp"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="24dp"
android:background="@drawable/sel_upload_edittext_focus_color"
android:gravity="center_vertical|end"
Expand Down
Loading

0 comments on commit de20143

Please sign in to comment.