feat: 포인트 내역 UI 추가
This commit is contained in:
@@ -104,6 +104,7 @@
|
|||||||
<activity android:name=".settings.terms.TermsActivity" />
|
<activity android:name=".settings.terms.TermsActivity" />
|
||||||
<activity android:name=".user.find_password.FindPasswordActivity" />
|
<activity android:name=".user.find_password.FindPasswordActivity" />
|
||||||
<activity android:name=".mypage.can.status.CanStatusActivity" />
|
<activity android:name=".mypage.can.status.CanStatusActivity" />
|
||||||
|
<activity android:name=".mypage.point.PointStatusActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".mypage.can.charge.CanChargeActivity"
|
android:name=".mypage.can.charge.CanChargeActivity"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||||
@@ -203,11 +204,13 @@
|
|||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
<!-- Redirect URI: "kakao${NATIVE_APP_KEY}://oauth" -->
|
<!-- Redirect URI: "kakao${NATIVE_APP_KEY}://oauth" -->
|
||||||
<data android:host="oauth"
|
<data
|
||||||
|
android:host="oauth"
|
||||||
android:scheme="kakao${KAKAO_APP_KEY}" />
|
android:scheme="kakao${KAKAO_APP_KEY}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ import kr.co.vividnext.sodalive.mypage.can.payment.CanPaymentTempViewModel
|
|||||||
import kr.co.vividnext.sodalive.mypage.can.payment.CanPaymentViewModel
|
import kr.co.vividnext.sodalive.mypage.can.payment.CanPaymentViewModel
|
||||||
import kr.co.vividnext.sodalive.mypage.can.payment.CanTempApi
|
import kr.co.vividnext.sodalive.mypage.can.payment.CanTempApi
|
||||||
import kr.co.vividnext.sodalive.mypage.can.status.CanStatusViewModel
|
import kr.co.vividnext.sodalive.mypage.can.status.CanStatusViewModel
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.PointStatusApi
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.PointStatusRepository
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.PointStatusViewModel
|
||||||
import kr.co.vividnext.sodalive.mypage.profile.ProfileUpdateViewModel
|
import kr.co.vividnext.sodalive.mypage.profile.ProfileUpdateViewModel
|
||||||
import kr.co.vividnext.sodalive.mypage.profile.nickname.NicknameUpdateViewModel
|
import kr.co.vividnext.sodalive.mypage.profile.nickname.NicknameUpdateViewModel
|
||||||
import kr.co.vividnext.sodalive.mypage.profile.tag.MemberTagApi
|
import kr.co.vividnext.sodalive.mypage.profile.tag.MemberTagApi
|
||||||
@@ -236,6 +239,7 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
|
|||||||
single { ApiBuilder().build(get(), AuditionApi::class.java) }
|
single { ApiBuilder().build(get(), AuditionApi::class.java) }
|
||||||
single { ApiBuilder().build(get(), AdTrackingApi::class.java) }
|
single { ApiBuilder().build(get(), AdTrackingApi::class.java) }
|
||||||
single { ApiBuilder().build(get(), SearchApi::class.java) }
|
single { ApiBuilder().build(get(), SearchApi::class.java) }
|
||||||
|
single { ApiBuilder().build(get(), PointStatusApi::class.java) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val viewModelModule = module {
|
private val viewModelModule = module {
|
||||||
@@ -331,6 +335,7 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
|
|||||||
viewModel { CompletedSeriesViewModel(get()) }
|
viewModel { CompletedSeriesViewModel(get()) }
|
||||||
viewModel { AlarmContentAllViewModel(get()) }
|
viewModel { AlarmContentAllViewModel(get()) }
|
||||||
viewModel { SearchViewModel(get()) }
|
viewModel { SearchViewModel(get()) }
|
||||||
|
viewModel { PointStatusViewModel(get()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val repositoryModule = module {
|
private val repositoryModule = module {
|
||||||
@@ -373,6 +378,7 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
|
|||||||
factory { AdTrackingRepository(get()) }
|
factory { AdTrackingRepository(get()) }
|
||||||
factory { SearchRepository(get()) }
|
factory { SearchRepository(get()) }
|
||||||
factory { UserEventRepository(get()) }
|
factory { UserEventRepository(get()) }
|
||||||
|
factory { PointStatusRepository(get()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val moduleList = listOf(
|
private val moduleList = listOf(
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import kr.co.vividnext.sodalive.mypage.block.BlockMemberActivity
|
|||||||
import kr.co.vividnext.sodalive.mypage.can.charge.CanChargeActivity
|
import kr.co.vividnext.sodalive.mypage.can.charge.CanChargeActivity
|
||||||
import kr.co.vividnext.sodalive.mypage.can.coupon.CanCouponActivity
|
import kr.co.vividnext.sodalive.mypage.can.coupon.CanCouponActivity
|
||||||
import kr.co.vividnext.sodalive.mypage.can.status.CanStatusActivity
|
import kr.co.vividnext.sodalive.mypage.can.status.CanStatusActivity
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.PointStatusActivity
|
||||||
import kr.co.vividnext.sodalive.mypage.profile.ProfileUpdateActivity
|
import kr.co.vividnext.sodalive.mypage.profile.ProfileUpdateActivity
|
||||||
import kr.co.vividnext.sodalive.mypage.service_center.ServiceCenterActivity
|
import kr.co.vividnext.sodalive.mypage.service_center.ServiceCenterActivity
|
||||||
import kr.co.vividnext.sodalive.settings.SettingsActivity
|
import kr.co.vividnext.sodalive.settings.SettingsActivity
|
||||||
@@ -127,6 +128,15 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.llTotalPoint.setOnClickListener {
|
||||||
|
startActivity(
|
||||||
|
Intent(
|
||||||
|
requireActivity(),
|
||||||
|
PointStatusActivity::class.java
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
binding.tvChargeCan.setOnClickListener {
|
binding.tvChargeCan.setOnClickListener {
|
||||||
startActivity(
|
startActivity(
|
||||||
Intent(
|
Intent(
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class GetPointStatusResponse(@SerializedName("point") val point: Int)
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.activity.OnBackPressedCallback
|
||||||
|
import com.google.android.material.tabs.TabLayout
|
||||||
|
import kr.co.vividnext.sodalive.R
|
||||||
|
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||||
|
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||||
|
import kr.co.vividnext.sodalive.databinding.ActivityPointStatusBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||||
|
import kr.co.vividnext.sodalive.main.MainActivity
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.reward.PointRewardStatusFragment
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.use.PointUseStatusFragment
|
||||||
|
import org.koin.android.ext.android.inject
|
||||||
|
|
||||||
|
class PointStatusActivity : BaseActivity<ActivityPointStatusBinding>(
|
||||||
|
ActivityPointStatusBinding::inflate
|
||||||
|
) {
|
||||||
|
private val viewModel: PointStatusViewModel by inject()
|
||||||
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
|
override fun handleOnBackPressed() {
|
||||||
|
onClickBackButton()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var loadingDialog: LoadingDialog
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
|
|
||||||
|
bindData()
|
||||||
|
viewModel.getPointStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setupView() {
|
||||||
|
binding.toolbar.tvBack.text = "포인트 내역"
|
||||||
|
binding.toolbar.tvBack.setOnClickListener { onClickBackButton() }
|
||||||
|
|
||||||
|
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||||
|
|
||||||
|
val tabs = binding.tabs
|
||||||
|
tabs.addTab(tabs.newTab().setText("받은내역").setTag("reward_status"))
|
||||||
|
tabs.addTab(tabs.newTab().setText("사용내역").setTag("use_status"))
|
||||||
|
|
||||||
|
changeFragment("reward_status")
|
||||||
|
|
||||||
|
tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||||
|
override fun onTabSelected(tab: TabLayout.Tab) {
|
||||||
|
val tag = tab.tag as String
|
||||||
|
changeFragment(tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabUnselected(tab: TabLayout.Tab) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabReselected(tab: TabLayout.Tab) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun changeFragment(tag: String) {
|
||||||
|
val fragmentManager = supportFragmentManager
|
||||||
|
val fragmentTransaction = fragmentManager.beginTransaction()
|
||||||
|
|
||||||
|
val currentFragment = fragmentManager.primaryNavigationFragment
|
||||||
|
if (currentFragment != null) {
|
||||||
|
fragmentTransaction.hide(currentFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
var fragment = fragmentManager.findFragmentByTag(tag)
|
||||||
|
if (fragment == null) {
|
||||||
|
fragment = if (tag == "reward_status") {
|
||||||
|
PointRewardStatusFragment(viewModel)
|
||||||
|
} else {
|
||||||
|
PointUseStatusFragment(viewModel)
|
||||||
|
}
|
||||||
|
|
||||||
|
fragmentTransaction.add(R.id.container, fragment, tag)
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(fragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
fragmentTransaction.setPrimaryNavigationFragment(fragment)
|
||||||
|
fragmentTransaction.setReorderingAllowed(true)
|
||||||
|
fragmentTransaction.commitNow()
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private fun bindData() {
|
||||||
|
viewModel.totalPointLiveData.observe(this) {
|
||||||
|
binding.tvTotalPoint.text = it.moneyFormat()
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.toastLiveData.observe(this) {
|
||||||
|
it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() }
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.isLoading.observe(this) {
|
||||||
|
if (it) {
|
||||||
|
loadingDialog.show(screenWidth)
|
||||||
|
} else {
|
||||||
|
loadingDialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onClickBackButton() {
|
||||||
|
val intent = Intent(applicationContext, MainActivity::class.java)
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
|
startActivity(intent)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.reward.GetPointRewardStatusResponse
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.use.GetPointUseStatusResponse
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Header
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
interface PointStatusApi {
|
||||||
|
@GET("/point/status")
|
||||||
|
fun getPointStatus(
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<GetPointStatusResponse>>
|
||||||
|
|
||||||
|
@GET("/point/status/reward")
|
||||||
|
fun getPointRewardStatus(
|
||||||
|
@Query("timezone") timezone: String,
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<List<GetPointRewardStatusResponse>>>
|
||||||
|
|
||||||
|
@GET("/point/status/use")
|
||||||
|
fun getPointUseStatus(
|
||||||
|
@Query("timezone") timezone: String,
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<List<GetPointUseStatusResponse>>>
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point
|
||||||
|
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
|
class PointStatusRepository(private val api: PointStatusApi) {
|
||||||
|
fun getPointStatus(token: String) = api.getPointStatus(authHeader = token)
|
||||||
|
|
||||||
|
fun getPointRewardStatus(token: String) = api.getPointRewardStatus(
|
||||||
|
timezone = TimeZone.getDefault().id,
|
||||||
|
authHeader = token
|
||||||
|
)
|
||||||
|
|
||||||
|
fun getPointUseStatus(token: String) = api.getPointUseStatus(
|
||||||
|
timezone = TimeZone.getDefault().id,
|
||||||
|
authHeader = token
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.orhanobut.logger.Logger
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||||
|
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.reward.GetPointRewardStatusResponse
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.use.GetPointUseStatusResponse
|
||||||
|
|
||||||
|
class PointStatusViewModel(private val repository: PointStatusRepository) : BaseViewModel() {
|
||||||
|
private val _totalPointLiveData = MutableLiveData<Int>()
|
||||||
|
val totalPointLiveData: LiveData<Int>
|
||||||
|
get() = _totalPointLiveData
|
||||||
|
|
||||||
|
private val _pointUseStatusLiveData = MutableLiveData<List<GetPointUseStatusResponse>>()
|
||||||
|
val pointUseStatusLiveData: LiveData<List<GetPointUseStatusResponse>>
|
||||||
|
get() = _pointUseStatusLiveData
|
||||||
|
|
||||||
|
private val _pointRewardStatusLiveData = MutableLiveData<List<GetPointRewardStatusResponse>>()
|
||||||
|
val pointRewardStatusLiveData: LiveData<List<GetPointRewardStatusResponse>>
|
||||||
|
get() = _pointRewardStatusLiveData
|
||||||
|
|
||||||
|
private val _toastLiveData = MutableLiveData<String?>()
|
||||||
|
val toastLiveData: LiveData<String?>
|
||||||
|
get() = _toastLiveData
|
||||||
|
|
||||||
|
private var _isLoading = MutableLiveData(false)
|
||||||
|
val isLoading: LiveData<Boolean>
|
||||||
|
get() = _isLoading
|
||||||
|
|
||||||
|
fun getPointStatus() {
|
||||||
|
_isLoading.value = true
|
||||||
|
compositeDisposable.add(
|
||||||
|
repository.getPointStatus("Bearer ${SharedPreferenceManager.token}")
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
if (it.success && it.data != null) {
|
||||||
|
_totalPointLiveData.value = it.data.point
|
||||||
|
} else {
|
||||||
|
if (it.message != null) {
|
||||||
|
_toastLiveData.postValue(it.message)
|
||||||
|
} else {
|
||||||
|
_toastLiveData.postValue(
|
||||||
|
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
it.message?.let { message -> Logger.e(message) }
|
||||||
|
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getPointRewardStatus() {
|
||||||
|
_isLoading.value = true
|
||||||
|
compositeDisposable.add(
|
||||||
|
repository.getPointRewardStatus(("Bearer ${SharedPreferenceManager.token}"))
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
if (it.success && it.data != null) {
|
||||||
|
_pointRewardStatusLiveData.value = it.data
|
||||||
|
} else {
|
||||||
|
if (it.message != null) {
|
||||||
|
_toastLiveData.postValue(it.message)
|
||||||
|
} else {
|
||||||
|
_toastLiveData.postValue(
|
||||||
|
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
it.message?.let { message -> Logger.e(message) }
|
||||||
|
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getPointUseStatus() {
|
||||||
|
_isLoading.value = true
|
||||||
|
compositeDisposable.add(
|
||||||
|
repository.getPointUseStatus(("Bearer ${SharedPreferenceManager.token}"))
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
if (it.success && it.data != null) {
|
||||||
|
_pointUseStatusLiveData.value = it.data
|
||||||
|
} else {
|
||||||
|
if (it.message != null) {
|
||||||
|
_toastLiveData.postValue(it.message)
|
||||||
|
} else {
|
||||||
|
_toastLiveData.postValue(
|
||||||
|
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
it.message?.let { message -> Logger.e(message) }
|
||||||
|
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point.reward
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class GetPointRewardStatusResponse(
|
||||||
|
@SerializedName("rewardPoint") val rewardPoint: String,
|
||||||
|
@SerializedName("date") val date: String,
|
||||||
|
@SerializedName("method") val method: String
|
||||||
|
)
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point.reward
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.databinding.ItemCanChargeStatusBinding
|
||||||
|
|
||||||
|
class PointRewardStatusAdapter : RecyclerView.Adapter<PointRewardStatusAdapter.ViewHolder>() {
|
||||||
|
val items = mutableListOf<GetPointRewardStatusResponse>()
|
||||||
|
|
||||||
|
inner class ViewHolder(
|
||||||
|
private val binding: ItemCanChargeStatusBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(item: GetPointRewardStatusResponse) {
|
||||||
|
binding.tvTitle.text = item.rewardPoint
|
||||||
|
binding.tvDate.text = item.date
|
||||||
|
binding.tvChargeMethod.text = item.method
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
return ViewHolder(
|
||||||
|
ItemCanChargeStatusBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
holder.bind(items[position])
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = items.count()
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point.reward
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||||
|
import kr.co.vividnext.sodalive.databinding.FragmentCanStatusBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.PointStatusViewModel
|
||||||
|
|
||||||
|
class PointRewardStatusFragment(
|
||||||
|
private val viewModel: PointStatusViewModel
|
||||||
|
) : BaseFragment<FragmentCanStatusBinding>(
|
||||||
|
FragmentCanStatusBinding::inflate
|
||||||
|
) {
|
||||||
|
|
||||||
|
private lateinit var adapter: PointRewardStatusAdapter
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
setupView()
|
||||||
|
bindData()
|
||||||
|
viewModel.getPointRewardStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun setupView() {
|
||||||
|
val recyclerView = binding.rvCanStatus
|
||||||
|
adapter = PointRewardStatusAdapter()
|
||||||
|
|
||||||
|
recyclerView.layoutManager = LinearLayoutManager(
|
||||||
|
requireContext(),
|
||||||
|
LinearLayoutManager.VERTICAL,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state)
|
||||||
|
|
||||||
|
when (parent.getChildAdapterPosition(view)) {
|
||||||
|
0 -> {
|
||||||
|
outRect.top = 13.3f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.itemCount - 1 -> {
|
||||||
|
outRect.top = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 13.3f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
outRect.top = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
recyclerView.adapter = adapter
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun bindData() {
|
||||||
|
viewModel.pointRewardStatusLiveData.observe(viewLifecycleOwner) {
|
||||||
|
adapter.items.addAll(it)
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point.use
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class GetPointUseStatusResponse(
|
||||||
|
@SerializedName("title") val title: String,
|
||||||
|
@SerializedName("date") val date: String,
|
||||||
|
@SerializedName("point") val point: Int
|
||||||
|
)
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point.use
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.databinding.ItemPointUseStatusBinding
|
||||||
|
|
||||||
|
class PointUseStatusAdapter : RecyclerView.Adapter<PointUseStatusAdapter.ViewHolder>() {
|
||||||
|
val items = mutableListOf<GetPointUseStatusResponse>()
|
||||||
|
|
||||||
|
inner class ViewHolder(
|
||||||
|
private val binding: ItemPointUseStatusBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(item: GetPointUseStatusResponse) {
|
||||||
|
binding.tvTitle.text = item.title
|
||||||
|
binding.tvDate.text = item.date
|
||||||
|
binding.tvPoint.text = "${item.point}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
return ViewHolder(
|
||||||
|
ItemPointUseStatusBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
holder.bind(items[position])
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = items.count()
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package kr.co.vividnext.sodalive.mypage.point.use
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||||
|
import kr.co.vividnext.sodalive.databinding.FragmentCanStatusBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
|
import kr.co.vividnext.sodalive.mypage.point.PointStatusViewModel
|
||||||
|
|
||||||
|
class PointUseStatusFragment(
|
||||||
|
private val viewModel: PointStatusViewModel
|
||||||
|
) : BaseFragment<FragmentCanStatusBinding>(
|
||||||
|
FragmentCanStatusBinding::inflate
|
||||||
|
) {
|
||||||
|
|
||||||
|
private lateinit var adapter: PointUseStatusAdapter
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
setupView()
|
||||||
|
bindData()
|
||||||
|
viewModel.getPointUseStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun setupView() {
|
||||||
|
val recyclerView = binding.rvCanStatus
|
||||||
|
adapter = PointUseStatusAdapter()
|
||||||
|
|
||||||
|
recyclerView.layoutManager = LinearLayoutManager(
|
||||||
|
requireContext(),
|
||||||
|
LinearLayoutManager.VERTICAL,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state)
|
||||||
|
|
||||||
|
when (parent.getChildAdapterPosition(view)) {
|
||||||
|
0 -> {
|
||||||
|
outRect.top = 13.3f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.itemCount - 1 -> {
|
||||||
|
outRect.top = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 13.3f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
outRect.top = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
recyclerView.adapter = adapter
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
private fun bindData() {
|
||||||
|
viewModel.pointUseStatusLiveData.observe(viewLifecycleOwner) {
|
||||||
|
adapter.items.addAll(it)
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
63
app/src/main/res/layout/activity_point_status.xml
Normal file
63
app/src/main/res/layout/activity_point_status.xml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/black">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
layout="@layout/detail_toolbar" />
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/toolbar">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="13.3dp"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:background="@drawable/bg_round_corner_16_7_222222"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingVertical="16.7dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_total_point"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="6.7dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/color_eeeeee"
|
||||||
|
android:textSize="18.3sp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_point"
|
||||||
|
tools:text="23,000" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:tabIndicatorColor="@color/color_80d8ff"
|
||||||
|
app:tabIndicatorHeight="1.3dp"
|
||||||
|
app:tabSelectedTextColor="@color/color_eeeeee"
|
||||||
|
app:tabTextAppearance="@style/tabText"
|
||||||
|
app:tabTextColor="@color/color_777777" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -319,6 +319,13 @@
|
|||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:src="@drawable/ic_point" />
|
android:src="@drawable/ic_point" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:gravity="center"
|
||||||
|
android:src="@drawable/ic_forward" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
50
app/src/main/res/layout/item_point_use_status.xml
Normal file
50
app/src/main/res/layout/item_point_use_status.xml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_round_corner_16_7_111111"
|
||||||
|
android:paddingHorizontal="13.3dp"
|
||||||
|
android:paddingTop="13.3dp"
|
||||||
|
android:paddingBottom="6.7dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:textColor="@color/color_eeeeee"
|
||||||
|
android:textSize="13.3sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="[후원] 상남자" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6.7dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:textColor="@color/color_777777"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_title"
|
||||||
|
tools:text="2021.07.22 | 21:02:45" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_point"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="6.7dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/color_eeeeee"
|
||||||
|
android:textSize="15.3sp"
|
||||||
|
app:drawableEndCompat="@drawable/ic_point"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="300" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user