From 2fbda24d2205ace0ede93faa824f7836d0ece445 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 17 Aug 2022 17:06:52 -0300 Subject: Upgrade libraries --- .../org/gnu/anastasis/ui/authentication/SmsFragment.kt | 1 + .../org/gnu/anastasis/ui/authentication/VideoFragment.kt | 1 + build.gradle | 12 ++++++------ cashier/src/main/java/net/taler/cashier/BalanceFragment.kt | 2 ++ .../main/java/net/taler/cashier/withdraw/ErrorFragment.kt | 9 ++++----- merchant-lib/build.gradle | 2 +- .../net/taler/merchantpos/config/ConfigFetcherFragment.kt | 8 ++++---- .../main/java/net/taler/merchantpos/order/OrderFragment.kt | 5 +++-- .../taler/merchantpos/payment/PaymentSuccessFragment.kt | 3 ++- taler-kotlin-android/build.gradle | 4 ++-- wallet/build.gradle | 6 +++--- .../java/net/taler/wallet/payment/PromptPaymentFragment.kt | 1 + .../net/taler/wallet/pending/PendingOperationsFragment.kt | 8 +++++--- .../main/java/net/taler/wallet/tip/PromptTipFragment.kt | 14 +++++++------- .../taler/wallet/transactions/TransactionDetailFragment.kt | 3 +++ .../net/taler/wallet/transactions/TransactionsFragment.kt | 1 + .../net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt | 12 ++++++------ 17 files changed, 52 insertions(+), 40 deletions(-) diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt index 2c35309..a7a1e75 100644 --- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt +++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt @@ -94,6 +94,7 @@ class SmsFragment : Fragment() { } } + @Deprecated("Deprecated in Java") override fun onRequestPermissionsResult( requestCode: Int, permissions: Array, diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/VideoFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/VideoFragment.kt index 6716f8a..4e83736 100644 --- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/VideoFragment.kt +++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/VideoFragment.kt @@ -98,6 +98,7 @@ class VideoFragment : Fragment() { } } + @Deprecated("Deprecated in Java") override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { val imageBitmap = data!!.extras!!.get("data") as Bitmap diff --git a/build.gradle b/build.gradle index 0598741..375a561 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ buildscript { ext { - kotlin_version = '1.6.21' - ktor_version = '2.0.1' - nav_version = '2.5.0' + kotlin_version = '1.7.10' + ktor_version = '2.1.0' + nav_version = '2.5.1' material_version = '1.6.1' - lifecycle_version = '2.4.1' + lifecycle_version = '2.5.1' constraintlayout_version = '2.1.4' - compose_version = '1.2.0-rc02' + compose_version = '1.2.1' junit_version = "4.13.2" // check https://android-rebuilds.beuc.net/ for availability of free build tools build_tools_version = "30.0.3" @@ -18,7 +18,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:7.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" diff --git a/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt b/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt index c0e2aca..b246e9f 100644 --- a/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt +++ b/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt @@ -104,11 +104,13 @@ class BalanceFragment : Fragment() { } } + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.balance, menu) super.onCreateOptionsMenu(menu, inflater) } + @Deprecated("Deprecated in Java") override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { R.id.action_reconfigure -> { findNavController().navigate(configManager.configDestination) diff --git a/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt b/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt index 4f98847..07b7415 100644 --- a/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt +++ b/cashier/src/main/java/net/taler/cashier/withdraw/ErrorFragment.kt @@ -22,7 +22,6 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import androidx.lifecycle.Observer import androidx.navigation.fragment.findNavController import net.taler.cashier.MainViewModel import net.taler.cashier.R @@ -37,22 +36,22 @@ class ErrorFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { ui = FragmentErrorBinding.inflate(inflater, container, false) return ui.root } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - withdrawManager.withdrawStatus.observe(viewLifecycleOwner, Observer { status -> - if (status == null) return@Observer + withdrawManager.withdrawStatus.observe(viewLifecycleOwner) { status -> + if (status == null) return@observe if (status is WithdrawStatus.Aborted) { ui.textView.setText(R.string.transaction_aborted) } else if (status is WithdrawStatus.Error) { ui.textView.text = status.msg } withdrawManager.completeTransaction() - }) + } ui.backButton.setOnClickListener { findNavController().popBackStack() } diff --git a/merchant-lib/build.gradle b/merchant-lib/build.gradle index 42dc3ec..ae7489b 100644 --- a/merchant-lib/build.gradle +++ b/merchant-lib/build.gradle @@ -63,7 +63,7 @@ dependencies { testImplementation "junit:junit:$junit_version" testImplementation "io.ktor:ktor-client-mock-jvm:$ktor_version" - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1' + testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt index b5b7be7..5564447 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt @@ -22,7 +22,6 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import androidx.lifecycle.Observer import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_SHORT import com.google.android.material.snackbar.Snackbar import net.taler.common.navigate @@ -46,18 +45,19 @@ class ConfigFetcherFragment : Fragment() { return ui.root } + @Deprecated("Deprecated in Java") override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) configManager.fetchConfig(configManager.config, false) - configManager.configUpdateResult.observe(viewLifecycleOwner, Observer { result -> + configManager.configUpdateResult.observe(viewLifecycleOwner) { result -> when (result) { - null -> return@Observer + null -> return@observe is ConfigUpdateResult.Error -> onNetworkError(result.msg) is ConfigUpdateResult.Success -> { navigate(actionConfigFetcherToOrder()) } } - }) + } } private fun onNetworkError(msg: String) { diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderFragment.kt index 25a1874..0de5939 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderFragment.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderFragment.kt @@ -50,9 +50,10 @@ class OrderFragment : Fragment() { return ui.root } + @Deprecated("Deprecated in Java") override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) - orderManager.currentOrderId.observe(viewLifecycleOwner, { orderId -> + orderManager.currentOrderId.observe(viewLifecycleOwner) { orderId -> val liveOrder = orderManager.getOrder(orderId) onOrderSwitched(orderId, liveOrder) // add a new OrderStateFragment for each order @@ -60,7 +61,7 @@ class OrderFragment : Fragment() { childFragmentManager.beginTransaction() .replace(R.id.fragment1, OrderStateFragment()) .commit() - }) + } } override fun onStart() { diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentSuccessFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentSuccessFragment.kt index 5b95dea..c2635c7 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentSuccessFragment.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentSuccessFragment.kt @@ -31,11 +31,12 @@ class PaymentSuccessFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View { ui = FragmentPaymentSuccessBinding.inflate(inflater, container, false) return ui.root } + @Deprecated("Deprecated in Java") override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) ui.paymentButton.setOnClickListener { diff --git a/taler-kotlin-android/build.gradle b/taler-kotlin-android/build.gradle index bbdcd92..bb68992 100644 --- a/taler-kotlin-android/build.gradle +++ b/taler-kotlin-android/build.gradle @@ -57,8 +57,8 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'androidx.core:core-ktx:1.8.0' implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" // Navigation diff --git a/wallet/build.gradle b/wallet/build.gradle index 33d6124..0f7dbac 100644 --- a/wallet/build.gradle +++ b/wallet/build.gradle @@ -91,7 +91,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion compose_version + kotlinCompilerExtensionVersion "1.3.0" } buildFeatures { @@ -128,13 +128,13 @@ dependencies { implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" // Compose - implementation 'androidx.activity:activity-compose:1.4.0' + implementation 'androidx.activity:activity-compose:1.5.1' implementation "androidx.compose.material:material:$compose_version" implementation "androidx.compose.animation:animation:$compose_version" implementation "androidx.compose.ui:ui-tooling:$compose_version" implementation "androidx.compose.material:material-icons-extended:$compose_version" implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version" - implementation 'com.google.android.material:compose-theme-adapter:1.1.13' + implementation 'com.google.android.material:compose-theme-adapter:1.1.16' // Lists and Selection implementation "androidx.recyclerview:recyclerview:1.2.1" 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 d5c3eaf..7ed1bab 100644 --- a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt @@ -82,6 +82,7 @@ class PromptPaymentFragment : Fragment(), ProductImageClickListener { private fun onPaymentStatusChanged(payStatus: PayStatus?) { when (payStatus) { + null -> {} is PayStatus.Prepared -> { showLoading(false) val fees = payStatus.amountEffective - payStatus.amountRaw diff --git a/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt b/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt index e3b5dc2..6bfcf90 100644 --- a/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt @@ -62,7 +62,7 @@ class PendingOperationsFragment : Fragment(), PendingOperationClickListener { inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View { ui = FragmentPendingOperationsBinding.inflate(inflater, container, false) return ui.root } @@ -79,9 +79,9 @@ class PendingOperationsFragment : Fragment(), PendingOperationClickListener { addItemDecoration(myItemDecoration) } - pendingOperationsManager.pendingOperations.observe(viewLifecycleOwner, { + pendingOperationsManager.pendingOperations.observe(viewLifecycleOwner) { updatePending(it) - }) + } } override fun onStart() { @@ -89,6 +89,7 @@ class PendingOperationsFragment : Fragment(), PendingOperationClickListener { pendingOperationsManager.getPending() } + @Deprecated("Deprecated in Java") override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.retry_pending -> { @@ -99,6 +100,7 @@ class PendingOperationsFragment : Fragment(), PendingOperationClickListener { } } + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.pending_operations, menu) super.onCreateOptionsMenu(menu, inflater) diff --git a/wallet/src/main/java/net/taler/wallet/tip/PromptTipFragment.kt b/wallet/src/main/java/net/taler/wallet/tip/PromptTipFragment.kt index a5c504c..6a96d1d 100644 --- a/wallet/src/main/java/net/taler/wallet/tip/PromptTipFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/tip/PromptTipFragment.kt @@ -16,28 +16,22 @@ package net.taler.wallet.tip -import android.graphics.Bitmap import android.os.Bundle import android.view.LayoutInflater import android.view.View -import android.view.View.GONE import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.navigation.fragment.findNavController -import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar.LENGTH_LONG import net.taler.common.Amount -import net.taler.common.ContractTerms import net.taler.common.fadeIn import net.taler.common.fadeOut import net.taler.wallet.MainViewModel import net.taler.wallet.R import net.taler.wallet.cleanExchange -import net.taler.wallet.databinding.FragmentPromptPaymentBinding import net.taler.wallet.databinding.FragmentPromptTipBinding -import net.taler.wallet.withdraw.ExchangeSelection /** * Show a tip and ask the user to accept/decline. @@ -81,9 +75,15 @@ class PromptTipFragment : Fragment() { private fun onPaymentStatusChanged(payStatus: TipStatus?) { when (payStatus) { + null -> {} is TipStatus.Prepared -> { showLoading(false) - showContent(payStatus.tipAmountRaw, payStatus.tipAmountEffective, payStatus.exchangeBaseUrl, payStatus.merchantBaseUrl) + showContent( + amountRaw = payStatus.tipAmountRaw, + amountEffective = payStatus.tipAmountEffective, + exchange = payStatus.exchangeBaseUrl, + merchant = payStatus.merchantBaseUrl + ) //showOrder(payStatus.contractTerms, payStatus.amountRaw, fees) ui.confirmWithdrawButton.isEnabled = true ui.confirmWithdrawButton.setOnClickListener { diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt index f21818f..07b95af 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt @@ -44,6 +44,7 @@ abstract class TransactionDetailFragment : Fragment() { setHasOptionsMenu(model.devMode.value == true) } + @Deprecated("Deprecated in Java") override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) requireActivity().apply { @@ -53,10 +54,12 @@ abstract class TransactionDetailFragment : Fragment() { } } + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.transactions_detail, menu) } + @Deprecated("Deprecated in Java") override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { else -> super.onOptionsItemSelected(item) diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt index da8508a..dd0af84 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt @@ -130,6 +130,7 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode. tracker?.onSaveInstanceState(outState) } + @Deprecated("Deprecated in Java") override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.transactions, menu) setupSearch(menu.findItem(R.id.action_search)) diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt index e3c5da6..7bf2e29 100644 --- a/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt @@ -22,7 +22,6 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import androidx.lifecycle.Observer import androidx.navigation.fragment.findNavController import io.noties.markwon.Markwon import net.taler.common.fadeIn @@ -44,8 +43,8 @@ class ReviewExchangeTosFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { + savedInstanceState: Bundle?, + ): View { ui = FragmentReviewExchangeTosBinding.inflate(inflater, container, false) return ui.root } @@ -56,7 +55,7 @@ class ReviewExchangeTosFragment : Fragment() { ui.acceptTosCheckBox.setOnCheckedChangeListener { _, _ -> withdrawManager.acceptCurrentTermsOfService() } - withdrawManager.withdrawStatus.observe(viewLifecycleOwner, Observer { + withdrawManager.withdrawStatus.observe(viewLifecycleOwner) { when (it) { is WithdrawStatus.TosReviewRequired -> { val sections = try { @@ -65,7 +64,7 @@ class ReviewExchangeTosFragment : Fragment() { parseTos(markwon, text) } catch (e: ParseException) { onTosError(e.message ?: "Unknown Error") - return@Observer + return@observe } adapter.setSections(sections) ui.tosList.adapter = adapter @@ -80,8 +79,9 @@ class ReviewExchangeTosFragment : Fragment() { is WithdrawStatus.ReceivedDetails -> { findNavController().navigate(R.id.action_reviewExchangeTOS_to_promptWithdraw) } + else -> {} } - }) + } } private fun onTosError(msg: String) { -- cgit v1.2.3