aboutsummaryrefslogtreecommitdiff
path: root/merchant-terminal
diff options
context:
space:
mode:
Diffstat (limited to 'merchant-terminal')
-rw-r--r--merchant-terminal/build.gradle4
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt6
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt2
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt2
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt6
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt2
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt4
-rw-r--r--merchant-terminal/src/main/res/layout/list_item_history.xml4
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>