diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt new file mode 100644 index 00000000..6fc2d7b9 --- /dev/null +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt @@ -0,0 +1,59 @@ +package net.dankito.banking.ui.android.dialogs.settings + +import android.os.Bundle +import android.view.* +import androidx.appcompat.app.AppCompatActivity +import kotlinx.android.synthetic.main.dialog_bank_account_settings.* +import kotlinx.android.synthetic.main.dialog_bank_account_settings.view.* +import kotlinx.android.synthetic.main.dialog_bank_settings.view.toolbar +import net.dankito.banking.ui.android.R +import net.dankito.banking.ui.model.TypedBankAccount + + +open class BankAccountSettingsDialog : SettingsDialogBase() { + + companion object { + const val DialogTag = "BankAccountSettingsDialog" + } + + + protected lateinit var account: TypedBankAccount + + + + fun show(account: TypedBankAccount, activity: AppCompatActivity) { + this.account = account + + show(activity, DialogTag) + } + + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + val rootView = inflater.inflate(R.layout.dialog_bank_account_settings, container, false) + + setupUI(rootView) + + return rootView + } + + protected open fun setupUI(rootView: View) { + rootView.apply { + toolbar.apply { + setupToolbar(this, account.displayName) + } + + edtxtBankAccountName.text = account.displayName + } + } + + + override val hasUnsavedChanges: Boolean + get() = didChange(edtxtBankAccountName, account.displayName) + + override fun saveChanges() { + account.userSetDisplayName = edtxtBankAccountName.text + + presenter.accountUpdated(account) + } + +} \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt index 9b44bef4..671355d0 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt @@ -45,7 +45,7 @@ open class BankSettingsDialog : SettingsDialogBase() { protected open fun setupUI(rootView: View) { rootView.apply { toolbar.apply { - setupToolbar(this, bank.bankName) + setupToolbar(this, bank.displayName) } edtxtBankName.text = bank.displayName @@ -54,6 +54,7 @@ open class BankSettingsDialog : SettingsDialogBase() { val items = bank.accountsSorted.map { DraggableBankAccountAdapterItem(it) } val adapter = FastAdapterRecyclerView(rootView.rcyBankAccounts, items, true) + adapter.onClickListener = { navigationToBankAccountSettingsDialog(it.account) } adapter.itemDropped = { oldPosition, oldItem, newPosition, newItem -> reorderedBankAccounts(oldPosition, oldItem.account, newPosition, newItem.account) } btnDeleteAccount.setOnClickListener { askUserToDeleteAccount() } @@ -61,6 +62,10 @@ open class BankSettingsDialog : SettingsDialogBase() { } + protected open fun navigationToBankAccountSettingsDialog(account: TypedBankAccount) { + BankAccountSettingsDialog().show(account, requireActivity() as AppCompatActivity) + } + protected open fun reorderedBankAccounts(oldPosition: Int, oldItem: TypedBankAccount, newPosition: Int, newItem: TypedBankAccount) { oldItem.displayIndex = oldPosition newItem.displayIndex = newPosition diff --git a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml new file mode 100644 index 00000000..81c03829 --- /dev/null +++ b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml index b339e015..b307a10d 100644 --- a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml @@ -106,6 +106,8 @@ Name Konto löschen + Name + Nicht gespeicherte Änderungen Es wurden nicht alle Änderungen gespeichert. Sind Sie sich sicher, dass Sie sie verwerfen möchten?\n\n(TODO: Oder einfach: Änderungen verwerfen?) diff --git a/ui/BankingAndroidApp/src/main/res/values/strings.xml b/ui/BankingAndroidApp/src/main/res/values/strings.xml index 270fc9bf..a20eb531 100644 --- a/ui/BankingAndroidApp/src/main/res/values/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values/strings.xml @@ -106,6 +106,8 @@ Name Delete account + Name + Unsaved changed Changed data hasn\'t been saved. Are you sure you want to discard them?\n\n(TODO: Oder einfach: Discard changes?)