t/oxr_android: Include library attribution/notices in "about" activity.

This commit is contained in:
Ryan Pavlik 2020-10-30 16:13:05 -05:00
parent f70b1abd88
commit 240b8f3047
17 changed files with 262 additions and 12 deletions

View file

@ -3,13 +3,16 @@
buildscript {
ext.kotlin_version = '1.4.10'
ext.latestAboutLibsRelease = "8.4.3"
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"
}
}
plugins {

View file

@ -3,11 +3,19 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
androidGitVersion {
tagPattern(/^v[0-9]+.*/)
codeFormat = 'MNNPPPBBB'
}
def parseOpenXRVersion(def fn) {
def matches = file(fn).readLines().find { it.contains('XR_CURRENT_API_VERSION') } =~ ~/XR_MAKE_VERSION\(([^\)]+)\)/
def components = matches[0][1].split(',').each { it.replace(' ', '').trim() }
String.join('.', components)
}
android {
compileSdkVersion project.sharedTargetSdk
buildToolsVersion '30.0.2'
@ -24,6 +32,9 @@ android {
resValue "string", "monado_lib_version", "${versionName}"
resValue "string", "app_name", "Monado XR"
resValue "string", "library_openxrheaders_libraryVersion", parseOpenXRVersion("../../../external/openxr_includes/openxr/openxr.h")
externalNativeBuild {
cmake {
arguments "-DEIGEN3_INCLUDE_DIR=${project.eigenIncludeDir}", "-DANDROID_PLATFORM=26", "-DANDROID_STL=c++_shared", "-DANDROID_ARM_NEON=TRUE"
@ -34,7 +45,8 @@ android {
buildTypes {
release {
minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// Gradle plugin produces proguard-android-optimize.txt from @Keep annotations
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
@ -65,10 +77,20 @@ android {
}
}
aboutLibraries {
configPath = "config"
}
dependencies {
outOfProcessImplementation project(':src:xrt:ipc:android')
implementation project(':src:xrt:auxiliary:android')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"
implementation "androidx.cardview:cardview:1.*.*"
implementation "androidx.recyclerview:recyclerview:1.1.*"
implementation "com.google.android.material:material:1.1.*"
}

View file

@ -0,0 +1,10 @@
# Copyright 2020, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
# see http://developer.android.com/guide/developing/tools/proguard.html
# Trying to keep most of them in source code annotations and let Gradle do the work
# For library auto-detection in AboutLibraries
-keep class .R
-keep class **.R$* {
<fields>;
}

View file

@ -13,9 +13,12 @@ import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.mikepenz.aboutlibraries.LibsBuilder;
public class MainActivity extends AppCompatActivity {
@Override
@ -32,6 +35,20 @@ public class MainActivity extends AppCompatActivity {
int status = VrModeStatus.detectStatus(this, BuildConfig.APPLICATION_ID);
VrModeStatus statusFrag = VrModeStatus.newInstance(status);
fragmentTransaction.add(R.id.statusFrame, statusFrag, null);
Fragment libsFragment = (new LibsBuilder())
.withFields(R.string.class.getFields())
// We do this ourselves bigger
.withAboutIconShown(false)
// Let the fragment show our version
.withAboutVersionShown(true)
// Not sure why you'd do this without license info
.withLicenseShown(true)
.supportFragment();
fragmentTransaction.add(R.id.aboutFrame, libsFragment, null);
fragmentTransaction.commit();
}
}

View file

@ -14,7 +14,7 @@
android:id="@+id/imageView"
android:layout_width="@android:dimen/thumbnail_width"
android:layout_height="@android:dimen/thumbnail_height"
android:layout_marginTop="24dp"
android:layout_marginTop="8dp"
android:contentDescription="@string/monado_logo"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
@ -39,12 +39,12 @@
android:id="@+id/textPowered"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="252dp"
android:layout_marginTop="8dp"
android:text="@string/powered_by_monado"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@+id/textView" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
@ -56,16 +56,35 @@
<FrameLayout
android:id="@+id/statusFrame"
android:layout_width="260dp"
android:layout_height="248dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@+id/btnOSS"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textPowered">
</FrameLayout>
<FrameLayout
android:id="@+id/aboutFrame"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/statusFrame">
<Button
android:id="@+id/btnAndroid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:visibility="gone" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -12,17 +12,15 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<TextView
android:id="@+id/textEnabledDisabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="@string/vr_mode_enabled"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"

View file

@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003<br>
<br>
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute, execute,
and transmit the Software, and to prepare derivative works of the Software,
and to permit third-parties to whom the Software is furnished to do so, all
subject to the following:<br>
<br>
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer, must
be included in all copies of the Software, in whole or in part, and all derivative
works of the Software, unless such copies or derivative works are solely in
the form of machine-executable object code generated by a source language
processor.<br>
<br>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_cjson">type</string>
<string name="library_cjson_author">Dave Gamble and cJSON contributors</string>
<string name="library_cjson_authorWebsite">https://github.com/DaveGamble/cJSON</string>
<string name="library_cjson_libraryName">cJSON</string>
<string name="library_cjson_libraryDescription">cJSON is a parser that tries to share the same philosophy as JSON itself. Simple, dumb, out of the way.</string>
<string name="library_cjson_libraryVersion">1.7.12</string>
<string name="library_cjson_licenseIds">mit</string>
<string name="library_cjson_isOpenSource">true</string>
<string name="library_cjson_repositoryLink">https://github.com/DaveGamble/cJSON</string>
<string name="library_cjson_type">native</string>
</resources>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_flexkalman">type</string>
<string name="library_flexkalman_author">Sensics and Collabora, Ltd.</string>
<string name="library_flexkalman_authorWebsite">https://github.com/rpavlik/UVBI-and-KalmanFramework-Standalone</string>
<string name="library_flexkalman_libraryName">flexkalman</string>
<string name="library_flexkalman_libraryDescription">Flexible Kalman filter framework.</string>
<string name="library_flexkalman_licenseIds">apache_2_0</string>
<string name="library_flexkalman_isOpenSource">true</string>
<string name="library_flexkalman_repositoryLink">https://github.com/rpavlik/UVBI-and-KalmanFramework-Standalone</string>
<string name="library_flexkalman_type">native</string>
</resources>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_jnipp">type</string>
<string name="library_jnipp_author">Mitchell Dowd, Ryan Pavlik</string>
<string name="library_jnipp_authorWebsite">https://github.com/rpavlik/jnipp</string>
<string name="library_jnipp_libraryName">JNIPP</string>
<string name="library_jnipp_libraryDescription">C++ wrapper for the Java Native Interface</string>
<string name="library_jnipp_licenseIds">mit</string>
<string name="library_jnipp_isOpenSource">true</string>
<string name="library_jnipp_repositoryLink">https://github.com/rpavlik/jnipp</string>
<string name="library_jnipp_type">native</string>
</resources>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_Monado">type</string>
<string name="library_Monado_author">Collabora, Ltd. and the Monado contributors</string>
<string name="library_Monado_authorWebsite">https://monado.freedesktop.org</string>
<string name="library_Monado_libraryName">Monado</string>
<string name="library_Monado_libraryDescription">XR runtime construction kit</string>
<string name="library_Monado_libraryVersion">@string/monado_lib_version</string>
<string name="library_Monado_licenseIds">bsl_1_0</string>
<string name="library_Monado_isOpenSource">true</string>
<string name="library_Monado_repositoryLink">https://gitlab.freedesktop.org/monado/monado</string>
<string name="library_Monado_type">native</string>
</resources>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_openxrheaders">type</string>
<string name="library_openxrheaders_author">The Khronos Group Inc.</string>
<string name="library_openxrheaders_authorWebsite">https://khronos.org/openxr</string>
<string name="library_openxrheaders_libraryName">OpenXR Headers</string>
<string name="library_openxrheaders_licenseIds">apache_2_0,mit</string>
<string name="library_openxrheaders_isOpenSource">true</string>
<string name="library_openxrheaders_repositoryLink">https://github.com/KhronosGroup/OpenXR-SDK</string>
<string name="library_openxrheaders_type">native</string>
</resources>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_openxrloaderinterfaces">type</string>
<string name="library_openxrloaderinterfaces_author">The Khronos Group Inc., Valve Corporation, LunarG, Inc.</string>
<string name="library_openxrloaderinterfaces_authorWebsite">https://khronos.org/openxr</string>
<string name="library_openxrloaderinterfaces_libraryName">OpenXR Loader Interfaces</string>
<string name="library_openxrloaderinterfaces_licenseIds">apache_2_0</string>
<string name="library_openxrloaderinterfaces_libraryVersion">1.0</string>
<string name="library_openxrloaderinterfaces_isOpenSource">true</string>
<string name="library_openxrloaderinterfaces_repositoryLink">https://github.com/KhronosGroup/OpenXR-SDK</string>
<string name="library_openxrloaderinterfaces_type">native</string>
</resources>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_plu_quatexpmap">type</string>
<string name="library_quatexpmap_author">Sensics, Inc., Collabora, Ltd.</string>
<string name="library_quatexpmap_libraryName">Quaternion Exponential Map</string>
<string name="library_quatexpmap_licenseIds">apache_2_0</string>
<string name="library_quatexpmap_isOpenSource">true</string>
<string name="library_quatexpmap_repositoryLink">https://gitlab.freedesktop.org/monado/monado/-/blob/master/src/xrt/auxiliary/math/m_quatexpmap.cpp</string>
<string name="library_quatexpmap_type">native</string>
</resources>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Copyright 2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0
-->
<string name="define_license_bsl_1_0" translatable="false" />
<string name="license_bsl_1_0_licenseName" translatable="false">Boost Software License 1.0</string>
<string name="license_bsl_1_0_licenseWebsite" translatable="false">https://www.boost.org/LICENSE_1_0.txt</string>
<string name="license_bsl_1_0_licenseShortDescription" translatable="false">
<![CDATA[
<p>Boost Software License - Version 1.0 - August 17th, 2003</p>
<p>Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute, execute,
and transmit the Software, and to prepare derivative works of the Software,
and to permit third-parties to whom the Software is furnished to do so, all
subject to the following:</p>
<p>The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer, must
be included in all copies of the Software, in whole or in part, and all derivative
works of the Software, unless such copies or derivative works are solely in
the form of machine-executable object code generated by a source language
processor.</p>
<pTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</p>
]]>
</string>
<!-- name of the license file under the raw folder -->
<string name="license_bsl_1_0_licenseDescription" translatable="false">raw:bsl_1_0</string>
</resources>

View file

@ -6,7 +6,6 @@
<!-- app_name supplied by build system -->
<string name="notice">"NOTICE text goes here\n\n\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam bibendum enim urna, consectetur mattis urna consectetur et. Aliquam erat volutpat. Nam dictum mi ac metus ullamcorper, eu finibus diam porta. Sed semper arcu mauris, eu porttitor arcu aliquet a. Donec et mauris id nulla aliquet eleifend. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque elementum velit non sem rutrum euismod.\n\nFusce venenatis justo ut suscipit sodales. Nunc tempor nunc nec est rhoncus varius. Quisque eget posuere sem, ac euismod nibh. Mauris viverra nisi varius varius hendrerit. Donec nibh est, ornare et ante eu, ultricies aliquet dolor. Nam laoreet velit tellus. In non felis sit amet velit mattis porttitor. Pellentesque non quam non erat porta auctor ut eget justo. Praesent non sem vitae metus blandit lacinia fringilla id mauris. Fusce quam magna, sodales eu tincidunt quis, accumsan et purus. Integer ipsum quam, egestas in malesuada id, gravida sed justo. Sed at leo tempus, porta turpis id, hendrerit dui. Nunc lobortis tortor ac orci vehicula, in sollicitudin ex pellentesque. Praesent euismod vulputate felis sed consectetur. Ut vitae quam velit.\n\nQuisque sodales sem nunc, sed semper ligula gravida ac. Nulla sit amet justo et enim suscipit lacinia ut vitae quam. Duis magna ipsum, gravida et eros a, vehicula viverra nibh. Fusce eu nisl ut massa congue auctor. Duis metus neque, egestas in accumsan scelerisque, rutrum efficitur libero. Sed bibendum id ante at pellentesque. Cras eget velit eu diam lacinia fringilla. Proin eleifend sit amet orci ac congue. Proin sed consequat justo. Sed et posuere velit.\n\nMauris consequat dignissim dui, nec ultrices augue elementum nec. Cras feugiat, ante non fringilla rhoncus, dolor metus volutpat eros, at rhoncus purus libero et mi. Sed rutrum iaculis nibh finibus congue. Maecenas sed mi vel orci volutpat sodales. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis non tortor aliquam felis mattis ultricies. Etiam iaculis massa id lacus dapibus placerat. Praesent ullamcorper imperdiet risus et commodo.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent scelerisque tellus purus, vel placerat sem fringilla in. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque lobortis mi nec luctus ullamcorper. Praesent diam tortor, accumsan ut vulputate non, volutpat eget ipsum. Sed sit amet ligula dictum, mollis lorem at, venenatis enim. Nullam mi nisl, pharetra suscipit facilisis non, posuere in nunc. Aliquam augue libero, eleifend non sagittis a, varius et arcu. Quisque arcu velit, lobortis eu felis ut, facilisis maximus urna. Integer nisl nisi, interdum sit amet ante nec, laoreet ullamcorper lacus. Donec lobortis non orci ac scelerisque. "</string>
<string name="powered_by_monado">An XR Runtime, powered by <a href="https://monado.dev">Monado</a></string>
</resources>

View file

@ -5,7 +5,7 @@
-->
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>