parent
7386c93d73
commit
14b3bfbae7
|
@ -55,6 +55,9 @@ import kr.co.vividnext.sodalive.report.ProfileReportDialog
|
||||||
import kr.co.vividnext.sodalive.report.ReportType
|
import kr.co.vividnext.sodalive.report.ReportType
|
||||||
import kr.co.vividnext.sodalive.report.UserReportDialog
|
import kr.co.vividnext.sodalive.report.UserReportDialog
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
||||||
ActivityUserProfileBinding::inflate
|
ActivityUserProfileBinding::inflate
|
||||||
|
@ -848,6 +851,15 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
||||||
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
|
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
||||||
|
val now = Date()
|
||||||
|
|
||||||
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault())
|
||||||
|
val diffTime: Long = now.time - beginDate.time
|
||||||
|
val hours = (diffTime / (1000 * 60 * 60)).toInt()
|
||||||
|
val mins = (diffTime / (1000 * 60)).toInt() % 60
|
||||||
|
|
||||||
if (it.isPrivateRoom) {
|
if (it.isPrivateRoom) {
|
||||||
LiveRoomPasswordDialog(
|
LiveRoomPasswordDialog(
|
||||||
activity = this,
|
activity = this,
|
||||||
|
@ -866,7 +878,21 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
||||||
activity = this,
|
activity = this,
|
||||||
layoutInflater = layoutInflater,
|
layoutInflater = layoutInflater,
|
||||||
title = "${it.price.moneyFormat()}캔으로 입장",
|
title = "${it.price.moneyFormat()}캔으로 입장",
|
||||||
desc = "'${it.title}' 라이브에 참여하기 위해 결제합니다.",
|
startDateTime = if (hours >= 1) {
|
||||||
|
dateFormat.format(beginDate)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
nowDateTime = if (hours >= 1) {
|
||||||
|
dateFormat.format(now)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
desc = if (hours >= 1) {
|
||||||
|
"라이브를 시작한지 ${hours}시간 ${mins}분 이상 지났습니다. 결제 후 참여하시겠습니까?"
|
||||||
|
} else {
|
||||||
|
"'${it.title}' 라이브에 참여하기 위해 결제합니다."
|
||||||
|
},
|
||||||
confirmButtonTitle = "결제 후 입장",
|
confirmButtonTitle = "결제 후 입장",
|
||||||
confirmButtonClick = {
|
confirmButtonClick = {
|
||||||
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
|
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
|
||||||
|
|
|
@ -51,6 +51,9 @@ import kr.co.vividnext.sodalive.live.room.update.LiveRoomEditActivity
|
||||||
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
|
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
|
||||||
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::inflate) {
|
class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::inflate) {
|
||||||
|
@ -695,6 +698,15 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
||||||
|
val now = Date()
|
||||||
|
|
||||||
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault())
|
||||||
|
val diffTime: Long = now.time - beginDate.time
|
||||||
|
val hours = (diffTime / (1000 * 60 * 60)).toInt()
|
||||||
|
val mins = (diffTime / (1000 * 60)).toInt() % 60
|
||||||
|
|
||||||
if (it.isPrivateRoom) {
|
if (it.isPrivateRoom) {
|
||||||
LiveRoomPasswordDialog(
|
LiveRoomPasswordDialog(
|
||||||
activity = requireActivity(),
|
activity = requireActivity(),
|
||||||
|
@ -715,7 +727,21 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
||||||
activity = requireActivity(),
|
activity = requireActivity(),
|
||||||
layoutInflater = layoutInflater,
|
layoutInflater = layoutInflater,
|
||||||
title = "${it.price.moneyFormat()}캔으로 입장",
|
title = "${it.price.moneyFormat()}캔으로 입장",
|
||||||
desc = "'${it.title}' 라이브에 참여하기 위해 결제합니다.",
|
startDateTime = if (hours >= 1) {
|
||||||
|
dateFormat.format(beginDate)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
nowDateTime = if (hours >= 1) {
|
||||||
|
dateFormat.format(now)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
desc = if (hours >= 1) {
|
||||||
|
"라이브를 시작한지 ${hours}시간 ${mins}분 이상 지났습니다. 결제 후 참여하시겠습니까?"
|
||||||
|
} else {
|
||||||
|
"'${it.title}' 라이브에 참여하기 위해 결제합니다."
|
||||||
|
},
|
||||||
confirmButtonTitle = "결제 후 입장",
|
confirmButtonTitle = "결제 후 입장",
|
||||||
confirmButtonClick = {
|
confirmButtonClick = {
|
||||||
handler.postDelayed({
|
handler.postDelayed({
|
||||||
|
|
|
@ -22,6 +22,9 @@ import kr.co.vividnext.sodalive.live.room.detail.LiveRoomDetailFragment
|
||||||
import kr.co.vividnext.sodalive.live.room.dialog.LivePaymentDialog
|
import kr.co.vividnext.sodalive.live.room.dialog.LivePaymentDialog
|
||||||
import kr.co.vividnext.sodalive.live.room.dialog.LiveRoomPasswordDialog
|
import kr.co.vividnext.sodalive.live.room.dialog.LiveRoomPasswordDialog
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
||||||
ActivityLiveNowAllBinding::inflate
|
ActivityLiveNowAllBinding::inflate
|
||||||
|
@ -157,6 +160,15 @@ class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
||||||
viewModel.enterRoom(roomId, onEnterRoomSuccess)
|
viewModel.enterRoom(roomId, onEnterRoomSuccess)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
||||||
|
val now = Date()
|
||||||
|
|
||||||
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault())
|
||||||
|
val diffTime: Long = now.time - beginDate.time
|
||||||
|
val hours = (diffTime / (1000 * 60 * 60)).toInt()
|
||||||
|
val mins = (diffTime / (1000 * 60)).toInt() % 60
|
||||||
|
|
||||||
if (it.isPrivateRoom) {
|
if (it.isPrivateRoom) {
|
||||||
LiveRoomPasswordDialog(
|
LiveRoomPasswordDialog(
|
||||||
activity = this,
|
activity = this,
|
||||||
|
@ -175,7 +187,21 @@ class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
||||||
activity = this,
|
activity = this,
|
||||||
layoutInflater = layoutInflater,
|
layoutInflater = layoutInflater,
|
||||||
title = "${it.price.moneyFormat()} 캔으로 입장",
|
title = "${it.price.moneyFormat()} 캔으로 입장",
|
||||||
desc = "'${it.title}' 라이브에 참여하기 위해 결제합니다.",
|
startDateTime = if (hours >= 1) {
|
||||||
|
dateFormat.format(beginDate)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
nowDateTime = if (hours >= 1) {
|
||||||
|
dateFormat.format(now)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
desc = if (hours >= 1) {
|
||||||
|
"라이브를 시작한지 ${hours}시간 ${mins}분 이상 지났습니다. 결제 후 참여하시겠습니까?"
|
||||||
|
} else {
|
||||||
|
"'${it.title}' 라이브에 참여하기 위해 결제합니다."
|
||||||
|
},
|
||||||
confirmButtonTitle = "결제 후 입장",
|
confirmButtonTitle = "결제 후 입장",
|
||||||
confirmButtonClick = {
|
confirmButtonClick = {
|
||||||
viewModel.enterRoom(roomId, onEnterRoomSuccess)
|
viewModel.enterRoom(roomId, onEnterRoomSuccess)
|
||||||
|
|
|
@ -1,32 +1,90 @@
|
||||||
package kr.co.vividnext.sodalive.live.room.dialog
|
package kr.co.vividnext.sodalive.live.room.dialog
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.widget.LinearLayout
|
import android.view.View
|
||||||
import kr.co.vividnext.sodalive.dialog.LiveDialog
|
import android.view.WindowManager
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import kr.co.vividnext.sodalive.databinding.DialogLivePaymentBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
|
|
||||||
class LivePaymentDialog(
|
class LivePaymentDialog(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
layoutInflater: LayoutInflater,
|
layoutInflater: LayoutInflater,
|
||||||
title: String,
|
title: String,
|
||||||
desc: String,
|
desc: String,
|
||||||
|
startDateTime: String? = null,
|
||||||
|
nowDateTime: String? = null,
|
||||||
confirmButtonTitle: String,
|
confirmButtonTitle: String,
|
||||||
confirmButtonClick: () -> Unit,
|
confirmButtonClick: () -> Unit,
|
||||||
cancelButtonTitle: String = "",
|
cancelButtonTitle: String = "",
|
||||||
cancelButtonClick: (() -> Unit)? = null,
|
cancelButtonClick: (() -> Unit)? = null,
|
||||||
) : LiveDialog(
|
|
||||||
activity,
|
|
||||||
layoutInflater,
|
|
||||||
title,
|
|
||||||
desc,
|
|
||||||
confirmButtonTitle,
|
|
||||||
confirmButtonClick,
|
|
||||||
cancelButtonTitle,
|
|
||||||
cancelButtonClick
|
|
||||||
) {
|
) {
|
||||||
|
private val alertDialog: AlertDialog
|
||||||
|
private val dialogView = DialogLivePaymentBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val lp = dialogView.tvConfirm.layoutParams as LinearLayout.LayoutParams
|
val dialogBuilder = AlertDialog.Builder(activity)
|
||||||
lp.weight = 2F
|
dialogBuilder.setView(dialogView.root)
|
||||||
dialogView.tvConfirm.layoutParams = lp
|
|
||||||
|
alertDialog = dialogBuilder.create()
|
||||||
|
alertDialog.setCancelable(false)
|
||||||
|
alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
|
||||||
|
dialogView.tvTitle.text = title
|
||||||
|
|
||||||
|
if (startDateTime != null && nowDateTime != null) {
|
||||||
|
dialogView.tvDesc.visibility = View.GONE
|
||||||
|
|
||||||
|
dialogView.tvDesc2.text = desc
|
||||||
|
dialogView.tvNowDate.text = nowDateTime
|
||||||
|
dialogView.tvStartDate.text = startDateTime
|
||||||
|
|
||||||
|
dialogView.tvDesc2.visibility = View.VISIBLE
|
||||||
|
dialogView.llTimeNotice.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
dialogView.tvDesc2.visibility = View.GONE
|
||||||
|
dialogView.llTimeNotice.visibility = View.GONE
|
||||||
|
|
||||||
|
dialogView.tvDesc.text = desc
|
||||||
|
dialogView.tvDesc.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogView.tvCancel.text = cancelButtonTitle
|
||||||
|
dialogView.tvCancel.setOnClickListener {
|
||||||
|
alertDialog.dismiss()
|
||||||
|
cancelButtonClick?.let { it() }
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogView.tvConfirm.text = confirmButtonTitle
|
||||||
|
dialogView.tvConfirm.setOnClickListener {
|
||||||
|
alertDialog.dismiss()
|
||||||
|
confirmButtonClick()
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogView.tvCancel.visibility = if (cancelButtonTitle.isNotBlank()) {
|
||||||
|
View.VISIBLE
|
||||||
|
} else {
|
||||||
|
View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogView.tvConfirm.visibility = if (confirmButtonTitle.isNotBlank()) {
|
||||||
|
View.VISIBLE
|
||||||
|
} else {
|
||||||
|
View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show(width: Int, message: String = "") {
|
||||||
|
alertDialog.show()
|
||||||
|
|
||||||
|
val lp = WindowManager.LayoutParams()
|
||||||
|
lp.copyFrom(alertDialog.window?.attributes)
|
||||||
|
lp.width = width - (26.7f.dpToPx()).toInt()
|
||||||
|
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
|
||||||
|
alertDialog.window?.attributes = lp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_round_corner_10_13181b"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="16.7dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="18.3sp"
|
||||||
|
tools:text="100캔으로 입장" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_desc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="21.3dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:lineSpacingExtra="4sp"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="'테스트' 라이브에 참여하기 위해 결제합니다.'테스트' 라이브에 참여하기 위해 결제합니다.'테스트' 라이브에 참여하기 위해 결제합니다." />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_time_notice"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="21.3dp"
|
||||||
|
android:background="@drawable/bg_round_corner_13_3_303030"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="13.3dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:text="라이브 시작 시각"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="13.3sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:text="현재 시각"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="13.3sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_start_date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="13.3sp"
|
||||||
|
tools:text="2024-01-01 15:30" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_now_date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="13.3sp"
|
||||||
|
tools:text="2024-01-01 19:30" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_desc2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16.7dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:lineSpacingExtra="4sp"
|
||||||
|
android:textColor="@color/color_bbbbbb"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="안내 문구" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="45dp"
|
||||||
|
android:layout_marginBottom="16.7dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_cancel"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="13.3dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_round_corner_10_13181b_3bb9f1"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingVertical="16dp"
|
||||||
|
android:textColor="@color/color_3bb9f1"
|
||||||
|
android:textSize="18.3sp"
|
||||||
|
tools:text="취소" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_confirm"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:background="@drawable/bg_round_corner_10_3bb9f1"
|
||||||
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingVertical="16dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18.3sp"
|
||||||
|
tools:text="결제 후 입장" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue