forked from LawnchairLauncher/lawnicons
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Patryk Michalik
committed
Nov 1, 2021
0 parents
commit 912eaf1
Showing
44 changed files
with
1,045 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
with: | ||
submodules: true | ||
- name: Restore Gradle cache | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: ${{ runner.os }}-gradle- | ||
- name: Set up Java 11 | ||
uses: actions/[email protected] | ||
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/[email protected] | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
.idea | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.lawnchair.lawnicons"> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Lawnicons"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:theme="@style/Theme.Lawnicons"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
app/src/main/java/app/lawnchair/lawnicons/IconPreviewGrid.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/app/lawnchair/lawnicons/LawniconsTheme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
Oops, something went wrong.