Skip to content

Commit 08c38b6

Browse files
committed
Initial commit
0 parents  commit 08c38b6

File tree

264 files changed

+17005
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+17005
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/*
5+
/.idea/libraries˚
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
import java.io.IOException
2+
import java.text.SimpleDateFormat
3+
import java.util.Locale
4+
import java.util.Date
5+
6+
plugins {
7+
id("com.android.application")
8+
id("org.jetbrains.kotlin.android")
9+
id("com.google.devtools.ksp")
10+
id("dagger.hilt.android.plugin")
11+
kotlin("kapt")
12+
id("com.google.dagger.hilt.android")
13+
id("kotlin-parcelize")
14+
}
15+
16+
val baseVersion = "0.0.1"
17+
val verName = "${baseVersion}.${getGitHash()}"
18+
val verCode = getGitCommitCount().toInt()
19+
20+
android {
21+
namespace = "luyao.pay"
22+
compileSdk = 34
23+
24+
defaultConfig {
25+
applicationId = "luyao.pay"
26+
minSdk = 24
27+
targetSdk = 34
28+
versionCode = verCode
29+
versionName = verName
30+
31+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
32+
33+
ksp {
34+
arg("room.schemaLocation", "$projectDir/schemas")
35+
arg("room.incremental", "true")
36+
}
37+
}
38+
39+
signingConfigs {
40+
create("release") {
41+
storeFile = file("../key/test")
42+
storePassword = "123456"
43+
keyAlias = "test"
44+
keyPassword = "123456"
45+
}
46+
}
47+
48+
buildTypes {
49+
getByName("debug") {
50+
applicationIdSuffix = ".debug"
51+
versionNameSuffix = "_debug"
52+
resValue("string", "app_name", "@string/app_name_debug")
53+
resValue("string", "package_name", "@string/package_name_debug")
54+
isMinifyEnabled = false
55+
isShrinkResources = false
56+
proguardFiles(
57+
getDefaultProguardFile("proguard-android-optimize.txt"),
58+
"proguard-rules.pro"
59+
)
60+
signingConfig = signingConfigs.getByName("release")
61+
}
62+
getByName("release") {
63+
resValue("string", "app_name", "@string/app_name_release")
64+
resValue("string", "package_name", "@string/package_name_release")
65+
isMinifyEnabled = true
66+
isShrinkResources = true
67+
proguardFiles(
68+
getDefaultProguardFile("proguard-android-optimize.txt"),
69+
"proguard-rules.pro"
70+
)
71+
signingConfig = signingConfigs.getByName("release")
72+
}
73+
}
74+
compileOptions {
75+
sourceCompatibility = JavaVersion.VERSION_17
76+
targetCompatibility = JavaVersion.VERSION_17
77+
}
78+
kotlinOptions {
79+
jvmTarget = JavaVersion.VERSION_17.toString()
80+
}
81+
buildFeatures {
82+
viewBinding = true
83+
compose = true
84+
}
85+
86+
composeOptions {
87+
kotlinCompilerExtensionVersion = "1.5.3"
88+
}
89+
90+
applicationVariants.all {
91+
val variant = this
92+
val time = SimpleDateFormat("yyyyMMddHHmm", Locale.getDefault()).format(Date())
93+
variant.outputs.map {
94+
it as com.android.build.gradle.internal.api.BaseVariantOutputImpl
95+
}.forEach {
96+
it.outputFileName =
97+
"Pay_${variant.flavorName}_${variant.versionName}_" + time + "_" + getGitBranch() + ".apk"
98+
}
99+
}
100+
}
101+
102+
dependencies {
103+
104+
implementation(project(":luyao_ktx"))
105+
106+
val composeBom = platform("androidx.compose:compose-bom:2023.10.01")
107+
implementation(composeBom)
108+
androidTestImplementation(composeBom)
109+
implementation("androidx.compose.material3:material3")
110+
implementation("androidx.compose.ui:ui-tooling-preview")
111+
debugImplementation("androidx.compose.ui:ui-tooling")
112+
implementation("androidx.activity:activity-compose:1.8.0")
113+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2")
114+
implementation("androidx.compose.runtime:runtime-livedata")
115+
116+
val roomVersion = "2.6.0"
117+
implementation("androidx.room:room-runtime:$roomVersion")
118+
implementation("androidx.room:room-ktx:$roomVersion")
119+
ksp("androidx.room:room-compiler:$roomVersion")
120+
implementation("androidx.preference:preference-ktx:1.2.1")
121+
// implementation(platform("com.google.firebase:firebase-bom:32.1.1"))
122+
// implementation("com.google.firebase:firebase-analytics-ktx")
123+
// implementation("com.google.firebase:firebase-crashlytics-ktx")
124+
// implementation("com.google.firebase:firebase-perf-ktx")
125+
126+
implementation("com.google.dagger:hilt-android:2.46.1")
127+
kapt("com.google.dagger:hilt-android-compiler:2.46.1")
128+
ksp("com.squareup.moshi:moshi-kotlin-codegen:1.15.0")
129+
implementation("com.github.loper7:DateTimePicker:0.6.3")
130+
implementation("com.github.xkzhangsan:xk-time:3.2.4")
131+
implementation("de.psdev.licensesdialog:licensesdialog:2.2.0")
132+
implementation("com.github.tingyik90:snackprogressbar:6.4.2")
133+
implementation("net.lingala.zip4j:zip4j:2.11.2")
134+
implementation("com.patrykandpatrick.vico:compose-m3:1.12.0")
135+
136+
testImplementation("junit:junit:4.13.2")
137+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
138+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
139+
}
140+
141+
fun getGitBranch(): String {
142+
return "git symbolic-ref --short -q HEAD".runCommand()
143+
}
144+
145+
fun getGitHash(): String {
146+
return "git rev-parse --short HEAD".runCommand()
147+
}
148+
149+
fun getGitCommitCount(): String {
150+
return "git rev-list --count HEAD".runCommand()
151+
}
152+
153+
fun String.runCommand(
154+
workingDir: File = File("."),
155+
timeoutAmount: Long = 60,
156+
timeoutUnit: TimeUnit = TimeUnit.SECONDS
157+
): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
158+
.directory(workingDir)
159+
.redirectOutput(ProcessBuilder.Redirect.PIPE)
160+
.redirectError(ProcessBuilder.Redirect.PIPE)
161+
.start()
162+
.apply { waitFor(timeoutAmount, timeoutUnit) }
163+
.run {
164+
val error = errorStream.bufferedReader().readText().trim()
165+
if (error.isNotEmpty()) {
166+
throw IOException(error)
167+
}
168+
inputStream.bufferedReader().readText().trim()
169+
}

app/proguard-rules.pro

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
22+
23+
# entity
24+
-keep class luyao.pay.model.entity.** { *; }
25+
26+
# viewbinding
27+
-keep class * implements androidx.viewbinding.ViewBinding {
28+
*;
29+
}
30+
31+
# Glide
32+
-keep public class * implements com.bumptech.glide.module.GlideModule
33+
-keep public class * extends com.bumptech.glide.module.AppGlideModule
34+
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
35+
**[] $VALUES;
36+
public *;
37+
}
38+
39+
-dontwarn android.content.res.XmlResourceParser
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 1,
5+
"identityHash": "e3368018d6af03af24caee2529b20286",
6+
"entities": [
7+
{
8+
"tableName": "pay",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `icon` TEXT NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY(`id`))",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "id",
14+
"affinity": "TEXT",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "icon",
19+
"columnName": "icon",
20+
"affinity": "TEXT",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "name",
25+
"columnName": "name",
26+
"affinity": "TEXT",
27+
"notNull": true
28+
}
29+
],
30+
"primaryKey": {
31+
"autoGenerate": false,
32+
"columnNames": [
33+
"id"
34+
]
35+
},
36+
"indices": [],
37+
"foreignKeys": []
38+
},
39+
{
40+
"tableName": "pay_detail",
41+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `pay_id` TEXT NOT NULL, `price` TEXT NOT NULL, `repeat` TEXT NOT NULL, `start_time` INTEGER NOT NULL, `remark` TEXT NOT NULL, PRIMARY KEY(`id`))",
42+
"fields": [
43+
{
44+
"fieldPath": "id",
45+
"columnName": "id",
46+
"affinity": "TEXT",
47+
"notNull": true
48+
},
49+
{
50+
"fieldPath": "payId",
51+
"columnName": "pay_id",
52+
"affinity": "TEXT",
53+
"notNull": true
54+
},
55+
{
56+
"fieldPath": "price",
57+
"columnName": "price",
58+
"affinity": "TEXT",
59+
"notNull": true
60+
},
61+
{
62+
"fieldPath": "repeatMode",
63+
"columnName": "repeat",
64+
"affinity": "TEXT",
65+
"notNull": true
66+
},
67+
{
68+
"fieldPath": "startTime",
69+
"columnName": "start_time",
70+
"affinity": "INTEGER",
71+
"notNull": true
72+
},
73+
{
74+
"fieldPath": "remark",
75+
"columnName": "remark",
76+
"affinity": "TEXT",
77+
"notNull": true
78+
}
79+
],
80+
"primaryKey": {
81+
"autoGenerate": false,
82+
"columnNames": [
83+
"id"
84+
]
85+
},
86+
"indices": [],
87+
"foreignKeys": []
88+
}
89+
],
90+
"views": [],
91+
"setupQueries": [
92+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
93+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e3368018d6af03af24caee2529b20286')"
94+
]
95+
}
96+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package luyao.pay
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("luyao.pay", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
6+
tools:ignore="QueryAllPackagesPermission" />
7+
<uses-permission android:name="android.permission.INTERNET" />
8+
9+
<application
10+
android:name=".PayApp"
11+
android:allowBackup="true"
12+
android:dataExtractionRules="@xml/data_extraction_rules"
13+
android:fullBackupContent="@xml/backup_rules"
14+
android:icon="@mipmap/ic_launcher"
15+
android:label="@string/app_name"
16+
android:roundIcon="@mipmap/ic_launcher_round"
17+
android:supportsRtl="true"
18+
android:theme="@style/Theme.Pay"
19+
tools:targetApi="31">
20+
21+
<activity
22+
android:name=".ui.MainActivity"
23+
android:exported="true"
24+
android:windowSoftInputMode="adjustPan">
25+
<intent-filter>
26+
<action android:name="android.intent.action.MAIN" />
27+
<category android:name="android.intent.category.LAUNCHER" />
28+
</intent-filter>
29+
</activity>
30+
<activity android:name="luyao.pay.ui.PayEditActivity"
31+
android:windowSoftInputMode="adjustPan"/>
32+
<activity android:name="luyao.pay.ui.ChooseAppActivity" />
33+
<activity android:name="luyao.pay.ui.PayDetailActivity" />
34+
<activity android:name="luyao.pay.ui.AboutActivity" />
35+
<activity android:name="luyao.pay.ui.setting.BackupActivity" />
36+
37+
</application>
38+
39+
</manifest>

0 commit comments

Comments
 (0)