gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] branch master updated (177d22b -> d78c200)


From: gnunet
Subject: [taler-taler-android] branch master updated (177d22b -> d78c200)
Date: Mon, 07 Sep 2020 16:29:00 +0200

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a change to branch master
in repository taler-android.

    from 177d22b  [wallet] bump wallet-core version
     new 65bd1c7  [pos] fix merchant API test case after removing instance field
     new 01acaca  [wallet] always show product details (remove details button)
     new d78c200  [pos] show snackbar at the bottom instead of top (should 
resolve UI issues)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/net/taler/merchantlib/MerchantApiTest.kt  |  3 +-
 .../src/main/java/net/taler/merchantpos/Utils.kt   |  6 +-
 .../taler/merchantpos/payment/PaymentManager.kt    |  4 +-
 wallet/build.gradle                                |  2 +-
 .../net/taler/wallet/payment/PaymentManager.kt     | 10 ---
 .../net/taler/wallet/payment/ProductAdapter.kt     | 11 +--
 .../taler/wallet/payment/PromptPaymentFragment.kt  | 15 +----
 .../main/res/layout/list_item_product_single.xml   | 78 ----------------------
 wallet/src/main/res/layout/payment_details.xml     | 16 +----
 9 files changed, 13 insertions(+), 132 deletions(-)
 delete mode 100644 wallet/src/main/res/layout/list_item_product_single.xml

diff --git 
a/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt 
b/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
index 1e6a634..63188f9 100644
--- a/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
+++ b/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
@@ -35,8 +35,7 @@ class MerchantApiTest {
 
     private val api = MerchantApi(httpClient, TestCoroutineDispatcher())
     private val merchantConfig = MerchantConfig(
-        baseUrl = "http://example.net/";,
-        instance = "testInstance",
+        baseUrl = "http://example.net/instances/testInstance";,
         apiKey = "apiKeyFooBar"
     )
     private val orderId = "orderIdFoo"
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/Utils.kt 
b/merchant-terminal/src/main/java/net/taler/merchantpos/Utils.kt
index 578debf..137dd37 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/Utils.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/Utils.kt
@@ -18,15 +18,13 @@ package net.taler.merchantpos
 
 import android.view.View
 import androidx.annotation.StringRes
+import com.google.android.material.bottomsheet.BottomSheetDialog
 import 
com.google.android.material.snackbar.BaseTransientBottomBar.ANIMATION_MODE_FADE
 import com.google.android.material.snackbar.BaseTransientBottomBar.Duration
 import com.google.android.material.snackbar.Snackbar.make
 
 fun topSnackbar(view: View, text: CharSequence, @Duration duration: Int) {
-    make(view, text, duration)
-        .setAnimationMode(ANIMATION_MODE_FADE)
-        .setAnchorView(R.id.navHostFragment)
-        .show()
+    make(view, text, duration).show()
 }
 
 fun topSnackbar(view: View, @StringRes resId: Int, @Duration duration: Int) {
diff --git 
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
 
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
index af340f1..b017726 100644
--- 
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
+++ 
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
@@ -117,7 +117,9 @@ class PaymentManager(
                 }
             }
         }
-        mPayment.value = mPayment.value!!.copy(error = error)
+        mPayment.value?.copy(error = error)?.let {
+            mPayment.value = it
+        }
         checkTimer.cancel()
         checkJob?.isCancelled
         checkJob = null
