Implemented SettingsDialog

This commit is contained in:
dankito 2020-09-28 03:33:02 +02:00
parent 936428c4f5
commit a6a5baaeb1
24 changed files with 510 additions and 83 deletions

View File

@ -47,6 +47,8 @@ ext {
androidUtilsVersion = '1.1.1-SNAPSHOT' androidUtilsVersion = '1.1.1-SNAPSHOT'
fastAdapterVersion = "5.2.3"
materialDrawerVersion = "8.0.1" materialDrawerVersion = "8.0.1"
clansFloatingActionButtonVersion = '1.6.4' clansFloatingActionButtonVersion = '1.6.4'

View File

@ -129,6 +129,12 @@ dependencies {
implementation "com.google.android.material:material:$materialComponentsVersion" implementation "com.google.android.material:material:$materialComponentsVersion"
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
implementation "com.mikepenz:fastadapter:$fastAdapterVersion"
implementation "com.mikepenz:fastadapter-extensions-binding:$fastAdapterVersion"
implementation "com.mikepenz:fastadapter-extensions-drag:$fastAdapterVersion"
implementation "com.mikepenz:fastadapter-extensions-swipe:$fastAdapterVersion"
implementation "com.mikepenz:fastadapter-extensions-utils:$fastAdapterVersion"
// for MaterialDrawer // for MaterialDrawer
implementation "com.mikepenz:materialdrawer:$materialDrawerVersion" implementation "com.mikepenz:materialdrawer:$materialDrawerVersion"
implementation "com.mikepenz:materialdrawer-nav:$materialDrawerVersion" implementation "com.mikepenz:materialdrawer-nav:$materialDrawerVersion"

View File

@ -1,13 +1,12 @@
package net.dankito.banking.ui.android.adapter package net.dankito.banking.ui.android.adapter
import android.content.Context import android.content.Context
import android.net.Uri
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView
import kotlinx.android.synthetic.main.list_item_bank_account.view.* import kotlinx.android.synthetic.main.list_item_bank_account.view.*
import net.dankito.banking.ui.android.R import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.extensions.setIcon
import net.dankito.banking.ui.model.TypedBankAccount import net.dankito.banking.ui.model.TypedBankAccount
import net.dankito.utils.android.ui.adapter.ListAdapter import net.dankito.utils.android.ui.adapter.ListAdapter
@ -24,20 +23,10 @@ open class BankAccountsAdapter(accounts: List<TypedBankAccount>) : ListAdapter<T
view?.let { view?.let {
view.txtBankAccountDisplayName.text = item.displayName view.txtBankAccountDisplayName.text = item.displayName
setIcon(item, view.imgBankIcon) view.imgBankIcon.setIcon(item.bank)
} }
return view return view
} }
protected open fun setIcon(account: TypedBankAccount, imgBankIcon: ImageView) {
try {
val iconUrl = account.bank.iconUrl
imgBankIcon.visibility = if (iconUrl == null) View.GONE else View.VISIBLE
imgBankIcon.setImageURI(Uri.parse(iconUrl))
} catch (e: Exception) {
imgBankIcon.visibility = View.GONE
}
}
} }

View File

@ -0,0 +1,46 @@
package net.dankito.banking.ui.android.adapter
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.mikepenz.fastadapter.FastAdapter
import com.mikepenz.fastadapter.drag.IDraggable
import com.mikepenz.fastadapter.items.AbstractItem
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.extensions.setIcon
import net.dankito.banking.ui.model.TypedBankData
open class BankDataAdapterItem(open val bank: TypedBankData) : AbstractItem<BankDataAdapterItem.ViewHolder>(), IDraggable {
override var isDraggable = true
override val type: Int
get() = R.id.bank_data_item_id
override val layoutRes: Int
get() = R.layout.list_item_bank_data
override fun getViewHolder(v: View): ViewHolder {
return ViewHolder(v)
}
class ViewHolder(view: View) : FastAdapter.ViewHolder<BankDataAdapterItem>(view) {
protected var bankIcon: ImageView = view.findViewById(R.id.imgBankIcon)
protected var bankDisplayName: TextView = view.findViewById(R.id.txtBankDisplayName)
override fun bindView(item: BankDataAdapterItem, payloads: List<Any>) {
bankIcon.setIcon(item.bank)
bankDisplayName.text = item.bank.displayName
}
override fun unbindView(item: BankDataAdapterItem) {
bankDisplayName.text = null
bankIcon.setImageURI(null)
}
}
}

