Skip to content

Commit

Permalink
Merge pull request #34 from team-nutee/hotfix/userNickName
Browse files Browse the repository at this point in the history
[FIX]  #33 fix userNickName next Button
  • Loading branch information
jinsu4755 authored Jun 28, 2020
2 parents b085077 + 924d67b commit d3a6003
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data class ResponseMainItem(
val Likers: List<Liker>,
/*val Retweet: Any,
val RetweetId: Any,*/
val User: User,
val User: User?,
val UserId: Int?,
val content: String?,
val createdAt: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package kr.nutee.nutee_android.data.main.home

data class User(
val Image: UserImage?,
val id: Int,
val nickname: String
val id: Int?,
val nickname: String?
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package kr.nutee.nutee_android.data.member.register

data class RequestNickCheck(
val userId: String
val nickname: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package kr.nutee.nutee_android.ui.extend.imageSetting

import android.content.ContentResolver
import android.net.Uri
import android.provider.MediaStore
import android.provider.OpenableColumns
import java.io.File

fun ContentResolver.getFileName(fileUri: Uri): String {
var name = ""
Expand All @@ -16,5 +14,4 @@ fun ContentResolver.getFileName(fileUri: Uri): String {
returnCursor.close()
}
return name

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package kr.nutee.nutee_android.ui.extend.imageSetting

import kr.nutee.nutee_android.network.RequestToServer

fun imageSetting(url: String?) : String {
fun setImageURLSetting(url: String?) : String {
val baseUrl = RequestToServer.retrofit.baseUrl().toString()

return "${baseUrl}${url?:"settings/nutee_profile.png"}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kr.nutee.nutee_android.network.RequestToServer
import kr.nutee.nutee_android.ui.extend.dialog.cumstomReportDialog
import kr.nutee.nutee_android.ui.extend.customEnqueue
import kr.nutee.nutee_android.ui.extend.dialog.customSelectDialog
import kr.nutee.nutee_android.ui.extend.imageSetting.imageSetting
import kr.nutee.nutee_android.ui.extend.imageSetting.setImageURLSetting
import kr.nutee.nutee_android.ui.main.MainActivity
import kr.nutee.nutee_android.ui.main.fragment.add.AddActivity
import kr.nutee.nutee_android.ui.main.fragment.home.detail.HomeDetailFragment
Expand All @@ -44,9 +44,9 @@ class HomeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
homeAdapter: HomeAdapter
) {
val userImageLoad =
imageSetting(customData.User.Image?.src)
setImageURLSetting(customData.User?.Image?.src)
Glide.with(itemView).load(userImageLoad).into(profileImg)
profileName.text = customData.User.nickname
profileName.text = customData.User?.nickname
text_main_updateat.text = customData.updatedAt?.let { DateParser(it).calculateDiffDate() }
content.text = customData.content
setLikeEvent(btn_favorite,customData)
Expand Down Expand Up @@ -106,7 +106,7 @@ class HomeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
}

private fun moreEvent(it:View, customData: ResponseMainItem) {
if (customData.User.id.toString() == App.prefs.local_user_id) {
if (customData.User?.id.toString() == App.prefs.local_user_id) {
itemView.context.customSelectDialog(View.GONE, View.VISIBLE, View.VISIBLE,
{},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.bumptech.glide.Glide
import kr.nutee.nutee_android.R
import kr.nutee.nutee_android.data.DateParser
import kr.nutee.nutee_android.data.main.home.Comment
import kr.nutee.nutee_android.ui.extend.imageSetting.imageSetting
import kr.nutee.nutee_android.ui.extend.imageSetting.setImageURLSetting

class HomeDetailCommentViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

Expand All @@ -21,7 +21,7 @@ class HomeDetailCommentViewHolder(itemView: View) : RecyclerView.ViewHolder(item

fun bind(customData: Comment) {
Glide.with(itemView).load(
imageSetting(
setImageURLSetting(
customData.User?.Image?.src
)
).into(img_comment_profile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import kr.nutee.nutee_android.network.RequestToServer
import kr.nutee.nutee_android.ui.extend.*
import kr.nutee.nutee_android.ui.extend.dialog.cumstomReportDialog
import kr.nutee.nutee_android.ui.extend.dialog.customSelectDialog
import kr.nutee.nutee_android.ui.extend.imageSetting.imageSetting
import kr.nutee.nutee_android.ui.extend.imageSetting.setImageURLSetting
import kr.nutee.nutee_android.ui.main.MainActivity
import kr.nutee.nutee_android.ui.main.fragment.home.HomeFragement

Expand Down Expand Up @@ -59,12 +59,12 @@ class HomeDetailFragment(private var lastId: Int) : Fragment(),View.OnClickListe
postId = responseMainItem.id!!
//유저 이미지 매핑
val userImageLoad =
imageSetting(
responseMainItem.User.Image?.src
setImageURLSetting(
responseMainItem.User?.Image?.src
)
context?.let { Glide.with(it).load(userImageLoad).into(img_detail_profile) }
//유저 정보 매핑
text_detail_nick.text = responseMainItem.User.nickname
text_detail_nick.text = responseMainItem.User?.nickname
text_detail_time.text =
responseMainItem.createdAt?.let { DateParser(it).calculateDiffDate() }
text_detail_content.text = responseMainItem.content
Expand Down Expand Up @@ -122,7 +122,7 @@ class HomeDetailFragment(private var lastId: Int) : Fragment(),View.OnClickListe
for (i in 0 until 2) {
context?.let {
Glide.with(it).load(
imageSetting(
setImageURLSetting(
response.Images[i].src
)
)
Expand All @@ -141,7 +141,7 @@ class HomeDetailFragment(private var lastId: Int) : Fragment(),View.OnClickListe
for (i in 0 until 3) {
context?.let {
Glide.with(it).load(
imageSetting(
setImageURLSetting(
response.Images[i].src
)
)
Expand All @@ -153,7 +153,7 @@ class HomeDetailFragment(private var lastId: Int) : Fragment(),View.OnClickListe
cl_detail_image_more.visibility = View.VISIBLE
context?.let {
Glide.with(it).load(
imageSetting(
setImageURLSetting(
response.Images[0].src
)
)
Expand All @@ -166,7 +166,7 @@ class HomeDetailFragment(private var lastId: Int) : Fragment(),View.OnClickListe
}

private fun detailMore(res: ResponseMainItem) {
if (res.User.id.toString() == App.prefs.local_user_id) {
if (res.User?.id.toString() == App.prefs.local_user_id) {
context?.customSelectDialog(View.GONE, View.VISIBLE, View.VISIBLE,
{},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import android.view.View
import android.view.ViewGroup
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.main_fragment_proflie.*

import kr.nutee.nutee_android.R
import kr.nutee.nutee_android.data.App
import kr.nutee.nutee_android.data.member.login.ResponseLogin
import kr.nutee.nutee_android.network.RequestToServer
import kr.nutee.nutee_android.ui.extend.customEnqueue
import kr.nutee.nutee_android.ui.extend.imageSetting.imageSetting
import kr.nutee.nutee_android.ui.extend.imageSetting.setImageURLSetting

class ProfileFragment : Fragment() {

Expand Down Expand Up @@ -42,7 +41,7 @@ class ProfileFragment : Fragment() {
private fun bindUserProfile(res: ResponseLogin) {
text_user_name.text = res.nickname
val userImageLoad =
imageSetting(res.Image)
setImageURLSetting(res.Image)
context?.let { Glide.with(it).load(userImageLoad).into(img_profile_image) }
text_profile_content_num.text = res.Posts.size.toString()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class RegisterActivity : AppCompatActivity(), View.OnClickListener {
private fun requestNicknameCheck(next_btn:TextView) {
requestToServer.service.requestNickCheck(
RequestNickCheck(
userId = user_id
nickname = et_register_nick.text.toString()
)
).customEnqueue {
when (it.code()) {
Expand Down

0 comments on commit d3a6003

Please sign in to comment.