-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
921 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 4 additions & 2 deletions
6
app/src/main/java/org/sopt/sopkathon5/andorid/data/model/ServiceCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
package org.sopt.sopkathon5.andorid.data.model | ||
package org.sopt.sopkathon5.andorid.data | ||
|
||
import org.sopt.sopkathon5.andorid.data.service.MyPageService | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
|
||
object ServiceCreator { | ||
private const val BASE_URL = "https://asia-northeast3-we-sopt-29.cloudfunctions.net/api/" | ||
private const val BASE_URL = "54.180.144.204:5001/" | ||
|
||
private val retrofit: Retrofit = Retrofit | ||
.Builder() | ||
.baseUrl(BASE_URL) | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.build() | ||
|
||
val myPageService = retrofit.create(MyPageService::class.java) | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/org/sopt/sopkathon5/andorid/data/model/request/RequestMissionCheck.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.sopt.sopkathon5.andorid.data.model.request | ||
|
||
data class RequestMissionCheck( | ||
val _id: String, | ||
val userId: Int, | ||
val dailyId: String, | ||
val completeMissions: List<String> | ||
) |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/org/sopt/sopkathon5/andorid/data/model/response/ResponseStoreDaily.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.sopt.sopkathon5.andorid.data.model.response | ||
|
||
data class ResponseStoreDaily( | ||
val status: Int, | ||
val success: Boolean, | ||
val message: String, | ||
val data: List<Data> | ||
) { | ||
data class Data( | ||
val _id: String, | ||
val userId: Int, | ||
val userName: String, | ||
val dailyId: String, | ||
val completeMissions: List<List<String>>, | ||
val __v: Int | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/org/sopt/sopkathon5/andorid/data/service/ApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.sopt.sopkathon5.andorid.data.service | ||
|
||
interface ApiService { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/org/sopt/sopkathon5/andorid/data/service/MyPageService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.sopt.sopkathon5.andorid.data.service | ||
|
||
import org.sopt.sopkathon5.andorid.data.model.response.ResponseStoreDaily | ||
import retrofit2.Call | ||
import retrofit2.http.GET | ||
|
||
interface MyPageService { | ||
@GET("daily/1") | ||
fun getStoredDaily(): Call<ResponseStoreDaily> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/src/main/java/org/sopt/sopkathon5/andorid/ui/mypage/MyDailyFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.sopt.sopkathon5.andorid.ui.mypage | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import org.sopt.sopkathon5.andorid.R | ||
import org.sopt.sopkathon5.andorid.databinding.FragmentMyDailyBinding | ||
import org.sopt.sopkathon5.andorid.ui.home.DailyAdapter | ||
import org.sopt.sopkathon5.andorid.ui.mypage.adapter.MyPageTodoCheckAdapter | ||
import org.sopt.sopkathon5.andorid.util.base.BaseFragment | ||
|
||
class MyDailyFragment : BaseFragment<FragmentMyDailyBinding>(R.layout.fragment_my_daily) { | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
initAdapter() | ||
} | ||
|
||
private fun initAdapter() { | ||
binding.rvMyDaily.adapter = DailyAdapter().apply { | ||
|
||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/org/sopt/sopkathon5/andorid/ui/mypage/MyPageFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,72 @@ | ||
package org.sopt.sopkathon5.andorid.ui.mypage | ||
|
||
import android.app.Dialog | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import androidx.databinding.DataBindingUtil | ||
import org.sopt.sopkathon5.andorid.R | ||
import org.sopt.sopkathon5.andorid.databinding.FragmentMyPageBinding | ||
import org.sopt.sopkathon5.andorid.databinding.LayoutCompleteDialogBinding | ||
import org.sopt.sopkathon5.andorid.ui.mypage.adapter.MyPageViewPagerAdapter | ||
import org.sopt.sopkathon5.andorid.util.DialogUtil | ||
import org.sopt.sopkathon5.andorid.util.base.BaseFragment | ||
|
||
class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_page) { | ||
private lateinit var completeDialog: Dialog | ||
private lateinit var layoutCompleteDialogBinding: LayoutCompleteDialogBinding | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
binding.tvMyDaily.isSelected = true | ||
initDialogBinding() | ||
initDialog() | ||
initViewPager() | ||
} | ||
|
||
private fun initViewPager() { | ||
with(binding) { | ||
vpMypage.adapter = MyPageViewPagerAdapter(requireActivity()).apply { | ||
fragmentList = listOf( | ||
MyDailyFragment(), | ||
YourDailyFragment() | ||
) | ||
} | ||
|
||
vpMypage.isUserInputEnabled = false | ||
|
||
tvMyDaily.setOnClickListener { | ||
it.isSelected = true | ||
tvYourDaily.isSelected = false | ||
binding.vpMypage.currentItem = 0 | ||
} | ||
|
||
tvYourDaily.setOnClickListener { | ||
it.isSelected = true | ||
tvMyDaily.isSelected = false | ||
binding.vpMypage.currentItem = 1 | ||
} | ||
} | ||
} | ||
|
||
private fun initDialogBinding() { | ||
layoutCompleteDialogBinding = DataBindingUtil.inflate( | ||
LayoutInflater.from(requireContext()), | ||
R.layout.layout_complete_dialog, | ||
null, | ||
false | ||
) | ||
} | ||
|
||
private fun initDialog() { | ||
requireContext().apply { | ||
completeDialog = DialogUtil.makeDialog(this) | ||
} | ||
|
||
layoutCompleteDialogBinding.btnComplete.setOnClickListener { | ||
completeDialog.dismiss() | ||
} | ||
|
||
DialogUtil.setDialog(completeDialog, layoutCompleteDialogBinding.root) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/org/sopt/sopkathon5/andorid/ui/mypage/YourDailyFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.sopt.sopkathon5.andorid.ui.mypage | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import org.sopt.sopkathon5.andorid.R | ||
import org.sopt.sopkathon5.andorid.databinding.FragmentYourDailyBinding | ||
import org.sopt.sopkathon5.andorid.util.base.BaseFragment | ||
|
||
class YourDailyFragment : BaseFragment<FragmentYourDailyBinding>(R.layout.fragment_your_daily) { | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
with(binding) { | ||
layoutDaily.isBookmarkNotVisible = true | ||
layoutDaily.isLogoutVisible = true | ||
} | ||
} | ||
|
||
private fun initAdapter() { | ||
binding.rvDone.adapter | ||
binding.layoutDaily.rvTodo.adapter | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
app/src/main/java/org/sopt/sopkathon5/andorid/ui/mypage/adapter/MyPageTodoCheckAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.sopt.sopkathon5.andorid.ui.mypage.adapter | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.databinding.DataBindingUtil | ||
import androidx.recyclerview.widget.RecyclerView | ||
import org.sopt.sopkathon5.andorid.R | ||
import org.sopt.sopkathon5.andorid.databinding.ItemTodoCheckBinding | ||
|
||
class MyPageTodoCheckAdapter : | ||
RecyclerView.Adapter<MyPageTodoCheckAdapter.MyPageTodoCheckViewHolder>() { | ||
private val _data = mutableListOf<String>() | ||
var data: List<String> = _data | ||
set(value) { | ||
_data.clear() | ||
_data.addAll(value) | ||
notifyDataSetChanged() | ||
} | ||
|
||
class MyPageTodoCheckViewHolder( | ||
private val binding: ItemTodoCheckBinding | ||
) : RecyclerView.ViewHolder( | ||
binding.root | ||
) { | ||
fun onBind(data: String) { | ||
with(binding) { | ||
tvTodo.text = data | ||
ibCheck.isSelected = !ibCheck.isSelected | ||
} | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyPageTodoCheckViewHolder { | ||
val binding: ItemTodoCheckBinding = DataBindingUtil.inflate( | ||
LayoutInflater.from(parent.context), | ||
R.layout.item_todo_check, parent, false | ||
) | ||
return MyPageTodoCheckViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: MyPageTodoCheckViewHolder, position: Int) { | ||
holder.onBind(_data[position]) | ||
} | ||
|
||
override fun getItemCount(): Int = _data.size | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/sopt/sopkathon5/andorid/ui/mypage/adapter/MyPageViewPagerAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.sopt.sopkathon5.andorid.ui.mypage.adapter | ||
|
||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.FragmentActivity | ||
import androidx.viewpager2.adapter.FragmentStateAdapter | ||
|
||
class MyPageViewPagerAdapter(fa: FragmentActivity) : FragmentStateAdapter(fa) { | ||
private val _fragmentList = mutableListOf<Fragment>() | ||
var fragmentList: List<Fragment> = _fragmentList | ||
set(value) { | ||
_fragmentList.addAll(value) | ||
} | ||
|
||
override fun getItemCount(): Int = _fragmentList.size | ||
override fun createFragment(position: Int): Fragment = _fragmentList[position] | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/sopt/sopkathon5/andorid/util/DialogUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.sopt.sopkathon5.andorid.util | ||
|
||
import android.app.Dialog | ||
import android.content.Context | ||
import android.view.View | ||
import android.view.Window | ||
import android.view.WindowManager | ||
import org.sopt.sopkathon5.andorid.R | ||
|
||
object DialogUtil { | ||
fun makeDialog(context: Context) = Dialog(context, R.style.CompleteDialogStyle) | ||
|
||
fun setDialog(dialog: Dialog, view: View) { | ||
dialog.apply { | ||
requestWindowFeature(Window.FEATURE_NO_TITLE) | ||
setCancelable(false) | ||
setContentView(view) | ||
|
||
with(window?.attributes) { | ||
this?.width = WindowManager.LayoutParams.MATCH_PARENT | ||
this?.height = WindowManager.LayoutParams.WRAP_CONTENT | ||
this?.verticalWeight = 1F | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.