Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private fun initView() {
- binding.btnZakat.setOnClickListener {
- if (TextUtils.isEmpty(binding.etAmountZakat.text)) {
- Toast.makeText(this, "Masukan Total Harta",
- Toast.LENGTH_SHORT).show()
- } else if (binding.etAmountZakat.getNumericValue()?.toInt()!! >= 85000000) {
- val formatAmount = NumberFormat.getNumberInstance(
- Locale("id", "ID"))
- .format(binding.etAmountZakat.getNumericValue())
- binding.tvHartaAmount.text = "Rp $formatAmount"
- val zakat = binding.etAmountZakat.getNumericValue()!!.toInt() * (2.5/100)
- val formatZakat = NumberFormat.getNumberInstance(
- Locale("id", "ID")).format(zakat)
- binding.tvAmountZakat.text = "Rp $formatZakat"
- } else {
- Toast.makeText(this,
- "Total Harta masih belum mencapai nisab", Toast.LENGTH_LONG)
- .show()
- binding.tvAmountZakat.text = "Rp. 0"
- }
- }
- }
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- when (item.itemId) {
- android.R.id.home -> {
- finish()
- }
- }
- return super.onOptionsItemSelected(item)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement