Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bl4ckspell7 committed Sep 3, 2024
0 parents commit ddb0cb1
Show file tree
Hide file tree
Showing 232 changed files with 128,913 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.iml
.gradle
/local.properties
/.idea/
/.kotlin/
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
app/release
104 changes: 104 additions & 0 deletions .run/Tests in 'edu.kit.dppviewer'.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tests in 'edu.kit.dppviewer'" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":app:testDebugUnitTest" />
<option value="--tests" />
<option value="&quot;edu.kit.dppviewer.*&quot;" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<EXTENSION ID="com.intellij.execution.ExternalSystemRunConfigurationJavaExtension">
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.data.client.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.data.model.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.data.repository.product.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.ui.feature.productpage.filter.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.ui.feature.productpage.product.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
</EXTENSION>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>true</RunAsTest>
<method v="2" />
</configuration>
<configuration default="false" name="Tests in 'edu.kit.dppviewer'" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":app:testDebugUnitTest" />
<option value="--tests" />
<option value="&quot;edu.kit.dppviewer.*&quot;" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<EXTENSION ID="com.intellij.execution.ExternalSystemRunConfigurationJavaExtension">
<extension name="coverage">
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.ui.feature.productpage.product.model.FilteredProduct" />
<option name="ENABLED" value="true" />
<option name="INCLUDE" value="false" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.ui.feature.productpage.product.model.Renderable" />
<option name="ENABLED" value="true" />
<option name="INCLUDE" value="false" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.data.client.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.data.model.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.ui.feature.productpage.filter.*" />
<option name="ENABLED" value="true" />
</pattern>
<pattern>
<option name="PATTERN" value="edu.kit.dppviewer.ui.feature.productpage.product.model.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
</EXTENSION>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>true</RunAsTest>
<method v="2" />
</configuration>
</component>
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# DPP Viewer
Android App for displaying Digital Product Passport Files.

## Features

### Import a DPP File from a FAAAST server
- Scan QR Code
- Import QR Code from Gallery Photo
- Enter URL to server manually

### View Product Information
- Displays product images if available
- Applies a filter template to the dpp data to improve user experience (Option to view all information is available)
- User is able to view Submodels

### Usage of AI
*GitHub Copilot* was used to generate parts of the Kotlin Documentation (KDoc).

The `setUpCertificate` function in the `AppUtilTest` class, which creates an X.509 certificate from a PEM file, was also generated by *GitHub Copilot*

In the `fetchTextFromUrlAsString` function in the `AppUtil` class, our HTTPS request is disguised as a request from a browser. The part of codes that adds the browser headers was generated by *Claude*.

*ChatGPT-4o* was used to generate the `analyzeQRCode()` method, which can detect QR Codes in a Bitmap.

### Image Sources
We show these placeholder images to the user, if the DPP does not contain images itself.
| Product Type | Placeholder Image Source |
| --- | --- |
| Textile | https://pixabay.com/photos/material-textile-to-dye-4590139/ |
| Battery | https://pixabay.com/vectors/battery-electrical-electricity-312747/ |
| Smartphone | https://pixabay.com/illustrations/smartphone-phone-android-531250/ |
| Other (Unknown) | https://pixabay.com/vectors/box-cardboard-cube-isometric-1299001/ |
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
178 changes: 178 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)

/**
* Compose
*/
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.serialization)

/**
* Dagger Hilt
*/
alias(libs.plugins.ksp)
alias(libs.plugins.hilt.android)
}

android {
namespace = "edu.kit.dppviewer"
compileSdk = 34

defaultConfig {
applicationId = "edu.kit.dppviewer"
minSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
buildFeatures {
buildConfig = true
compose = true
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"

)
buildConfigField("Boolean", "INCLUDE_DEBUG_OPTIONS", "false")
signingConfig = signingConfigs.getByName("debug")
}

debug {
isDebuggable = true
buildConfigField("Boolean", "INCLUDE_DEBUG_OPTIONS", "true")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}

sourceSets {
getByName("main") {
resources.srcDir("src/main/res")
assets.srcDirs(
file("src/main/assets")
)
}
getByName("test") {
resources.srcDir("src/main/res")
assets.srcDirs(
file("src/main/assets")
)
}
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.lifecycle.runtime.compose.android)
implementation(libs.androidx.adaptive.android)

androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)

debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

/**
* Material 3
*/
implementation(libs.material)

/**
* Compose
*/
implementation(libs.lifecycle.viewmodel.compose)
implementation(libs.androidx.material.icons.extended)
implementation(libs.androidx.navigation.compose)
implementation(libs.kotlinx.serialization.json)

/**
* Dagger Hilt
*/
ksp(libs.hilt.android.compiler)
implementation(libs.hilt.android)
implementation(libs.androidx.hilt.navigation.compose)

/**
* Camera
*/
implementation(libs.androidx.camera.core)
implementation(libs.androidx.camera.lifecycle)
implementation(libs.androidx.camera.view)
implementation(libs.androidx.camera.camera2)

/**
* QR Code Scanner & Generator
*/
implementation(libs.zxing.core)
implementation(libs.zxing.android.core)

/**
* Displaying product pictures
*/
implementation(libs.coil.compose)
implementation(libs.glide)
implementation(libs.androidx.foundation)

/**
* Testing
*/
testImplementation(libs.junit)
testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junitJupiterEngine)
testImplementation(libs.junitVintageEngine)

testImplementation(libs.robolectric)
testImplementation(libs.mockito.core)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.truth)


/**
* Jackson to parse json
*/
implementation(libs.jackson.core)
implementation(libs.jackson.datatype.jsr310)
implementation(libs.jackson.databind)
implementation(libs.jackson.module.kotlin)

/**
* OkHttp Client
*/
implementation(libs.okhttp)

/**
* Adaptive Navigation Suite for supporting different Screen Sizes
*/
implementation(libs.androidx.material3.adaptive.navigation.suite)
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package edu.kit.dppviewer

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("edu.kit.dppviewer", appContext.packageName)
}
}
Loading

0 comments on commit ddb0cb1

Please sign in to comment.