Using new convenience methods from AndroidUtils to show / hide views
This commit is contained in:
parent
873a9a537e
commit
7dea0c0d83
|
@ -12,6 +12,7 @@ import net.dankito.banking.ui.android.authentication.AuthenticationService
|
||||||
import net.dankito.banking.ui.android.authentication.AuthenticationType
|
import net.dankito.banking.ui.android.authentication.AuthenticationType
|
||||||
import net.dankito.banking.ui.android.di.BankingComponent
|
import net.dankito.banking.ui.android.di.BankingComponent
|
||||||
import net.dankito.banking.ui.android.extensions.addEnterPressedListener
|
import net.dankito.banking.ui.android.extensions.addEnterPressedListener
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ open class LoginActivity : BaseActivity() {
|
||||||
setContentView(R.layout.activity_login)
|
setContentView(R.layout.activity_login)
|
||||||
|
|
||||||
if (authenticationService.authenticationType == AuthenticationType.Password) {
|
if (authenticationService.authenticationType == AuthenticationType.Password) {
|
||||||
lytBiometricAuthentication.visibility = View.GONE
|
lytBiometricAuthentication.hide()
|
||||||
|
|
||||||
edtxtLoginPassword.actualEditText.addEnterPressedListener {
|
edtxtLoginPassword.actualEditText.addEnterPressedListener {
|
||||||
checkEnteredPasswordAndLogIn()
|
checkEnteredPasswordAndLogIn()
|
||||||
|
@ -47,7 +48,7 @@ open class LoginActivity : BaseActivity() {
|
||||||
btnLogin.setOnClickListener { checkEnteredPasswordAndLogIn() }
|
btnLogin.setOnClickListener { checkEnteredPasswordAndLogIn() }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lytPasswordAuthentication.visibility = View.GONE
|
lytPasswordAuthentication.hide()
|
||||||
|
|
||||||
btnBiometricAuthentication.customButtonClickHandler = {
|
btnBiometricAuthentication.customButtonClickHandler = {
|
||||||
authenticationService.loginUserWithBiometric { result ->
|
authenticationService.loginUserWithBiometric { result ->
|
||||||
|
|
|
@ -9,6 +9,8 @@ import net.dankito.banking.ui.android.extensions.showAmount
|
||||||
import net.dankito.banking.ui.model.IAccountTransaction
|
import net.dankito.banking.ui.model.IAccountTransaction
|
||||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
import net.dankito.utils.android.extensions.asActivity
|
import net.dankito.utils.android.extensions.asActivity
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
import net.dankito.utils.android.ui.adapter.ListRecyclerAdapter
|
import net.dankito.utils.android.ui.adapter.ListRecyclerAdapter
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,11 +43,11 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter)
|
||||||
|
|
||||||
if (presenter.areAllAccountSelected) {
|
if (presenter.areAllAccountSelected) {
|
||||||
viewHolder.imgvwBankIcon.setIcon(item.account.bank)
|
viewHolder.imgvwBankIcon.setIcon(item.account.bank)
|
||||||
// TODO: if bank icon isn't set: Show default icon? show at least an empty space to that amount and date don't shift up causing an inconsistent view?
|
viewHolder.imgvwBankIcon.show()
|
||||||
viewHolder.imgvwBankIcon.visibility = View.VISIBLE
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
viewHolder.imgvwBankIcon.visibility = View.GONE
|
// TODO: if bank icon isn't set: Show default icon? show at least an empty space to that amount and date don't shift up causing an inconsistent view?
|
||||||
|
viewHolder.imgvwBankIcon.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.view.View
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.adapter.viewholder.RecipientViewHolder
|
import net.dankito.banking.ui.android.adapter.viewholder.RecipientViewHolder
|
||||||
import net.dankito.banking.search.TransactionParty
|
import net.dankito.banking.search.TransactionParty
|
||||||
|
import net.dankito.utils.android.extensions.isGone
|
||||||
import net.dankito.utils.android.ui.adapter.ListRecyclerAdapter
|
import net.dankito.utils.android.ui.adapter.ListRecyclerAdapter
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ open class RecipientListAdapter(protected val itemClicked: ((TransactionParty) -
|
||||||
viewHolder.txtvwRecipientName.text = item.name
|
viewHolder.txtvwRecipientName.text = item.name
|
||||||
|
|
||||||
viewHolder.txtvwRecipientBankName.text = item.bankName
|
viewHolder.txtvwRecipientBankName.text = item.bankName
|
||||||
viewHolder.txtvwRecipientBankName.visibility = if (item.bankName.isNullOrBlank()) View.GONE else View.VISIBLE
|
viewHolder.txtvwRecipientBankName.isGone = item.bankName.isNullOrBlank()
|
||||||
|
|
||||||
viewHolder.txtvwRecipientAccountId.text = item.iban
|
viewHolder.txtvwRecipientAccountId.text = item.iban
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.widget.TextView
|
||||||
import com.mikepenz.fastadapter.FastAdapter
|
import com.mikepenz.fastadapter.FastAdapter
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.adapter.CheckableValueAdapterItem
|
import net.dankito.banking.ui.android.adapter.CheckableValueAdapterItem
|
||||||
|
import net.dankito.utils.android.extensions.setVisibleOrInvisible
|
||||||
|
|
||||||
|
|
||||||
open class CheckableValueViewHolder(view: View) : FastAdapter.ViewHolder<CheckableValueAdapterItem>(view) {
|
open class CheckableValueViewHolder(view: View) : FastAdapter.ViewHolder<CheckableValueAdapterItem>(view) {
|
||||||
|
@ -16,7 +17,7 @@ open class CheckableValueViewHolder(view: View) : FastAdapter.ViewHolder<Checkab
|
||||||
|
|
||||||
|
|
||||||
override fun bindView(item: CheckableValueAdapterItem, payloads: List<Any>) {
|
override fun bindView(item: CheckableValueAdapterItem, payloads: List<Any>) {
|
||||||
imgCheckmark.visibility = if (item.isChecked) View.VISIBLE else View.INVISIBLE
|
imgCheckmark.setVisibleOrInvisible(item.isChecked)
|
||||||
|
|
||||||
txtValue.text = item.text
|
txtValue.text = item.text
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ import net.dankito.banking.ui.model.responses.AddAccountResponse
|
||||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
import net.dankito.banking.bankfinder.BankInfo
|
import net.dankito.banking.bankfinder.BankInfo
|
||||||
import net.dankito.utils.android.extensions.asActivity
|
import net.dankito.utils.android.extensions.asActivity
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
import net.dankito.utils.android.extensions.showKeyboardDelayed
|
import net.dankito.utils.android.extensions.showKeyboardDelayed
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -118,12 +120,12 @@ open class AddAccountDialog : DialogFragment() {
|
||||||
val password = bankCredentialsPassword.password
|
val password = bankCredentialsPassword.password
|
||||||
|
|
||||||
btnAddAccount.isEnabled = false
|
btnAddAccount.isEnabled = false
|
||||||
pgrbrAddAccount.visibility = View.VISIBLE
|
pgrbrAddAccount.show()
|
||||||
|
|
||||||
presenter.addAccountAsync(selectedBank, userName, password) { response ->
|
presenter.addAccountAsync(selectedBank, userName, password) { response ->
|
||||||
context?.asActivity()?.runOnUiThread {
|
context?.asActivity()?.runOnUiThread {
|
||||||
btnAddAccount.isEnabled = true
|
btnAddAccount.isEnabled = true
|
||||||
pgrbrAddAccount.visibility = View.GONE
|
pgrbrAddAccount.hide()
|
||||||
|
|
||||||
handleAccountCheckResponseOnUiThread(response)
|
handleAccountCheckResponseOnUiThread(response)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import net.dankito.banking.ui.model.responses.BankingClientResponse
|
||||||
import net.dankito.banking.ui.model.tan.*
|
import net.dankito.banking.ui.model.tan.*
|
||||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
import net.dankito.utils.android.extensions.getSpannedFromHtml
|
import net.dankito.utils.android.extensions.getSpannedFromHtml
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ open class EnterTanDialog : DialogFragment() {
|
||||||
val tanMediaForTanMethod = presenter.getTanMediaForTanMethod(bank, tanChallenge.tanMethod)
|
val tanMediaForTanMethod = presenter.getTanMediaForTanMethod(bank, tanChallenge.tanMethod)
|
||||||
|
|
||||||
if (tanMediaForTanMethod.size > 1) {
|
if (tanMediaForTanMethod.size > 1) {
|
||||||
rootView.lytTanMedium.visibility = View.VISIBLE
|
rootView.lytTanMedium.show()
|
||||||
|
|
||||||
tanMediumAdapter.setItems(bank.tanMediaSorted)
|
tanMediumAdapter.setItems(bank.tanMediaSorted)
|
||||||
|
|
||||||
|
@ -172,7 +173,7 @@ open class EnterTanDialog : DialogFragment() {
|
||||||
|
|
||||||
protected open fun setupFlickerCodeTanView(rootView: View) {
|
protected open fun setupFlickerCodeTanView(rootView: View) {
|
||||||
val flickerCodeView = rootView.flickerCodeView
|
val flickerCodeView = rootView.flickerCodeView
|
||||||
flickerCodeView.visibility = View.VISIBLE
|
flickerCodeView.show()
|
||||||
|
|
||||||
val flickerCode = (tanChallenge as FlickerCodeTanChallenge).flickerCode
|
val flickerCode = (tanChallenge as FlickerCodeTanChallenge).flickerCode
|
||||||
if (flickerCode.decodingSuccessful) {
|
if (flickerCode.decodingSuccessful) {
|
||||||
|
@ -184,7 +185,7 @@ open class EnterTanDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun setupImageTanView(rootView: View) {
|
protected open fun setupImageTanView(rootView: View) {
|
||||||
rootView.tanImageView.visibility = View.VISIBLE
|
rootView.tanImageView.show()
|
||||||
|
|
||||||
val decodedImage = (tanChallenge as ImageTanChallenge).image
|
val decodedImage = (tanChallenge as ImageTanChallenge).image
|
||||||
if (decodedImage.decodingSuccessful) {
|
if (decodedImage.decodingSuccessful) {
|
||||||
|
|
|
@ -13,6 +13,8 @@ import kotlinx.android.synthetic.main.dialog_send_message_log.view.*
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.di.BankingComponent
|
import net.dankito.banking.ui.android.di.BankingComponent
|
||||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,8 +56,8 @@ open class SendMessageLogDialog : DialogFragment() {
|
||||||
val messageLog = presenter.getMessageLogForAccounts(presenter.allBanksSortedByDisplayIndex).joinToString("\r\n\r\n")
|
val messageLog = presenter.getMessageLogForAccounts(presenter.allBanksSortedByDisplayIndex).joinToString("\r\n\r\n")
|
||||||
|
|
||||||
if (messageLog.isBlank()) {
|
if (messageLog.isBlank()) {
|
||||||
rootView.txtvwInfoNoMessageLogEntriesYet.visibility = View.VISIBLE
|
rootView.txtvwInfoNoMessageLogEntriesYet.show()
|
||||||
rootView.lytMessageLog.visibility = View.GONE
|
rootView.lytMessageLog.hide()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rootView.edtxtMessageLog.setText(context?.getString(R.string.dialog_send_message_courteously_add_error_description, messageLog))
|
rootView.edtxtMessageLog.setText(context?.getString(R.string.dialog_send_message_courteously_add_error_description, messageLog))
|
||||||
|
|
|
@ -35,11 +35,8 @@ import net.dankito.banking.bankfinder.BankInfo
|
||||||
import net.dankito.banking.ui.android.extensions.isEllipsized
|
import net.dankito.banking.ui.android.extensions.isEllipsized
|
||||||
import net.dankito.banking.ui.android.views.InfoPopupWindow
|
import net.dankito.banking.ui.android.views.InfoPopupWindow
|
||||||
import net.dankito.banking.util.ValidationResult
|
import net.dankito.banking.util.ValidationResult
|
||||||
|
import net.dankito.utils.android.extensions.*
|
||||||
import net.dankito.utils.multiplatform.toBigDecimal
|
import net.dankito.utils.multiplatform.toBigDecimal
|
||||||
import net.dankito.utils.android.extensions.asActivity
|
|
||||||
import net.dankito.utils.android.extensions.getDimension
|
|
||||||
import net.dankito.utils.android.extensions.getResourceIdentifier
|
|
||||||
import net.dankito.utils.android.extensions.setVisibility
|
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.text.DecimalFormatSymbols
|
import java.text.DecimalFormatSymbols
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -114,7 +111,7 @@ open class TransferMoneyDialog : DialogFragment() {
|
||||||
account = preselectedValues?.account ?: accountsSupportingTransferringMoney.first()
|
account = preselectedValues?.account ?: accountsSupportingTransferringMoney.first()
|
||||||
|
|
||||||
if (accountsSupportingTransferringMoney.size > 1) {
|
if (accountsSupportingTransferringMoney.size > 1) {
|
||||||
rootView.lytSelectBankAccount.visibility = View.VISIBLE
|
rootView.lytSelectBankAccount.show()
|
||||||
|
|
||||||
val adapter = IconedBankAccountsAdapter(accountsSupportingTransferringMoney)
|
val adapter = IconedBankAccountsAdapter(accountsSupportingTransferringMoney)
|
||||||
rootView.spnBankAccounts.adapter = adapter
|
rootView.spnBankAccounts.adapter = adapter
|
||||||
|
@ -185,13 +182,7 @@ open class TransferMoneyDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun setRealTimeTransferControlsVisibility(rootView: View) {
|
protected open fun setRealTimeTransferControlsVisibility(rootView: View) {
|
||||||
rootView.lytRealTimeTransfer.visibility =
|
rootView.lytRealTimeTransfer.setVisibility(account.supportsRealTimeTransfer)
|
||||||
if (account.supportsRealTimeTransfer) {
|
|
||||||
View.VISIBLE
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
View.GONE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun showRealTimeTransferInfo(btnShowRealTimeTransferInfo: ImageButton) {
|
protected open fun showRealTimeTransferInfo(btnShowRealTimeTransferInfo: ImageButton) {
|
||||||
|
@ -353,16 +344,16 @@ open class TransferMoneyDialog : DialogFragment() {
|
||||||
|
|
||||||
if (foundBank != null) {
|
if (foundBank != null) {
|
||||||
txtRecipientBankInfo.text = getString(R.string.dialog_transfer_money_bic_detected_from_iban, foundBank.bic, foundBank.name)
|
txtRecipientBankInfo.text = getString(R.string.dialog_transfer_money_bic_detected_from_iban, foundBank.bic, foundBank.name)
|
||||||
txtRecipientBankInfo.visibility = View.VISIBLE
|
txtRecipientBankInfo.show()
|
||||||
setIbanValidationErrorVisibility()
|
setIbanValidationErrorVisibility()
|
||||||
}
|
}
|
||||||
else if (enteredIban.length >= InputValidator.MinimumLengthToDetermineBicFromIban) {
|
else if (enteredIban.length >= InputValidator.MinimumLengthToDetermineBicFromIban) {
|
||||||
txtRecipientBankInfo.text = getString(R.string.dialog_transfer_money_could_not_determine_bic_from_iban, enteredIban.substring(4, InputValidator.MinimumLengthToDetermineBicFromIban))
|
txtRecipientBankInfo.text = getString(R.string.dialog_transfer_money_could_not_determine_bic_from_iban, enteredIban.substring(4, InputValidator.MinimumLengthToDetermineBicFromIban))
|
||||||
txtRecipientBankInfo.visibility = View.VISIBLE
|
txtRecipientBankInfo.show()
|
||||||
setIbanValidationErrorVisibility()
|
setIbanValidationErrorVisibility()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
txtRecipientBankInfo.visibility = View.GONE
|
txtRecipientBankInfo.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfRequiredDataEnteredOnUiThread()
|
checkIfRequiredDataEnteredOnUiThread()
|
||||||
|
@ -371,7 +362,7 @@ open class TransferMoneyDialog : DialogFragment() {
|
||||||
protected open fun setIbanValidationErrorVisibility() {
|
protected open fun setIbanValidationErrorVisibility() {
|
||||||
getIbanTextInputErrorView()?.let { textInputError ->
|
getIbanTextInputErrorView()?.let { textInputError ->
|
||||||
val displaysErrorOrHint = lytRecipientIban.error != null || lytRecipientIban.helperText != null
|
val displaysErrorOrHint = lytRecipientIban.error != null || lytRecipientIban.helperText != null
|
||||||
(textInputError.parent?.parent as? ViewGroup)?.visibility = if (displaysErrorOrHint) View.VISIBLE else View.GONE
|
(textInputError.parent?.parent as? ViewGroup)?.setVisibility(displaysErrorOrHint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ import net.dankito.banking.ui.android.di.BankingComponent
|
||||||
import net.dankito.banking.ui.android.extensions.addEnterPressedListener
|
import net.dankito.banking.ui.android.extensions.addEnterPressedListener
|
||||||
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
||||||
import net.dankito.utils.android.extensions.hideKeyboardDelayed
|
import net.dankito.utils.android.extensions.hideKeyboardDelayed
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.setVisibility
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -62,7 +65,7 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() {
|
||||||
val isBiometricAuthenticationSupported = authenticationService.isBiometricAuthenticationSupported
|
val isBiometricAuthenticationSupported = authenticationService.isBiometricAuthenticationSupported
|
||||||
|
|
||||||
val showAuthenticationMethods = isBiometricAuthenticationSupported || authenticationType != AuthenticationType.None // hide select authentication method if password is the only option to choose
|
val showAuthenticationMethods = isBiometricAuthenticationSupported || authenticationType != AuthenticationType.None // hide select authentication method if password is the only option to choose
|
||||||
segmentedGroup.visibility = if (showAuthenticationMethods) View.VISIBLE else View.GONE
|
segmentedGroup.setVisibility(showAuthenticationMethods)
|
||||||
segmentedGroup.doOnNextLayout {
|
segmentedGroup.doOnNextLayout {
|
||||||
val segmentedControlButtonWidth = segmentedGroup.measuredWidth / 3
|
val segmentedControlButtonWidth = segmentedGroup.measuredWidth / 3
|
||||||
btnShowBiometricAuthenticationSection.layoutParams.width = segmentedControlButtonWidth
|
btnShowBiometricAuthenticationSection.layoutParams.width = segmentedControlButtonWidth
|
||||||
|
@ -70,7 +73,7 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() {
|
||||||
btnShowRemoveAppProtectionSection.layoutParams.width = segmentedControlButtonWidth
|
btnShowRemoveAppProtectionSection.layoutParams.width = segmentedControlButtonWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
btnShowBiometricAuthenticationSection.visibility = if (isBiometricAuthenticationSupported) View.VISIBLE else View.GONE
|
btnShowBiometricAuthenticationSection.setVisibility(isBiometricAuthenticationSupported)
|
||||||
btnShowBiometricAuthenticationSection.setOnCheckedChangeListener { _, isChecked ->
|
btnShowBiometricAuthenticationSection.setOnCheckedChangeListener { _, isChecked ->
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
showAuthenticationLayout(rootView, lytBiometricAuthentication)
|
showAuthenticationLayout(rootView, lytBiometricAuthentication)
|
||||||
|
@ -114,11 +117,11 @@ open class ProtectAppSettingsDialog : SettingsDialogBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun showAuthenticationLayout(rootView: View, authenticationLayoutToShow: ViewGroup) {
|
protected open fun showAuthenticationLayout(rootView: View, authenticationLayoutToShow: ViewGroup) {
|
||||||
lytBiometricAuthentication.visibility = View.GONE
|
lytBiometricAuthentication.hide()
|
||||||
lytPasswordAuthentication.visibility = View.GONE
|
lytPasswordAuthentication.hide()
|
||||||
lytRemoveAppProtection.visibility = View.GONE
|
lytRemoveAppProtection.hide()
|
||||||
|
|
||||||
authenticationLayoutToShow.visibility = View.VISIBLE
|
authenticationLayoutToShow.show()
|
||||||
|
|
||||||
if (authenticationLayoutToShow == lytRemoveAppProtection) {
|
if (authenticationLayoutToShow == lytRemoveAppProtection) {
|
||||||
btnSetAuthenticationMethod.setText(R.string.dialog_protect_app_settings_button_remove_app_protection_title)
|
btnSetAuthenticationMethod.setText(R.string.dialog_protect_app_settings_button_remove_app_protection_title)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package net.dankito.banking.ui.android.extensions
|
package net.dankito.banking.ui.android.extensions
|
||||||
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import net.dankito.banking.ui.model.IBankData
|
import net.dankito.banking.ui.model.IBankData
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
|
|
||||||
|
|
||||||
fun ImageView.setIcon(bank: IBankData<*, *>) {
|
fun ImageView.setIcon(bank: IBankData<*, *>) {
|
||||||
|
@ -10,15 +11,15 @@ fun ImageView.setIcon(bank: IBankData<*, *>) {
|
||||||
val iconData = bank.iconData
|
val iconData = bank.iconData
|
||||||
|
|
||||||
if (iconData != null) {
|
if (iconData != null) {
|
||||||
this.visibility = View.VISIBLE
|
this.show()
|
||||||
this.setImageFromBytes(iconData)
|
this.setImageFromBytes(iconData)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.visibility = View.GONE
|
this.hide()
|
||||||
this.setImageURI(null)
|
this.setImageURI(null)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
this.visibility = View.GONE
|
this.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ import net.dankito.banking.ui.model.parameters.TransferMoneyData
|
||||||
import net.dankito.banking.ui.model.responses.GetTransactionsResponse
|
import net.dankito.banking.ui.model.responses.GetTransactionsResponse
|
||||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
import net.dankito.utils.android.extensions.asActivity
|
import net.dankito.utils.android.extensions.asActivity
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.isGone
|
||||||
|
import net.dankito.utils.android.extensions.setVisibility
|
||||||
import net.dankito.utils.multiplatform.sum
|
import net.dankito.utils.multiplatform.sum
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -246,7 +249,7 @@ class HomeFragment : Fragment() {
|
||||||
mnitmBalance.title = presenter.formatAmount(presenter.balanceOfSelectedAccounts)
|
mnitmBalance.title = presenter.formatAmount(presenter.balanceOfSelectedAccounts)
|
||||||
mnitmBalance.isVisible = presenter.doSelectedAccountsSupportRetrievingBalance
|
mnitmBalance.isVisible = presenter.doSelectedAccountsSupportRetrievingBalance
|
||||||
|
|
||||||
lytTransactionsSummary.visibility = if (presenter.doSelectedAccountsSupportRetrievingBalance) View.VISIBLE else View.GONE
|
lytTransactionsSummary.setVisibility(presenter.doSelectedAccountsSupportRetrievingBalance)
|
||||||
|
|
||||||
txtCountTransactions.text = context?.getString(R.string.fragment_home_count_transactions, transactionAdapter.items.size)
|
txtCountTransactions.text = context?.getString(R.string.fragment_home_count_transactions, transactionAdapter.items.size)
|
||||||
|
|
||||||
|
@ -264,11 +267,11 @@ class HomeFragment : Fragment() {
|
||||||
val haveTransactionsBeenRetrieved = transactionsRetrievalState == TransactionsRetrievalState.RetrievedTransactions
|
val haveTransactionsBeenRetrieved = transactionsRetrievalState == TransactionsRetrievalState.RetrievedTransactions
|
||||||
val noAccountsAddedYet = presenter.allBanks.isEmpty()
|
val noAccountsAddedYet = presenter.allBanks.isEmpty()
|
||||||
|
|
||||||
lytTransactionsTopBar.visibility = if (haveTransactionsBeenRetrieved) View.VISIBLE else View.GONE
|
lytTransactionsTopBar.setVisibility(haveTransactionsBeenRetrieved)
|
||||||
rcyvwAccountTransactions.visibility = if (haveTransactionsBeenRetrieved) View.VISIBLE else View.GONE
|
rcyvwAccountTransactions.setVisibility(haveTransactionsBeenRetrieved)
|
||||||
lytNoTransactionsFetched.visibility = if (haveTransactionsBeenRetrieved || noAccountsAddedYet) View.GONE else View.VISIBLE
|
lytNoTransactionsFetched.isGone = haveTransactionsBeenRetrieved || noAccountsAddedYet
|
||||||
btnRetrieveTransactions.visibility = if (TransactionsCannotBeRetrievedStates.contains(transactionsRetrievalState)) View.GONE else View.VISIBLE
|
btnRetrieveTransactions.isGone = TransactionsCannotBeRetrievedStates.contains(transactionsRetrievalState)
|
||||||
btnAddAccount.visibility = if (noAccountsAddedYet) View.VISIBLE else View.GONE
|
btnAddAccount.setVisibility(noAccountsAddedYet)
|
||||||
|
|
||||||
val messageArgs = mutableListOf<String>()
|
val messageArgs = mutableListOf<String>()
|
||||||
val transactionsRetrievalStateMessageId = when (transactionsRetrievalState) {
|
val transactionsRetrievalStateMessageId = when (transactionsRetrievalState) {
|
||||||
|
@ -291,19 +294,14 @@ class HomeFragment : Fragment() {
|
||||||
showTopFetchAllTransactionsView = presenter.showStrikingFetchAllTransactionsViewForSelectedAccounts
|
showTopFetchAllTransactionsView = presenter.showStrikingFetchAllTransactionsViewForSelectedAccounts
|
||||||
val showFetchAllTransactionsView = presenter.showFetchAllTransactionsViewForSelectedAccounts
|
val showFetchAllTransactionsView = presenter.showFetchAllTransactionsViewForSelectedAccounts
|
||||||
|
|
||||||
if (showFetchAllTransactionsView && showTopFetchAllTransactionsView) {
|
lytTopFetchAllTransactions.setVisibility(showFetchAllTransactionsView && showTopFetchAllTransactionsView)
|
||||||
lytTopFetchAllTransactions.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lytTopFetchAllTransactions.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showFetchAllTransactionsView && showTopFetchAllTransactionsView == false) {
|
if (showFetchAllTransactionsView && showTopFetchAllTransactionsView == false) {
|
||||||
// TODO: implement CoordinatorLayout to show lytBottomFetchAllTransactions below rcyvwAccountTransactions
|
// TODO: implement CoordinatorLayout to show lytBottomFetchAllTransactions below rcyvwAccountTransactions
|
||||||
// lytBottomFetchAllTransactions.visibility = View.VISIBLE
|
// lytBottomFetchAllTransactions.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lytBottomFetchAllTransactions.visibility = View.GONE
|
lytBottomFetchAllTransactions.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import kotlinx.android.synthetic.main.view_collapsible_text.view.*
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
import net.dankito.banking.ui.android.util.StandardTextWatcher
|
||||||
import net.dankito.utils.android.extensions.asActivity
|
import net.dankito.utils.android.extensions.asActivity
|
||||||
|
import net.dankito.utils.android.extensions.setVisibility
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.concurrent.schedule
|
import kotlin.concurrent.schedule
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ open class CollapsibleTextView @JvmOverloads constructor(
|
||||||
Timer().schedule(500) { // wait some time till txtvwCollapsibleText is layout and lineCount is set
|
Timer().schedule(500) { // wait some time till txtvwCollapsibleText is layout and lineCount is set
|
||||||
context.asActivity()?.runOnUiThread {
|
context.asActivity()?.runOnUiThread {
|
||||||
val showExpandButton = isCollapsed == false || txtvwCollapsibleText.lineCount > CountDisplayedLinesWhenCollapsed
|
val showExpandButton = isCollapsed == false || txtvwCollapsibleText.lineCount > CountDisplayedLinesWhenCollapsed
|
||||||
btnExpandCollapseTextView.visibility = if (showExpandButton) View.VISIBLE else View.GONE
|
btnExpandCollapseTextView.setVisibility(showExpandButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import kotlinx.android.synthetic.main.view_form_labelled_value.view.*
|
import kotlinx.android.synthetic.main.view_form_labelled_value.view.*
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
|
import net.dankito.utils.android.extensions.setVisibility
|
||||||
|
|
||||||
|
|
||||||
open class FormLabelledValue @JvmOverloads constructor(
|
open class FormLabelledValue @JvmOverloads constructor(
|
||||||
|
@ -60,13 +61,8 @@ open class FormLabelledValue @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun setValueAndVisibilityIfValueIsSet(value: CharSequence?) {
|
open fun setValueAndVisibilityIfValueIsSet(value: CharSequence?) {
|
||||||
if (value != null) {
|
this.setVisibility(value != null)
|
||||||
this.value = value
|
this.value = value ?: ""
|
||||||
this.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,6 +16,8 @@ import com.mikepenz.materialdrawer.model.BaseDescribeableDrawerItem
|
||||||
import com.mikepenz.materialdrawer.model.BaseViewHolder
|
import com.mikepenz.materialdrawer.model.BaseViewHolder
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.utils.android.extensions.createColorStateList
|
import net.dankito.utils.android.extensions.createColorStateList
|
||||||
|
import net.dankito.utils.android.extensions.hide
|
||||||
|
import net.dankito.utils.android.extensions.show
|
||||||
|
|
||||||
|
|
||||||
open class SecondaryIconDrawerItem<Item : SecondaryIconDrawerItem<Item>> : BaseDescribeableDrawerItem<Item, SecondaryIconDrawerItem.ViewHolder>() {
|
open class SecondaryIconDrawerItem<Item : SecondaryIconDrawerItem<Item>> : BaseDescribeableDrawerItem<Item, SecondaryIconDrawerItem.ViewHolder>() {
|
||||||
|
@ -41,7 +43,7 @@ open class SecondaryIconDrawerItem<Item : SecondaryIconDrawerItem<Item>> : BaseD
|
||||||
bindViewHelper(holder)
|
bindViewHelper(holder)
|
||||||
|
|
||||||
if (secondaryIcon == null) {
|
if (secondaryIcon == null) {
|
||||||
holder.btnSecondaryIcon.visibility = View.GONE
|
holder.btnSecondaryIcon.hide()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val context = holder.itemView.context
|
val context = holder.itemView.context
|
||||||
|
@ -52,7 +54,7 @@ open class SecondaryIconDrawerItem<Item : SecondaryIconDrawerItem<Item>> : BaseD
|
||||||
|
|
||||||
holder.btnSecondaryIcon.setOnClickListener { onSecondaryIconClicked?.invoke() }
|
holder.btnSecondaryIcon.setOnClickListener { onSecondaryIconClicked?.invoke() }
|
||||||
|
|
||||||
holder.btnSecondaryIcon.visibility = View.VISIBLE
|
holder.btnSecondaryIcon.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
|
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
|
||||||
|
|
Loading…
Reference in New Issue