From dcd67f8c0362e3eaf8029041cb814af6022a3eb1 Mon Sep 17 00:00:00 2001 From: Hariharan Date: Wed, 10 Feb 2021 01:29:32 +0530 Subject: [PATCH] fix#1216:Minimum Date in valid Till DatePicker fixed. --- .../standinginstruction/ui/SIDetailsActivity.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/standinginstruction/ui/SIDetailsActivity.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/standinginstruction/ui/SIDetailsActivity.kt index 552344c95..4da19c6c7 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/standinginstruction/ui/SIDetailsActivity.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/standinginstruction/ui/SIDetailsActivity.kt @@ -1,8 +1,11 @@ package org.mifos.mobilewallet.mifospay.standinginstruction.ui +import android.annotation.SuppressLint import android.app.DatePickerDialog import android.content.res.Resources +import android.os.Build import android.os.Bundle +import android.support.annotation.RequiresApi import android.view.Menu import android.view.MenuItem import android.view.View @@ -19,6 +22,9 @@ import org.mifos.mobilewallet.mifospay.standinginstruction.presenter.StandingIns import org.mifos.mobilewallet.mifospay.utils.Constants import org.mifos.mobilewallet.mifospay.utils.DialogBox import org.mifos.mobilewallet.mifospay.utils.Utils +import java.text.SimpleDateFormat +import java.time.LocalDate +import java.time.format.DateTimeFormatter import java.util.* import javax.inject.Inject @@ -41,6 +47,7 @@ class SIDetailsActivity : BaseActivity(), StandingInstructionContract.SIDetailsV private lateinit var mStandingInstructionPresenter: StandingInstructionContract.StandingInstructorDetailsPresenter + @SuppressLint("NewApi") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_si_details) @@ -58,6 +65,8 @@ class SIDetailsActivity : BaseActivity(), StandingInstructionContract.SIDetailsV setUpUI() } + @SuppressLint("SimpleDateFormat") + @RequiresApi(Build.VERSION_CODES.O) private fun setUpUI() { tv_edit_pick.setOnClickListener { val calendar: Calendar = Calendar.getInstance() @@ -68,6 +77,7 @@ class SIDetailsActivity : BaseActivity(), StandingInstructionContract.SIDetailsV DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth -> tv_valid_till.text = "$dayOfMonth-${(monthOfYear + 1)}-$year" }, year, month, day) + picker.datePicker.minDate=SimpleDateFormat("dd-MM-yyyy").parse(tv_valid_from.text.toString()).time picker.show() }