Guest User

Untitled

a guest
Mar 9th, 2020
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. package fullpagedeveloper.com.bottomsheetdialogfragment
  2.  
  3. import android.content.Intent
  4. import android.os.Bundle
  5. import android.util.Log
  6. import androidx.appcompat.app.AppCompatActivity
  7. import com.google.android.material.bottomsheet.BottomSheetDialog
  8. import kotlinx.android.synthetic.main.activity_transaction.*
  9. import java.text.SimpleDateFormat
  10. import java.util.*
  11.  
  12.  
  13. class TransactionActivity : AppCompatActivity() {
  14.  
  15. override fun onCreate(savedInstanceState: Bundle?) {
  16. super.onCreate(savedInstanceState)
  17. setContentView(R.layout.activity_transaction)
  18.  
  19. textView_Content_PaymentDetail.setOnClickListener {
  20. val view = layoutInflater.inflate(R.layout.dialog_bottom_sheet, null)
  21. val dialog = BottomSheetDialog(this)
  22. dialog.setContentView(view)
  23. dialog.show()
  24. }
  25.  
  26. button_Check_Payment_Status.setOnClickListener {
  27. startActivity(Intent(this, WaitingForPaymentActivity::class.java))
  28. }
  29.  
  30. TimeCountDown()
  31.  
  32. }
  33.  
  34. fun TimeCountDown() {
  35.  
  36. val EVENT_DATE_TIME = "2019-12-31 10:30:00"
  37. val DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"
  38. val dateFormat = SimpleDateFormat(DATE_FORMAT)
  39. val event_date: Date = dateFormat.parse(EVENT_DATE_TIME)
  40. val current_date = Date()
  41. if (!current_date.after(event_date)) {
  42. val diff = event_date.time - current_date.time
  43. val Days = diff / (24 * 60 * 60 * 1000)
  44. val Hours = diff / (60 * 60 * 1000) % 24
  45. val Minutes = diff / (60 * 1000) % 60
  46. val Seconds = diff / 1000 % 60
  47. Log.d("pesan", Days.toString())
  48. } else {
  49. //visible gone your layout accrodingly
  50. }
  51. }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment