Skip to content

Commit

Permalink
[#139] fix : 플로우 컨트롤러 버벅임 해결(for문 내부로 로직 옮기기, media3로 업그레이드)
Browse files Browse the repository at this point in the history
  • Loading branch information
serioushyeon committed Oct 30, 2024
1 parent c6a1229 commit e8115b0
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 139 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ dependencies {

//구글 로그인 지원용
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.0")

//media3
implementation ("androidx.media3:media3-exoplayer:1.0.0")
implementation ("androidx.media3:media3-ui:1.0.0")
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.project.balpyo.api.request.GenerateNoteRequest
import com.project.balpyo.api.response.GenerateAudioResponse
import com.project.balpyo.api.response.SpeechMark
import com.project.balpyo.api.response.StorageListResult
import com.project.balpyo.api.toStorageListResult
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
Expand Down Expand Up @@ -120,7 +119,7 @@ class FlowControllerViewModel : ViewModel() {
val result: BaseDto? = response.body()
generateFlowControllerResponse.value = result!!
val action = LoadingFragmentDirections.actionLoadingFragmentToFlowControllerResultFragment(
isNew = true
type = "New"
)
navController.navigate(action)
} else {
Expand All @@ -145,20 +144,20 @@ class FlowControllerViewModel : ViewModel() {
navController.navigate(actionToLoading)
apiClient.apiService.editAndCalc("Bearer ${PreferenceHelper.getUserToken(mainActivity)}", scriptId.value!!.toInt(), baseDto )
.enqueue(object :
Callback<BaseDto> {
override fun onResponse(call: Call<BaseDto>, response: Response<BaseDto>) {
Callback<StorageListResult> {
override fun onResponse(call: Call<StorageListResult>, response: Response<StorageListResult>) {
if (response.isSuccessful) {
// 정상적으로 통신이 성공된 경우
val result: BaseDto? = response.body()
val result: StorageListResult? = response.body()
Log.d("##", "onResponse 성공: " + result?.toString())
setFlowControllerResult(result!!.toStorageListResult())
setFlowControllerResult(result!!)
val actionToResult = LoadingFragmentDirections.actionLoadingFragmentToFlowControllerResultFragment(
isNew = false
type = "Home"
)
navController.navigate(actionToResult)
} else {
// 통신이 실패한 경우(응답코드 3xx, 4xx 등)
var result: BaseDto? = response.body()
var result: StorageListResult? = response.body()
Log.d("##", "onResponse 실패")
Log.d("##", "onResponse 실패: " + response.code())
Log.d("##", "onResponse 실패: " + response.body())
Expand All @@ -168,7 +167,7 @@ class FlowControllerViewModel : ViewModel() {
}
}

override fun onFailure(call: Call<BaseDto>, t: Throwable) {
override fun onFailure(call: Call<StorageListResult>, t: Throwable) {
// 통신 실패
Log.d("##", "onFailure 에러: " + t.message.toString());
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/project/balpyo/Home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class HomeFragment : Fragment() {
flowControllerViewModel.setFlowControllerResult(list[position])
val action =
HomeFragmentDirections.actionHomeFragmentToFlowControllerResultFragment(
isNew = false
type = "Home"
)
findNavController().navigate(action)

Expand All @@ -124,7 +124,7 @@ class HomeFragment : Fragment() {
flowControllerViewModel.setFlowControllerResult(list[position])
val action =
HomeFragmentDirections.actionHomeFragmentToFlowControllerResultFragment(
isNew = false
type = "Home"
)
findNavController().navigate(action)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class StorageFragment : Fragment(), FilterBottomSheetListener {
flowControllerViewModel.initialize()
flowControllerViewModel.setFlowControllerResult(list[position])
val action = StorageFragmentDirections.actionStorageFragmentToFlowControllerResultFragment(
isNew = false
type = "Storage"
)
findNavController().navigate(action)

Expand All @@ -136,7 +136,7 @@ class StorageFragment : Fragment(), FilterBottomSheetListener {
flowControllerViewModel.initialize()
flowControllerViewModel.setFlowControllerResult(list[position])
val action = StorageFragmentDirections.actionStorageFragmentToFlowControllerResultFragment(
isNew = false
type = "Storage"
)
findNavController().navigate(action)
} else {
Expand Down Expand Up @@ -170,7 +170,7 @@ class StorageFragment : Fragment(), FilterBottomSheetListener {
flowControllerViewModel.initialize()
flowControllerViewModel.setFlowControllerResult(list[position])
val action = StorageFragmentDirections.actionStorageFragmentToFlowControllerResultFragment(
isNew = false
type = "Storage"
)
findNavController().navigate(action)

Expand All @@ -181,7 +181,7 @@ class StorageFragment : Fragment(), FilterBottomSheetListener {
flowControllerViewModel.initialize()
flowControllerViewModel.setFlowControllerResult(list[position])
val action = StorageFragmentDirections.actionStorageFragmentToFlowControllerResultFragment(
isNew = false
type = "Storage"
)
findNavController().navigate(action)
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/project/balpyo/api/ApiService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ interface ApiService {

//수정 (계산함)
@PUT("scripts/{id}/cal")
fun editAndCalc(@Header("Authorization") token: String, @Path("id") id: Int, @Body parameters: BaseDto): Call<BaseDto>
fun editAndCalc(@Header("Authorization") token: String, @Path("id") id: Int, @Body parameters: BaseDto): Call<StorageListResult>

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
android:fontFamily="@font/pretendard_bold"
android:paddingBottom="50dp"
android:text="안녕하세요 반갑습니다 저는 개발자입니다"
android:textColor="@color/black"
android:textSize="28sp"
app:lineHeight="40sp" />
</LinearLayout>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
android:id="@+id/action_flowControllerResultFragment_to_loadingFragment"
app:destination="@id/loadingFragment" />
<argument
android:name="isNew"
app:argType="boolean"
android:name="type"
app:argType="string"
android:defaultValue="true" />
</fragment>
<fragment
Expand Down

0 comments on commit e8115b0

Please sign in to comment.