Conversation
| inline fun <reified T> create(url: String): T { | ||
| this.url = url | ||
| return retrofit.create<T>(T::class.java) | ||
| } |
| data class ResponseGetFollwerDto( | ||
| @SerialName("page") | ||
| val page: Int, | ||
| @SerialName("per_page") | ||
| val per_page: Int, | ||
| @SerialName("total") | ||
| val total: Int, | ||
| @SerialName("total_pages") | ||
| val total_pages: Int, | ||
| @SerialName("data") | ||
| val data: List<ResponseData>, | ||
| @SerialName("support") | ||
| val support: ResponseSupport |
| private val homeViewModel by viewModels<HomeViewModel>() | ||
| private val viewModel by viewModels<EditMyPageViewModel>() |
| android:layout_height="wrap_content" | ||
| android:layout_marginStart="30dp" | ||
| android:text="@string/nickName_title" | ||
| android:text="@={viewModel.nickName}" |
| Glide.with(binding.root) | ||
| .load(friendData.reqresData?.avatar) | ||
| .into(ivProfile) |
There was a problem hiding this comment.
Coroutine Image Loader 좋은 정보감사합니다!
| } | ||
|
|
||
| private fun processLogin(response: Response<ResponseLoginDto>) { | ||
| val data: ResponseLoginDto = response.body()!! |
There was a problem hiding this comment.
흐음 requireNotNull사용하면 괜찮으려나요??
app/build.gradle
Outdated
|
|
||
|
|
| import retrofit2.http.GET | ||
|
|
||
| interface FollowerService { | ||
| @GET("https://reqres.in/api/users?page=2") |
There was a problem hiding this comment.
왜 여기에 url이 전부 들어갔을까요?
Base url 따로 분리해주세요!
? 이 있는 경우 사용하는 어노테이션이 있습니다. 지금은 2번 페이지만 고정으로 받아오고 있네요!
| @SerialName("page") | ||
| val page: Int, | ||
| @SerialName("per_page") | ||
| val per_page: Int, |
There was a problem hiding this comment.
Camel, snake 중 하나만 골라서 적용해볼까요? 다른 data class는 카멜이네요!
| // var music: Music?, | ||
| val type: Int, | ||
| val MBTI: String?, | ||
| val intro: String?, | ||
| val id: String? | ||
| // var MBTI: String?, | ||
| // var intro: String?, |
There was a problem hiding this comment.
흠흠 그러게요 뭘까요?? 얼렁 삭제하겠습니다..
| R.drawable.img_monkey, | ||
| null, | ||
| nickname, | ||
| // null, |
| musicArtist = "데이식스", | ||
| id = "jihyune_hi", | ||
| nickname = "경지현", | ||
| musicTitle = "숲", |
| fun getProfile(index: Int): Profile = mockProfileList[index] | ||
| fun getMockProfileLIst() = mockProfileList | ||
|
|
||
| // fun getResponseDataList(): MutableList<Profile> = _responseDataList |
| Profile(getName(data), data.email, data.avatar, data.id) | ||
|
|
||
| private fun getName(data: ResponseData): String = data.first_name + " " + data.last_name |
There was a problem hiding this comment.
getName()보다는
val fullName = data. ~
변수로 쓰고 convertDataToProfile함수 안에 넣어주는 건 어떤가요?
단순히 취향차이지만 함수가 중간에 껴있는 것보단 전부 파라미터가 변수인게 어떨까 싶습니다!
There was a problem hiding this comment.
더 깔끔할 것 같습니다! 감사합니다
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent"> | ||
|
|
| android:hint="@string/pw_hint" | ||
| android:inputType="textPassword" | ||
| android:text = "@={viewModel.password}" | ||
| android:text="@={viewModel.password}" |
| binding = ActivityHomeBinding.inflate(layoutInflater) | ||
| setContentView(binding.root) | ||
| binding = DataBindingUtil.setContentView(this, R.layout.activity_home) | ||
| binding.lifecycleOwner = this |
There was a problem hiding this comment.
이 코드는 왜 매번 설정해주는걸까요??? 무슨 기능을 하는지 모르겠어요
There was a problem hiding this comment.
좀만 더 공부해서 톡방에 올리겠숩니다.>!
| import android.widget.Toast | ||
| import androidx.lifecycle.MutableLiveData | ||
|
|
||
| object ToastMaker { |
There was a problem hiding this comment.
이렇게 토스트를 유틸로 빼서 쓰는거군요! 오늘도 한 수 배워갑니닷!
| binding = ActivityHomeBinding.inflate(layoutInflater) | ||
| setContentView(binding.root) | ||
| binding = DataBindingUtil.setContentView(this, R.layout.activity_home) | ||
| binding.lifecycleOwner = this |
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
Recording_2023-11-16-13-08-55.mp4
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
감사합니다 모두들 꾸벅
그 뭐냐 선택 과제는 늦게 봐서 못했어요,,,, 하지만 해보도록 하겠습니다. 심화에 도전도 해보겠숩니다.