diff --git a/app/build.gradle b/app/build.gradle
index e3fe45a7..191bd48b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,5 +1,6 @@
plugins {
id "com.github.triplet.play" version "3.6.0"
+ id "com.mikepenz.aboutlibraries.plugin"
}
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
@@ -99,6 +100,12 @@ android {
}
}
+// https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt
+aboutLibraries {
+ prettyPrint = true
+ configPath = "config/aboutLibraries"
+}
+
dependencies {
// Room
implementation fileTree(include: ["*.jar"], dir: "libs")
@@ -107,23 +114,23 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.test:core-ktx:1.5.0"
- def room_version = "2.4.3"
+ def roomVersion = "2.4.3"
- implementation "androidx.room:room-runtime:$room_version"
- kapt "androidx.room:room-compiler:$room_version"
+ implementation "androidx.room:room-runtime:$roomVersion"
+ kapt "androidx.room:room-compiler:$roomVersion"
// optional - Kotlin Extensions and Coroutines support for Room
- implementation "androidx.room:room-ktx:$room_version"
+ implementation "androidx.room:room-ktx:$roomVersion"
// optional - RxJava support for Room
- implementation "androidx.room:room-rxjava2:$room_version"
+ implementation "androidx.room:room-rxjava2:$roomVersion"
// optional - Guava support for Room, including Optional and ListenableFuture
- implementation "androidx.room:room-guava:$room_version"
+ implementation "androidx.room:room-guava:$roomVersion"
implementation "net.sf.kxml:kxml2:2.3.0"
implementation "com.caverock:androidsvg:1.4"
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
// Tests
@@ -143,9 +150,9 @@ dependencies {
*
* https://github.com/noties/Markwon
*/
- def markwon_version = "4.6.2"
- implementation "io.noties.markwon:core:$markwon_version"
- implementation "io.noties.markwon:linkify:$markwon_version"
+ def markwonVersion = "4.6.2"
+ implementation "io.noties.markwon:core:$markwonVersion"
+ implementation "io.noties.markwon:linkify:$markwonVersion"
/*
* CSV library for tour book export
@@ -156,6 +163,13 @@ dependencies {
// For introspection
implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.0"
+
+ /*
+ * Listing all used libraries
+ *
+ * https://github.com/mikepenz/AboutLibraries
+ */
+ implementation "com.mikepenz:aboutlibraries-core:${aboutlibrariesVersion}"
}
repositories {
mavenCentral()
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 389350b7..9e9baed8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -75,6 +75,12 @@
android:parentActivityName=".AboutActivity"
android:theme="@style/AppTheme.ActionBar">
+
+
Unit)? = null) {
layoutInflater.inflate(R.layout.about_entry, null).let {
- val contentAbout = findViewById(R.id.aboutContent)
it.setOnClickListener { callback?.invoke() ?: _activityUtils.openUrl(description) }
it.findViewById(R.id.aboutEntryTitle).text = title
it.findViewById(R.id.aboutEntryDescription).text = description
- contentAbout.addView(it)
+ findViewById(R.id.aboutContent).addView(it)
}
}
private fun _showPrivacyPolicy() {
- val intent = Intent(this, PrivacyPolicyActivity::class.java)
- startActivity(intent)
+ startActivity(Intent(this, PrivacyPolicyActivity::class.java))
}
private fun _selectContactConcern() {
@@ -82,4 +84,8 @@ class AboutActivity : BaseNavigationActivity() {
setNegativeButton()
}.show()
}
+
+ private fun _showLibraries() {
+ startActivity(Intent(this, AboutLibrariesActivity::class.java))
+ }
}
diff --git a/app/src/main/java/com/yacgroup/yacguide/AboutLibrariesActivity.kt b/app/src/main/java/com/yacgroup/yacguide/AboutLibrariesActivity.kt
new file mode 100644
index 00000000..39bcce85
--- /dev/null
+++ b/app/src/main/java/com/yacgroup/yacguide/AboutLibrariesActivity.kt
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2023 Christian Sommer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/*
+ * NOTE:
+ * The library can automatically generate a view.
+ * However, it uses material design elements which makes things a bit inconsistent within
+ * this app. As soon as the app is migrated to material design, this and related code
+ * may become obsolete.
+ */
+
+package com.yacgroup.yacguide
+
+import android.os.Bundle
+import android.widget.LinearLayout
+import android.widget.TextView
+import androidx.appcompat.app.AppCompatActivity
+import com.mikepenz.aboutlibraries.Libs
+import com.mikepenz.aboutlibraries.entity.Library
+import com.yacgroup.yacguide.utils.ActivityUtils
+
+class AboutLibrariesActivity : AppCompatActivity() {
+
+ private lateinit var _activityUtils: ActivityUtils
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ _activityUtils = ActivityUtils(this)
+ setTitle(R.string.software_and_licenses)
+ setContentView(R.layout.activity_about_libraries)
+ _displayContent()
+ }
+
+ private fun _displayContent() {
+ // The resource JSON file is automatically generated
+ // by the Gradle plugin com.mikepenz.aboutlibraries.plugin
+ val jsonStr = resources.openRawResource(R.raw.aboutlibraries)
+ .bufferedReader().use { it.readText() }
+ val libs = Libs.Builder()
+ .withJson(jsonStr)
+ .build()
+ libs.libraries.sortedBy { it.uniqueId }.forEach {
+ _createEntry(it)
+ }
+ }
+
+ private fun _createEntry(lib: Library) {
+ layoutInflater.inflate(R.layout.about_libraries_entry, null).let {
+ it.setOnClickListener { _activityUtils.openUrl(lib.website.orEmpty()) }
+ it.findViewById(R.id.aboutLibrariesName).text = lib.uniqueId
+ it.findViewById(R.id.aboutLibrariesVersion).text = lib.artifactVersion
+ val licenses = lib.licenses.joinToString(
+ separator = ", ",
+ transform = { license -> license.name }
+ )
+ it.findViewById(R.id.aboutLibrariesLicenses).text = licenses
+ findViewById(R.id.aboutLibrariesContent).addView(it)
+ }
+ }
+}
diff --git a/app/src/main/java/com/yacgroup/yacguide/PrivacyPolicyActivity.kt b/app/src/main/java/com/yacgroup/yacguide/PrivacyPolicyActivity.kt
index f723ff10..9affcc7c 100644
--- a/app/src/main/java/com/yacgroup/yacguide/PrivacyPolicyActivity.kt
+++ b/app/src/main/java/com/yacgroup/yacguide/PrivacyPolicyActivity.kt
@@ -31,7 +31,6 @@ class PrivacyPolicyActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setTitle(R.string.privacy_policy)
setContentView(R.layout.activity_privacy_policy)
- supportActionBar!!.setDisplayHomeAsUpEnabled(true)
_displayContent()
}
@@ -52,4 +51,4 @@ class PrivacyPolicyActivity : AppCompatActivity() {
val privacyTextView = findViewById(R.id.privacyPolicyTextView)
markwon.setMarkdown(privacyTextView, privacyStr)
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/res/layout/about_entry.xml b/app/src/main/res/layout/about_entry.xml
index a6a55181..2f1a0e94 100644
--- a/app/src/main/res/layout/about_entry.xml
+++ b/app/src/main/res/layout/about_entry.xml
@@ -28,7 +28,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
- android:layout_marginStart="20dp"
+ android:layout_marginStart="@dimen/activity_horizontal_margin"
android:textAlignment="textStart"
android:textSize="16sp"
android:textColor="?android:textColorPrimary"/>
@@ -37,16 +37,14 @@
android:id="@+id/aboutEntryDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="20dp"
+ android:layout_marginStart="@dimen/activity_horizontal_margin"
android:textAlignment="textStart"
android:textSize="14sp"
android:textColor="?android:textColorSecondary"/>
+ style="@style/ThinDivider"/>
-
\ No newline at end of file
+
diff --git a/app/src/main/res/layout/about_libraries_entry.xml b/app/src/main/res/layout/about_libraries_entry.xml
new file mode 100644
index 00000000..df1a4dbf
--- /dev/null
+++ b/app/src/main/res/layout/about_libraries_entry.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_about_libraries.xml b/app/src/main/res/layout/activity_about_libraries.xml
new file mode 100644
index 00000000..703a9d63
--- /dev/null
+++ b/app/src/main/res/layout/activity_about_libraries.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6bb4e612..771af223 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -60,6 +60,7 @@
Datenbezugsquelle
Datenschutzerklärung
Lizenz
+ Externe Software und Lizenzen
Version
Kontakt
Generelles Feedback und Fehler melden
diff --git a/build.gradle b/build.gradle
index f9f4a0a3..2446bcae 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = "1.7.20"
+ ext.kotlinVersion = "1.7.20"
+ ext.aboutlibrariesVersion = "10.5.2"
repositories {
google()
@@ -9,7 +10,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.8.2.0"
// NOTE: Do not place your application dependencies here; they belong
@@ -17,6 +18,10 @@ buildscript {
}
}
+plugins {
+ id "com.mikepenz.aboutlibraries.plugin" version "${aboutlibrariesVersion}" apply false
+}
+
allprojects {
repositories {
google()
diff --git a/config/aboutLibraries/libraries/lib_apache_commons_csv.json b/config/aboutLibraries/libraries/lib_apache_commons_csv.json
new file mode 100644
index 00000000..c58f93f7
--- /dev/null
+++ b/config/aboutLibraries/libraries/lib_apache_commons_csv.json
@@ -0,0 +1,6 @@
+{
+ "uniqueId": "org.apache.commons:commons-csv",
+ "licenses": [
+ "Apache-2.0"
+ ]
+}