10
0

[MWA-5265] Meta Demo: Theming via xml

{CR fixes}
This commit is contained in:
andre 2025-11-21 11:36:06 +01:00
parent 74845b8cb1
commit ac84869d1e
10 changed files with 121 additions and 213 deletions

View File

@ -1,56 +0,0 @@
apply plugin: "maven-publish"
configurations.maybeCreate("default")
def publishArtifact = artifacts.add("default", file('src/lib/ahoysdk.aar'))
// set maven repository URL
ext.isSnapshot = ahoy_library_versionName.endsWith("-SNAPSHOT")
def mavenUrl = isSnapshot ? ahoy_publish_snapshotRepositoryUrl : ahoy_publish_releaseRepositoryUrl
if (ahoy_publish_toBuildDir.toBoolean()) {
mavenUrl = "file://$buildDir/repos/" + isSnapshot ? 'snapshots' : 'releases'
}
publishing {
publications {
aar(MavenPublication) {
groupId = ahoy_library_groupId
artifactId = ahoy_library_artifactId
version = ahoy_library_versionName
artifact publishArtifact
pom.withXml {
// 2. add dependencies
def dependenciesNode = asNode().appendNode('dependencies')
def node = dependenciesNode.appendNode('dependency')
node.appendNode('groupId', 'org.java-websocket')
node.appendNode('artifactId', 'Java-WebSocket')
node.appendNode('version', '1.5.7')
node.appendNode('scope', 'compile')
// 3. configure pom.xml extra information
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name ahoy_library_name
url ahoy_library_url
description ahoy_library_description
}
}
}
}
// Config maven repository
repositories {
maven {
url mavenUrl
credentials {
username = ahoy_publish_username
password = ahoy_publish_password
}
}
}
}
repositories {
google()
mavenCentral()
}

View File

@ -1,19 +0,0 @@
ahoy_library_name = Ahoy's native android SDK
ahoy_library_description = Ahoy's mobile app SDK for android.
ahoy_library_url = https://ahoyrtc.com/
ahoy_library_groupId = com.ahoyrtc
ahoy_library_artifactId= sdk
ahoy_library_versionName = 1.47
# url including scheme, host and port
ahoy_publish_toBuildDir = false
ahoy_publish_snapshotRepositoryUrl=https://api.webid-solutions.de/releases/android/maven/repository/snapshots
ahoy_publish_releaseRepositoryUrl=https://api.webid-solutions.de/releases/android/maven/repository/internal
# Do not put real credentials here!
# Instead, copy to ~/.gradle/gradle.properties and set the values there.
ahoy_publish_username =
ahoy_publish_password =

View File

@ -1 +0,0 @@

Binary file not shown.

View File

