9
0

[MWA-3546] Integration Demo für ProductCatalog erstellen

{ add initial project }
This commit is contained in:
Simon Hagen 2024-04-03 10:22:47 +02:00
parent 43afb02ece
commit bc08760ec9
40 changed files with 1301 additions and 0 deletions

70
README.md Normal file
View File

@ -0,0 +1,70 @@
# MetaPlugin Demo Android
This project demonstrates how to embed the WebID Meta Plugin into an Android App.
The code of the project is described with comments on how to use it.
## Tutorial
To start the plugin in this example project, open the gradle.properties file.
You will find empty credential properties at the bottom.</br>
You should have been given a username and a password to access your environment.</br>
Navigate to the ~/.gradle/gradle.properties file on your system..
If it does not exist, create it.</br>
Enter the properties for your preferred platform.
To begin the identification process, you will need to create it outside the app.</br>
From the process creation request to the server, you should have received an action-id, consisting of 9 numbers.
After that, open the MainActivity.kt file and finish the three TODOs at the top.
<ol>
<li>choose video call configs</li>
<li>insert your 9-digit action id</li>
<li>choose an environment to use</li>
</ol>
After that, start the demo app on an android device.</br>
Press the main button to start the plugin at runtime.
## Fastened Tutorial
<ol>
<li>Add usernames and passwords in your ~/.gradle/gradle.properties file</li>
<li>Create a transaction via backend API</li>
<li>Set video-call configs in MainActivity.kt</li>
<li>Replace placeholder string of action-id in MainActivity.kt with action-id from process-creation response</li>
<li>Choose environment in MainActivity.kt</li>
<li>Start this app on a test device</li>
<li>Click main button to start the plugin at runtime</li>
</ol>
## Additional Notes
On Samsung Devices, configurations should be changed.
In MainActivity.kt, go to
<pre><code>private val config = VideoOptionsConfig(true, false, false)</code></pre>
and set the booleans according to the chapter
>The VideoOptionsConfig object
in the Integration Guide.
## Theming (Optional)
The plugin implemented in this project supports customized theming.</br>
To try out different themes, go to the file src/main/res/values/themes.xml and add items to the following element:
```
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Light">
</style>
```
Consult the theming guide to see what items can be changed.</br>
To change the Dark mode theming, navigate to the file src/main/res/values-night/themes.xml and add items to the following element:
```
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Dark">
</style>
```

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

83
app/build.gradle Normal file
View File

@ -0,0 +1,83 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 34
namespace "de.webidsolutions.metaplugindemo"
defaultConfig {
applicationId "de.webidsolutions.metaplugindemo"
minSdkVersion 24
targetSdkVersion 34
versionCode 1
versionName "1.0.0"
buildConfigField "String", "WEBID_DEMO_USERNAME_TEST", "\"${WEBID_DEMO_USERNAME_TEST}\""
buildConfigField "String", "WEBID_DEMO_APIKEY_TEST", "\"${WEBID_DEMO_APIKEY_TEST}\""
buildConfigField "String", "WEBID_DEMO_USERNAME_PROD", "\"${WEBID_DEMO_USERNAME_PROD}\""
buildConfigField "String", "WEBID_DEMO_APIKEY_PROD", "\"${WEBID_DEMO_APIKEY_PROD}\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
buildConfig true
}
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
jniLibs { useLegacyPackaging = true }
}
}
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'
// webid product-plugin
//noinspection GradleDependency
def product_catalog_version = "12.0.0"
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") {
changing = true
}
implementation ("de.webid-solutions:android_pay_on_server_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") {
changing = true
}
}

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

1
app/src/LICENSE Normal file
View File

@ -0,0 +1 @@
Copyright (C) 2013 - 2024 WebID Solutions GmbH | www.webid-solutions.de. All Rights Reserved

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.webidsolutions.metaplugindemo">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MetaPluginDemo">
<activity
android:name="de.webidsolutions.metaplugindemo.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,62 @@
/*
* Created by WebID Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo
import java.net.URI
/**
* Environment configuration for WebID endpoints for test usage.
*/
enum class EWebIDEnv(
/**
* Username of the client
* Used for authentication of the client.
*/
internal val username: String,
/**
* API Key of the client
* Used for authentication of the client.
*/
internal val apiKey: String,
/**
* The uri of the environment.
* Used to determine the backend.
*/
internal val uri: URI,
/**
* Sha pins of the environment.
* Used for authentication
*/
internal val shaPins: Array<String>
) {
/**
* WebID TEST environment.
*/
TEST(
BuildConfig.WEBID_DEMO_USERNAME_TEST,
BuildConfig.WEBID_DEMO_APIKEY_TEST,
URI.create("https://test.webid-solutions.de/"),
arrayOf(
"sha256/WcFCbp232usb2PlWzs2PYdr5K7pm21EG6kBms5LUDfY=" // expires 2025.02.22
)
),
/**
* WebID PRODUCTION environment.
*/
PRODUCTION(
BuildConfig.WEBID_DEMO_USERNAME_PROD,
BuildConfig.WEBID_DEMO_APIKEY_PROD,
URI.create("https://webid-gateway.de/"),
arrayOf(
"sha256/FJ8bpW+Zzu86wDBFYA6GygAhw7DbpY10oDmtJl46Hdw=" // expires 2024.11.02
)
);
}

View File

@ -0,0 +1,195 @@
/*
* Created by WebID Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo
import android.annotation.SuppressLint
import android.os.Bundle
import android.widget.Button
import android.widget.CheckBox
import android.widget.TextView
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 de.webidsolutions.meta_plugin.WebIdMetaPlugin
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.plugin_core.IProductPluginWebId
import de.webidsolutions.video_ident.plugin.videocall.VideoOptionsConfig
import de.webidsolutions.video_ident_product_plugin.VideoIdentProductPlugin
import de.webidsolutions.metaplugindemo.tasks.EApiResult
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
import java.lang.Integer.parseInt
import java.net.URI
// TODO set your configs
private val config = VideoOptionsConfig(
true,
false,
false
)
// TODO insert your Action id
private const val actionId = "136249502"
// TODO choose your environment
private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
// private val chosenEnvironment: EWebIDEnv = EWebIDEnv.PRODUCTION
/**
* Demo App which starts the [MetaPlugin] and handles its result.
*/
internal class MainActivity : AppCompatActivity() {
private lateinit var videoPluginCb: CheckBox
private lateinit var eidOnServerPluginCb: CheckBox
private lateinit var payOnServerPluginCb: CheckBox
private lateinit var autoIdOnServerPluginCb: 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("Starting…")
createCoreSdk()
}
}
/* CORE SDK */
/**
* Creates the Core SDK from the existing credentials.
*/
private fun createCoreSdk() {
writeLog("Creating the Core SDK…")
// should be provided to you -> currently just using demo credentials
val selectedUri: URI = chosenEnvironment.uri
val username: String = chosenEnvironment.username
val apiKey: String = chosenEnvironment.apiKey
// actual creation of the core SDK
val environment = WebIdSdkEnvironment(
selectedUri,
*chosenEnvironment.shaPins
)
writeLog("Core SDK creation successful")
validateActionId()
val selectProductPlugins = getSelectedPlugins()
val metaPlugin = WebIdMetaPlugin(
environment,
username,
apiKey,
this.applicationContext,
selectProductPlugins
)
metaPlugin.setVideoConfig(config)
MetaPluginVerifyTask(metaPlugin)
.setOnPostExecuteCallback(metaPluginVerifyCallback(metaPlugin))
.execute(actionId)
}
/**
* Validates the WebID actionID
*/
private fun validateActionId() {
writeLog("Validate Action-ID…")
try {
parseInt(actionId)
if (actionId.length != 9) {
throw NumberFormatException()
}
} catch (e: NumberFormatException) {
writeLog("Failure: action id was not set to 9-digit number string in MainActivity.kt file")
}
}
// add result launcher for intent
private val activityResultLauncher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult(),
this::onPluginResultCallback
)
private fun getSelectedPlugins(): 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(VideoOptionsConfig()) else null
)
)
}
private fun metaPluginVerifyCallback(metaPlugin: WebIdMetaPlugin): (AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>) -> Unit {
return { result ->
if (result.errorResult == EApiResult.SUCCESS) {
var verifyActionIdResult = result.result
try {
metaPlugin.startPlugin(
this,
activityResultLauncher,
R.style.CustomizedPluginTheme,
)
} catch (e: WebIdMobileAppSdkException) {
e.printStackTrace()
writeLog(e.message.toString())
}
} else {
val metaPluginVerifyError = result.errorResult
writeLog(metaPluginVerifyError.toString())
}
}
}
private fun onPluginResultCallback(result: ActivityResult?) {
var metaPluginActivityResult = result
}
/* MISC */
/**
* Add an entry to the log.
*
* @param
*/
@SuppressLint("SetTextI18n")
private fun writeLog(entry: String) {
textLog.text = "${textLog.text} $entry\n"
}
/**
* Resets the text log of this activity.
*/
private fun clearLog() {
textLog.text = ""
}
}

View File

@ -0,0 +1,27 @@
/*
* Created by WebId Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.tasks;
/**
* A simple structure for transporting the response of the AsyncTask
*/
public class AsyncTaskResult<T> {
private final T result;
private final String apiResult;
public T getResult() {
return result;
}
public String getApiResult() {
return apiResult;
}
public AsyncTaskResult(T result, String apiResult) {
this.result = result;
this.apiResult = apiResult;
}
}

View File

@ -0,0 +1,107 @@
/*
* Created by WebID Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.tasks
enum class EApiResult(val messageKey: String, val messageID: Int, val fatal: Boolean) {
SUCCESS(
"api_success",
0,
false
),
ACTIONID_NOT_FOUND(
"apierror_actionid_not_found",
0,
false
),
ACTIONID_NOT_VALID(
"apierror_actionid_not_valid",
0,
false
),
ACCESS_DENIED(
"apierror_access_denied",
0,
true
),
IO_FAILURE(
"apierror_io_failure",
0,
false
),
ILLEGAL_ARGUMENT(
"apierror_illegal_argument",
0,
true
),
ILLEGAL_STATE(
"apierror_illegal_state",
0,
true
),
TAN_INCORRECT(
"apierror_tan_incorrect",
0,
false
),
TAN_ILLEGAL_STATE(
"apierror_tan_illegal_state",
0,
false
),
PRECHECK_REQUIRED(
"apierror_precheck_required",
0,
true
),
ECHECK_REQUIRED(
"apierror_echeck_required",
0,
true
),
LEGALNOTICES_CONFIRMATION_MISSING(
"apierror_legalnotices_confirmation_missing",
0,
true
),
AUTOIDENT_REQUIRED(
"apierror_autoident_required",
0,
true
),
SHOW_ENDUSERDIALOG(
"apierror_show_enduserdialog",
0,
true
),
EID_AUTHADA_REQUIRED(
"apierror_eid_authada_required",
0,
true
),
IDENT_NOT_SUPPORTED(
"apierror_ident_not_supported",
0,
true
),
USER_ACTION_NOT_FINISHED(
"apierror_user_action_not_finished",
0,
false
), //497
SERVICE_UNAVAILABLE(
"apierror_service_unavailable",
0,
true
),
SESSION_EXPIRED(
"apierror_session_expired",
0,
true
);
var extInfo = ""
var extInfo2 = ""
}

View File

@ -0,0 +1,15 @@
/*
* Created by WebId Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.tasks;
/**
* Callback interface for the demo verify api-call.
* Is executed after AsyncTask callback.
*
* @param <T> the type of the callback response
*/
public interface IOnPostExecuteCallback<T> {
void onPostExecute(T result);
}

View File

