Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fullpagedeveloper.com.bottomsheetdialogfragment
- import android.content.Intent
- import android.os.Bundle
- import android.util.Log
- import androidx.appcompat.app.AppCompatActivity
- import com.google.android.material.bottomsheet.BottomSheetDialog
- import kotlinx.android.synthetic.main.activity_transaction.*
- import java.text.SimpleDateFormat
- import java.util.*
- class TransactionActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_transaction)
- textView_Content_PaymentDetail.setOnClickListener {
- val view = layoutInflater.inflate(R.layout.dialog_bottom_sheet, null)
- val dialog = BottomSheetDialog(this)
- dialog.setContentView(view)
- dialog.show()
- }
- button_Check_Payment_Status.setOnClickListener {
- startActivity(Intent(this, WaitingForPaymentActivity::class.java))
- }
- TimeCountDown()
- }
- fun TimeCountDown() {
- val EVENT_DATE_TIME = "2019-12-31 10:30:00"
- val DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"
- val dateFormat = SimpleDateFormat(DATE_FORMAT)
- val event_date: Date = dateFormat.parse(EVENT_DATE_TIME)
- val current_date = Date()
- if (!current_date.after(event_date)) {
- val diff = event_date.time - current_date.time
- val Days = diff / (24 * 60 * 60 * 1000)
- val Hours = diff / (60 * 60 * 1000) % 24
- val Minutes = diff / (60 * 1000) % 60
- val Seconds = diff / 1000 % 60
- Log.d("pesan", Days.toString())
- } else {
- //visible gone your layout accrodingly
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment