[#851] Androidx Updates

Note that the APIs for Room, Sqlite, and Compose changed slightly with these dependency updates
This commit is contained in:
Carter Jernigan 2023-01-18 06:26:12 -05:00 committed by Carter Jernigan
parent 6e89805ee1
commit 30979e5ebf
7 changed files with 51 additions and 45 deletions

View File

@ -7,7 +7,6 @@ import androidx.activity.viewModels
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cash.z.ecc.android.sdk.demoapp.ui.common.BindCompLocalProvider
import cash.z.ecc.android.sdk.demoapp.ui.screen.home.viewmodel.SecretState
@ -33,7 +32,6 @@ class ComposeActivity : ComponentActivity() {
}
}
@OptIn(ExperimentalLifecycleComposeApi::class)
@Composable
private fun MainContent() {
when (walletViewModel.secretState.collectAsStateWithLifecycle().value) {

View File

@ -11,7 +11,6 @@ import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import androidx.navigation.NavOptionsBuilder
@ -33,7 +32,6 @@ import cash.z.ecc.android.sdk.model.ZcashNetwork
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
@OptIn(ExperimentalLifecycleComposeApi::class)
@Composable
@Suppress("LongMethod")
internal fun ComposeActivity.Navigation() {

View File

@ -4,7 +4,9 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import cash.z.ecc.android.bip39.Mnemonics
import cash.z.ecc.android.bip39.toSeed
import cash.z.ecc.android.sdk.demoapp.BaseDemoFragment
@ -42,22 +44,24 @@ class GetPrivateKeyFragment : BaseDemoFragment<FragmentGetPrivateKeyBinding>() {
private fun displayKeys() {
// derive the keys from the seed:
// demonstrate deriving spending keys for five accounts but only take the first one
lifecycleScope.launchWhenStarted {
@Suppress("MagicNumber")
val spendingKey = DerivationTool.deriveUnifiedSpendingKey(
seed,
ZcashNetwork.fromResources(requireApplicationContext()),
Account(5)
)
lifecycleScope.launch {
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
@Suppress("MagicNumber")
val spendingKey = DerivationTool.deriveUnifiedSpendingKey(
seed,
ZcashNetwork.fromResources(requireApplicationContext()),
Account(5)
)
// derive the key that allows you to view but not spend transactions
val viewingKey = DerivationTool.deriveUnifiedFullViewingKey(
spendingKey,
ZcashNetwork.fromResources(requireApplicationContext())
)
// derive the key that allows you to view but not spend transactions
val viewingKey = DerivationTool.deriveUnifiedFullViewingKey(
spendingKey,
ZcashNetwork.fromResources(requireApplicationContext())
)
// display the keys in the UI
binding.textInfo.setText("Spending Key:\n$spendingKey\n\nViewing Key:\n$viewingKey")
// display the keys in the UI
binding.textInfo.setText("Spending Key:\n$spendingKey\n\nViewing Key:\n$viewingKey")
}
}
}
@ -75,8 +79,8 @@ class GetPrivateKeyFragment : BaseDemoFragment<FragmentGetPrivateKeyBinding>() {
return view
}
override fun onResume() {
super.onResume()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
displayKeys()
}

View File

@ -88,29 +88,31 @@ RUST_GRADLE_PLUGIN_VERSION=0.9.3
ANDROIDX_ACTIVITY_VERSION=1.6.1
ANDROIDX_ANNOTATION_VERSION=1.5.0
ANDROIDX_APPCOMPAT_VERSION=1.5.1
ANDROIDX_COMPOSE_COMPILER_VERSION=1.4.0-alpha02
ANDROIDX_COMPOSE_MATERIAL3_VERSION=1.1.0-alpha02
ANDROIDX_COMPOSE_VERSION=1.3.1
ANDROIDX_APPCOMPAT_VERSION=1.6.0
ANDROIDX_COMPOSE_COMPILER_VERSION=1.4.0
ANDROIDX_COMPOSE_MATERIAL3_VERSION=1.1.0-alpha04
ANDROIDX_COMPOSE_VERSION=1.3.3
ANDROIDX_COMPOSE_MATERIAL_ICONS_VERSION=1.3.1
ANDROIDX_CONSTRAINT_LAYOUT_VERSION=2.1.4
ANDROIDX_CORE_VERSION=1.9.0
ANDROIDX_DATABASE_VERSION=2.2.0
ANDROIDX_ESPRESSO_VERSION=3.5.0
ANDROIDX_LIFECYCLE_VERSION=2.6.0-alpha03
ANDROIDX_DATABASE_VERSION=2.3.0
ANDROIDX_ESPRESSO_VERSION=3.5.1
ANDROIDX_LIFECYCLE_VERSION=2.6.0-alpha04
ANDROIDX_MULTIDEX_VERSION=2.0.1
ANDROIDX_NAVIGATION_VERSION=2.5.3
ANDROIDX_NAVIGATION_COMPOSE_VERSION=2.5.3
ANDROIDX_NAVIGATION_FRAGMENT_VERSION=2.4.2
ANDROIDX_PAGING_VERSION=2.1.2
ANDROIDX_PROFILE_INSTALLER_VERSION=1.3.0-alpha02
ANDROIDX_ROOM_VERSION=2.4.3
ANDROIDX_PROFILE_INSTALLER_VERSION=1.3.0-alpha03
ANDROIDX_ROOM_VERSION=2.5.0
ANDROIDX_SECURITY_CRYPTO_VERSION=1.1.0-alpha04
ANDROIDX_TEST_JUNIT_VERSION=1.1.4
ANDROIDX_TEST_MACROBENCHMARK_VERSION=1.2.0-alpha08
ANDROIDX_TEST_JUNIT_VERSION=1.1.5
ANDROIDX_TEST_MACROBENCHMARK_VERSION=1.2.0-alpha09
ANDROIDX_TEST_ORCHESTRATOR_VERSION=1.4.2
ANDROIDX_TEST_VERSION=1.5.0
ANDROIDX_TEST_CORE_VERSION=1.5.0
ANDROIDX_TEST_RUNNER_VERSION=1.5.0
ANDROIDX_TRACING_VERSION=1.2.0-alpha01
ANDROIDX_UI_AUTOMATOR_VERSION=2.3.0-alpha01
ANDROIDX_UI_AUTOMATOR_VERSION=2.3.0-alpha02
BIP39_VERSION=1.0.4
COROUTINES_OKHTTP=1.0
GOOGLE_MATERIAL_VERSION=1.7.0

View File

@ -392,7 +392,7 @@ internal class DatabaseCoordinator private constructor(context: Context) {
* @param databaseFile The database file.
* @return A {@code RoomDatabaseBuilder<T>} which you can use to create the database.
*/
internal fun <T : RoomDatabase?> commonDatabaseBuilder(
internal fun <T : RoomDatabase> commonDatabaseBuilder(
context: Context,
klass: Class<T>,
databaseFile: File

View File

@ -91,12 +91,14 @@ internal fun <T> SupportSQLiteDatabase.queryAndMap(
groupBy(groupBy)
orderBy(orderBy)
// Counterintuitive but correct. When using the comma syntax, offset comes first.
// When using the keyword syntax, "LIMIT 1 OFFSET 2" then the offset comes second.
if (null == offset) {
limit(limit)
} else {
limit(String.format(Locale.ROOT, "%s,%s", offset, limit)) // NON-NLS
if (null != limit) {
// Counterintuitive but correct. When using the comma syntax, offset comes first.
// When using the keyword syntax, "LIMIT 1 OFFSET 2" then the offset comes second.
if (null == offset) {
limit(limit)
} else {
limit(String.format(Locale.ROOT, "%s,%s", offset, limit)) // NON-NLS
}
}
}

View File

@ -70,6 +70,7 @@ dependencyResolutionManagement {
val androidxAppcompatVersion = extra["ANDROIDX_APPCOMPAT_VERSION"].toString()
val androidxComposeCompilerVersion = extra["ANDROIDX_COMPOSE_COMPILER_VERSION"].toString()
val androidxComposeMaterial3Version = extra["ANDROIDX_COMPOSE_MATERIAL3_VERSION"].toString()
val androidxComposeMaterialIconsVersion = extra["ANDROIDX_COMPOSE_MATERIAL_ICONS_VERSION"].toString()
val androidxComposeVersion = extra["ANDROIDX_COMPOSE_VERSION"].toString()
val androidxConstraintLayoutVersion = extra["ANDROIDX_CONSTRAINT_LAYOUT_VERSION"].toString()
val androidxCoreVersion = extra["ANDROIDX_CORE_VERSION"].toString()
@ -87,7 +88,8 @@ dependencyResolutionManagement {
val androidxTestJunitVersion = extra["ANDROIDX_TEST_JUNIT_VERSION"].toString()
val androidxTestMacrobenchmarkVersion = extra["ANDROIDX_TEST_MACROBENCHMARK_VERSION"].toString()
val androidxTestOrchestratorVersion = extra["ANDROIDX_TEST_ORCHESTRATOR_VERSION"].toString()
val androidxTestVersion = extra["ANDROIDX_TEST_VERSION"].toString()
val androidxTestCoreVersion = extra["ANDROIDX_TEST_CORE_VERSION"].toString()
val androidxTestRunnerVersion = extra["ANDROIDX_TEST_RUNNER_VERSION"].toString()
val androidxTracingVersion = extra["ANDROIDX_TRACING_VERSION"].toString()
val androidxUiAutomatorVersion = extra["ANDROIDX_UI_AUTOMATOR_VERSION"].toString()
val bip39Version = extra["BIP39_VERSION"].toString()
@ -165,8 +167,8 @@ dependencyResolutionManagement {
// Demo app
library("androidx-compose-foundation", "androidx.compose.foundation:foundation:$androidxComposeVersion")
library("androidx-compose-material3", "androidx.compose.material3:material3:$androidxComposeMaterial3Version")
library("androidx-compose-material-icons-core", "androidx.compose.material:material-icons-core:$androidxComposeVersion")
library("androidx-compose-material-icons-extended", "androidx.compose.material:material-icons-extended:$androidxComposeVersion")
library("androidx-compose-material-icons-core", "androidx.compose.material:material-icons-core:$androidxComposeMaterialIconsVersion")
library("androidx-compose-material-icons-extended", "androidx.compose.material:material-icons-extended:$androidxComposeMaterialIconsVersion")
library("androidx-compose-tooling", "androidx.compose.ui:ui-tooling:$androidxComposeVersion")
library("androidx-compose-ui", "androidx.compose.ui:ui:$androidxComposeVersion")
library("androidx-compose-ui-fonts", "androidx.compose.ui:ui-text-google-fonts:$androidxComposeVersion")
@ -179,10 +181,10 @@ dependencyResolutionManagement {
library("androidx-espresso-contrib", "androidx.test.espresso:espresso-contrib:$androidxEspressoVersion")
library("androidx-espresso-core", "androidx.test.espresso:espresso-core:$androidxEspressoVersion")
library("androidx-espresso-intents", "androidx.test.espresso:espresso-intents:$androidxEspressoVersion")
library("androidx-test-core", "androidx.test:core:$androidxTestVersion")
library("androidx-test-core", "androidx.test:core:$androidxTestCoreVersion")
library("androidx-test-junit", "androidx.test.ext:junit:$androidxTestJunitVersion")
library("androidx-test-macrobenchmark", "androidx.benchmark:benchmark-macro-junit4:$androidxTestMacrobenchmarkVersion")
library("androidx-test-runner", "androidx.test:runner:$androidxTestVersion")
library("androidx-test-runner", "androidx.test:runner:$androidxTestRunnerVersion")
library("androidx-test-orchestrator", "androidx.test:orchestrator:$androidxTestOrchestratorVersion")
library("androidx-tracing", "androidx.tracing:tracing:$androidxTracingVersion")
library("androidx-uiAutomator", "androidx.test.uiautomator:uiautomator:$androidxUiAutomatorVersion")