diff --git a/app/src/main/java/org/android/go/sopt/MainActivity.kt b/app/src/main/java/org/android/go/sopt/MainActivity.kt index 01f821e..b7b7cd6 100644 --- a/app/src/main/java/org/android/go/sopt/MainActivity.kt +++ b/app/src/main/java/org/android/go/sopt/MainActivity.kt @@ -1,7 +1,7 @@ package org.android.go.sopt -import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import org.android.go.sopt.databinding.ActivityMainBinding import org.android.go.sopt.present.menuFragment.GalleryFragment @@ -15,7 +15,6 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) @@ -24,12 +23,11 @@ class MainActivity : AppCompatActivity() { supportFragmentManager.beginTransaction().add(R.id.fcv_main, HomeFragment()).commit() } - binding.bnvMain.setOnItemSelectedListener { item -> // 선택된 탭의 itemId와 현재 보여지고 있는 FragmentContainerView의 itemId가 같은 경우 // 즉 같은 탭을 다시 선택한 경우에 scrollTo 메소드를 호출 - if (binding.bnvMain.selectedItemId == item.itemId){ - binding.fcvMain.scrollTo(0,0) + if (binding.bnvMain.selectedItemId == item.itemId) { + binding.fcvMain.scrollTo(0, 0) } when (item.itemId) { @@ -52,12 +50,8 @@ class MainActivity : AppCompatActivity() { else -> { false } - } - - } - } private fun changeFragment(fragment: Fragment) { @@ -65,8 +59,5 @@ class MainActivity : AppCompatActivity() { .beginTransaction() .replace(R.id.fcv_main, fragment) .commit() - } - - -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt b/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt index 49a8e2a..7e64117 100644 --- a/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt +++ b/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt @@ -19,8 +19,6 @@ import org.android.go.sopt.databinding.ItemTopBinding import org.android.go.sopt.databinding.ItemUsersBinding import org.android.go.sopt.remote.remoteData.model.ResponseListUsersDto - - class MultiViewAdapter(context: Context) : ListAdapter(diffUtil) { @@ -28,7 +26,6 @@ class MultiViewAdapter(context: Context) : setHasStableIds(true) } - private val inflater by lazy { LayoutInflater.from(context) } private lateinit var selectionTracker: SelectionTracker @@ -50,8 +47,6 @@ class MultiViewAdapter(context: Context) : val binding: ItemUsersBinding = ItemUsersBinding.inflate(inflater, parent, false) return UsersListViewHolder(binding) } - - } } @@ -59,28 +54,22 @@ class MultiViewAdapter(context: Context) : return position.toLong() } - override fun getItemViewType(position: Int): Int { return when (position) { 0 -> MULTI_TYPE1 currentList.size + 1 -> MULTI_TYPE3 else -> MULTI_TYPE2 - } - } override fun getItemCount(): Int { return currentList.size + 2 // UserList + Top + Bottom 이므로 +2를 해준다 } - fun setSelectionTracker(selectionTracker: SelectionTracker) { - this.selectionTracker = selectionTracker } - override fun onBindViewHolder(holder: ViewHolder, position: Int) { when (getItemViewType(position)) { MULTI_TYPE1 -> { @@ -96,7 +85,6 @@ class MultiViewAdapter(context: Context) : holder.setIsRecyclable(false) } } - } class TopRvTitleViewHolder(private val binding: ItemTopBinding) : ViewHolder(binding.root) { @@ -109,7 +97,6 @@ class MultiViewAdapter(context: Context) : ViewHolder(binding.root) { fun onBind(item: ResponseListUsersDto.Data) { - binding.tvUserName.text = item.first_name + item.last_name binding.tvUserEmail.text = item.email Glide.with(binding.root).load(item.avatar).into(binding.ivAvatar) @@ -119,8 +106,6 @@ class MultiViewAdapter(context: Context) : } else { binding.ivSelect.setImageResource(R.drawable.ic_image) } - - } fun getItemDetails(viewHolder: RecyclerView.ViewHolder?): ItemDetailsLookup.ItemDetails { @@ -148,26 +133,23 @@ class MultiViewAdapter(context: Context) : fun onBind() { binding.tvMusicEnd.text = "후원사 SOPT" } - } - companion object { val diffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( oldItem: ResponseListUsersDto.Data, - newItem: ResponseListUsersDto.Data + newItem: ResponseListUsersDto.Data, ): Boolean { return oldItem === newItem } override fun areContentsTheSame( oldItem: ResponseListUsersDto.Data, - newItem: ResponseListUsersDto.Data + newItem: ResponseListUsersDto.Data, ): Boolean { return oldItem == newItem } - } } @@ -183,6 +165,4 @@ class MultiViewAdapter(context: Context) : return null } } - - } diff --git a/app/src/main/java/org/android/go/sopt/data/MultiMode.kt b/app/src/main/java/org/android/go/sopt/data/MultiMode.kt index 946d864..2a432ad 100644 --- a/app/src/main/java/org/android/go/sopt/data/MultiMode.kt +++ b/app/src/main/java/org/android/go/sopt/data/MultiMode.kt @@ -2,4 +2,4 @@ package org.android.go.sopt.data const val MULTI_TYPE1 = 0 const val MULTI_TYPE2 = 1 -const val MULTI_TYPE3 = 2 \ No newline at end of file +const val MULTI_TYPE3 = 2 diff --git a/app/src/main/java/org/android/go/sopt/data/User.kt b/app/src/main/java/org/android/go/sopt/data/User.kt index 1ff0368..a6a7763 100644 --- a/app/src/main/java/org/android/go/sopt/data/User.kt +++ b/app/src/main/java/org/android/go/sopt/data/User.kt @@ -5,8 +5,8 @@ import kotlinx.parcelize.Parcelize @Parcelize data class User( - val id : String, - val pw : String, - val name : String, - val feature : String -):Parcelable \ No newline at end of file + val id: String, + val pw: String, + val name: String, + val feature: String, +) : Parcelable diff --git a/app/src/main/java/org/android/go/sopt/present/loginPage/MySharedPrefences.kt b/app/src/main/java/org/android/go/sopt/present/loginPage/MySharedPrefences.kt index 187dbf7..dd2feff 100644 --- a/app/src/main/java/org/android/go/sopt/present/loginPage/MySharedPrefences.kt +++ b/app/src/main/java/org/android/go/sopt/present/loginPage/MySharedPrefences.kt @@ -4,61 +4,69 @@ import android.content.Context import android.content.SharedPreferences object MySharedPreferences { - private val MY_ACCOUNT : String = "account" + private val MY_ACCOUNT: String = "account" fun setUserId(context: Context, input: String) { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) - val editor : SharedPreferences.Editor = prefs.edit() + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val editor: SharedPreferences.Editor = prefs.edit() editor.putString("MY_ID", input) editor.commit() } fun getUserId(context: Context): String { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) return prefs.getString("MY_ID", "").toString() } fun setUserPass(context: Context, input: String) { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) - val editor : SharedPreferences.Editor = prefs.edit() + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val editor: SharedPreferences.Editor = prefs.edit() editor.putString("MY_PASS", input) editor.commit() } fun getUserPass(context: Context): String { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) return prefs.getString("MY_PASS", "").toString() } fun setUserName(context: Context, input: String) { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) - val editor : SharedPreferences.Editor = prefs.edit() + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val editor: SharedPreferences.Editor = prefs.edit() editor.putString("MY_NAME", input) editor.commit() } fun getUserName(context: Context): String { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) return prefs.getString("MY_NAME", "").toString() } fun setUserSpec(context: Context, input: String) { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) - val editor : SharedPreferences.Editor = prefs.edit() + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val editor: SharedPreferences.Editor = prefs.edit() editor.putString("MY_SPEC", input) editor.commit() } fun getUserSpec(context: Context): String { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) return prefs.getString("MY_SPEC", "").toString() } fun clearUser(context: Context) { - val prefs : SharedPreferences = context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) - val editor : SharedPreferences.Editor = prefs.edit() + val prefs: SharedPreferences = + context.getSharedPreferences(MY_ACCOUNT, Context.MODE_PRIVATE) + val editor: SharedPreferences.Editor = prefs.edit() editor.clear() editor.commit() } - -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/present/menuFragment/GalleryFragment.kt b/app/src/main/java/org/android/go/sopt/present/menuFragment/GalleryFragment.kt index 959d425..42686a1 100644 --- a/app/src/main/java/org/android/go/sopt/present/menuFragment/GalleryFragment.kt +++ b/app/src/main/java/org/android/go/sopt/present/menuFragment/GalleryFragment.kt @@ -18,7 +18,7 @@ class GalleryFragment : Fragment() { override fun onCreateView( // 뷰를 만든다 << 이때 초기화하면 좋음 inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { // 이제 반환하는 View가 Null일 수 없기 때문에, ?를 지워주셔도 됩니다. _binding = FragmentGalleryBinding.inflate(inflater, container, false) return binding.root @@ -33,12 +33,10 @@ class GalleryFragment : Fragment() { TabLayoutMediator(binding.tabLayout, binding.pagerHome) { tab, position -> tab.text = "Fragment ${position + 1}" }.attach() - - } override fun onDestroyView() { _binding = null super.onDestroyView() } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/present/menuFragment/SearchFragment.kt b/app/src/main/java/org/android/go/sopt/present/menuFragment/SearchFragment.kt index 097ff90..a41f9c1 100644 --- a/app/src/main/java/org/android/go/sopt/present/menuFragment/SearchFragment.kt +++ b/app/src/main/java/org/android/go/sopt/present/menuFragment/SearchFragment.kt @@ -7,7 +7,7 @@ import android.view.ViewGroup import androidx.fragment.app.Fragment import org.android.go.sopt.databinding.FragmentSearchBinding -class SearchFragment: Fragment() { +class SearchFragment : Fragment() { private var _binding: FragmentSearchBinding? = null private val binding: FragmentSearchBinding get() = requireNotNull(_binding) { "앗 ! _binding이 null이다 !" } @@ -15,7 +15,7 @@ class SearchFragment: Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { // 이제 반환하는 View가 Null일 수 없기 때문에, ?를 지워주셔도 됩니다. _binding = FragmentSearchBinding.inflate(inflater, container, false) return binding.root @@ -30,4 +30,4 @@ class SearchFragment: Fragment() { super.onDestroyView() _binding = null } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/ListUsersDto.kt b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/ListUsersDto.kt index 759e6eb..73d78d7 100644 --- a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/ListUsersDto.kt +++ b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/ListUsersDto.kt @@ -3,7 +3,6 @@ package org.android.go.sopt.remote.remoteData.model import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable - @Serializable data class ResponseListUsersDto( @SerialName("page") @@ -40,4 +39,4 @@ data class ResponseListUsersDto( @SerialName("text") val text: String, ) -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/LogInDto.kt b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/LogInDto.kt index ba44589..23220e2 100644 --- a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/LogInDto.kt +++ b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/LogInDto.kt @@ -8,7 +8,7 @@ data class RequestLogInDto( @SerialName("id") val id: String, @SerialName("password") - val password: String + val password: String, ) @Serializable @@ -18,15 +18,15 @@ data class ResponseLogInDto( @SerialName("message") val message: String, @SerialName("data") - val data: LogInData? + val data: LogInData?, ) { @Serializable data class LogInData( @SerialName("id") - val id:String, + val id: String, @SerialName("name") val name: String, @SerialName("skill") val skill: String, ) -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/MyProfileDto.kt b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/MyProfileDto.kt index 211f4fc..c61650d 100644 --- a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/MyProfileDto.kt +++ b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/MyProfileDto.kt @@ -6,19 +6,19 @@ import kotlinx.serialization.Serializable @Serializable data class MyProfileDto( @SerialName("status") - val status : Int, + val status: Int, @SerialName("message") - val message : String, + val message: String, @SerialName("data") - val data : InfoData -){ + val data: InfoData, +) { @Serializable data class InfoData( @SerialName("id") - val id : String, + val id: String, @SerialName("name") - val name : String, + val name: String, @SerialName("skill") - val skill : String + val skill: String, ) -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/RequestSignUpDto.kt b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/RequestSignUpDto.kt index 7eb9a86..a68db87 100644 --- a/app/src/main/java/org/android/go/sopt/remote/remoteData/model/RequestSignUpDto.kt +++ b/app/src/main/java/org/android/go/sopt/remote/remoteData/model/RequestSignUpDto.kt @@ -31,4 +31,4 @@ data class ResponseSignUpDto( @SerialName("skill") val skill: String, ) -} \ No newline at end of file +}