-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from boostcampwm2023/android/feature/upload
음원 파일 업로드 (유저 입력)
- Loading branch information
Showing
15 changed files
with
117 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...re/ui/src/main/java/com/ohdodok/catchytape/core/ui/bindingadapter/UploadBindingAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.ohdodok.catchytape.core.ui.bindingadapter | ||
|
||
import android.widget.AutoCompleteTextView | ||
import androidx.databinding.BindingAdapter | ||
|
||
|
||
@BindingAdapter("changeSelectedPosition") | ||
fun AutoCompleteTextView.bindPosition(onChange: (Int) -> Unit) { | ||
setOnItemClickListener { _, _, position, _ -> onChange(position) } | ||
} |
5 changes: 5 additions & 0 deletions
5
android/core/ui/src/main/res/drawable/btn_complete_selector.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:color="@color/on_surface" android:state_enabled="true" /> | ||
<item android:color="@color/on_surface_variant" /> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM15.59,7L12,10.59 8.41,7 7,8.41 10.59,12 7,15.59 8.41,17 12,13.41 15.59,17 17,15.59 13.41,12 17,8.41z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...oid/feature/upload/src/main/java/com/ohdodok/catchytape/feature/upload/UploadViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,40 @@ | ||
package com.ohdodok.catchytape.feature.upload | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import kotlinx.coroutines.flow.launchIn | ||
import kotlinx.coroutines.flow.onEach | ||
|
||
class UploadViewModel : ViewModel() { | ||
|
||
val uploadedMusicTitle = MutableStateFlow<String>("") | ||
|
||
private val _uploadedMusicGenrePosition = MutableStateFlow(0) | ||
val uploadedMusicGenrePosition = _uploadedMusicGenrePosition.asStateFlow() | ||
|
||
private val _isUploadEnable = MutableStateFlow(false) | ||
val isUploadEnable = _isUploadEnable.asStateFlow() | ||
|
||
init { | ||
observeMusicTitle() | ||
observeGenrePosition() | ||
} | ||
|
||
val onChangePosition: (Int) -> Unit = { position: Int -> _uploadedMusicGenrePosition.value = position } | ||
|
||
|
||
private fun observeMusicTitle() { | ||
uploadedMusicTitle.onEach { | ||
_isUploadEnable.value = uploadedMusicGenrePosition.value != 0 && it.isNotEmpty() | ||
}.launchIn(viewModelScope) | ||
} | ||
|
||
|
||
private fun observeGenrePosition() { | ||
uploadedMusicGenrePosition.onEach { | ||
_isUploadEnable.value = it != 0 && uploadedMusicTitle.value.isNotEmpty() | ||
}.launchIn(viewModelScope) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters