Add open-source notices

This commit is contained in:
Patryk Michalik
2021-03-22 19:05:52 +01:00
parent 32c5e8bd64
commit 4b1884816c
5 changed files with 62 additions and 1 deletions

View File

@@ -194,5 +194,13 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.AppCompat.DayNight" />
</application>
</manifest>

View File

@@ -12,6 +12,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.0.0-alpha10'
classpath PROTOBUF_CLASS_PATH
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
}
}
@@ -45,6 +46,7 @@ allprojects {
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.protobuf'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
final def commitHash = { ->
final def stdout = new ByteArrayOutputStream()
@@ -228,6 +230,7 @@ allprojects {
}
dependencies {
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
implementation "androidx.recyclerview:recyclerview:${ANDROID_X_VERSION}"
implementation "androidx.preference:preference-ktx:${ANDROID_X_VERSION}"

View File

@@ -44,7 +44,7 @@
<string name="twitter" translatable="false">Twitter</string>
<string name="github" translatable="false">GitHub</string>
<string name="team_members">Team Members</string>
<string name="os_licenses">Open-Source Licenses</string>
<string name="acknowledgements">Acknowledgements</string>
<string name="patryk_description">To be determined.</string>
<string name="kshitij_description">To be determined.</string>
<string name="devops_engineer">DevOps Engineer</string>

View File

@@ -1,5 +1,6 @@
package app.lawnchair.ui.preferences
import android.content.Intent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
@@ -17,9 +18,12 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import app.lawnchair.util.preferences.getFormattedVersionName
import com.android.launcher3.R
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
@Composable
fun About() {
val context = LocalContext.current
Column(
modifier = Modifier
.fillMaxWidth()
@@ -115,5 +119,12 @@ fun About() {
url = "https://twitter.com/skittles9823"
)
}
PreferenceGroup(useTopPadding = true) {
ClickListenerPreference(label = stringResource(id = R.string.acknowledgements), showDivider = false, onClick = {
val intent = Intent(context, OssLicensesMenuActivity::class.java)
OssLicensesMenuActivity.setActivityTitle(context.getString(R.string.acknowledgements))
context.startActivity(intent)
})
}
}
}

View File

@@ -0,0 +1,39 @@
package app.lawnchair.ui.preferences
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.navigate
@Composable
fun ClickListenerPreference(
label: String,
subtitle: String? = null,
onClick: () -> Unit,
showDivider: Boolean = true
) =
PreferenceTemplate(height = if (subtitle != null) 72.dp else 52.dp, showDivider = showDivider) {
Column(
verticalArrangement = Arrangement.Center,
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight()
.clickable(onClick = onClick)
.padding(start = 16.dp, end = 16.dp),
) {
Text(text = label, style = MaterialTheme.typography.subtitle1, color = MaterialTheme.colors.onBackground)
subtitle?.let {
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(text = it, style = MaterialTheme.typography.body2, color = MaterialTheme.colors.onBackground)
}
}
}
}