From ef81032b42a6b7caadae4168d72f1ca79c6d958f Mon Sep 17 00:00:00 2001 From: Seungmin-develop Date: Sun, 6 Mar 2022 18:07:11 +0900 Subject: [PATCH] [fix] #99 Fix Error --- .../category/model/IdeaListInfo.kt | 11 -- .../category/view/adapter/IdeaListAdapter.kt | 11 +- .../view/fragment/IdeaListFragment.kt | 6 - .../infraandroid/id/view/LoginFragment.kt | 126 +++++++++--------- .../model/RequestJoinedUserData.kt | 8 ++ .../model/ResponseJoinedUserData.kt | 17 +++ .../teammembereval/model/TeamMemberService.kt | 14 ++ .../infraandroid/util/BindingConversion.kt | 9 +- app/src/main/res/layout/fragment_login.xml | 10 +- 9 files changed, 113 insertions(+), 99 deletions(-) delete mode 100644 app/src/main/java/com/example/infraandroid/category/model/IdeaListInfo.kt create mode 100644 app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/RequestJoinedUserData.kt create mode 100644 app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/ResponseJoinedUserData.kt create mode 100644 app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/TeamMemberService.kt diff --git a/app/src/main/java/com/example/infraandroid/category/model/IdeaListInfo.kt b/app/src/main/java/com/example/infraandroid/category/model/IdeaListInfo.kt deleted file mode 100644 index 3ea344f..0000000 --- a/app/src/main/java/com/example/infraandroid/category/model/IdeaListInfo.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.example.infraandroid.category.model - -data class IdeaListInfo ( - var projectImg : String, - var projectName : String, - var projectCategory : String, - var projectTeamNumber : String, - var hashTagOne : String, - var hashTagTwo : String, - var projectStatus : String, -) \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt b/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt index d57a299..d47ce67 100644 --- a/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt +++ b/app/src/main/java/com/example/infraandroid/category/view/adapter/IdeaListAdapter.kt @@ -4,10 +4,8 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.navigation.findNavController import androidx.recyclerview.widget.RecyclerView -import com.bumptech.glide.Glide import com.example.infraandroid.util.ImageRound import com.example.infraandroid.R -import com.example.infraandroid.category.model.IdeaListInfo import com.example.infraandroid.category.model.ResponseLookUpAllProjectData import com.example.infraandroid.databinding.ItemIdeaListRecyclerviewBinding @@ -33,16 +31,9 @@ class IdeaListAdapter(): RecyclerView.Adapter() { private val binding:ItemIdeaListRecyclerviewBinding ): RecyclerView.ViewHolder(binding.root){ fun onBind(ideaListInfo: ResponseLookUpAllProjectData.Result){ -// binding.projectCategoryTitle.text = ideaListInfo. -// binding.projectCategoryTextView.text = ideaListInfo.projectCategory -// binding.hashTagOne.text = ideaListInfo.hashTagOne -// binding.hashTagTwo.text = ideaListInfo.hashTagTwo - ImageRound.roundAll(binding.projectImageView, 36f) binding.projectList = ideaListInfo -// Glide.with(itemView) -// .load(ideaListInfo.projectImg) -// .into(binding.projectImageView) + itemView.setOnClickListener { it.findNavController().navigate(R.id.action_idea_list_fragment_to_categoryViewIdeaFragment) } diff --git a/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt b/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt index a2e3d05..4c1c024 100644 --- a/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt +++ b/app/src/main/java/com/example/infraandroid/category/view/fragment/IdeaListFragment.kt @@ -1,14 +1,8 @@ package com.example.infraandroid.category.view.fragment -import android.os.Bundle import android.util.Log -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.fragment.app.Fragment import androidx.navigation.findNavController import com.example.infraandroid.R -import com.example.infraandroid.category.model.IdeaListInfo import com.example.infraandroid.category.model.ResponseLookUpAllProjectData import com.example.infraandroid.category.view.adapter.IdeaListAdapter import com.example.infraandroid.databinding.FragmentIdeaListBinding diff --git a/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt b/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt index cbf73ce..6a86216 100644 --- a/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt +++ b/app/src/main/java/com/example/infraandroid/id/view/LoginFragment.kt @@ -108,23 +108,23 @@ class LoginFragment : BaseFragment(R.layout.fragment_login it.findNavController().navigate(R.id.action_login_fragment_to_sign_up_first_fragment) } - binding.loginGoogleIv.setOnClickListener { - oneTapClient.beginSignIn(signInRequest) - .addOnSuccessListener(requireActivity()) { result -> - try { - startIntentSenderForResult( - result.pendingIntent.intentSender, REQ_ONE_TAP, - null, 0, 0, 0, null) - } catch (e: IntentSender.SendIntentException) { - Log.e(TAG, "Couldn't start One Tap UI: ${e.localizedMessage}") - } - } - .addOnFailureListener(requireActivity()) { e -> - // No saved credentials found. Launch the One Tap sign-up flow, or - // do nothing and continue presenting the signed-out UI. - Log.d(TAG, e.localizedMessage) - } - } +// binding.loginGoogleIv.setOnClickListener { +// oneTapClient.beginSignIn(signInRequest) +// .addOnSuccessListener(requireActivity()) { result -> +// try { +// startIntentSenderForResult( +// result.pendingIntent.intentSender, REQ_ONE_TAP, +// null, 0, 0, 0, null) +// } catch (e: IntentSender.SendIntentException) { +// Log.e(TAG, "Couldn't start One Tap UI: ${e.localizedMessage}") +// } +// } +// .addOnFailureListener(requireActivity()) { e -> +// // No saved credentials found. Launch the One Tap sign-up flow, or +// // do nothing and continue presenting the signed-out UI. +// Log.d(TAG, e.localizedMessage) +// } +// } // 네이버 아이디로 로그인 // val naver_client_id = "WWSmSMIYeWU77c_0uql8" @@ -187,51 +187,51 @@ class LoginFragment : BaseFragment(R.layout.fragment_login // } // } - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - - when (requestCode) { - REQ_ONE_TAP -> { - try { - val credential = oneTapClient.getSignInCredentialFromIntent(data) - val idToken = credential.googleIdToken - val username = credential.id - val password = credential.password - when { - idToken != null -> { - // Got an ID token from Google. Use it to authenticate - // with your backend. - Log.d(TAG, "Got ID token.") - } - password != null -> { - // Got a saved username and password. Use them to authenticate - // with your backend. - Log.d(TAG, "Got password.") - } - else -> { - // Shouldn't happen. - Log.d(TAG, "No ID token or password!") - } - } - } catch (e: ApiException) { - when (e.statusCode) { - CommonStatusCodes.CANCELED -> { - Log.d(TAG, "One-tap dialog was closed.") - // Don't re-prompt the user. - showOneTapUI = false - } - CommonStatusCodes.NETWORK_ERROR -> { - Log.d(TAG, "One-tap encountered a network error.") - // Try again or just ignore. - } - else -> { - Log.d(TAG, "Couldn't get credential from result." + - " (${e.localizedMessage})") - } - } - } - } - } - } +// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { +// super.onActivityResult(requestCode, resultCode, data) +// +// when (requestCode) { +// REQ_ONE_TAP -> { +// try { +// val credential = oneTapClient.getSignInCredentialFromIntent(data) +// val idToken = credential.googleIdToken +// val username = credential.id +// val password = credential.password +// when { +// idToken != null -> { +// // Got an ID token from Google. Use it to authenticate +// // with your backend. +// Log.d(TAG, "Got ID token.") +// } +// password != null -> { +// // Got a saved username and password. Use them to authenticate +// // with your backend. +// Log.d(TAG, "Got password.") +// } +// else -> { +// // Shouldn't happen. +// Log.d(TAG, "No ID token or password!") +// } +// } +// } catch (e: ApiException) { +// when (e.statusCode) { +// CommonStatusCodes.CANCELED -> { +// Log.d(TAG, "One-tap dialog was closed.") +// // Don't re-prompt the user. +// showOneTapUI = false +// } +// CommonStatusCodes.NETWORK_ERROR -> { +// Log.d(TAG, "One-tap encountered a network error.") +// // Try again or just ignore. +// } +// else -> { +// Log.d(TAG, "Couldn't get credential from result." + +// " (${e.localizedMessage})") +// } +// } +// } +// } +// } +// } } diff --git a/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/RequestJoinedUserData.kt b/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/RequestJoinedUserData.kt new file mode 100644 index 0000000..ce45ed7 --- /dev/null +++ b/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/RequestJoinedUserData.kt @@ -0,0 +1,8 @@ +package com.example.infraandroid.myinfo.teammembereval.model + +import com.google.gson.annotations.SerializedName + +data class RequestJoinedUserData( + @SerializedName("pj_num") + val projectIdx : Int +) diff --git a/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/ResponseJoinedUserData.kt b/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/ResponseJoinedUserData.kt new file mode 100644 index 0000000..f551ca1 --- /dev/null +++ b/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/ResponseJoinedUserData.kt @@ -0,0 +1,17 @@ +package com.example.infraandroid.myinfo.teammembereval.model + +import com.google.gson.annotations.SerializedName + +data class ResponseJoinedUserData( + val isSuccess: Boolean, + val code: Int, + val message: String, + val result: ArrayList, +){ + data class Result( + @SerializedName("user_nickname") + val nickName : String, + @SerializedName("user_prPhoto") + val profileImg : String, + ) +} diff --git a/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/TeamMemberService.kt b/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/TeamMemberService.kt new file mode 100644 index 0000000..7ef5ff3 --- /dev/null +++ b/app/src/main/java/com/example/infraandroid/myinfo/teammembereval/model/TeamMemberService.kt @@ -0,0 +1,14 @@ +package com.example.infraandroid.myinfo.teammembereval.model + +import retrofit2.Call +import retrofit2.http.Header +import retrofit2.http.POST +import retrofit2.http.Query + +interface TeamMemberService { + @POST("/project/team?") + fun lookUpAllJoinedUser( + @Header("X-ACCESS-TOKEN") jwt: String, + @Query("user_id") user_id : String + ): Call +} \ No newline at end of file diff --git a/app/src/main/java/com/example/infraandroid/util/BindingConversion.kt b/app/src/main/java/com/example/infraandroid/util/BindingConversion.kt index 73cd4b6..8e0594f 100644 --- a/app/src/main/java/com/example/infraandroid/util/BindingConversion.kt +++ b/app/src/main/java/com/example/infraandroid/util/BindingConversion.kt @@ -1,6 +1,8 @@ package com.example.infraandroid.util import android.annotation.SuppressLint +import android.content.res.ColorStateList +import android.graphics.Color import android.widget.ImageView import android.widget.TextView import androidx.core.view.isGone @@ -43,15 +45,14 @@ object BindingConversions { } } - @SuppressLint("ResourceAsColor") @JvmStatic @BindingAdapter("deadline") fun setDeadlineText(textView: TextView, comment: String){ textView.text = comment when(comment){ - "마감" -> textView.setTextColor(R.color.infra_gray_v) - "마감임박!" -> textView.setTextColor(R.color.infra_purple_a) - "모집중!" -> textView.setTextColor(R.color.infra_skyblue_a) + "마감" -> textView.setTextColor(Color.parseColor("#8F8F8F")) + "마감임박" -> textView.setTextColor(Color.parseColor("#9277F8")) + "모집중" -> textView.setTextColor(Color.parseColor("#4B8EFF")) } } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml index d38a619..c7902d8 100644 --- a/app/src/main/res/layout/fragment_login.xml +++ b/app/src/main/res/layout/fragment_login.xml @@ -225,11 +225,11 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + + + + +