Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
leavesCZY committed May 4, 2024
1 parent 8d81af6 commit d38d2d2
Show file tree
Hide file tree
Showing 51 changed files with 1,193 additions and 392 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Android CI

on:
push:
branches: [ master ]
paths:
- '**/WorkflowsTrigger.kt'

env:
TZ: Asia/Shanghai

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3

- name: set up jdk 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "oracle"
cache: gradle

- name: grant execute permission for gradlew
run: chmod +x gradlew

- name: build apk with gradle
run: ./gradlew app:assembleRelease

- name: get current time
id: currentTime
run: echo "time=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT

- name: create a release
uses: ncipollo/release-action@v1
with:
artifacts: "app/build/outputs/apk/release/*.apk"
body: "create by workflows"
allowUpdates: true
artifactErrorsFailBuild: true
generateReleaseNotes: false
token: ${{ secrets.ACTION_TOKEN }}
name: v${{ steps.currentTime.outputs.time }}
tag: ${{ steps.currentTime.outputs.time }}
11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/caches/build_file_checksums.ser
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/
.DS_Store
/build
/captures
.externalNativeBuild
/.idea
.idea
*.apk
*.json
.cxx
local.properties
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Activity

用于查看设备安装的所有应用的详细信息,并且可以查看当前系统顶层 Activity 的全路径,方便在反编译应用的时候快速定位

Apk 下载体验请看:[Releases](https://github.com/leavesCZY/Activity/releases)
用于查看系统中安装的所有应用的详细信息,且可以查看当前顶层 Activity 的全路径,方便在反编译应用的时候快速定位
3 changes: 1 addition & 2 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/build
*.apk
*.json
/release/
81 changes: 0 additions & 81 deletions app/build.gradle

This file was deleted.

103 changes: 103 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
import java.util.TimeZone

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}

android {
namespace = "github.leavesczy.activity"
compileSdk = 34
defaultConfig {
applicationId = "github.leavesczy.activity"
minSdk = 23
targetSdk = 34
versionCode = 1
versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
applicationVariants.all {
val variant = this
outputs.all {
if (this is ApkVariantOutputImpl) {
val simpleDateFormat = SimpleDateFormat("yyyy_MM_dd_HH_mm_ss", Locale.US)
simpleDateFormat.timeZone = TimeZone.getTimeZone("Asia/Shanghai")
val currentTime = Calendar.getInstance().time
val apkBuildTime = simpleDateFormat.format(currentTime)
this.outputFileName =
"activity_${variant.name}_v${variant.versionName}_${variant.versionCode}_${apkBuildTime}.apk"
}
}
}
}
signingConfigs {
create("release") {
storeFile =
File(rootDir.absolutePath + File.separator + "doc" + File.separator + "key.jks")
keyAlias = "leavesCZY"
keyPassword = "123456"
storePassword = "123456"
enableV1Signing = true
enableV2Signing = true
}
}
buildTypes {
debug {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false
isShrinkResources = false
isDebuggable = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
isDebuggable = 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"
}
packaging {
jniLibs {
excludes += setOf("META-INF/{AL2.0,LGPL2.1}")
}
resources {
excludes += setOf(
"**/*.version",
"DebugProbesKt.bin",
"kotlin-tooling-metadata.json",
)
}
}
}

dependencies {
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.recyclerview)
implementation(libs.androidx.lifecycle.runtime)
implementation(libs.google.material)
implementation(libs.kotlinx.coroutines)
}
Loading

0 comments on commit d38d2d2

Please sign in to comment.