diff --git a/.github/workflows/build_debug_apk.yml b/.github/workflows/build_debug_apk.yml new file mode 100644 index 00000000000..f94b70d8209 --- /dev/null +++ b/.github/workflows/build_debug_apk.yml @@ -0,0 +1,84 @@ +name: Build debug APK + +on: + workflow_dispatch: + push: + branches: + - master + +jobs: + build-debug-apk: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Check out repository + uses: actions/checkout@v2.3.4 + with: + submodules: true + - name: Restore Gradle cache + uses: actions/cache@v2.1.4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-gradle- + - name: Set up Java 11 + uses: actions/setup-java@v1.4.3 + with: + java-version: 11 + - name: Grant execution permission to Gradle Wrapper + run: chmod +x gradlew + - name: Build debug APK + run: ./gradlew assembleDebug + - name: Sign debug APK + uses: r0adkll/sign-android-release@v1 + id: sign-debug-apk + with: + releaseDirectory: app/build/outputs/apk/debug + signingKeyBase64: ${{ secrets.KEYSTORE }} + alias: ${{ secrets.KEY_ALIAS }} + keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + - name: Rename artifact + run: | + oldArtifactPath="${{ steps.sign-debug-apk.outputs.signedReleaseFile }}" + newArtifactPath="${oldArtifactPath%'-signed.apk'}.apk" + echo "ARTIFACT_PATH=$newArtifactPath" >> $GITHUB_ENV + mv "$oldArtifactPath" "$newArtifactPath" + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: Debug APK + path: ${{ env.ARTIFACT_PATH }} + send-notifications: + runs-on: ubuntu-latest + needs: build-debug-apk + steps: + - name: Check out repository + uses: actions/checkout@v2.3.4 + with: + submodules: true + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install Python packages + run: | + python -m pip install --upgrade pip + pip install gitpython requests + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: Debug APK + path: artifacts/debug-apk + - name: Send notifications + run: python send_notifications.py + env: + GITHUB_EVENT_BEFORE: ${{ github.event.before }} + TELEGRAM_CI_BOT_TOKEN: ${{ secrets.TELEGRAM_CI_BOT_TOKEN }} + TELEGRAM_CI_CHANNEL_ID: ${{ secrets.TELEGRAM_CI_CHANNEL_ID }} + TELEGRAM_TEAM_GROUP_ID: ${{ secrets.NOTIFY_CHANNEL_ID }} + ARTIFACT_DIRECTORY: artifacts/debug-apk + GITHUB_REF: ${{ github.ref }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..25d9b602cf8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.iml +.gradle +/local.properties +.idea +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 00000000000..42afabfd2ab --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 00000000000..c2a94d60f7f --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,58 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} +android { + compileSdk 31 + defaultConfig { + applicationId "app.lawnchair.lawnicons" + minSdk 26 + targetSdk 31 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary true + } + } + 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 { + compose true + } + composeOptions { + kotlinCompilerExtensionVersion compose_version + } + packagingOptions { + resources { + excludes += '/META-INF/{AL2.0,LGPL2.1}' + } + } +} +dependencies { + implementation 'androidx.core:core-ktx:1.7.0' + implementation "androidx.compose.ui:ui:$compose_version" + implementation "androidx.compose.material:material:$compose_version" + implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' + implementation 'androidx.activity:activity-compose:1.3.1' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" + debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" + implementation"androidx.compose.material3:material3:1.0.0-alpha01" + implementation "com.google.accompanist:accompanist-insets:$accompanist_version" + implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version" +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 00000000000..e69de29bb2d diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..942ad8262d6 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/Elevation.kt b/app/src/main/java/app/lawnchair/lawnicons/Elevation.kt new file mode 100644 index 00000000000..c9e1e02b136 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/Elevation.kt @@ -0,0 +1,12 @@ +package app.lawnchair.lawnicons + +import androidx.compose.ui.unit.dp + +object Elevation { + val Level0 = 0.0.dp + val Level1 = 1.0.dp + val Level2 = 3.0.dp + val Level3 = 6.0.dp + val Level4 = 8.0.dp + val Level5 = 12.0.dp +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/IconPreview.kt b/app/src/main/java/app/lawnchair/lawnicons/IconPreview.kt new file mode 100644 index 00000000000..a4f72b2bbd2 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/IconPreview.kt @@ -0,0 +1,36 @@ +package app.lawnchair.lawnicons + +import androidx.annotation.DrawableRes +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp + +@Composable +fun IconPreview(@DrawableRes iconId: Int) { + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .padding(all = 8.dp) + .aspectRatio(ratio = 1F) + .clip(shape = CircleShape) + .background(color = MaterialTheme.colorScheme.surfaceColorAtElevation(Elevation.Level2)) + ) { + Icon( + painter = painterResource(id = iconId), + contentDescription = null, + modifier = Modifier.fillMaxSize(fraction = 0.6f), + tint = MaterialTheme.colorScheme.onBackground + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/IconPreviewGrid.kt b/app/src/main/java/app/lawnchair/lawnicons/IconPreviewGrid.kt new file mode 100644 index 00000000000..ff6801f8854 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/IconPreviewGrid.kt @@ -0,0 +1,34 @@ +package app.lawnchair.lawnicons + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.lazy.GridCells +import androidx.compose.foundation.lazy.LazyVerticalGrid +import androidx.compose.foundation.lazy.items +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.unit.dp +import com.google.accompanist.insets.LocalWindowInsets + +@Composable +@ExperimentalFoundationApi +fun IconPreviewGrid() { + val context = LocalContext.current + val iconIds = remember { getIconIds(context = context) } + val density = LocalDensity.current + LazyVerticalGrid( + cells = GridCells.Fixed(count = 5), + contentPadding = PaddingValues( + start = 8.dp, + top = with(density) { LocalWindowInsets.current.statusBars.top.toDp() }, + end = 8.dp, + bottom = with(density) { LocalWindowInsets.current.navigationBars.bottom.toDp() } + ) + ) { + items(items = iconIds) { iconId -> + IconPreview(iconId = iconId) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/Lawnicons.kt b/app/src/main/java/app/lawnchair/lawnicons/Lawnicons.kt new file mode 100644 index 00000000000..29fc4df3519 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/Lawnicons.kt @@ -0,0 +1,23 @@ +package app.lawnchair.lawnicons + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Surface +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier + +@Composable +@ExperimentalFoundationApi +fun Lawnicons() { + LawniconsTheme { + SystemUi { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background + ) { + IconPreviewGrid() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/LawniconsTheme.kt b/app/src/main/java/app/lawnchair/lawnicons/LawniconsTheme.kt new file mode 100644 index 00000000000..800ab3af0d0 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/LawniconsTheme.kt @@ -0,0 +1,28 @@ +package app.lawnchair.lawnicons + +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext +import androidx.compose.material3.MaterialTheme + +@Composable +fun LawniconsTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + content: @Composable () -> Unit +) { + val context = LocalContext.current + val colorScheme = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } else { + if (darkTheme) darkColorScheme() else lightColorScheme() + } + MaterialTheme( + colorScheme = colorScheme, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/MainActivity.kt b/app/src/main/java/app/lawnchair/lawnicons/MainActivity.kt new file mode 100644 index 00000000000..963ee589643 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/MainActivity.kt @@ -0,0 +1,20 @@ +package app.lawnchair.lawnicons + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.core.view.WindowCompat + +@ExperimentalFoundationApi +@ExperimentalMaterial3Api +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + WindowCompat.setDecorFitsSystemWindows(window, false) + setContent { + Lawnicons() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/SystemUi.kt b/app/src/main/java/app/lawnchair/lawnicons/SystemUi.kt new file mode 100644 index 00000000000..a2ef0ecb94f --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/SystemUi.kt @@ -0,0 +1,21 @@ +package app.lawnchair.lawnicons + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.Color +import com.google.accompanist.insets.ProvideWindowInsets +import com.google.accompanist.systemuicontroller.rememberSystemUiController + +@Composable +fun SystemUi(content: @Composable () -> Unit) { + val systemUiController = rememberSystemUiController() + val useDarkIcons = !isSystemInDarkTheme() + SideEffect { + systemUiController.setSystemBarsColor( + color = Color.Transparent, + darkIcons = useDarkIcons + ) + } + ProvideWindowInsets(content = content) +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/getIconIds.kt b/app/src/main/java/app/lawnchair/lawnicons/getIconIds.kt new file mode 100644 index 00000000000..918a321dc76 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/getIconIds.kt @@ -0,0 +1,34 @@ +package app.lawnchair.lawnicons + +import android.content.Context +import org.xmlpull.v1.XmlPullParser + +fun getIconIds(context: Context): List { + val iconIds = mutableListOf() + val resources = context.resources + val packageName = context.packageName + + try { + val xmlId = resources.getIdentifier("grayscale_icon_map", "xml", packageName) + if (xmlId != 0) { + val parser = resources.getXml(xmlId) + val depth = parser.depth + var type: Int + while ( + (parser.next().also { type = it } != XmlPullParser.END_TAG || parser.depth > depth) && + type != XmlPullParser.END_DOCUMENT + ) { + if (type != XmlPullParser.START_TAG) continue + if ("icon" == parser.name) { + val pkg = parser.getAttributeValue(null, "package") + val iconId = parser.getAttributeResourceValue(null, "drawable", 0) + if (iconId != 0 && pkg.isNotEmpty()) { + iconIds += iconId + } + } + } + } + } catch (e: Exception) { } + + return iconIds +} \ No newline at end of file diff --git a/app/src/main/java/app/lawnchair/lawnicons/surfaceColorAtElevation.kt b/app/src/main/java/app/lawnchair/lawnicons/surfaceColorAtElevation.kt new file mode 100644 index 00000000000..471d177ffe6 --- /dev/null +++ b/app/src/main/java/app/lawnchair/lawnicons/surfaceColorAtElevation.kt @@ -0,0 +1,14 @@ +package app.lawnchair.lawnicons + +import androidx.compose.material3.ColorScheme +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.compositeOver +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import kotlin.math.ln + +fun ColorScheme.surfaceColorAtElevation(elevation: Dp): Color { + if (elevation == 0.dp) return surface + val alpha = ((4.5f * ln(elevation.value + 1)) + 2f) / 100f + return primary.copy(alpha = alpha).compositeOver(surface) +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000000..2b068d11462 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000000..07d5da9cbf1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/themed_icon_camera.xml b/app/src/main/res/drawable/themed_icon_camera.xml new file mode 100644 index 00000000000..08efa492fea --- /dev/null +++ b/app/src/main/res/drawable/themed_icon_camera.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/themed_icon_files.xml b/app/src/main/res/drawable/themed_icon_files.xml new file mode 100644 index 00000000000..3785b0deba5 --- /dev/null +++ b/app/src/main/res/drawable/themed_icon_files.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/src/main/res/drawable/themed_icon_spark_email.xml b/app/src/main/res/drawable/themed_icon_spark_email.xml new file mode 100644 index 00000000000..9f1337faf2b --- /dev/null +++ b/app/src/main/res/drawable/themed_icon_spark_email.xml @@ -0,0 +1,18 @@ + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000000..eca70cfe52e --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000000..eca70cfe52e --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000000..c209e78ecd3 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000000..b2dfe3d1ba5 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000000..4f0f1d64e58 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000000..62b611da081 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000000..948a3070fe3 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000000..1b9a6956b3a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000000..28d4b77f9f0 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000000..9287f508362 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000000..aa7d6427e6f Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000000..9126ae37cbc Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 00000000000..f8c6127d327 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 00000000000..1614f84ac16 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Lawnicons + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 00000000000..a0d2db16ff7 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/grayscale_icon_map.xml b/app/src/main/res/xml/grayscale_icon_map.xml new file mode 100644 index 00000000000..ef12e133311 --- /dev/null +++ b/app/src/main/res/xml/grayscale_icon_map.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000000..ec10ffb2c9d --- /dev/null +++ b/build.gradle @@ -0,0 +1,14 @@ +buildscript { + ext { + compose_version = '1.0.4' + accompanist_version = '0.20.0' + } +} +plugins { + id 'com.android.application' version '7.1.0-beta02' apply false + id 'com.android.library' version '7.1.0-beta02' apply false + id 'org.jetbrains.kotlin.android' version '1.5.31' apply false +} +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000000..0dee8cbe1f7 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +android.useAndroidX=true +kotlin.code.style=official +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..e708b1c023e Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..2c5aec7b906 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Oct 30 17:11:53 CEST 2021 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME \ No newline at end of file diff --git a/gradlew b/gradlew new file mode 100755 index 00000000000..4f906e0c811 --- /dev/null +++ b/gradlew @@ -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" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000000..ac1b06f9382 --- /dev/null +++ b/gradlew.bat @@ -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 diff --git a/send_notifications.py b/send_notifications.py new file mode 100644 index 00000000000..391294d604b --- /dev/null +++ b/send_notifications.py @@ -0,0 +1,72 @@ +import git +import html +import os +import requests + +github_event_before = os.getenv('GITHUB_EVENT_BEFORE') +github_sha = os.getenv('GITHUB_SHA') +github_repository = os.getenv('GITHUB_REPOSITORY') +github_ref = os.getenv('GITHUB_REF') +telegram_ci_bot_token = os.getenv('TELEGRAM_CI_BOT_TOKEN') +telegram_ci_channel_id = os.getenv('TELEGRAM_CI_CHANNEL_ID') +telegram_team_group_id = os.getenv('TELEGRAM_TEAM_GROUP_ID') +artifact_directory = os.getenv('ARTIFACT_DIRECTORY') + +def send_message_to_ci_channel(message): + data = { + 'chat_id': telegram_ci_channel_id, + 'parse_mode': 'HTML', + 'text': message, + 'disable_web_page_preview': 'true' + } + requests.post( + url = f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendMessage', + data = data + ) + +def send_document_to_ci_channel(document): + data = { + 'chat_id': telegram_ci_channel_id, + } + files = { + 'document': document + } + requests.post( + url = f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendDocument', + data = data, + files = files + ) + +def send_silent_message_to_team_group(message): + data = { + 'chat_id': telegram_team_group_id, + 'parse_mode': 'HTML', + 'text': message, + 'disable_web_page_preview': 'true', + 'disable_notification': 'true' + } + requests.post( + url = f'https://api.telegram.org/bot{telegram_ci_bot_token}/sendMessage', + data = data + ) + +repository = git.Repo('.') +commits_range = f'{github_event_before}...{github_sha}' +commits = list(repository.iter_commits(commits_range)) + +overview_link = f'https://github.com/{github_repository}/compare/{commits_range}' +overview_link_tag = f'''{len(commits)} new commit{'s' if len(commits) > 1 else ''}''' +message = f'''🔨 {overview_link_tag} to lawnicons:{github_ref}:\n''' + +for commit in reversed(commits): + commit_message = commit.message.split('\n')[0] + commit_link = f'https://github.com/{github_repository}/commit/{commit.hexsha}' + commit_link_tag = f'{repository.git.rev_parse(commit.hexsha, short=7)}' + encoded_message = html.escape(commit_message) + message += f'\n• {commit_link_tag}: {encoded_message}' + +send_message_to_ci_channel(message=message) +send_silent_message_to_team_group(message=message) + +with open(f'{artifact_directory}/{os.listdir(artifact_directory)[0]}', 'rb') as apk: + send_document_to_ci_channel(document=apk) \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000000..79ead077665 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "Lawnicons" +include ':app' \ No newline at end of file