diff --git a/wallet/build.gradle b/wallet/build.gradle
index b3a8210..0e04d17 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -47,7 +47,7 @@ android {
         minSdkVersion 24
         targetSdkVersion 29
         versionCode 6
-        versionName "0.7.1.dev.25"
+        versionName "0.7.1.dev.28"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         buildConfigField "String", "WALLET_CORE_VERSION", 
"\"$walletCoreVersion\""
     }
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt 
b/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt
index 9e6984c..34a8023 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt
@@ -64,13 +64,9 @@ class PaymentManager(
     private val mPayStatus = MutableLiveData<PayStatus>(PayStatus.None)
     internal val payStatus: LiveData<PayStatus> = mPayStatus
 
-    private val mDetailsShown = MutableLiveData<Boolean>()
-    internal val detailsShown: LiveData<Boolean> = mDetailsShown
-
     @UiThread
     fun preparePay(url: String) = scope.launch {
         mPayStatus.value = PayStatus.Loading
-        mDetailsShown.value = false
         api.request("preparePay", PreparePayResponse.serializer()) {
             put("talerPayUri", url)
         }.onError {
@@ -118,12 +114,6 @@ class PaymentManager(
         }
     }
 
-    @UiThread
-    fun toggleDetailsShown() {
-        val oldValue = mDetailsShown.value ?: false
-        mDetailsShown.value = !oldValue
-    }
-
     @UiThread
     fun resetPayStatus() {
         mPayStatus.value = PayStatus.None
diff --git a/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt 
b/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt
index 24bbd27..87b6387 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt
@@ -43,14 +43,9 @@ internal class ProductAdapter(private val listener: 
ProductImageClickListener) :
 
     override fun getItemCount() = items.size
 
-    override fun getItemViewType(position: Int): Int {
-        return if (itemCount == 1) 1 else 0
-    }
-
     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): 
ProductViewHolder {
-        val res =
-            if (viewType == 1) R.layout.list_item_product_single else 
R.layout.list_item_product
-        val view = LayoutInflater.from(parent.context).inflate(res, parent, 
false)
+        val inflater = LayoutInflater.from(parent.context)
+        val view = inflater.inflate(R.layout.list_item_product, parent, false)
         return ProductViewHolder(view)
     }
 
@@ -81,7 +76,7 @@ internal class ProductAdapter(private val listener: 
ProductImageClickListener) :
                 val decodedString = Base64.decode(match.groups[2]!!.value, 
Base64.DEFAULT)
                 val bitmap = decodeByteArray(decodedString, 0, 
decodedString.size)
                 image.setImageBitmap(bitmap)
-                if (itemCount > 1) image.setOnClickListener {
+                image.setOnClickListener {
                     listener.onImageClick(bitmap)
                 }
             }
diff --git 
a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt 
b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
index 8815408..664dcc9 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
@@ -21,15 +21,12 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.View.GONE
-import android.view.View.VISIBLE
 import android.view.ViewGroup
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.activityViewModels
-import androidx.lifecycle.Observer
 import androidx.lifecycle.observe
 import androidx.navigation.fragment.findNavController
 import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.transition.TransitionManager.beginDelayedTransition
 import com.google.android.material.snackbar.Snackbar
 import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
 import net.taler.common.ContractTerms
@@ -61,16 +58,7 @@ class PromptPaymentFragment : Fragment(), 
ProductImageClickListener {
 
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
         paymentManager.payStatus.observe(viewLifecycleOwner, 
::onPaymentStatusChanged)
-        paymentManager.detailsShown.observe(viewLifecycleOwner, Observer { 
shown ->
-            beginDelayedTransition(view as ViewGroup)
-            val res = if (shown) R.string.payment_hide_details else 
R.string.payment_show_details
-            ui.details.detailsButton.setText(res)
-            ui.details.productsList.visibility = if (shown) VISIBLE else GONE
-        })
 
-        ui.details.detailsButton.setOnClickListener {
-            paymentManager.toggleDetailsShown()
-        }
         ui.details.productsList.apply {
             adapter = this@PromptPaymentFragment.adapter
             layoutManager = LinearLayoutManager(requireContext())
@@ -147,7 +135,7 @@ class PromptPaymentFragment : Fragment(), 
ProductImageClickListener {
     private fun showOrder(contractTerms: ContractTerms, amount:Amount, 
totalFees: Amount? = null) {
         ui.details.orderView.text = contractTerms.summary
         adapter.setItems(contractTerms.products)
-        if (contractTerms.products.size == 1) 
paymentManager.toggleDetailsShown()
+        ui.details.productsList.fadeIn()
         ui.bottom.totalView.text = amount.toString()
         if (totalFees != null && !totalFees.isZero()) {
             ui.bottom.feeView.text = getString(R.string.payment_fee, totalFees)
@@ -157,7 +145,6 @@ class PromptPaymentFragment : Fragment(), 
ProductImageClickListener {
         }
         ui.details.orderLabelView.fadeIn()
         ui.details.orderView.fadeIn()
-        if (contractTerms.products.size > 1) ui.details.detailsButton.fadeIn()
         ui.bottom.totalLabelView.fadeIn()
         ui.bottom.totalView.fadeIn()
     }
diff --git a/wallet/src/main/res/layout/list_item_product_single.xml 
b/wallet/src/main/res/layout/list_item_product_single.xml
deleted file mode 100644
index 6f0f79f..0000000
--- a/wallet/src/main/res/layout/list_item_product_single.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
-  ~ This file is part of GNU Taler
-  ~ (C) 2020 Taler Systems S.A.
-  ~
-  ~ GNU Taler is free software; you can redistribute it and/or modify it under 
the
-  ~ terms of the GNU General Public License as published by the Free Software
-  ~ Foundation; either version 3, or (at your option) any later version.
-  ~
-  ~ GNU Taler is distributed in the hope that it will be useful, but WITHOUT 
ANY
-  ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
-  ~ A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-  ~
-  ~ You should have received a copy of the GNU General Public License along 
with
-  ~ GNU Taler; see the file COPYING.  If not, see 
<http://www.gnu.org/licenses/>
-  -->
-
-<androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android";
-    xmlns:app="http://schemas.android.com/apk/res-auto";
-    xmlns:tools="http://schemas.android.com/tools";
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:padding="8dp">
-
-    <TextView
-        android:id="@+id/quantity"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:visibility="gone"
-        app:layout_constraintEnd_toStartOf="@+id/name"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintHorizontal_chainStyle="packed"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_bias="0.0"
-        tools:text="31" />
-
-    <ImageView
-        android:id="@+id/image"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/name"
-        tools:ignore="ContentDescription"
-        tools:srcCompat="@tools:sample/avatars"
-        tools:visibility="visible" />
-
-    <TextView
-        android:id="@+id/name"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:layout_marginEnd="8dp"
-        android:visibility="gone"
-        app:layout_constrainedWidth="true"
-        app:layout_constraintBottom_toTopOf="@+id/image"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintEnd_toStartOf="@+id/price"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/quantity"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_goneMarginEnd="0dp"
-        tools:text="A product item that can have a very long name that wraps 
over two lines" />
-
-    <TextView
-        android:id="@+id/price"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:visibility="gone"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_bias="0.0"
-        tools:text="23.42" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/wallet/src/main/res/layout/payment_details.xml 
b/wallet/src/main/res/layout/payment_details.xml
index 643974e..0610f52 100644
--- a/wallet/src/main/res/layout/payment_details.xml
+++ b/wallet/src/main/res/layout/payment_details.xml
@@ -69,25 +69,13 @@
             android:textAppearance="@style/TextAppearance.AppCompat.Headline"
             android:textSize="25sp"
             android:visibility="invisible"
-            app:layout_constraintBottom_toTopOf="@+id/detailsButton"
+            app:layout_constraintBottom_toTopOf="@+id/productsList"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/orderLabelView"
             tools:text="2 x Cappuccino, 1 x Hot Meals, 1 x Dessert"
             tools:visibility="visible" />
 
-        <Button
-            android:id="@+id/detailsButton"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/payment_show_details"
-            android:visibility="gone"
-            app:layout_constraintBottom_toTopOf="@+id/productsList"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/orderView"
-            tools:visibility="visible" />
-
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/productsList"
             android:layout_width="0dp"
@@ -97,7 +85,7 @@
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/detailsButton"
+            app:layout_constraintTop_toBottomOf="@+id/orderView"
             tools:listitem="@layout/list_item_product"
             tools:visibility="visible" />
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]