diff options
author | Torsten Grote <t@grobox.de> | 2021-08-27 16:43:46 +0200 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2021-08-27 16:43:46 +0200 |
commit | b663081104dc38df462c30d7dfc90e435ef3cf6c (patch) | |
tree | fce942ffc2eedfdb2a32ef4aa4f838c9b65e25c6 /merchant-terminal | |
parent | 06f16a7477b337f07526285b65a7f3003b814d33 (diff) | |
download | taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.tar.gz taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.tar.bz2 taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.zip |
Update libraries and do associated maintenance
Diffstat (limited to 'merchant-terminal')
8 files changed, 15 insertions, 15 deletions
diff --git a/merchant-terminal/build.gradle b/merchant-terminal/build.gradle index 0458f36..e7a3bcc 100644 --- a/merchant-terminal/build.gradle +++ b/merchant-terminal/build.gradle @@ -68,7 +68,7 @@ dependencies { implementation "com.google.android.material:material:$material_version" implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" - implementation "androidx.recyclerview:recyclerview:1.1.0" + implementation "androidx.recyclerview:recyclerview:1.2.1" implementation "androidx.recyclerview:recyclerview-selection:1.1.0" // Navigation @@ -77,6 +77,6 @@ dependencies { implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - testImplementation 'androidx.test.ext:junit:1.1.2' + testImplementation 'androidx.test.ext:junit:1.1.3' testImplementation 'org.robolectric:robolectric:4.4' } diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt index d7c446f..165bb8e 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt @@ -84,8 +84,8 @@ class ConfigManager( var currency: String? = null private set - private val mConfigUpdateResult = MutableLiveData<ConfigUpdateResult>() - val configUpdateResult: LiveData<ConfigUpdateResult> = mConfigUpdateResult + private val mConfigUpdateResult = MutableLiveData<ConfigUpdateResult?>() + val configUpdateResult: LiveData<ConfigUpdateResult?> = mConfigUpdateResult fun addConfigurationReceiver(receiver: ConfigurationReceiver) { configurationReceivers.add(receiver) @@ -115,7 +115,7 @@ class ConfigManager( Log.e(TAG, "Error retrieving merchant config", e) val msg = if (e is ClientRequestException) { context.getString( - if (e.response?.status == Unauthorized) R.string.config_auth_error + if (e.response.status == Unauthorized) R.string.config_auth_error else R.string.config_error_network ) } else { diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt index 738e32b..10aabd4 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt @@ -54,7 +54,7 @@ internal class MutableLiveOrder( MutableLiveData(Order(id, currency, availableCategories)) override val orderTotal: LiveData<Amount> = Transformations.map(order) { it.total } override val restartState = MutableLiveData(DISABLED) - private val selectedOrderLine = MutableLiveData<ConfigProduct>() + private val selectedOrderLine = MutableLiveData<ConfigProduct?>() override val selectedProductKey: String? get() = selectedOrderLine.value?.id override val modifyOrderAllowed = diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt index 2180ccb..dc98f88 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt @@ -100,7 +100,7 @@ internal class OrderAdapter : Adapter<OrderViewHolder>() { list.findChildViewUnder(e.x, e.y)?.let { view -> val holder = list.getChildViewHolder(view) val adapter = list.adapter as OrderAdapter - val position = holder.adapterPosition + val position = holder.bindingAdapterPosition return object : ItemDetails<String>() { override fun getPosition(): Int = position override fun getSelectionKey(): String = adapter.keyProvider.getKey(position) diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt index a89a85d..6c5ecdf 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt @@ -120,7 +120,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver { val currentOrder = order(currentId) if (currentOrder.isEmpty()) orders.remove(currentId) else currentOrder.lastAddedProduct = null // not needed anymore and it would get selected - mCurrentOrderId.value = nextId + mCurrentOrderId.value = requireNotNull(nextId) } @UiThread @@ -143,7 +143,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver { // and would get selected when navigating back instead of last selection if (currentOrder.isEmpty()) orders.remove(currentId) else currentOrder.lastAddedProduct = null - mCurrentOrderId.value = previousId + mCurrentOrderId.value = requireNotNull(previousId) } fun hasPreviousOrder(currentOrderId: Int): Boolean { @@ -159,7 +159,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver { forEach { if (it.selected) it.selected = false } category.selected = true } - mCategories.postValue(newCategories) + mCategories.postValue(newCategories ?: emptyList()) mProducts.postValue(productsByCategory[category]) } diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt index a3898fd..b2a245f 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt @@ -100,7 +100,7 @@ private class ProductAdapter( notifyDataSetChanged() } - private inner class ProductViewHolder(private val v: View) : ViewHolder(v) { + inner class ProductViewHolder(private val v: View) : ViewHolder(v) { private val name: TextView = v.findViewById(R.id.name) private val price: TextView = v.findViewById(R.id.price) diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt index de6cdde..8b3efca 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt @@ -49,8 +49,8 @@ class RefundManager( var toBeRefunded: OrderHistoryEntry? = null private set - private val mRefundResult = MutableLiveData<RefundResult>() - internal val refundResult: LiveData<RefundResult> = mRefundResult + private val mRefundResult = MutableLiveData<RefundResult?>() + internal val refundResult: LiveData<RefundResult?> = mRefundResult @UiThread internal fun startRefund(item: OrderHistoryEntry) { diff --git a/merchant-terminal/src/main/res/layout/list_item_history.xml b/merchant-terminal/src/main/res/layout/list_item_history.xml index 08f45b7..4d947cf 100644 --- a/merchant-terminal/src/main/res/layout/list_item_history.xml +++ b/merchant-terminal/src/main/res/layout/list_item_history.xml @@ -87,10 +87,10 @@ android:layout_height="48dp" android:backgroundTint="?colorPrimary" android:contentDescription="@string/history_refund" - android:tint="?attr/colorOnPrimary" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" - app:srcCompat="@drawable/ic_cash_refund" /> + app:srcCompat="@drawable/ic_cash_refund" + app:tint="?attr/colorOnPrimary" /> </androidx.constraintlayout.widget.ConstraintLayout> |