[MWA-5265] Meta Demo: Theming via xml
{updated dependencies}
[MWA-5265] Meta Demo: Theming via xml
{added Standart Theme}
[MWA-5265] Meta Demo: Theming via xml
{change theme colors}
c[MWA-5265] Meta Demo: Theming via xml
{Use RadioButton for theming choice}
[MWA-5265] Meta Demo: Theming via xml
{Update demo app UI and theming}
[MWA-5265] Meta Demo: Theming via xml testen
{added more colors}
[MWA-5265] Meta Demo: Theming via xml testen
{Update app theme to WebId.PluginTheme}
[MWA-5265] Meta Demo: Theming via xml testen
{addAdd Compose theming option to MetaPl}ugin
[MWA-5265] Meta Demo: Theming via xml testen
{Update dependencies and plugin initialization}
[MWA-5265] Meta Demo: Theming via xml testen
{Refactor UI to Jetpack Compose}
[MWA-5265] Meta Demo: Theming via xml testen
{added translations}
This commit is contained in:
parent
d9b2e9fbfd
commit
74845b8cb1
56
ahoy_rtc_sdk/build.gradle
Normal file
56
ahoy_rtc_sdk/build.gradle
Normal file
@ -0,0 +1,56 @@
|
||||
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()
|
||||
}
|
||||
19
ahoy_rtc_sdk/gradle.properties
Normal file
19
ahoy_rtc_sdk/gradle.properties
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
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 =
|
||||
1
ahoy_rtc_sdk/settings.gradle
Normal file
1
ahoy_rtc_sdk/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
|
||||
BIN
ahoy_rtc_sdk/src/lib/ahoysdk.aar
Normal file
BIN
ahoy_rtc_sdk/src/lib/ahoysdk.aar
Normal file
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'org.jetbrains.kotlin.plugin.compose' version '2.1.0'
|
||||
}
|
||||
|
||||
android {
|
||||
@ -55,6 +56,8 @@ dependencies {
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.compose.material3:material3:1.4.0'
|
||||
implementation 'androidx.compose.foundation:foundation-layout:1.9.4'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
@ -62,22 +65,38 @@ dependencies {
|
||||
// webid product-plugin
|
||||
//noinspection GradleDependency
|
||||
|
||||
def product_catalog_version = "15.1.1"
|
||||
def product_catalog_version = "21.1.2-SNAPSHOT"
|
||||
implementation ("de.webid-solutions:android_meta_plugin:$product_catalog_version") {
|
||||
changing = true
|
||||
}
|
||||
|
||||
implementation ("de.webid-solutions:android_auto_ident_on_server_product_plugin:$product_catalog_version") {
|
||||
implementation ("de.webid-solutions:android_auto_ident_product_plugin:$product_catalog_version") {
|
||||
changing = true
|
||||
}
|
||||
implementation ("de.webid-solutions:android_pay_on_server_product_plugin:$product_catalog_version") {
|
||||
implementation ("de.webid-solutions:android_pay_ident_product_plugin:$product_catalog_version") {
|
||||
changing = true
|
||||
}
|
||||
implementation ("de.webid-solutions:android_video_ident_product_plugin:$product_catalog_version") {
|
||||
changing = true
|
||||
}
|
||||
implementation ("de.webid-solutions:android_eid_on_server_product_plugin:$product_catalog_version") {
|
||||
implementation ("de.webid-solutions:android_eid_product_plugin:$product_catalog_version") {
|
||||
changing = true
|
||||
}
|
||||
|
||||
implementation("de.webid-solutions:android_document_scanner:20.3.0-SNAPSHOT")
|
||||
|
||||
|
||||
def composeBom = platform('androidx.compose:compose-bom:2025.11.00')
|
||||
implementation composeBom
|
||||
androidTestImplementation composeBom
|
||||
|
||||
// Compose Core Dependencies
|
||||
implementation 'androidx.compose.ui:ui'
|
||||
implementation 'androidx.compose.ui:ui-graphics'
|
||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||
implementation 'androidx.compose.material3:material3'
|
||||
implementation 'androidx.activity:activity-compose:1.9.3'
|
||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling'
|
||||
|
||||
}
|
||||
@ -9,7 +9,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:localeConfig="@xml/locales_config"
|
||||
android:theme="@style/Theme.MetaPluginDemo">
|
||||
android:theme="@style/WebId.PluginTheme">
|
||||
<activity
|
||||
android:name="de.webidsolutions.metaplugindemo.MainActivity"
|
||||
android:exported="true">
|
||||
|
||||
@ -7,23 +7,27 @@ package de.webidsolutions.metaplugindemo
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import android.widget.CheckBox
|
||||
import android.widget.TextView
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import de.webidsolutions.auto_ident_on_server_product_plugin.AutoIdentOnServerProductPlugin
|
||||
import de.webidsolutions.eid_on_server_product_plugin.EIdOnServerProductPlugin
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import de.webidsolutions.auto_ident_product_plugin.AutoIdProductPlugin
|
||||
import de.webidsolutions.eid_product_plugin.EIdProductPlugin
|
||||
import de.webidsolutions.meta_plugin.EMetaPluginFailReason
|
||||
import de.webidsolutions.meta_plugin.WebIdMetaPlugin
|
||||
import de.webidsolutions.metaplugindemo.scenes.MetaPluginDemoScreen
|
||||
import de.webidsolutions.metaplugindemo.scenes.ThemingChoice
|
||||
import de.webidsolutions.metaplugindemo.tasks.EApiResult
|
||||
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
|
||||
import de.webidsolutions.mobile_app.sdk.WebIdMobileAppSdkException
|
||||
import de.webidsolutions.mobile_app.sdk.WebIdSdkEnvironment
|
||||
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult
|
||||
import de.webidsolutions.mobile_app.sdk.impl.AsyncTaskResultGeneric
|
||||
import de.webidsolutions.pay_on_server_product_plugin.PayOnServerProductPlugin
|
||||
import de.webidsolutions.pay_ident_product_plugin.AccountIdProductPlugin
|
||||
import de.webidsolutions.plugin_core.EProductPluginErrors
|
||||
import de.webidsolutions.plugin_core.IEPluginError
|
||||
import de.webidsolutions.plugin_core.IProductPluginWebId
|
||||
@ -32,8 +36,8 @@ import de.webidsolutions.plugin_core.ProductPluginErrorResult
|
||||
import de.webidsolutions.plugin_core.ProductPluginResult
|
||||
import de.webidsolutions.plugin_core.WebIdPluginInterruptedException
|
||||
import de.webidsolutions.video_ident.plugin.videocall.VideoOptionsConfig
|
||||
import de.webidsolutions.video_ident_product_plugin.EVideoIdentProductPluginFailReasons
|
||||
import de.webidsolutions.video_ident_product_plugin.VideoIdentProductPlugin
|
||||
import de.webidsolutions.video_ident_product_plugin.VideoIdProductFailReason
|
||||
import de.webidsolutions.video_ident_product_plugin.VideoIdProductPlugin
|
||||
import java.lang.Integer.parseInt
|
||||
import java.net.URI
|
||||
|
||||
@ -45,7 +49,7 @@ private val config = VideoOptionsConfig(
|
||||
)
|
||||
|
||||
// TODO insert your Action id
|
||||
private const val actionId = "<9_digit_webid_transaction_id>"
|
||||
private const val actionId = "348758601"
|
||||
|
||||
// TODO choose your environment
|
||||
private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
|
||||
@ -54,34 +58,35 @@ private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
|
||||
/**
|
||||
* Demo App which starts the [MetaPlugin] and handles its result.
|
||||
*/
|
||||
internal class MainActivity : AppCompatActivity() {
|
||||
internal class MainActivity : ComponentActivity
|
||||
() {
|
||||
|
||||
private var logText by mutableStateOf("")
|
||||
|
||||
private lateinit var eidOnServerPluginCb: CheckBox
|
||||
private lateinit var payOnServerPluginCb: CheckBox
|
||||
private lateinit var autoIdOnServerPluginCb: CheckBox
|
||||
private lateinit var videoPluginCb: CheckBox
|
||||
private lateinit var textLog: TextView
|
||||
private lateinit var startButton: Button
|
||||
|
||||
// private lateinit var coreSdk: IWebIdMobileAppSdk
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
textLog = findViewById(R.id.log)
|
||||
|
||||
autoIdOnServerPluginCb = findViewById(R.id.cb_plugin_auto_id_on_server)
|
||||
payOnServerPluginCb = findViewById(R.id.cb_plugin_pay_on_server)
|
||||
eidOnServerPluginCb = findViewById(R.id.cb_plugin_eid_on_server)
|
||||
videoPluginCb = findViewById(R.id.cb_plugin_video)
|
||||
|
||||
startButton = findViewById(R.id.startButton)
|
||||
startButton.setOnClickListener {
|
||||
clearLog()
|
||||
writeLog(getString(R.string.starting))
|
||||
createCoreSdk()
|
||||
setContent {
|
||||
MaterialTheme {
|
||||
MetaPluginDemoScreen(
|
||||
logText = logText,
|
||||
onStartClicked = { useAutoIdent, usePayOnServer, useEidOnServer, useVideo, themingChoice ->
|
||||
clearLog()
|
||||
writeLog(getString(R.string.starting))
|
||||
createCoreSdk(
|
||||
useAutoIdent = useAutoIdent,
|
||||
usePayOnServer = usePayOnServer,
|
||||
useEidOnServer = useEidOnServer,
|
||||
useVideo = useVideo,
|
||||
themingChoice = themingChoice
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* CORE SDK */
|
||||
@ -89,7 +94,13 @@ internal class MainActivity : AppCompatActivity() {
|
||||
/**
|
||||
* Creates the Core SDK from the existing credentials.
|
||||
*/
|
||||
private fun createCoreSdk() {
|
||||
private fun createCoreSdk(
|
||||
useAutoIdent: Boolean,
|
||||
usePayOnServer: Boolean,
|
||||
useEidOnServer: Boolean,
|
||||
useVideo: Boolean,
|
||||
themingChoice: ThemingChoice
|
||||
) {
|
||||
writeLog(getString(R.string.creating_core_sdk))
|
||||
|
||||
// should be provided to you -> currently just using demo credentials
|
||||
@ -106,7 +117,12 @@ internal class MainActivity : AppCompatActivity() {
|
||||
writeLog(getString(R.string.core_sdk_creation_successful))
|
||||
validateActionId()
|
||||
|
||||
val selectProductPlugins = getSelectedPlugins()
|
||||
val selectProductPlugins = getSelectedPlugins(
|
||||
useAutoIdent = useAutoIdent,
|
||||
usePayOnServer = usePayOnServer,
|
||||
useEidOnServer = useEidOnServer,
|
||||
useVideo = useVideo
|
||||
)
|
||||
|
||||
val metaPlugin = WebIdMetaPlugin(
|
||||
environment,
|
||||
@ -116,7 +132,12 @@ internal class MainActivity : AppCompatActivity() {
|
||||
selectProductPlugins
|
||||
)
|
||||
MetaPluginVerifyTask(metaPlugin)
|
||||
.setOnPostExecuteCallback(metaPluginVerifyCallback(metaPlugin))
|
||||
.setOnPostExecuteCallback(
|
||||
metaPluginVerifyCallback(
|
||||
metaPlugin = metaPlugin,
|
||||
themingChoice = themingChoice
|
||||
)
|
||||
)
|
||||
.execute(actionId)
|
||||
}
|
||||
|
||||
@ -142,27 +163,47 @@ internal class MainActivity : AppCompatActivity() {
|
||||
this::onPluginResultCallback
|
||||
)
|
||||
|
||||
private fun getSelectedPlugins(): ArrayList<IProductPluginWebId> {
|
||||
private fun getSelectedPlugins(
|
||||
useAutoIdent: Boolean,
|
||||
usePayOnServer: Boolean,
|
||||
useEidOnServer: Boolean,
|
||||
useVideo: Boolean
|
||||
): ArrayList<IProductPluginWebId> {
|
||||
return ArrayList(
|
||||
listOfNotNull(
|
||||
if (autoIdOnServerPluginCb.isChecked) AutoIdentOnServerProductPlugin() else null,
|
||||
if (payOnServerPluginCb.isChecked) PayOnServerProductPlugin() else null,
|
||||
if (eidOnServerPluginCb.isChecked) EIdOnServerProductPlugin() else null,
|
||||
if (videoPluginCb.isChecked) VideoIdentProductPlugin(config) else null,
|
||||
if (useAutoIdent) AutoIdProductPlugin() else null,
|
||||
if (usePayOnServer) AccountIdProductPlugin() else null,
|
||||
if (useEidOnServer) EIdProductPlugin() else null,
|
||||
if (useVideo) VideoIdProductPlugin(config) else null,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun metaPluginVerifyCallback(metaPlugin: WebIdMetaPlugin): (AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>) -> Unit {
|
||||
private fun metaPluginVerifyCallback(metaPlugin: WebIdMetaPlugin,
|
||||
themingChoice: ThemingChoice
|
||||
): (AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>) -> Unit {
|
||||
|
||||
return { result ->
|
||||
if (result.errorResult == EApiResult.SUCCESS) {
|
||||
var verifyActionIdResult = result.result
|
||||
try {
|
||||
metaPlugin.startPlugin(
|
||||
this,
|
||||
activityResultLauncher,
|
||||
R.style.CustomizedPluginTheme,
|
||||
)
|
||||
when (themingChoice) {
|
||||
ThemingChoice.XML -> {
|
||||
metaPlugin.startPlugin(
|
||||
this,
|
||||
activityResultLauncher,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
ThemingChoice.COMPOSE -> {
|
||||
metaPlugin.startPlugin(
|
||||
this,
|
||||
activityResultLauncher,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (e: WebIdMobileAppSdkException) {
|
||||
e.printStackTrace()
|
||||
writeLog(e.message.toString())
|
||||
@ -175,7 +216,6 @@ internal class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun onPluginResultCallback(activityResult: ActivityResult) {
|
||||
var metaPluginActivityResult = activityResult
|
||||
var result: String?
|
||||
try {
|
||||
// Get data and handle potential null case
|
||||
@ -194,6 +234,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
result += " $resultInfo"
|
||||
// your code to handle the successful plugin execution
|
||||
}
|
||||
writeLog(result)
|
||||
} else {
|
||||
// failure case
|
||||
if (failReason.specificResult != null) {
|
||||
@ -203,30 +244,36 @@ internal class MainActivity : AppCompatActivity() {
|
||||
if (specificResult is EMetaPluginFailReason) {
|
||||
if (specificResult == EMetaPluginFailReason.EID_PENDING_AUTHADA) {
|
||||
// handle EID_PENDING_AUTHADA as described in code documentation
|
||||
writeLog("EID_PENDING_AUTHADA")
|
||||
} else {
|
||||
// handle all other EMetaPluginFailReason as described in code documentation
|
||||
writeLog("MetaPluginFailReason: $specificResult")
|
||||
}
|
||||
} else {
|
||||
// handle EVideoIdentProductPluginFailReasons
|
||||
if (specificResult is EVideoIdentProductPluginFailReasons) {
|
||||
if (specificResult == EVideoIdentProductPluginFailReasons.CALL_CENTER_CLOSED) {
|
||||
if (specificResult is VideoIdProductFailReason) {
|
||||
if (specificResult == VideoIdProductFailReason.CALL_CENTER_CLOSED) {
|
||||
// handle CALL_CENTER_CLOSED as described in code documentation
|
||||
writeLog("CALL_CENTER_CLOSED")
|
||||
} else {
|
||||
// handle all other EVideoIdentProductPluginFailReasons errors as described in the code documentation
|
||||
writeLog("VideoIdentFailReason: $specificResult")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (failReason.genericResult == EProductPluginErrors.UNKNOWN) {
|
||||
// handle UNKNOWN as described in code documentation
|
||||
writeLog("Unknown Error")
|
||||
} else {
|
||||
// handle all other EProductPluginErrors errors as described in the code documentation
|
||||
writeLog("Error: ${failReason.genericResult}")
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: WebIdPluginInterruptedException) {
|
||||
// Handle interruption in your preferred way
|
||||
writeLog(e.toString())
|
||||
writeLog("Plugin interrupted: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,18 +281,17 @@ internal class MainActivity : AppCompatActivity() {
|
||||
|
||||
/**
|
||||
* Add an entry to the log.
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun writeLog(entry: String) {
|
||||
textLog.text = "${textLog.text} $entry\n"
|
||||
logText += "$entry\n"
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the text log of this activity.
|
||||
*/
|
||||
private fun clearLog() {
|
||||
textLog.text = ""
|
||||
logText = ""
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
package de.webidsolutions.metaplugindemo.scenes
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
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.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.systemBarsPadding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
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.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import de.webidsolutions.metaplugindemo.R
|
||||
|
||||
enum class ThemingChoice() {
|
||||
COMPOSE,
|
||||
XML
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MetaPluginDemoScreen(
|
||||
logText: String,
|
||||
onStartClicked: (
|
||||
useAutoIdent: Boolean,
|
||||
usePayOnServer: Boolean,
|
||||
useEidOnServer: Boolean,
|
||||
useVideo: Boolean,
|
||||
themingChoice: ThemingChoice
|
||||
) -> Unit
|
||||
) {
|
||||
var useAutoIdent by remember { mutableStateOf(false) }
|
||||
var usePayOnServer by remember { mutableStateOf(false) }
|
||||
var useEidOnServer by remember { mutableStateOf(false) }
|
||||
var useVideo by remember { mutableStateOf(false) }
|
||||
var useXmlTheming by remember { mutableStateOf(ThemingChoice.COMPOSE) }
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(start = 10.dp, top = 10.dp, end = 10.dp)
|
||||
.systemBarsPadding()
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.choose_plugins),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.padding(start = 10.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
Column {
|
||||
CheckboxWithLabel(
|
||||
checked = useAutoIdent,
|
||||
onCheckedChange = { useAutoIdent = it },
|
||||
label = stringResource(R.string.autoid)
|
||||
)
|
||||
|
||||
CheckboxWithLabel(
|
||||
checked = usePayOnServer,
|
||||
onCheckedChange = { usePayOnServer = it },
|
||||
label = stringResource(R.string.accountid)
|
||||
)
|
||||
|
||||
CheckboxWithLabel(
|
||||
checked = useEidOnServer,
|
||||
onCheckedChange = { useEidOnServer = it },
|
||||
label = stringResource(R.string.eid)
|
||||
)
|
||||
|
||||
CheckboxWithLabel(
|
||||
checked = useVideo,
|
||||
onCheckedChange = { useVideo = it },
|
||||
label = stringResource(R.string.videoid)
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.choose_theming),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.padding(start = 10.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
Column {
|
||||
CheckboxWithLabel(
|
||||
checked = useXmlTheming == ThemingChoice.COMPOSE,
|
||||
onCheckedChange = { isChecked ->
|
||||
if (isChecked) {
|
||||
useXmlTheming = ThemingChoice.COMPOSE
|
||||
}
|
||||
},
|
||||
label = "Standard Theme"
|
||||
)
|
||||
|
||||
CheckboxWithLabel(
|
||||
checked = useXmlTheming == ThemingChoice.XML,
|
||||
onCheckedChange = { isChecked ->
|
||||
if (isChecked) {
|
||||
useXmlTheming = ThemingChoice.XML
|
||||
}
|
||||
},
|
||||
label = "Custom Theme (XML)"
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.log_headline),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.padding(start = 10.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 10.dp)
|
||||
) {
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
LaunchedEffect(logText) {
|
||||
scrollState.animateScrollTo(scrollState.maxValue)
|
||||
}
|
||||
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
shape = MaterialTheme.shapes.small
|
||||
) {
|
||||
Text(
|
||||
text = logText.ifEmpty { stringResource(R.string.log_placeholder) },
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(16.dp)
|
||||
.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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CheckboxWithLabel(
|
||||
checked: Boolean,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
label: String
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Checkbox(
|
||||
checked = checked,
|
||||
onCheckedChange = onCheckedChange,
|
||||
colors = CheckboxDefaults.colors(
|
||||
checkedColor = Color(0xFF05B1FB),
|
||||
checkmarkColor = Color.White
|
||||
)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.width(2.dp))
|
||||
Text(text = label)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(
|
||||
name = "MetaPluginDemoScreen - Long Log",
|
||||
showBackground = true,
|
||||
showSystemUi = true
|
||||
)
|
||||
@Composable
|
||||
private fun MetaPluginDemoScreenLongLogPreview() {
|
||||
MaterialTheme {
|
||||
MetaPluginDemoScreen(
|
||||
logText = buildString {
|
||||
repeat(20) { index ->
|
||||
appendLine("Log entry ${index + 1}: Processing...")
|
||||
}
|
||||
},
|
||||
onStartClicked = { _, _, _, _, _ -> }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +55,41 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_eid_on_server" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_theming_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/choose_theming"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_plugin_video" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/themeChoiceGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_theming_header"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_code_theming"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Code-Theming"
|
||||
android:checked="true" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_xml_theming"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="XML-Theming"
|
||||
android:layout_marginStart="24dp" />
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logHeadline"
|
||||
android:layout_width="wrap_content"
|
||||
@ -64,7 +99,7 @@
|
||||
android:text="@string/log_headline"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_video" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/themeChoiceGroup" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollViewLog"
|
||||
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK erfolgreich erstellt</string>
|
||||
<string name="validate_action_id">Validiere Vorgangsnummer…</string>
|
||||
<string name="action_id_not_valid">Fehler: Die Vorgangsnummer (Action-ID) wurde in der Datei „MainActivity.kt“ nicht auf eine 9-stellige Zahlenfolge gesetzt.</string>
|
||||
<string name="choose_theming">Theme auswählen:</string>
|
||||
</resources>
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK creado correctamente</string>
|
||||
<string name="validate_action_id">Validar número de operación…</string>
|
||||
<string name="action_id_not_valid">Error: El número de operación («action-ID») no se ha establecido en una secuencia numérica de 9 dígitos en el archivo «MainActivity.kt».</string>
|
||||
<string name="choose_theming">Elige un tema</string>
|
||||
</resources>
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK créé avec succès</string>
|
||||
<string name="validate_action_id">Valider le numéro d\'opération…</string>
|
||||
<string name="action_id_not_valid">Erreur : le numéro d\'opération (ActionID) n\'a pas été défini sur une séquence de 9 chiffres dans le fichier « MainActivity.kt ».</string>
|
||||
<string name="choose_theming">Choisir le thème</string>
|
||||
</resources>
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK creato con successo</string>
|
||||
<string name="validate_action_id">Convalida numero operazione…</string>
|
||||
<string name="action_id_not_valid">Errore: il numero dell\'operazione (ActionID) non è stato impostato su una sequenza di 9 cifre nel file “MainActivity.kt”.</string>
|
||||
<string name="choose_theming">Scegli il tema</string>
|
||||
</resources>
|
||||
@ -1,13 +1,20 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.MetaPluginDemo" parent="Theme.AppCompat.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">#05b1fb</item>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="WebId.PluginTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
||||
<item name="actionPrimary">#FFD32D1F</item>
|
||||
<item name="actionPrimaryPressed">#FF8A1E15</item>
|
||||
<item name="actionPrimaryHover">#FFE57373</item>
|
||||
<item name="actionPrimaryInvert">#FFFFFFFF</item>
|
||||
<item name="actionDisabled">#FFBDBDBD</item>
|
||||
|
||||
<item name="brandPrimary">#FFD32D1F</item>
|
||||
<item name="brandSecondary">#FF8A1E15</item>
|
||||
|
||||
<item name="backgroundPrimary">#FFFFFFFF</item>
|
||||
<item name="backgroundSecondary">#FFFFFF</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Dark">
|
||||
<!--
|
||||
Implement your customized style attributes here for standard and/or light theme.
|
||||
-->
|
||||
</style>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK succesvol aangemaakt</string>
|
||||
<string name="validate_action_id">Valideer transactienummer…</string>
|
||||
<string name="action_id_not_valid">Fout: het actienummer (ActionID) is in het bestand “MainActivity.kt” niet ingesteld op een reeks van 9 cijfers.</string>
|
||||
<string name="choose_theming">Thema kiezen</string>
|
||||
</resources>
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK utworzony pomyślnie</string>
|
||||
<string name="validate_action_id">Zatwierdź numer operacji…</string>
|
||||
<string name="action_id_not_valid">Błąd: Numer operacji (Action-ID) nie został ustawiony na 9-cyfrową sekwencję cyfr w pliku „MainActivity.kt”.</string>
|
||||
<string name="choose_theming">Wybierz motyw</string>
|
||||
</resources>
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK creat cu succes</string>
|
||||
<string name="validate_action_id">Validați numărul operațiunii…</string>
|
||||
<string name="action_id_not_valid">Eroare: Numărul operațiunii („Action-ID”) nu a fost setat la o secvență de 9 cifre în fișierul „MainActivity.kt”.</string>
|
||||
<string name="choose_theming">Alege tema</string>
|
||||
</resources>
|
||||
@ -9,4 +9,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK başarıyla oluşturuldu</string>
|
||||
<string name="validate_action_id">İşlem numarasını doğrula…</string>
|
||||
<string name="action_id_not_valid">Hata: İşlem numarası (Action-ID) “MainActivity.kt” dosyasında 9 basamaklı bir sayı dizisi olarak ayarlanmamıştır.</string>
|
||||
<string name="choose_theming">Tema seç</string>
|
||||
</resources>
|
||||
@ -8,4 +8,5 @@
|
||||
<string name="core_sdk_creation_successful">Core SDK creation successful</string>
|
||||
<string name="validate_action_id">Validate Action-ID…</string>
|
||||
<string name="action_id_not_valid">Failure: The transaction number (Action-ID) was not set to 9-digit number string in MainActivity.kt file.</string>
|
||||
<string name="choose_theming">Choose A Theme:</string>
|
||||
</resources>
|
||||
@ -1,13 +1,19 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.MetaPluginDemo" parent="Theme.AppCompat.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">#05b1fb</item>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="WebId.PluginTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
||||
<item name="actionPrimary">#FFD32D1F</item> <!-- Deep Orange 400 -->
|
||||
<item name="actionPrimaryPressed">#FF8A1E15</item> <!-- Deep Orange 600 -->
|
||||
<item name="actionPrimaryHover">#FFE57373</item> <!-- Deep Orange 300 -->
|
||||
<item name="actionPrimaryInvert">#FFFFFFFF</item> <!-- White -->
|
||||
<item name="actionDisabled">#FFBDBDBD</item> <!-- Grey 400 -->
|
||||
|
||||
<item name="brandPrimary">#FFD32D1F</item>
|
||||
<item name="brandSecondary">#FF8A1E15</item>
|
||||
<!-- ===== Background Colors ===== -->
|
||||
<item name="backgroundPrimary">#FFFFFFFF</item> <!-- Light Cyan (Cyan 50) -->
|
||||
<item name="backgroundSecondary">#FFFFFF</item> <!-- White -->
|
||||
</style>
|
||||
|
||||
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Light">
|
||||
<!--
|
||||
Implement your customized style attributes here for standard and/or light theme.
|
||||
-->
|
||||
</style>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@ -14,7 +14,17 @@ dependencyResolutionManagement {
|
||||
|
||||
// add the webid repo to receive the plugin
|
||||
maven {
|
||||
url 'https://api.webid-solutions.de/releases/android/maven/repository/internal'
|
||||
url "https://api.webid-solutions.de/releases/android/maven/repository/snapshots"
|
||||
}
|
||||
maven {
|
||||
url "https://api.webid-solutions.de/releases/android/maven2/snapshots"
|
||||
}
|
||||
// use our release repository for releases
|
||||
maven {
|
||||
url "https://api.webid-solutions.de/releases/android/maven/repository/internal"
|
||||
}
|
||||
maven {
|
||||
url "https://api.webid-solutions.de/releases/android/maven2/releases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user