View File

@ -0,0 +1,81 @@
package net.dankito.banking.ui.android.adapter
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mikepenz.fastadapter.FastAdapter
import com.mikepenz.fastadapter.GenericItem
import com.mikepenz.fastadapter.adapters.ItemAdapter
import com.mikepenz.fastadapter.adapters.ItemAdapter.Companion.items
import com.mikepenz.fastadapter.drag.ItemTouchCallback
import com.mikepenz.fastadapter.drag.SimpleDragCallback
import com.mikepenz.fastadapter.select.getSelectExtension
import com.mikepenz.fastadapter.utils.DragDropUtil
open class FastAdapterRecyclerView<Item : GenericItem>(
recyclerView: RecyclerView,
items: List<Item> = listOf(),
enableDragAndDrop: Boolean = false,
open var itemDropped: ((oldPosition: Int, oldItem: Item, newPosition: Int, newItem: Item) -> Unit)? = null,
open var onClickListener: ((Item) -> Unit)? = null
) : ItemTouchCallback {
protected val fastAdapter: FastAdapter<Item>
protected val itemAdapter: ItemAdapter<Item>
private lateinit var touchCallback: SimpleDragCallback
private lateinit var touchHelper: ItemTouchHelper
init {
itemAdapter = items()
fastAdapter = FastAdapter.with(itemAdapter)
init(recyclerView, items, enableDragAndDrop)
}
protected open fun init(recyclerView: RecyclerView, items: List<Item>, enableDragAndDrop: Boolean = true) {
val selectExtension = fastAdapter.getSelectExtension()
selectExtension.isSelectable = true
fastAdapter.onClickListener = { _, _, item, _ ->
onClickListener?.invoke(item)
false
}
recyclerView.layoutManager = LinearLayoutManager(recyclerView.context)
recyclerView.itemAnimator = DefaultItemAnimator()
recyclerView.adapter = fastAdapter
itemAdapter.set(items)
if (enableDragAndDrop) {
touchCallback = SimpleDragCallback(this)
touchHelper = ItemTouchHelper(touchCallback)
touchHelper.attachToRecyclerView(recyclerView)
}
}
override fun itemTouchStartDrag(viewHolder: RecyclerView.ViewHolder) {
// add visual highlight to dragged item
}
override fun itemTouchOnMove(oldPosition: Int, newPosition: Int): Boolean {
DragDropUtil.onMove(itemAdapter, oldPosition, newPosition) // change position
return true
}
override fun itemTouchDropped(oldPosition: Int, newPosition: Int) {
// remove visual highlight to dropped item
itemDropped?.invoke(oldPosition, itemAdapter.getAdapterItem(oldPosition), newPosition, itemAdapter.getAdapterItem(newPosition))
}
}

View File

