-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* About module * Sample: About compose interop with xml * remove unused color, fix visibility * github actions * Replace clickable with btn due to weird ripple * fixes * add previews * typo fix
- Loading branch information
Showing
40 changed files
with
1,273 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,61 @@ | ||
name: Build about module | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- about/** | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- about/** | ||
|
||
|
||
jobs: | ||
build: | ||
if: ${{ ! startsWith(github.actor, 'dependabot') }} | ||
environment: Development | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/[email protected] | ||
|
||
|
||
- name: Decrypt the keystore for signing | ||
run: | | ||
echo "${{ secrets.KEYSTORE_ENCRYPTED }}" > keystore.asc | ||
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSWORD }}" --batch keystore.asc > keystore.jks | ||
- name: Build about module | ||
run: ./gradlew about:assembleRelease | ||
|
||
- name: Build release sample APK | ||
run: ./gradlew sample:assembleRelease | ||
|
||
- name: Upload release arm64-v8a APK | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-arm64-v8a-apk | ||
path: ./sample/build/outputs/apk/release/sample-arm64-v8a-release.apk | ||
|
||
- name: Upload release armeabi-v7a APK | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-armeabi-v7a-apk | ||
path: ./sample/build/outputs/apk/release/sample-armeabi-v7a-release.apk | ||
|
||
- name: Upload release universal APK | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-universal-apk | ||
path: ./sample/build/outputs/apk/release/sample-universal-release.apk |
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 @@ | ||
name: Release about | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'about*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/[email protected] | ||
|
||
- name: Publish about to Github | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: about:publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,90 @@ | ||
import java.net.URI | ||
|
||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id("pl.allegro.tech.build.axion-release") | ||
`maven-publish` | ||
} | ||
|
||
android { | ||
namespace = "dev.arkbuilders.components.about" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() | ||
} | ||
publishing { | ||
singleVariant("release") { | ||
withSourcesJar() | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.core.ktx) | ||
implementation(libs.androidx.appcompat) | ||
|
||
implementation(libraries.androidx.compose.activity) | ||
implementation(platform(libs.androidx.compose.bom)) | ||
implementation(libs.androidx.compose.ui) | ||
implementation(libs.androidx.compose.ui.graphics) | ||
implementation(libs.androidx.compose.ui.tooling) | ||
implementation(libs.androidx.compose.ui.tooling.preview) | ||
implementation(libs.androidx.compose.material3) | ||
|
||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.test.junit) | ||
androidTestImplementation(libs.androidx.test.espresso) | ||
} | ||
|
||
val libVersion: String = scmVersion.version | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("release") { | ||
groupId = "dev.arkbuilders.components" | ||
artifactId = "about" | ||
version = libVersion | ||
afterEvaluate { | ||
from(components["release"]) | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
name = "GithubPackages" | ||
url = URI("https://maven.pkg.github.com/ARK-Builders/ark-android") | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
} |
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
about/src/androidTest/java/dev/arkbuilders/components/about/ExampleInstrumentedTest.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,24 @@ | ||
package dev.arkbuilders.components.about | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("dev.arkbuilders.components.about.test", appContext.packageName) | ||
} | ||
} |
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
60 changes: 60 additions & 0 deletions
60
about/src/main/java/dev/arkbuilders/components/about/ArkAboutFragment.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,60 @@ | ||
package dev.arkbuilders.components.about | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.annotation.DrawableRes | ||
import androidx.compose.ui.platform.ComposeView | ||
import androidx.compose.ui.platform.ViewCompositionStrategy | ||
import androidx.fragment.app.Fragment | ||
import dev.arkbuilders.components.about.presentation.ArkAbout | ||
|
||
class ArkAboutFragment : Fragment(R.layout.fragment_about) { | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
val composeView = view.findViewById<ComposeView>(R.id.compose_view) | ||
val appName = requireArguments().getString(APP_NAME_KEY) | ||
?: error("appName can't be null") | ||
val appLogoResID = requireArguments().getInt(APP_LOGO_KEY) | ||
val versionName = requireArguments().getString(VERSION_NAME_KEY) | ||
?: error("versionName can't be null") | ||
val privacyPolicyUrl = requireArguments().getString(PRIVACY_POLICY_URL_KEY) | ||
?: error("privacyPolicyUrl can't be null") | ||
|
||
composeView.apply { | ||
setViewCompositionStrategy( | ||
ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed | ||
) | ||
setContent { | ||
ArkAbout( | ||
appName = appName, | ||
appLogoResId = appLogoResID, | ||
versionName = versionName, | ||
privacyPolicyUrl = privacyPolicyUrl | ||
) | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
private const val APP_NAME_KEY = "APP_NAME_KEY" | ||
private const val APP_LOGO_KEY = "APP_LOGO_KEY" | ||
private const val VERSION_NAME_KEY = "VERSION_NAME_KEY" | ||
private const val PRIVACY_POLICY_URL_KEY = "PRIVACY_POLICY_URL_KEY" | ||
|
||
fun create( | ||
appName: String, | ||
@DrawableRes | ||
appLogoResID: Int, | ||
versionName: String, | ||
privacyPolicyUrl: String | ||
) = ArkAboutFragment().apply { | ||
arguments = Bundle().apply { | ||
putString(APP_NAME_KEY, appName) | ||
putInt(APP_LOGO_KEY, appLogoResID) | ||
putString(VERSION_NAME_KEY, versionName) | ||
putString(PRIVACY_POLICY_URL_KEY, privacyPolicyUrl) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.