diff options
Diffstat (limited to 'wallet/src/main')
9 files changed, 16 insertions, 33 deletions
diff --git a/wallet/src/main/AndroidManifest.xml b/wallet/src/main/AndroidManifest.xml index e2a79da..b011583 100644 --- a/wallet/src/main/AndroidManifest.xml +++ b/wallet/src/main/AndroidManifest.xml @@ -32,14 +32,15 @@ <application android:allowBackup="true" + android:extractNativeLibs="true" android:fullBackupContent="@xml/backup_descriptor" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" - android:extractNativeLibs="true" - tools:ignore="GoogleAppIndexingWarning"> + tools:ignore="GoogleAppIndexingWarning" + tools:targetApi="m"> <activity android:name=".MainActivity" diff --git a/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt b/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt index d17977b..f4a5f23 100644 --- a/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt @@ -26,6 +26,7 @@ import android.view.View import android.view.ViewGroup import android.widget.Toast import android.widget.Toast.LENGTH_LONG +import androidx.core.content.getSystemService import androidx.fragment.app.Fragment import net.taler.wallet.databinding.FragmentUriInputBinding @@ -43,10 +44,10 @@ class UriInputFragment : Fragment() { } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - val clipboard = requireContext().getSystemService(ClipboardManager::class.java)!! + val clipboard = requireContext().getSystemService<ClipboardManager>() ui.pasteButton.setOnClickListener { - val item = clipboard.primaryClip?.getItemAt(0) + val item = clipboard?.primaryClip?.getItemAt(0) if (item?.text != null) { ui.uriView.setText(item.text) } else { diff --git a/wallet/src/main/java/net/taler/wallet/Utils.kt b/wallet/src/main/java/net/taler/wallet/Utils.kt index ea01552..388bf61 100644 --- a/wallet/src/main/java/net/taler/wallet/Utils.kt +++ b/wallet/src/main/java/net/taler/wallet/Utils.kt @@ -29,8 +29,8 @@ import android.os.Build.VERSION.SDK_INT import android.widget.Toast import android.widget.Toast.LENGTH_LONG import androidx.annotation.RequiresApi +import androidx.core.content.getSystemService import com.google.zxing.integration.android.IntentIntegrator -import org.json.JSONObject fun scanQrCode(activity: Activity) { IntentIntegrator(activity).apply { @@ -69,7 +69,7 @@ private fun connectToWifi29(context: Context, ssid: String) { @Suppress("DEPRECATION") private fun connectToWifiDeprecated(context: Context, ssid: String) { - context.getSystemService(WifiManager::class.java)?.apply { + context.getSystemService<WifiManager>()?.apply { if (!isWifiEnabled) { val enabledResult = setWifiEnabled(true) while (enabledResult && !isWifiEnabled) Thread.sleep(25) @@ -91,22 +91,6 @@ private fun connectToWifiDeprecated(context: Context, ssid: String) { } } -fun getErrorString(json: JSONObject): String { - return StringBuilder().apply { - append(json.getString("talerErrorCode")) - append(" ") - append(json.getString("message")) - json.optJSONObject("details")?.let { details -> - details.optJSONObject("errorResponse")?.let { errorResponse -> - append("\n\n") - append(errorResponse.optString("code")) - append(" ") - append(errorResponse.optString("hint")) - } - } - }.toString() -} - fun cleanExchange(exchange: String) = exchange.let { if (it.startsWith("https://")) it.substring(8) else it }.trimEnd('/') diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt index 936bbbd..5e492f5 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt @@ -25,6 +25,7 @@ import android.view.View.VISIBLE import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView +import androidx.core.content.ContextCompat.getColor import androidx.recyclerview.selection.ItemDetailsLookup import androidx.recyclerview.selection.ItemKeyProvider import androidx.recyclerview.selection.SelectionTracker @@ -80,13 +81,11 @@ internal class TransactionAdapter( private val amount: TextView = v.findViewById(R.id.amount) private val pendingView: TextView = v.findViewById(R.id.pendingView) - private val selectableForeground = v.foreground private val amountColor = amount.currentTextColor - private val red = context.getColor(R.color.red) - private val green = context.getColor(R.color.green) + private val red = getColor(context, R.color.red) + private val green = getColor(context, R.color.green) fun bind(transaction: Transaction, selected: Boolean) { - v.foreground = selectableForeground v.setOnClickListener { listener.onTransactionClicked(transaction) } v.isActivated = selected if (transaction.error == null) { diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt index 4b56dd0..f368c68 100644 --- a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt @@ -53,7 +53,7 @@ class ManualWithdrawFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { ui.qrCodeButton.setOnClickListener { scanQrCode(requireActivity()) } ui.currencyView.text = exchangeItem.currency - val paymentOptions = exchangeItem.paytoUris.mapNotNull {paytoUri -> + val paymentOptions = exchangeItem.paytoUris.mapNotNull { paytoUri -> Uri.parse(paytoUri).authority?.toUpperCase(Locale.getDefault()) }.joinToString(separator = "\n", prefix = "• ") ui.paymentOptionsLabel.text = diff --git a/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml b/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml index 5a1e82f..8fe3247 100644 --- a/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml +++ b/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml @@ -60,8 +60,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@drawable/ic_account_balance" - android:drawableTint="?attr/colorOnPrimarySurface" android:text="@string/withdraw_button_confirm_bank" + app:drawableTint="?attr/colorOnPrimarySurface" app:layout_constraintBottom_toTopOf="@+id/chosenAmountLabel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/wallet/src/main/res/layout/fragment_uri_input.xml b/wallet/src/main/res/layout/fragment_uri_input.xml index 60155e3..1e9934f 100644 --- a/wallet/src/main/res/layout/fragment_uri_input.xml +++ b/wallet/src/main/res/layout/fragment_uri_input.xml @@ -51,8 +51,8 @@ android:layout_marginEnd="16dp" android:layout_weight="1" android:drawableLeft="@drawable/ic_content_paste" - android:drawableTint="?attr/colorOnPrimarySurface" android:text="@string/paste" + app:drawableTint="?attr/colorOnPrimarySurface" app:layout_constraintEnd_toStartOf="@+id/okButton" app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintStart_toStartOf="parent" diff --git a/wallet/src/main/res/layout/list_item_exchange.xml b/wallet/src/main/res/layout/list_item_exchange.xml index c9d1df4..d81e759 100644 --- a/wallet/src/main/res/layout/list_item_exchange.xml +++ b/wallet/src/main/res/layout/list_item_exchange.xml @@ -19,8 +19,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/selectable_background" - android:foreground="?attr/selectableItemBackground" + android:background="?attr/selectableItemBackground" android:paddingTop="16dp" android:paddingBottom="16dp"> diff --git a/wallet/src/main/res/layout/list_item_transaction.xml b/wallet/src/main/res/layout/list_item_transaction.xml index 239e656..ed031c3 100644 --- a/wallet/src/main/res/layout/list_item_transaction.xml +++ b/wallet/src/main/res/layout/list_item_transaction.xml @@ -19,8 +19,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/selectable_background" - android:foreground="?attr/selectableItemBackground" + android:background="?attr/selectableItemBackground" android:paddingStart="16dp" android:paddingTop="8dp" android:paddingEnd="16dp" |