@ -7,7 +7,7 @@ import net.dankito.banking.ui.android.dialogs.AddAccountDialog
import net.dankito.banking.ui.android.dialogs.EnterTanDialog import net.dankito.banking.ui.android.dialogs.EnterTanDialog
import net.dankito.banking.ui.android.dialogs.SendMessageLogDialog import net.dankito.banking.ui.android.dialogs.SendMessageLogDialog
import net.dankito.banking.ui.android.dialogs.TransferMoneyDialog import net.dankito.banking.ui.android.dialogs.TransferMoneyDialog
import net.dankito.banking.ui.android.dialogs.settings.BankSettingsDialog import net.dankito.banking.ui.android.dialogs.settings.SettingsDialogBase
import net.dankito.banking.ui.android.home.HomeFragment import net.dankito.banking.ui.android.home.HomeFragment
import javax.inject.Singleton import javax.inject.Singleton
@ -33,7 +33,7 @@ interface BankingComponent {
fun inject(transferMoneyDialog: TransferMoneyDialog) fun inject(transferMoneyDialog: TransferMoneyDialog)
fun inject(bankSettingsDialog: BankSettingsDialog) fun inject(settingsDialogBase: SettingsDialogBase)
fun inject(sendMessageLogDialog: SendMessageLogDialog) fun inject(sendMessageLogDialog: SendMessageLogDialog)

View File

@ -51,7 +51,7 @@ open class SendMessageLogDialog : DialogFragment() {
} }
protected open fun setupUI(rootView: View) { protected open fun setupUI(rootView: View) {
val messageLog = presenter.getMessageLogForAccounts(presenter.allBanks).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.visibility = View.VISIBLE

View File

@ -18,7 +18,7 @@ import net.dankito.banking.ui.presenter.BankingPresenter
import javax.inject.Inject import javax.inject.Inject
open class BankSettingsDialog : DialogFragment() { open class BankSettingsDialog : SettingsDialogBase() {
companion object { companion object {
const val DialogTag = "BankSettingsDialog" const val DialogTag = "BankSettingsDialog"
@ -28,23 +28,11 @@ open class BankSettingsDialog : DialogFragment() {
protected lateinit var bank: TypedBankData protected lateinit var bank: TypedBankData
@Inject
protected lateinit var presenter: BankingPresenter
fun show(bank: TypedBankData, activity: AppCompatActivity) {
init {
BankingComponent.component.inject(this)
}
fun show(bank: TypedBankData, activity: AppCompatActivity, fullscreen: Boolean = false) {
this.bank = bank this.bank = bank
val style = if (fullscreen) R.style.FullscreenDialogWithStatusBar else R.style.FloatingDialog show(activity, DialogTag)
setStyle(STYLE_NORMAL, style)
show(activity.supportFragmentManager, DialogTag)
} }
@ -59,12 +47,7 @@ open class BankSettingsDialog : DialogFragment() {
protected open fun setupUI(rootView: View) { protected open fun setupUI(rootView: View) {
rootView.apply { rootView.apply {
toolbar.apply { toolbar.apply {
title = bank.bankName setupToolbar(this, bank.bankName)
inflateMenu(R.menu.menu_bank_settings_dialog)
setOnMenuItemClickListener { item -> onOptionsItemSelected(item) }
setNavigationOnClickListener { askToDismissChanges() }
} }
edtxtBankName.text = bank.displayName edtxtBankName.text = bank.displayName
@ -76,34 +59,12 @@ open class BankSettingsDialog : DialogFragment() {
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override val hasUnsavedChanges: Boolean
return when (item.itemId) {
R.id.mnitmSaveChanges -> saveChangesAndCloseDialog()
else -> super.onOptionsItemSelected(item)
}
}
protected val hasUnsavedChanges: Boolean
get() = didChange(edtxtBankName, bank.displayName) get() = didChange(edtxtBankName, bank.displayName)
|| didChange(edtxtUserName, bank.userName) || didChange(edtxtUserName, bank.userName)
|| didChange(edtxtPassword, bank.password) || didChange(edtxtPassword, bank.password)
protected open fun didChange(editedValue: FormEditText, originalValue: String): Boolean { override fun saveChanges() {
return editedValue.text != originalValue
}
protected open fun saveChangesAndCloseDialog(): Boolean {
if (hasUnsavedChanges) {
saveChanges()
}
closeDialog()
return true
}
protected open fun saveChanges() {
bank.userSetDisplayName = edtxtBankName.text bank.userSetDisplayName = edtxtBankName.text
bank.userName = edtxtUserName.text bank.userName = edtxtUserName.text
bank.password = edtxtPassword.text bank.password = edtxtPassword.text
@ -111,22 +72,10 @@ open class BankSettingsDialog : DialogFragment() {
presenter.bankUpdated(bank) presenter.bankUpdated(bank)
} }
protected open fun askToDismissChanges() {
if (hasUnsavedChanges) {
AskDismissChangesAlert().show(this)
}
else {
closeDialog()
}
}
protected open fun askUserToDeleteAccount() { protected open fun askUserToDeleteAccount() {
AskDeleteAccountAlert().show(bank, presenter, requireContext()) { AskDeleteAccountAlert().show(bank, presenter, requireContext()) {
closeDialog() closeDialog()
} }
} }
protected open fun closeDialog() {
dismiss()
}
} }

View File

@ -0,0 +1,70 @@
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_settings.view.*
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.adapter.BankDataAdapterItem
import net.dankito.banking.ui.android.adapter.FastAdapterRecyclerView
import net.dankito.banking.ui.model.TypedBankData
open class SettingsDialog : SettingsDialogBase() {
companion object {
const val DialogTag = "SettingsDialog"
}
fun show(activity: AppCompatActivity) {
show(activity, DialogTag)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val rootView = inflater.inflate(R.layout.dialog_settings, container, false)
setupUI(rootView)
return rootView
}
protected open fun setupUI(rootView: View) {
rootView.apply {
toolbar.apply {
setupToolbar(this, rootView.context.getString(R.string.dialog_settings_title), false)
}
val items = presenter.allBanksSortedByDisplayIndex.map { BankDataAdapterItem(it) }
val adapter = FastAdapterRecyclerView(rootView.rcyBankCredentials, items, true)
adapter.onClickListener = { navigationToBankSettingsDialog(it.bank) }
adapter.itemDropped = { oldPosition, oldItem, newPosition, newItem -> reorderedBanks(oldPosition, oldItem.bank, newPosition, newItem.bank) }
rootView.btnShowSendMessageLogDialog.setOnClickListener { presenter.showSendMessageLogDialog() }
}
}
protected open fun navigationToBankSettingsDialog(bank: TypedBankData) {
BankSettingsDialog().show(bank, requireActivity() as AppCompatActivity)
}
protected open fun reorderedBanks(oldPosition: Int, oldItem: TypedBankData, newPosition: Int, newItem: TypedBankData) {
oldItem.displayIndex = oldPosition
newItem.displayIndex = newPosition
presenter.bankDisplayIndexUpdated(oldItem)
presenter.bankDisplayIndexUpdated(newItem)
}
override val hasUnsavedChanges: Boolean
get() = false
override fun saveChanges() {
}
}

View File

@ -0,0 +1,89 @@
package net.dankito.banking.ui.android.dialogs.settings
import android.view.*
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.DialogFragment
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.alerts.AskDismissChangesAlert
import net.dankito.banking.ui.android.di.BankingComponent
import net.dankito.banking.ui.android.views.FormEditText
import net.dankito.banking.ui.presenter.BankingPresenter
import javax.inject.Inject
abstract class SettingsDialogBase : DialogFragment() {
protected abstract val hasUnsavedChanges: Boolean
protected abstract fun saveChanges()
@Inject
protected lateinit var presenter: BankingPresenter
init {
BankingComponent.component.inject(this)
}
fun show(activity: AppCompatActivity, dialogTag: String, fullscreen: Boolean = true) {
val style = if (fullscreen) R.style.FullscreenDialogWithStatusBar else R.style.FloatingDialog
setStyle(STYLE_NORMAL, style)
show(activity.supportFragmentManager, dialogTag)
}
protected open fun setupToolbar(toolbar: Toolbar, dialogTitle: String, showSaveButton: Boolean = true) {
toolbar.apply {
title = dialogTitle
inflateMenu(R.menu.menu_settings_dialog)
menu.findItem(R.id.mnitmSaveChanges).isVisible = showSaveButton
setOnMenuItemClickListener { item -> onOptionsItemSelected(item) }
setNavigationOnClickListener { askToDismissChanges() }
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.mnitmSaveChanges -> saveChangesAndCloseDialog()
else -> super.onOptionsItemSelected(item)
}
}
protected open fun didChange(editedValue: FormEditText, originalValue: String): Boolean {
return editedValue.text != originalValue
}
protected open fun saveChangesAndCloseDialog(): Boolean {
if (hasUnsavedChanges) {
saveChanges()
}
closeDialog()
return true
}
protected open fun askToDismissChanges() {
if (hasUnsavedChanges) {
AskDismissChangesAlert().show(this)
}
else {
closeDialog()
}
}
protected open fun closeDialog() {
dismiss()
}
}

View File

@ -0,0 +1,17 @@
package net.dankito.banking.ui.android.extensions
import android.net.Uri
import android.view.View
import android.widget.ImageView
import net.dankito.banking.ui.model.IBankData
fun ImageView.setIcon(bank: IBankData<*, *>) {
try {
val iconUrl = bank.iconUrl
this.visibility = if (iconUrl == null) View.GONE else View.VISIBLE
this.setImageURI(Uri.parse(iconUrl))
} catch (e: Exception) {
this.visibility = View.GONE
}
}

View File

@ -3,6 +3,7 @@ package net.dankito.banking.ui.android.views
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout import androidx.drawerlayout.widget.DrawerLayout
import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome
@ -19,6 +20,7 @@ import com.mikepenz.materialdrawer.util.removeItemByPosition
import com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView import com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
import net.dankito.banking.ui.android.R import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.dialogs.settings.BankSettingsDialog import net.dankito.banking.ui.android.dialogs.settings.BankSettingsDialog
import net.dankito.banking.ui.android.dialogs.settings.SettingsDialog
import net.dankito.banking.ui.android.extensions.withIcon import net.dankito.banking.ui.android.extensions.withIcon
import net.dankito.banking.ui.model.TypedBankData import net.dankito.banking.ui.model.TypedBankData
import net.dankito.banking.ui.presenter.BankingPresenter import net.dankito.banking.ui.presenter.BankingPresenter
@ -103,10 +105,11 @@ open class DrawerView(
, ,
PrimaryDrawerItem() PrimaryDrawerItem()
.withName(R.string.drawer_menu_send_message_log_title) .withName(R.string.drawer_menu_show_settings_dialog_title)
.withIcon(activity, GoogleMaterial.Icon.gmd_mail, R.color.primaryTextColor_Dark) .withIcon(R.drawable.ic_baseline_settings_24)
.withIconColor(ContextCompat.getColorStateList(activity, R.color.primaryTextColor_Dark)!!)
.withSelectable(false) .withSelectable(false)
.withOnDrawerItemClickListener { _, _, _ -> itemClicked { presenter.showSendMessageLogDialog() } } .withOnDrawerItemClickListener { _, _, _ -> itemClicked { SettingsDialog().show(activity) } }
) )
} }
@ -129,7 +132,7 @@ open class DrawerView(
} }
private fun createAccountsDrawerItems(): List<IDrawerItem<*>> { private fun createAccountsDrawerItems(): List<IDrawerItem<*>> {
return presenter.allBanks.map { account -> return presenter.allBanksSortedByDisplayIndex.map { account ->
val accountItem = createAccountDrawerItem(account) val accountItem = createAccountDrawerItem(account)
val accountsItems = createBankAccountsDrawerItems(account).toMutableList() val accountsItems = createBankAccountsDrawerItems(account).toMutableList()
@ -182,7 +185,7 @@ open class DrawerView(
} }
private fun editAccount(bank: TypedBankData) { private fun editAccount(bank: TypedBankData) {
BankSettingsDialog().show(bank, activity, true) BankSettingsDialog().show(bank, activity)
} }
private fun showAppVersion(navigationHeaderView: View?) { private fun showAppVersion(navigationHeaderView: View?) {

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,9H4v2h16V9zM4,15h16v-2H4V15z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
</vector>

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="@drawable/ic_baseline_close_24"
/>
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dialog_settings_padding"
>
<net.dankito.banking.ui.android.views.FormSectionTitle
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bank_credentials"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcyBankCredentials"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/btnShowSendMessageLogDialog"
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_settings_button_send_message_log_height"
android:layout_marginTop="@dimen/dialog_settings_send_message_log_margin_top"
style="?android:attr/buttonBarButtonStyle"
android:drawableLeft="@drawable/ic_baseline_send_24"
android:drawableStart="@drawable/ic_baseline_send_24"
android:drawablePadding="@dimen/dialog_settings_button_send_message_log_space_between_icon_and_text"
android:gravity="start|center_vertical"
android:textAlignment="gravity"
android:textAllCaps="false"
android:textColor="@color/materialDesignTextColorPrimary"
android:textSize="@dimen/dialog_settings_button_send_message_log_text_size"
android:text="@string/dialog_settings_send_message_log_title"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_bank_data_height"
android:padding="@dimen/list_item_bank_data_padding"
android:gravity="center_vertical"
>
<ImageView
android:id="@+id/imgBankIcon"
android:layout_width="@dimen/list_item_bank_data_icon_size"
android:layout_height="@dimen/list_item_bank_data_icon_size"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="@dimen/list_item_bank_data_icon_margin_right"
android:layout_marginEnd="@dimen/list_item_bank_data_icon_margin_right"
android:layout_gravity="center_vertical"
android:visibility="gone"
/>
<TextView
android:id="@+id/txtBankDisplayName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/imgBankIcon"
android:layout_toEndOf="@+id/imgBankIcon"
android:layout_toLeftOf="@+id/imgDragHandle"
android:layout_toStartOf="@+id/imgDragHandle"
android:layout_alignParentBottom="true"
android:gravity="center_vertical"
android:textAlignment="gravity"
android:singleLine="true"
android:textSize="@dimen/list_item_bank_data_bank_name_text_size"
android:ellipsize="marquee"
/>
<ImageView
android:id="@+id/imgDragHandle"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
app:srcCompat="@drawable/ic_baseline_drag_handle_24"
/>
</RelativeLayout>

View File

@ -19,6 +19,8 @@
<string name="online_banking_credentials_login_name">Login Name</string> <string name="online_banking_credentials_login_name">Login Name</string>
<string name="online_banking_credentials_password">Passwort</string> <string name="online_banking_credentials_password">Passwort</string>
<string name="bank_credentials">Bankzugänge</string>
<string name="navigation_drawer_open">Seitenleiste öffnen</string> <string name="navigation_drawer_open">Seitenleiste öffnen</string>
<string name="navigation_drawer_close">Seitenleiste schließen</string> <string name="navigation_drawer_close">Seitenleiste schließen</string>
<string name="nav_header_title">@string/app_name</string> <string name="nav_header_title">@string/app_name</string>
@ -26,7 +28,7 @@
<string name="nav_header_desc">Navigationsbereich</string> <string name="nav_header_desc">Navigationsbereich</string>
<string name="drawer_menu_bank_accounts_section_title">Konten</string> <string name="drawer_menu_bank_accounts_section_title">Konten</string>
<string name="drawer_menu_all_bank_accounts_title">Alle Konten</string> <string name="drawer_menu_all_bank_accounts_title">Alle Konten</string>
<string name="drawer_menu_send_message_log_title">Message Log senden</string> <string name="drawer_menu_show_settings_dialog_title">Einstellungen</string>
<string name="floating_action_menu_add_account">Konto</string> <string name="floating_action_menu_add_account">Konto</string>
<string name="floating_action_menu_transfer_money">Überweisung</string> <string name="floating_action_menu_transfer_money">Überweisung</string>
@ -97,7 +99,10 @@
<string name="dialog_enter_atc_error_entered_atc_is_not_a_number">ATC muss eine Zahl sein.\n\nDer eingebene ATC Wert \'%s\' kann jedoch nicht in eine Zahl konvertiert werden.</string> <string name="dialog_enter_atc_error_entered_atc_is_not_a_number">ATC muss eine Zahl sein.\n\nDer eingebene ATC Wert \'%s\' kann jedoch nicht in eine Zahl konvertiert werden.</string>
<string name="dialog_bank_settings_title">Bank settings</string> <string name="dialog_settings_title">Einstellungen</string>
<string name="dialog_settings_send_message_log_title">Message Log senden</string>
<string name="dialog_bank_settings_bank_name">Name</string> <string name="dialog_bank_settings_bank_name">Name</string>
<string name="dialog_bank_settings_delete_account">Konto löschen</string> <string name="dialog_bank_settings_delete_account">Konto löschen</string>

View File

@ -15,6 +15,8 @@
<!-- Use a bit different gray as secondary text color, the same gray also used on iOS --> <!-- Use a bit different gray as secondary text color, the same gray also used on iOS -->
<color name="textColorSecondary">#8a8a8e</color> <color name="textColorSecondary">#8a8a8e</color>
<color name="materialDesignTextColorPrimary">#737373</color>
<color name="drawerMenuItemPrimaryColor">@color/primaryTextColor_Dark</color> <color name="drawerMenuItemPrimaryColor">@color/primaryTextColor_Dark</color>
<color name="positiveAmount">#43A047</color> <color name="positiveAmount">#43A047</color>

View File

@ -140,6 +140,18 @@
<dimen name="dialog_enter_atc_enter_value_field_value_margin_left">6dp</dimen> <dimen name="dialog_enter_atc_enter_value_field_value_margin_left">6dp</dimen>
<dimen name="dialog_enter_atc_buttons_width">120dp</dimen> <dimen name="dialog_enter_atc_buttons_width">120dp</dimen>
<dimen name="dialog_settings_padding">8dp</dimen>
<dimen name="dialog_settings_send_message_log_margin_top">18dp</dimen>
<dimen name="dialog_settings_button_send_message_log_height">40dp</dimen>
<dimen name="dialog_settings_button_send_message_log_space_between_icon_and_text">12dp</dimen>
<dimen name="dialog_settings_button_send_message_log_text_size">16sp</dimen>
<dimen name="list_item_bank_data_height">35dp</dimen>
<dimen name="list_item_bank_data_padding">2dp</dimen>
<dimen name="list_item_bank_data_icon_size">24dp</dimen>
<dimen name="list_item_bank_data_icon_margin_right">8dp</dimen>
<dimen name="list_item_bank_data_bank_name_text_size">16sp</dimen>
<dimen name="dialog_bank_settings_delete_account_button_height">50dp</dimen> <dimen name="dialog_bank_settings_delete_account_button_height">50dp</dimen>
<dimen name="dialog_send_message_log_padding">4dp</dimen> <dimen name="dialog_send_message_log_padding">4dp</dimen>

View File

@ -4,4 +4,6 @@
<item name="material_drawer_item_secondary_icon" type="id" /> <item name="material_drawer_item_secondary_icon" type="id" />
<item name="bank_data_item_id" type="id" />
</resources> </resources>

View File

@ -19,6 +19,8 @@
<string name="online_banking_credentials_login_name">Login name</string> <string name="online_banking_credentials_login_name">Login name</string>
<string name="online_banking_credentials_password">Password</string> <string name="online_banking_credentials_password">Password</string>
<string name="bank_credentials">Bank credentials</string>
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">@string/app_name</string> <string name="nav_header_title">@string/app_name</string>
@ -26,7 +28,7 @@
<string name="nav_header_desc">Navigation header</string> <string name="nav_header_desc">Navigation header</string>
<string name="drawer_menu_bank_accounts_section_title">Accounts</string> <string name="drawer_menu_bank_accounts_section_title">Accounts</string>
<string name="drawer_menu_all_bank_accounts_title">All accounts</string> <string name="drawer_menu_all_bank_accounts_title">All accounts</string>
<string name="drawer_menu_send_message_log_title">Send message log</string> <string name="drawer_menu_show_settings_dialog_title">Settings</string>
<string name="floating_action_menu_add_account">Account</string> <string name="floating_action_menu_add_account">Account</string>
<string name="floating_action_menu_transfer_money">Transfer money</string> <string name="floating_action_menu_transfer_money">Transfer money</string>
@ -97,7 +99,10 @@
<string name="dialog_enter_atc_error_entered_atc_is_not_a_number">ATC has to be a number.\n\nBut entered ATC value \'%s\' cannot be converted to a number.</string> <string name="dialog_enter_atc_error_entered_atc_is_not_a_number">ATC has to be a number.\n\nBut entered ATC value \'%s\' cannot be converted to a number.</string>
<string name="dialog_bank_settings_title">Bank settings</string> <string name="dialog_settings_title">Settings</string>
<string name="dialog_settings_send_message_log_title">Send message log</string>
<string name="dialog_bank_settings_bank_name">Name</string> <string name="dialog_bank_settings_bank_name">Name</string>
<string name="dialog_bank_settings_delete_account">Delete account</string> <string name="dialog_bank_settings_delete_account">Delete account</string>

View File

@ -15,7 +15,7 @@ import tornadofx.*
open class AccountsView(protected val presenter: BankingPresenter) : View() { open class AccountsView(protected val presenter: BankingPresenter) : View() {
protected val accounts = FXCollections.observableArrayList(presenter.allBanks) protected val accounts = FXCollections.observableArrayList(presenter.allBanksSortedByDisplayIndex)
init { init {

View File

@ -725,6 +725,9 @@ open class BankingPresenter(
open val allBanks: List<TypedBankData> open val allBanks: List<TypedBankData>
get() = bankingClientsForBanks.keys.toList() get() = bankingClientsForBanks.keys.toList()
open val allBanksSortedByDisplayIndex: List<TypedBankData>
get() = allBanks.sortedByDisplayIndex()
open val allAccounts: List<TypedBankAccount> open val allAccounts: List<TypedBankAccount>
get() = allBanks.flatMap { it.accounts } get() = allBanks.flatMap { it.accounts }