[MWA-5265] Meta Demo: Theming via xml
{Update actionId placeholder and add theming strings}
[MWA-5265] Meta Demo: Theming via xml
{Clean up dependencies and UI}
[MWA-5265] Meta Demo: Theming via xml
{cr fixes}
[MWA-5265] Meta Demo: Theming via xml
{Configure light and dark themes}
[MWA-5265] Meta Demo: Theming via xml
{Update placeholder for action ID}
[MWA-5265] Meta Demo: Theming via xml
{CR fixes}
[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
f5e00df252
commit
92fedb7b19
@ -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 {
|
||||
@ -51,33 +52,42 @@ android {
|
||||
|
||||
dependencies {
|
||||
|
||||
// android dependencies from demo app
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
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.activity:activity-compose:1.9.3'
|
||||
implementation 'androidx.compose.foundation:foundation:1.9.5'
|
||||
implementation 'androidx.compose.foundation:foundation-layout:1.9.4'
|
||||
implementation 'androidx.compose.ui:ui'
|
||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
}
|
||||
@ -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,29 @@ 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.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import de.webidsolutions.android_ui_components.theming.v4.WebIdThemeProviderV4
|
||||
import de.webidsolutions.android_ui_components.theming.v4.WebIdThemeV4
|
||||
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.MetaPluginDemoScene
|
||||
import de.webidsolutions.metaplugindemo.scenes.ThemingChoice
|
||||
import de.webidsolutions.metaplugindemo.scenes.UserConfiguration
|
||||
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 +38,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
|
||||
|
||||
@ -54,33 +60,34 @@ 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 result 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)
|
||||
setContent {
|
||||
WebIdThemeProviderV4(
|
||||
theme = WebIdThemeV4.makeLightTheme {},
|
||||
darkTheme = WebIdThemeV4.makeDarkTheme {}
|
||||
){
|
||||
MetaPluginDemoScene(
|
||||
result = result,
|
||||
onStartClicked = { userConfiguration ->
|
||||
clearResult()
|
||||
showResult(getString(R.string.starting))
|
||||
createCoreSdk(
|
||||
userConfiguration = userConfiguration
|
||||
)
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,8 +96,10 @@ internal class MainActivity : AppCompatActivity() {
|
||||
/**
|
||||
* Creates the Core SDK from the existing credentials.
|
||||
*/
|
||||
private fun createCoreSdk() {
|
||||
writeLog(getString(R.string.creating_core_sdk))
|
||||
private fun createCoreSdk(
|
||||
userConfiguration: UserConfiguration
|
||||
) {
|
||||
showResult(getString(R.string.creating_core_sdk))
|
||||
|
||||
// should be provided to you -> currently just using demo credentials
|
||||
val selectedUri: URI = chosenEnvironment.uri
|
||||
@ -103,10 +112,15 @@ internal class MainActivity : AppCompatActivity() {
|
||||
*chosenEnvironment.shaPins
|
||||
)
|
||||
|
||||
writeLog(getString(R.string.core_sdk_creation_successful))
|
||||
showResult(getString(R.string.core_sdk_creation_successful))
|
||||
validateActionId()
|
||||
|
||||
val selectProductPlugins = getSelectedPlugins()
|
||||
val selectProductPlugins = getSelectedPlugins(
|
||||
useAutoIdent = userConfiguration.useAutoIdent,
|
||||
usePayOnServer = userConfiguration.useAcountId,
|
||||
useEidOnServer = userConfiguration.useEId,
|
||||
useVideoIdent = userConfiguration.useVideoIdent
|
||||
)
|
||||
|
||||
val metaPlugin = WebIdMetaPlugin(
|
||||
environment,
|
||||
@ -116,7 +130,12 @@ internal class MainActivity : AppCompatActivity() {
|
||||
selectProductPlugins
|
||||
)
|
||||
MetaPluginVerifyTask(metaPlugin)
|
||||
.setOnPostExecuteCallback(metaPluginVerifyCallback(metaPlugin))
|
||||
.setOnPostExecuteCallback(
|
||||
metaPluginVerifyCallback(
|
||||
metaPlugin = metaPlugin,
|
||||
themingChoice = userConfiguration.themingChoice
|
||||
)
|
||||
)
|
||||
.execute(actionId)
|
||||
}
|
||||
|
||||
@ -124,7 +143,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
* Validates the WebID actionID
|
||||
*/
|
||||
private fun validateActionId() {
|
||||
writeLog(getString(R.string.validate_action_id))
|
||||
showResult(getString(R.string.validate_action_id))
|
||||
|
||||
try {
|
||||
parseInt(actionId)
|
||||
@ -132,7 +151,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
throw NumberFormatException()
|
||||
}
|
||||
} catch (e: NumberFormatException) {
|
||||
writeLog(getString(R.string.action_id_not_valid))
|
||||
showResult(getString(R.string.action_id_not_valid))
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,35 +161,57 @@ internal class MainActivity : AppCompatActivity() {
|
||||
this::onPluginResultCallback
|
||||
)
|
||||
|
||||
private fun getSelectedPlugins(): ArrayList<IProductPluginWebId> {
|
||||
private fun getSelectedPlugins(
|
||||
useAutoIdent: Boolean,
|
||||
usePayOnServer: Boolean,
|
||||
useEidOnServer: Boolean,
|
||||
useVideoIdent: 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 (useVideoIdent) 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) {
|
||||
writeLog(getString(R.string.verification_successful))
|
||||
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(getString(R.string.start_failed) + e.message.toString())
|
||||
showResult(getString(R.string.start_failed) + e.message.toString())
|
||||
}
|
||||
} else {
|
||||
val metaPluginVerifyError = result.errorResult
|
||||
writeLog(getString(R.string.verification_failed) + metaPluginVerifyError.toString())
|
||||
showResult(getString(R.string.verification_failed) + metaPluginVerifyError.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -196,6 +237,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
result += " $resultInfo"
|
||||
// your code to handle the successful plugin execution
|
||||
}
|
||||
showResult(result)
|
||||
} else {
|
||||
// failure case
|
||||
writeLog(getString(R.string.product_journey_finished_with_failure))
|
||||
@ -206,24 +248,30 @@ internal class MainActivity : AppCompatActivity() {
|
||||
if (specificResult is EMetaPluginFailReason) {
|
||||
if (specificResult == EMetaPluginFailReason.EID_PENDING_AUTHADA) {
|
||||
// handle EID_PENDING_AUTHADA as described in code documentation
|
||||
showResult("EID_PENDING_AUTHADA")
|
||||
} else {
|
||||
// handle all other EMetaPluginFailReason as described in code documentation
|
||||
showResult("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
|
||||
showResult("CALL_CENTER_CLOSED")
|
||||
} else {
|
||||
// handle all other EVideoIdentProductPluginFailReasons errors as described in the code documentation
|
||||
showResult("VideoIdentFailReason: $specificResult")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (failReason.genericResult == EProductPluginErrors.UNKNOWN) {
|
||||
// handle UNKNOWN as described in code documentation
|
||||
showResult("Unknown Error")
|
||||
} else {
|
||||
// handle all other EProductPluginErrors errors as described in the code documentation
|
||||
showResult("Error: ${failReason.genericResult}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,19 +284,18 @@ internal class MainActivity : AppCompatActivity() {
|
||||
/* MISC */
|
||||
|
||||
/**
|
||||
* Add an entry to the log.
|
||||
*
|
||||
* @param
|
||||
* Add an entry to the result.
|
||||
*/
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun writeLog(entry: String) {
|
||||
textLog.text = "${textLog.text} $entry\n"
|
||||
private fun showResult(entry: String) {
|
||||
result += "$entry\n"
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the text log of this activity.
|
||||
* Resets the text result of this activity.
|
||||
*/
|
||||
private fun clearLog() {
|
||||
textLog.text = ""
|
||||
private fun clearResult() {
|
||||
result = ""
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,217 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.systemBarsPadding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
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.CheckboxTyp
|
||||
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.text.TextV4
|
||||
import de.webidsolutions.metaplugindemo.R
|
||||
|
||||
@Composable
|
||||
fun MetaPluginDemoScene(
|
||||
result: String,
|
||||
onStartClicked: (
|
||||
UserConfiguration
|
||||
) -> Unit
|
||||
) {
|
||||
var useAutoIdent by remember { mutableStateOf(false) }
|
||||
var usePayOnServer by remember { mutableStateOf(false) }
|
||||
var useEidOnServer by remember { mutableStateOf(false) }
|
||||
var useVideoIdent by remember { mutableStateOf(false) }
|
||||
var useXmlTheming by remember { mutableStateOf(ThemingChoice.COMPOSE) }
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.systemBarsPadding()
|
||||
.padding(top = SpacingV4.N.size)
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.padding(
|
||||
start = SpacingV4.S.size,
|
||||
top = SpacingV4.N.size,
|
||||
end = SpacingV4.N.size
|
||||
)
|
||||
) {
|
||||
item {
|
||||
TextV4(
|
||||
text = stringResource(R.string.choose_plugins),
|
||||
)
|
||||
|
||||
SpacingV4.S.VSpacer()
|
||||
|
||||
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 = useVideoIdent,
|
||||
onCheckedChange = { useVideoIdent = it },
|
||||
label = stringResource(R.string.videoid)
|
||||
)
|
||||
|
||||
SpacingV4.L.VSpacer()
|
||||
|
||||
TextV4(
|
||||
text = stringResource(R.string.choose_theming),
|
||||
)
|
||||
|
||||
SpacingV4.S.VSpacer()
|
||||
|
||||
CheckboxWithLabel(
|
||||
checked = useXmlTheming == ThemingChoice.COMPOSE,
|
||||
onCheckedChange = { isChecked ->
|
||||
if (isChecked) {
|
||||
useXmlTheming = ThemingChoice.COMPOSE
|
||||
}
|
||||
},
|
||||
label = stringResource(R.string.choose_theming_compose)
|
||||
)
|
||||
|
||||
CheckboxWithLabel(
|
||||
checked = useXmlTheming == ThemingChoice.XML,
|
||||
onCheckedChange = { isChecked ->
|
||||
if (isChecked) {
|
||||
useXmlTheming = ThemingChoice.XML
|
||||
}
|
||||
},
|
||||
label = stringResource(R.string.choose_theming_xml)
|
||||
)
|
||||
|
||||
SpacingV4.L.VSpacer()
|
||||
|
||||
TextV4(
|
||||
text = stringResource(R.string.log_headline),
|
||||
)
|
||||
|
||||
SpacingV4.S.VSpacer()
|
||||
|
||||
ResultView(result = result.split("\n"))
|
||||
|
||||
SpacingV4.M.VSpacer()
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = SpacingV4.S.size,
|
||||
end = SpacingV4.N.size,
|
||||
bottom = SpacingV4.S.size
|
||||
)
|
||||
) {
|
||||
PrimaryButtonV4(
|
||||
onClick = {
|
||||
onStartClicked(
|
||||
UserConfiguration(
|
||||
useAutoIdent = useAutoIdent,
|
||||
useAcountId = usePayOnServer,
|
||||
useEId = useEidOnServer,
|
||||
useVideoIdent = useVideoIdent,
|
||||
themingChoice = useXmlTheming
|
||||
)
|
||||
)
|
||||
},
|
||||
title = stringResource(R.string.start_button),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ResultView(
|
||||
result: List<String>,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
if (result.isNotEmpty()) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
result.forEach { result ->
|
||||
TextV4(
|
||||
text = result,
|
||||
modifier = Modifier.padding(vertical = 4.dp)
|
||||
)
|
||||
}
|
||||
SpacingV4.S.VSpacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CheckboxWithLabel(
|
||||
checked: Boolean,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
label: String
|
||||
) {
|
||||
CheckboxV4(
|
||||
checked = checked,
|
||||
isRequired = false,
|
||||
onCheckedChange = onCheckedChange,
|
||||
text = label,
|
||||
textTyp = CheckboxTyp.Label,
|
||||
modifier = Modifier.padding(start = SpacingV4.N.size)
|
||||
)
|
||||
|
||||
SpacingV4.XXS.VSpacer()
|
||||
}
|
||||
|
||||
|
||||
@Preview(
|
||||
name = "MetaPluginDemoScreen - Long Log",
|
||||
showBackground = true,
|
||||
showSystemUi = true
|
||||
)
|
||||
@Composable
|
||||
private fun MetaPluginDemoSceneLongLogPreview() {
|
||||
WebIdThemeProviderV4 {
|
||||
MetaPluginDemoScene(
|
||||
result = buildString {
|
||||
appendLine("Log entry: Processing...")
|
||||
|
||||
},
|
||||
onStartClicked = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
data class UserConfiguration(
|
||||
val useAutoIdent: Boolean,
|
||||
val useAcountId: Boolean,
|
||||
val useEId: Boolean,
|
||||
val useVideoIdent: Boolean,
|
||||
val themingChoice: ThemingChoice
|
||||
)
|
||||
@ -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"
|
||||
|
||||
@ -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>
|
||||
</style>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Dark">
|
||||
<!--
|
||||
Implement your customized style attributes here for standard and/or light theme.
|
||||
-->
|
||||
<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">#FF000000</item>
|
||||
<item name="actionDisabled">#FF666666</item>
|
||||
|
||||
<item name="brandPrimary">#FFD32D1F</item>
|
||||
<item name="brandSecondary">#FF8A1E15</item>
|
||||
|
||||
<item name="backgroundPrimary">#FF121212</item>
|
||||
<item name="backgroundSecondary">#FF1E1E1E</item>
|
||||
<item name="android:fontFamily">monospace</item>
|
||||
<item name="primaryButtonCornerRadius">@dimen/webid_button_corner_radius</item>
|
||||
</style>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@ -3,4 +3,5 @@
|
||||
<dimen name="grid_margin">24dp</dimen>
|
||||
<dimen name="button_height">60dp</dimen>
|
||||
<dimen name="log_margin">40dp</dimen>
|
||||
<dimen name="webid_button_corner_radius">8dp</dimen>
|
||||
</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>
|
||||
</style>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Light">
|
||||
<!--
|
||||
Implement your customized style attributes here for standard and/or light theme.
|
||||
-->
|
||||
<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>
|
||||
|
||||
<item name="backgroundPrimary">#FFFFFFFF</item> <!-- Light Cyan (Cyan 50) -->
|
||||
<item name="backgroundSecondary">#FFFFFF</item> <!-- White -->
|
||||
<item name="android:fontFamily">monospace</item>
|
||||
<item name="primaryButtonCornerRadius">@dimen/webid_button_corner_radius</item>
|
||||
</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