@ -0,0 +1,92 @@
/*
* Created by WebID Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.tasks
import de.webidsolutions.meta_plugin.WebIdMetaPlugin
import de.webidsolutions.mobile_app.sdk.EidIdentRequiredException
import de.webidsolutions.mobile_app.sdk.IdentNotSupportedException
import de.webidsolutions.mobile_app.sdk.LegalTermsConfirmationMissingException
import de.webidsolutions.mobile_app.sdk.ServiceUnavailableException
import de.webidsolutions.mobile_app.sdk.UserActionNotFinishedException
import de.webidsolutions.mobile_app.sdk.UserActionNotFoundException
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult
import de.webidsolutions.mobile_app.sdk.impl.AsyncTaskResultGeneric
import de.webidsolutions.mobile_app.sdk.impl.IOnPostExecuteCallback
import de.webidsolutions.mobile_app.sdk.impl.WebIdAsyncTask
import java.io.IOException
internal class MetaPluginVerifyTask(
private val metaPlugin: WebIdMetaPlugin
) : WebIdAsyncTask<String, Void, AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>>() {
private var metaPluginVerifyOnPostExecuteCallback: IOnPostExecuteCallback<AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>>? =
null
override fun doInBackground(vararg params: String): AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult> {
val apiResult = try {
return AsyncTaskResultGeneric(metaPlugin.verify(params[0]), EApiResult.SUCCESS)
} catch (e: IllegalArgumentException) {
e.printStackTrace()
if (e.message!!.startsWith("actionId")) {
EApiResult.ACTIONID_NOT_VALID
} else {
EApiResult.ILLEGAL_ARGUMENT
}
} catch (e: LegalTermsConfirmationMissingException) {
e.printStackTrace()
if (e.message!!.startsWith("actionId")) {
EApiResult.ACTIONID_NOT_VALID
} else {
EApiResult.ILLEGAL_ARGUMENT
}
} catch (e: UserActionNotFinishedException) {
e.printStackTrace()
if (e.message!!.startsWith("actionId")) {
EApiResult.ACTIONID_NOT_VALID
} else {
EApiResult.ILLEGAL_ARGUMENT
}
} catch (e: IdentNotSupportedException) {
e.printStackTrace()
if (e.message!!.startsWith("actionId")) {
EApiResult.ACTIONID_NOT_VALID
} else {
EApiResult.ILLEGAL_ARGUMENT
}
} catch (e: EidIdentRequiredException) {
e.printStackTrace()
if (e.message!!.startsWith("actionId")) {
EApiResult.ACTIONID_NOT_VALID
} else {
EApiResult.ILLEGAL_ARGUMENT
}
} catch (e: AccessDeniedException) {
e.printStackTrace()
EApiResult.ACCESS_DENIED.apply { extInfo = e.message!! }
} catch (e: UserActionNotFoundException) {
e.printStackTrace()
EApiResult.ACTIONID_NOT_FOUND
} catch (e: IOException) {
e.printStackTrace()
EApiResult.IO_FAILURE.apply { extInfo = e.message!! }
} catch (e: IllegalStateException) {
e.printStackTrace()
EApiResult.ILLEGAL_STATE
} catch (e: ServiceUnavailableException) {
e.printStackTrace()
EApiResult.SERVICE_UNAVAILABLE
}
return AsyncTaskResultGeneric(null, apiResult)
}
override fun onPostExecute(result: AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>?) {
metaPluginVerifyOnPostExecuteCallback?.let { clb -> result?.let { clb.onPostExecute(it) } }
}
fun setOnPostExecuteCallback(onPostExecuteCallback: IOnPostExecuteCallback<AsyncTaskResultGeneric<VerifyActionIdResult?, EApiResult>>): MetaPluginVerifyTask {
metaPluginVerifyOnPostExecuteCallback = onPostExecuteCallback
return this
}
}

View File

@ -0,0 +1,70 @@
/*
* Created by WebId Solutions GmbH | www.webid-solutions.de.
* See the file "LICENSE" for the full license governing this code.
*/
package de.webidsolutions.metaplugindemo.tasks;
import android.os.AsyncTask;
import java.io.IOException;
import de.webidsolutions.mobile_app.sdk.AccessDeniedException;
import de.webidsolutions.mobile_app.sdk.EidIdentRequiredException;
import de.webidsolutions.mobile_app.sdk.IWebIdMobileAppSdk;
import de.webidsolutions.mobile_app.sdk.IdentNotSupportedException;
import de.webidsolutions.mobile_app.sdk.LegalTermsConfirmationMissingException;
import de.webidsolutions.mobile_app.sdk.ServiceUnavailableException;
import de.webidsolutions.mobile_app.sdk.UserActionNotFinishedException;
import de.webidsolutions.mobile_app.sdk.UserActionNotFoundException;
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult;
/**
* A asynchronous call for sdkInstance.verifyActionId(params[0]).
* Only implemented inside an AsyncTask for demo purposes.
* Can be also be done via other means, e.g. coroutines.
*/
public class VerifyActionIdTask extends AsyncTask<String, Void, AsyncTaskResult<VerifyActionIdResult>> {
private IOnPostExecuteCallback<AsyncTaskResult<VerifyActionIdResult>> iVerifyActionIdInternalOnPostExecuteCallback;
private final IWebIdMobileAppSdk sdkInstance;
@Override
protected AsyncTaskResult<VerifyActionIdResult> doInBackground(String... params) {
String apiResult;
try {
return new AsyncTaskResult<>(sdkInstance.verifyActionId(params[0]), "success");
} catch (
IdentNotSupportedException |
UserActionNotFinishedException |
AccessDeniedException |
EidIdentRequiredException |
LegalTermsConfirmationMissingException |
IOException |
ServiceUnavailableException |
UserActionNotFoundException e
) {
apiResult = e.getClass().getSimpleName();
}
return new AsyncTaskResult<>(null, apiResult);
}
public VerifyActionIdTask(IWebIdMobileAppSdk sdkInstance) {
this.sdkInstance = sdkInstance;
}
@Override
protected void onPostExecute(AsyncTaskResult<VerifyActionIdResult> data) {
if (iVerifyActionIdInternalOnPostExecuteCallback != null) {
iVerifyActionIdInternalOnPostExecuteCallback.onPostExecute(data);
}
}
public VerifyActionIdTask setOnPostExecuteCallback(IOnPostExecuteCallback<AsyncTaskResult<VerifyActionIdResult>> onPostExecuteCallback) {
this.iVerifyActionIdInternalOnPostExecuteCallback = onPostExecuteCallback;
return this;
}
}

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="381.81818"
android:viewportHeight="381.81818">
<group android:translateX="49.159092"
android:translateY="134.57677">
<path
android:pathData="M245.9,58.2c0,12.4 -5.7,21 -19.8,21h-7.3V37.2h7.3C240.2,37.2 245.9,45.8 245.9,58.2M255,58.2c0,-20.9 -12.9,-29.6 -28.8,-29.6H210v59.2h16.1C241.6,87.8 255,79 255,58.2M197.6,28.6h-8.9v59.2h8.9V28.6z"
android:fillColor="#05B1FB"/>
<path
android:fillColor="#FF000000"
android:pathData="M169.9,66.5c0,9.4 -3.4,14.1 -9.6,14.1c-4.4,0 -8.4,-3.2 -10.4,-5.8V56.1c2.3,-2.9 5.9,-5.7 10.1,-5.7C166.4,50.5 169.9,55.4 169.9,66.5M178.6,66.3c0,-16.9 -7.5,-23.8 -17.1,-23.8c-4.6,0 -8.4,2.2 -11.6,5.2V26.2l-8.6,4.5v57.1h8.6v-4.1c2.5,2.7 6.7,5.1 11.2,5.1C170.4,88.7 178.6,81.5 178.6,66.3M124.3,61.5h-20.6c0.8,-7.1 4.3,-11.2 10.1,-11.2C121,50.3 123.9,55.4 124.3,61.5M133.1,64.7c0,-12 -6.1,-22.2 -18.7,-22.2c-11.5,0 -19.4,8.1 -19.4,23.2c0,14.7 8.8,23.1 19.2,23.1c6.8,0 11.4,-2.1 15.3,-5.8l-5.2,-5.6c-3,2.2 -5.9,3.5 -9.6,3.5c-5.4,0 -10.2,-3.6 -11.2,-12.2h29.3C132.9,67.7 133.1,66.3 133.1,64.7M92.8,28.6h-8.6L77,66.8c-0.3,1.4 -0.8,4.7 -1.2,6.9c-0.3,-2.1 -1,-5.2 -1.4,-6.8l-9.6,-38.3h-7.6L47.7,66c-0.4,1.8 -1.3,5.7 -1.6,7.7c-0.3,-1.9 -1,-6 -1.4,-7.8l-7.1,-37.3h-9l12.1,59.2h8.8l9.6,-38.2c0.5,-2 1.4,-6.4 1.7,-7.9c0.3,1.4 1.2,5.8 1.7,7.9l9.2,38.2h9L92.8,28.6z"/>
</group>
</vector>

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/tv_plugins_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_marginTop="13dp"
android:text="Choose Plugins To Add:"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cb_plugin_auto_id_on_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="13dp"
android:text="AutoIdOnServer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_plugins_header" />
<CheckBox
android:id="@+id/cb_plugin_pay_on_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:text="PayOnServer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_auto_id_on_server" />
<CheckBox
android:id="@+id/cb_plugin_eid_on_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:text="EidOnServer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_pay_on_server" />
<CheckBox
android:id="@+id/cb_plugin_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:text="VideoId"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_eid_on_server" />
<TextView
android:id="@+id/logHeadline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/grid_margin"
android:layout_marginTop="@dimen/grid_margin"
android:text="@string/log_headline"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_video" />
<ScrollView
android:id="@+id/scrollViewLog"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/grid_margin"
android:layout_marginEnd="@dimen/grid_margin"
android:layout_marginTop="@dimen/grid_margin"
android:layout_marginBottom="@dimen/grid_margin"
app:layout_constraintBottom_toTopOf="@id/startButton"
app:layout_constraintTop_toBottomOf="@id/logHeadline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/log"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_placeholder"/>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/startButton"
android:layout_width="match_parent"
android:layout_height="@dimen/button_height"
android:text="@string/start_button"
android:backgroundTint="@color/colorBlueWebid"
android:textColor="@color/white"
android:layout_marginBottom="@dimen/grid_margin"
android:layout_marginEnd="@dimen/grid_margin"
android:layout_marginStart="@dimen/grid_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,13 @@
<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>
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Dark">
<!--
Implement your customized style attributes here for standard and/or light theme.
-->
</style>
</resources>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="colorBlueWebid">#05b1fb</color>
<color name="grey">#A49DB2</color>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="grid_margin">24dp</dimen>
<dimen name="button_height">60dp</dimen>
<dimen name="log_margin">40dp</dimen>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@ -0,0 +1,6 @@
<resources>
<string name="app_name">MetaPluginDemo</string>
<string name="start_button">Start Meta Plugin</string>
<string name="log_headline">Log:</string>
<string name="log_placeholder">Nothing yet…</string>
</resources>

View File

@ -0,0 +1,13 @@
<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>
<style name="CustomizedPluginTheme" parent="WebId.PluginTheme.Light">
<!--
Implement your customized style attributes here for standard and/or light theme.
-->
</style>
</resources>

10
build.gradle Normal file
View File

@ -0,0 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

34
gradle.properties Normal file
View File

@ -0,0 +1,34 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# credentials for WebId's test system
# Do not put real credentials here!
# Instead, copy to ~/.gradle/gradle.properties and set the values there.
WEBID_DEMO_USERNAME_TEST=
WEBID_DEMO_APIKEY_TEST=
# credentials for WebId's production system
# Do not put real credentials here!
# Instead, copy to ~/.gradle/gradle.properties and set the values there.
WEBID_DEMO_USERNAME_PROD=
WEBID_DEMO_APIKEY_PROD=

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Jul 13 14:56:30 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
gradlew vendored Executable file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

22
settings.gradle Normal file
View File

@ -0,0 +1,22 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
// add the webid repo to receive the plugin
maven {
url 'https://api.webid-solutions.de/releases/android/maven/repository/internal'
}
}
}
rootProject.name = "MetaPluginDemo"
include ':app'