@ -56,7 +56,6 @@ dependencies {
implementation 'androidx.core:core-ktx:1.12.0' implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.compose.material3:material3:1.4.0'
implementation 'androidx.compose.foundation:foundation-layout:1.9.4' implementation 'androidx.compose.foundation:foundation-layout:1.9.4'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.1.5'
@ -85,10 +84,9 @@ dependencies {
implementation("de.webid-solutions:android_document_scanner:20.3.0-SNAPSHOT") implementation("de.webid-solutions:android_document_scanner:20.3.0-SNAPSHOT")
api("de.webid-solutions:android_ui_components:20.3.+") {
def composeBom = platform('androidx.compose:compose-bom:2025.11.00') changing = true
implementation composeBom }
androidTestImplementation composeBom
// Compose Core Dependencies // Compose Core Dependencies
implementation 'androidx.compose.ui:ui' implementation 'androidx.compose.ui:ui'

View File

@ -11,16 +11,17 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.result.ActivityResult import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import de.webidsolutions.android_ui_components.theming.v4.WebIdThemeProviderV4
import de.webidsolutions.auto_ident_product_plugin.AutoIdProductPlugin import de.webidsolutions.auto_ident_product_plugin.AutoIdProductPlugin
import de.webidsolutions.eid_product_plugin.EIdProductPlugin import de.webidsolutions.eid_product_plugin.EIdProductPlugin
import de.webidsolutions.meta_plugin.EMetaPluginFailReason import de.webidsolutions.meta_plugin.EMetaPluginFailReason
import de.webidsolutions.meta_plugin.WebIdMetaPlugin import de.webidsolutions.meta_plugin.WebIdMetaPlugin
import de.webidsolutions.metaplugindemo.scenes.MetaPluginDemoScreen import de.webidsolutions.metaplugindemo.scenes.MetaPluginDemoScene
import de.webidsolutions.metaplugindemo.scenes.ThemingChoice import de.webidsolutions.metaplugindemo.scenes.ThemingChoice
import de.webidsolutions.metaplugindemo.scenes.UserConfiguration
import de.webidsolutions.metaplugindemo.tasks.EApiResult import de.webidsolutions.metaplugindemo.tasks.EApiResult
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
import de.webidsolutions.mobile_app.sdk.WebIdMobileAppSdkException import de.webidsolutions.mobile_app.sdk.WebIdMobileAppSdkException
@ -61,7 +62,7 @@ private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
internal class MainActivity : ComponentActivity internal class MainActivity : ComponentActivity
() { () {
private var logText by mutableStateOf("") private var result by mutableStateOf("")
// private lateinit var coreSdk: IWebIdMobileAppSdk // private lateinit var coreSdk: IWebIdMobileAppSdk
@ -69,21 +70,19 @@ internal class MainActivity : ComponentActivity
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContent { setContent {
MaterialTheme { WebIdThemeProviderV4{
MetaPluginDemoScreen( MetaPluginDemoScene(
logText = logText, result = result,
onStartClicked = { useAutoIdent, usePayOnServer, useEidOnServer, useVideo, themingChoice -> onStartClicked = { userConfiguration ->
clearLog() clearLog()
writeLog(getString(R.string.starting)) writeLog(getString(R.string.starting))
createCoreSdk( createCoreSdk(
useAutoIdent = useAutoIdent, userConfiguration = userConfiguration
usePayOnServer = usePayOnServer,
useEidOnServer = useEidOnServer,
useVideo = useVideo,
themingChoice = themingChoice
) )
} }
) )
} }
} }
@ -95,11 +94,7 @@ internal class MainActivity : ComponentActivity
* Creates the Core SDK from the existing credentials. * Creates the Core SDK from the existing credentials.
*/ */
private fun createCoreSdk( private fun createCoreSdk(
useAutoIdent: Boolean, userConfiguration: UserConfiguration
usePayOnServer: Boolean,
useEidOnServer: Boolean,
useVideo: Boolean,
themingChoice: ThemingChoice
) { ) {
writeLog(getString(R.string.creating_core_sdk)) writeLog(getString(R.string.creating_core_sdk))
@ -118,10 +113,10 @@ internal class MainActivity : ComponentActivity
validateActionId() validateActionId()
val selectProductPlugins = getSelectedPlugins( val selectProductPlugins = getSelectedPlugins(
useAutoIdent = useAutoIdent, useAutoIdent = userConfiguration.useAutoIdent,
usePayOnServer = usePayOnServer, usePayOnServer = userConfiguration.useAcountId,
useEidOnServer = useEidOnServer, useEidOnServer = userConfiguration.useEId,
useVideo = useVideo useVideo = userConfiguration.useVideoIdent
) )
val metaPlugin = WebIdMetaPlugin( val metaPlugin = WebIdMetaPlugin(
@ -135,7 +130,7 @@ internal class MainActivity : ComponentActivity
.setOnPostExecuteCallback( .setOnPostExecuteCallback(
metaPluginVerifyCallback( metaPluginVerifyCallback(
metaPlugin = metaPlugin, metaPlugin = metaPlugin,
themingChoice = themingChoice themingChoice = userConfiguration.themingChoice
) )
) )
.execute(actionId) .execute(actionId)
@ -171,7 +166,7 @@ internal class MainActivity : ComponentActivity
): ArrayList<IProductPluginWebId> { ): ArrayList<IProductPluginWebId> {
return ArrayList( return ArrayList(
listOfNotNull( listOfNotNull(
if (useAutoIdent) AutoIdProductPlugin() else null, if (useAutoIdent) AutoIdProductPlugin() else null,
if (usePayOnServer) AccountIdProductPlugin() else null, if (usePayOnServer) AccountIdProductPlugin() else null,
if (useEidOnServer) EIdProductPlugin() else null, if (useEidOnServer) EIdProductPlugin() else null,
if (useVideo) VideoIdProductPlugin(config) else null, if (useVideo) VideoIdProductPlugin(config) else null,
@ -179,8 +174,9 @@ internal class MainActivity : ComponentActivity
) )
} }
private fun metaPluginVerifyCallback(metaPlugin: WebIdMetaPlugin, private fun metaPluginVerifyCallback(
themingChoice: ThemingChoice metaPlugin: WebIdMetaPlugin,
themingChoice: ThemingChoice
): (AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>) -> Unit { ): (AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>) -> Unit {
return { result -> return { result ->
@ -196,12 +192,12 @@ internal class MainActivity : ComponentActivity
} }
ThemingChoice.COMPOSE -> { ThemingChoice.COMPOSE -> {
metaPlugin.startPlugin( metaPlugin.startPlugin(
this, this,
activityResultLauncher, activityResultLauncher,
null, null,
null null
) )
} }
} }
} catch (e: WebIdMobileAppSdkException) { } catch (e: WebIdMobileAppSdkException) {
@ -284,14 +280,14 @@ internal class MainActivity : ComponentActivity
*/ */
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun writeLog(entry: String) { private fun writeLog(entry: String) {
logText += "$entry\n" result += "$entry\n"
} }
/** /**
* Resets the text log of this activity. * Resets the text log of this activity.
*/ */
private fun clearLog() { private fun clearLog() {
logText = "" result = ""
} }
} }

View File

@ -1,52 +1,39 @@
/*
* Created by WebID Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.scenes package de.webidsolutions.metaplugindemo.scenes
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import de.webidsolutions.android_ui_components.theming.v4.SpacingV4
import de.webidsolutions.android_ui_components.theming.v4.WebIdThemeProviderV4
import de.webidsolutions.android_ui_components.theming.v4.components.checkbox.CheckboxV4
import de.webidsolutions.android_ui_components.theming.v4.components.primary_button.PrimaryButtonV4
import de.webidsolutions.android_ui_components.theming.v4.components.surface.Surface
import de.webidsolutions.android_ui_components.theming.v4.components.text.TextV4
import de.webidsolutions.metaplugindemo.R import de.webidsolutions.metaplugindemo.R
enum class ThemingChoice() {
COMPOSE,
XML
}
@Composable @Composable
fun MetaPluginDemoScreen( fun MetaPluginDemoScene(
logText: String, result: String,
onStartClicked: ( onStartClicked: (
useAutoIdent: Boolean, UserConfiguration
usePayOnServer: Boolean,
useEidOnServer: Boolean,
useVideo: Boolean,
themingChoice: ThemingChoice
) -> Unit ) -> Unit
) { ) {
var useAutoIdent by remember { mutableStateOf(false) } var useAutoIdent by remember { mutableStateOf(false) }
@ -58,16 +45,19 @@ fun MetaPluginDemoScreen(
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(start = 10.dp, top = 10.dp, end = 10.dp) .padding(
start = SpacingV4.S.size,
top = SpacingV4.N.size,
end = SpacingV4.N.size
)
.systemBarsPadding() .systemBarsPadding()
) { ) {
Text( TextV4(
text = stringResource(R.string.choose_plugins), text = stringResource(R.string.choose_plugins),
style = MaterialTheme.typography.headlineSmall, modifier = Modifier.padding(start = SpacingV4.N.size)
modifier = Modifier.padding(start = 10.dp)
) )
Spacer(modifier = Modifier.height(10.dp)) SpacingV4.S.VSpacer()
Column { Column {
CheckboxWithLabel( CheckboxWithLabel(
@ -95,15 +85,14 @@ fun MetaPluginDemoScreen(
) )
} }
Spacer(modifier = Modifier.height(10.dp)) SpacingV4.L.VSpacer()
Text( TextV4(
text = stringResource(R.string.choose_theming), text = stringResource(R.string.choose_theming),
style = MaterialTheme.typography.headlineSmall, modifier = Modifier.padding(start = SpacingV4.N.size)
modifier = Modifier.padding(start = 10.dp)
) )
Spacer(modifier = Modifier.height(10.dp)) SpacingV4.S.VSpacer()
Column { Column {
CheckboxWithLabel( CheckboxWithLabel(
@ -113,7 +102,7 @@ fun MetaPluginDemoScreen(
useXmlTheming = ThemingChoice.COMPOSE useXmlTheming = ThemingChoice.COMPOSE
} }
}, },
label = "Standard Theme" label = "Theming with Compose"
) )
CheckboxWithLabel( CheckboxWithLabel(
@ -123,72 +112,60 @@ fun MetaPluginDemoScreen(
useXmlTheming = ThemingChoice.XML useXmlTheming = ThemingChoice.XML
} }
}, },
label = "Custom Theme (XML)" label = "Theming with XML"
) )
} }
Spacer(modifier = Modifier.height(10.dp)) SpacingV4.L.VSpacer()
Text( TextV4(
text = stringResource(R.string.log_headline), text = stringResource(R.string.log_headline),
style = MaterialTheme.typography.headlineSmall, modifier = Modifier.padding(start = SpacingV4.N.size)
modifier = Modifier.padding(start = 10.dp)
) )
Spacer(modifier = Modifier.height(10.dp)) SpacingV4.S.VSpacer()
Box( Box(
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 10.dp) .padding(horizontal = SpacingV4.N.size)
) { ) {
val scrollState = rememberScrollState() val scrollState = rememberScrollState()
LaunchedEffect(logText) { LaunchedEffect(result) {
scrollState.animateScrollTo(scrollState.maxValue) scrollState.animateScrollTo(scrollState.maxValue)
} }
Surface( Surface(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
shape = MaterialTheme.shapes.small
) { ) {
Text( TextV4(
text = logText.ifEmpty { stringResource(R.string.log_placeholder) }, text = result.ifEmpty { stringResource(R.string.log_placeholder) },
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.verticalScroll(scrollState) .verticalScroll(scrollState)
.padding(16.dp) .padding(SpacingV4.S.size),
.padding(bottom = 80.dp),
style = MaterialTheme.typography.bodyMedium
)
}
Button(
onClick = {
onStartClicked(
useAutoIdent,
usePayOnServer,
useEidOnServer,
useVideo,
useXmlTheming
)
},
modifier = Modifier
.align(Alignment.BottomCenter)
.fillMaxWidth()
.height(60.dp),
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF05B1FB)
)
) {
Text(
text = stringResource(R.string.start_button),
color = Color.White
) )
} }
} }
SpacingV4.M.VSpacer()
PrimaryButtonV4(
onClick = {
onStartClicked(
UserConfiguration(
useAutoIdent = useAutoIdent,
useAcountId = usePayOnServer,
useEId = useEidOnServer,
useVideoIdent = useVideo,
themingChoice = useXmlTheming
)
)
},
title = stringResource(R.string.start_button),
)
} }
} }
@ -198,38 +175,33 @@ private fun CheckboxWithLabel(
onCheckedChange: (Boolean) -> Unit, onCheckedChange: (Boolean) -> Unit,
label: String label: String
) { ) {
Row( CheckboxV4(
verticalAlignment = Alignment.CenterVertically, checked = checked,
) { isRequired = false,
Checkbox( onCheckedChange = onCheckedChange,
checked = checked, text = label,
onCheckedChange = onCheckedChange, modifier = Modifier.padding(start = SpacingV4.N.size)
colors = CheckboxDefaults.colors( )
checkedColor = Color(0xFF05B1FB),
checkmarkColor = Color.White
)
)
Spacer(modifier = Modifier.width(2.dp)) SpacingV4.XXS.VSpacer()
Text(text = label)
}
} }
@Preview( @Preview(
name = "MetaPluginDemoScreen - Long Log", name = "MetaPluginDemoScreen - Long Log",
showBackground = true, showBackground = true,
showSystemUi = true showSystemUi = true
) )
@Composable @Composable
private fun MetaPluginDemoScreenLongLogPreview() { private fun MetaPluginDemoSceneLongLogPreview() {
MaterialTheme { WebIdThemeProviderV4 {
MetaPluginDemoScreen( MetaPluginDemoScene(
logText = buildString { result = buildString {
repeat(20) { index -> appendLine("Log entry: Processing...")
appendLine("Log entry ${index + 1}: Processing...")
}
}, },
onStartClicked = { _, _, _, _, _ -> } onStartClicked = {}
) )
} }
} }

View File

@ -0,0 +1,10 @@
/*
* Created by WebID Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.scenes
enum class ThemingChoice() {
COMPOSE,
XML
}

View File

@ -0,0 +1,9 @@
package de.webidsolutions.metaplugindemo.scenes
data class UserConfiguration(
val useAutoIdent: Boolean,
val useAcountId: Boolean,
val useEId: Boolean,
val useVideoIdent: Boolean,
val themingChoice: ThemingChoice
)

View File

@ -16,5 +16,4 @@
<item name="backgroundSecondary">#FFFFFF</item> <item name="backgroundSecondary">#FFFFFF</item>
</style> </style>
</resources> </resources>