Skip to content

Commit

Permalink
[feat] detail_image / EditText 추가 (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
2chang5 committed Jul 22, 2022
1 parent e04c175 commit bcc1f26
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,21 @@ class DetailImageActivity :
popupMenu.inflate(R.menu.menu_search_result)
popupMenu.setOnMenuItemClickListener { item ->
when (item?.itemId) {
R.id.tag_add -> true
R.id.tag_edit -> true
R.id.tag_delete -> true
R.id.tag_add -> {
binding.updateState = true
detailImageViewModel.updateProcessState(ADD)
true
}
R.id.tag_edit -> {
binding.updateState = true
detailImageViewModel.updateProcessState(EDIT)
true
}
R.id.tag_delete -> {
binding.updateState = true
detailImageViewModel.updateProcessState(DELETE)
true
}
else -> false
}
}
Expand Down Expand Up @@ -134,6 +146,6 @@ class DetailImageActivity :
const val START = "START"
const val ADD = "ADD"
const val DELETE = "DELETE"
const val ADJUST = "ADJUST"
const val EDIT = "EDIT"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class DetailImageViewModel @Inject constructor(
private val _deleteSuccessState = MutableLiveData<Event<Boolean>>()
val deleteSuccessState: LiveData<Event<Boolean>> = _deleteSuccessState

private val _processState = MutableLiveData<String>("START")
val processState: LiveData<String> = _processState

fun updateProcessState(processState: String) {
_processState.value = processState
}

fun updateTagInfoList(tags: List<TagInfo>) {
_tagInfoList.value = tags
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
xmlns:tools="http://schemas.android.com/tools">

<data>
<variable
name="detailImageViewModel"
type="com.photosurfer.android.search_result.detailimage.DetailImageViewModel" />

<import type="android.view.View" />

<variable
name="detailImageViewModel"
type="com.photosurfer.android.search_result.detailimage.DetailImageViewModel" />

<variable
name="updateState"
type="boolean" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
Expand Down Expand Up @@ -59,10 +66,10 @@
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:setImage="@{detailImageViewModel.imageUrl}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_tool_bar"
app:setImage="@{detailImageViewModel.imageUrl}"
tools:srcCompat="@tools:sample/avatars" />

<androidx.constraintlayout.widget.ConstraintLayout
Expand All @@ -89,6 +96,7 @@
android:layout_marginBottom="16dp"
android:background="@drawable/shape_oval_white_fill"
android:padding="10dp"
android:visibility="@{updateState ? View.GONE: View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_trashcan_line" />
Expand All @@ -101,11 +109,40 @@
android:layout_marginBottom="16dp"
android:background="@drawable/shape_oval_white_fill"
android:padding="10dp"
android:visibility="@{updateState ? View.GONE: View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_share_line" />

</androidx.constraintlayout.widget.ConstraintLayout>

<EditText
android:id="@+id/et_tag_process"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginHorizontal="20dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_rect_white_fill_300"
android:inputType="textPersonName"
android:paddingVertical="13dp"
android:paddingStart="16dp"
android:paddingEnd="40dp"
android:textAppearance="@style/body2"
android:textColor="@color/gray_90"
app:layout_constraintBottom_toBottomOf="@+id/iv_detail"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<ImageView
android:id="@+id/iv_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
app:layout_constraintBottom_toBottomOf="@+id/et_tag_process"
app:layout_constraintEnd_toEndOf="@+id/et_tag_process"
app:layout_constraintTop_toTopOf="@+id/et_tag_process"
app:srcCompat="@drawable/ic_x_circle_fill" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_tag_detail"
android:layout_width="match_parent"
Expand Down
9 changes: 9 additions & 0 deletions shared/src/main/res/drawable/shape_rect_white_fill_300.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">
<solid android:color="@color/white" />
<stroke
android:width="1dp"
android:color="@color/gray_30" />
<corners android:radius="300dp" />
</shape>

0 comments on commit bcc1f26

Please sign in to comment.