Skip to content

Commit

Permalink
Merge pull request #26 from ltttttttttttt/dev
Browse files Browse the repository at this point in the history
kmp可用
  • Loading branch information
ltttttttttttt authored Nov 29, 2022
2 parents bbc934c + c40ffb4 commit 50f8bda
Show file tree
Hide file tree
Showing 161 changed files with 1,448 additions and 470 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ freeline/
freeline_project_description.json

# svn
.svn/
.svn/

test_index.txt
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,20 @@ allprojects {
}
```

Step 2.Your app dir, build.gradle.kts add(If it is kmp, add it in the common):
Step 2.Your app dir, build.gradle.kts add:

version
= [![](https://jitpack.io/v/ltttttttttttt/ComposeViews.svg)](https://jitpack.io/#ltttttttttttt/ComposeViews)

```kotlin
dependencies {
...
implementation("com.github.ltttttttttttt:ComposeViews:$version")//this, such as 1.3.3
//common target
implementation("com.github.ltttttttttttt.ComposeViews:core:$version")//this, such as 1.3.4
//android target(If it is android project, just use this)
implementation("com.github.ltttttttttttt.ComposeViews:maven_android:$version")//this, such as 1.3.4
//desktop target
implementation("com.github.ltttttttttttt.ComposeViews:maven_desktop:$version")//this, such as 1.3.4
}
```

Expand Down
9 changes: 7 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,19 @@ allprojects {
}
```

Step 2.在app模块目录内的build.gradle.kts内添加(如果是kmp,则在common中添加):
Step 2.在app模块目录内的build.gradle.kts内添加:

version = [![](https://jitpack.io/v/ltttttttttttt/ComposeViews.svg)](https://jitpack.io/#ltttttttttttt/ComposeViews)

```kotlin
dependencies {
...
implementation("com.github.ltttttttttttt:ComposeViews:$version")//this,比如1.3.3
//common路径中
implementation("com.github.ltttttttttttt.ComposeViews:core:$version")//this,比如1.3.4
//android路径中(如果是安卓项目,只需要引入这个)
implementation("com.github.ltttttttttttt.ComposeViews:maven_android:$version")//this,比如1.3.4
//desktop路径中
implementation("com.github.ltttttttttttt.ComposeViews:maven_desktop:$version")//this,比如1.3.4
}
```

Expand Down
File renamed without changes.
82 changes: 82 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright lt 2022
*
* 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
*
* http://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.
*/

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("maven-publish")
}

group = "com.github.ltttttttttttt"
version = githubVersion

android {
namespace = "com.lt.android"
compileSdk = 31
sourceSets["main"].res.srcDir("../core/src/desktopMain/resources")

defaultConfig {
minSdk = 21
targetSdk = 31

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_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
publishing {
singleVariant("release")
}
}

afterEvaluate {
publishing {
publications {
create("maven_android", MavenPublication::class) {
groupId = "com.github.ltttttttttttt"
artifactId = "maven_android"
version = githubVersion
from(components.getByName("release"))
}
}
}
}

dependencies {
api(project(":core"))
api("androidx.activity:activity-compose:1.4.0")
//协程
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright lt 2022
*
* 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
*
* http://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.
*/

package com.lt.android

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("com.lt.android.test", appContext.packageName)
}
}
20 changes: 20 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright lt 2022
~
~ 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
~
~ http://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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
33 changes: 33 additions & 0 deletions android/src/test/java/com/lt/android/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright lt 2022
*
* 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
*
* http://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.
*/

package com.lt.android

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
File renamed without changes.
11 changes: 2 additions & 9 deletions app/build.gradle.kts → android_app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,14 @@ android {
defaultConfig {
applicationId = "com.lt.test_compose"
minSdk = 21
targetSdk = 30
targetSdk = 31
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}

var testIndex = "-1"
try {
testIndex = File("test_index.txt").readText()
} catch (e: Exception) {
}
buildConfigField("int", "TEST_INDEX", testIndex)
}

buildTypes {
Expand All @@ -67,7 +60,7 @@ android {
}

dependencies {
implementation(project(":compose_views"))
implementation(project(":common_app"))
implementation("androidx.core:core-ktx:1.3.2")
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("com.google.android.material:material:1.3.0")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
android:supportsRtl="true"
android:theme="@style/Theme.Test_compose">
<activity
android:name=".ComposePagerActivity"
android:name="com.lt.common_app.ComposePagerActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:name="com.lt.common_app.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Test_compose.NoActionBar">
Expand All @@ -39,16 +39,16 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainListActivity" />
<activity android:name=".BannerActivity" />
<activity android:name=".FlowLayoutActivity" />
<activity android:name=".TextFieldActivity" />
<activity android:name=".MenuFabActivity" />
<activity android:name=".RefreshLayoutActivity" />
<activity android:name=".PagerIndicatorActivity" />
<activity android:name=".ScrollableAppBarActivity" />
<activity android:name=".SwipeToDismissActivity" />
<activity android:name=".TextPagerIndicatorActivity" />
<activity android:name="com.lt.common_app.MainListActivity" />
<activity android:name="com.lt.common_app.BannerActivity" />
<activity android:name="com.lt.common_app.FlowLayoutActivity" />
<activity android:name="com.lt.common_app.TextFieldActivity" />
<activity android:name="com.lt.common_app.MenuFabActivity" />
<activity android:name="com.lt.common_app.RefreshLayoutActivity" />
<activity android:name="com.lt.common_app.PagerIndicatorActivity" />
<activity android:name="com.lt.common_app.ScrollableAppBarActivity" />
<activity android:name="com.lt.common_app.SwipeToDismissActivity" />
<activity android:name="com.lt.common_app.TextPagerIndicatorActivity" />
</application>

</manifest>
File renamed without changes
25 changes: 25 additions & 0 deletions android_app/src/main/res/drawable/ic_empty_delete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright lt 2022
~
~ 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
~
~ http://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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="#FF000000"
android:pathData="M13.05,42q-1.2,0 -2.1,-0.9 -0.9,-0.9 -0.9,-2.1L10.05,10.5L8,10.5v-3h9.4L17.4,6h13.2v1.5L40,7.5v3h-2.05L37.95,39q0,1.2 -0.9,2.1 -0.9,0.9 -2.1,0.9ZM34.95,10.5h-21.9L13.05,39h21.9ZM18.35,34.7h3L21.35,14.75h-3ZM26.65,34.7h3L29.65,14.75h-3ZM13.05,10.5L13.05,39Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!--
~ Copyright lt 2022
~
~ 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
~
~ http://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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 50f8bda

Please sign in to comment.