Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa authored Dec 10, 2024
0 parents commit 9fe19b0
Show file tree
Hide file tree
Showing 52 changed files with 1,453 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
registries:
maven-google:
type: maven-repository
url: https://maven.google.com
username: ""
password: ""
maven-center:
type: maven-repository
url: https://repo.maven.apache.org/maven2/
username: ""
password: ""
updates:
- package-ecosystem: "gradle"
directory: "/"
registries:
- maven-center
- maven-google

schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: ".github/workflows"
schedule:
interval: "daily"
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Android Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew :app:assembleDebug
- name: Upload a Build Artifact
if: success()
uses: actions/upload-artifact@v4.4.3
with:
name: build-artifact
path: |
./**/*.apk
26 changes: 26 additions & 0 deletions .github/workflows/unitTest.yml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Unit Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew :app:test
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# IntelliJ
*.iml
*.ipr
.idea/
out/

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Android template
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties
keystore.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof

# Keystore files
*.jks
*.keystore

# Google Services (e.g. APIs or Firebase)
google-services.json

# Kotlin
.kotlin/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "TvBoxPlugin"]
path = TvBoxPlugin
url = https://github.com/muedsa/TvBoxPlugin.git
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 MUEDSA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# TvBoxDemoPlugin
[TvBox](https://github.com/muedsa/TvBox)的demo插件

## Use this template(使用此仓库作为模板)
本仓库使用**git submodule**,请在项目Clone后使用`git submodule update --init --recursive`拉取子模块。
你需要修改以下位置
- [ ] [settings.gradle.kts](settings.gradle.kts) 中的 `rootProject.name = "你的项目名称"`
- [ ] [app/src/main/res/values/strings.xml](app/src/main/res/values/strings.xml) 中的 `<string name="app_name">你的插件名称</string>`
- [ ] [app/build.gradle.kts](app/build.gradle.kts) 中的 `namespace = "你的namespace"`
- [ ] [app/build.gradle.kts](app/build.gradle.kts) 中的 `applicationId = "applicationId"`
- [ ] [app/build.gradle.kts](app/build.gradle.kts) 中的 `signingConfigs { // 你的签名 }`
- [ ] [app/src/main/res/mipmap-xxxx](app/src/main/res) 中的 [ic_launcher](app/src/main/res/mipmap-hdpi/ic_launcher.webp) 为你的Icon
- [ ] 编写代码实现插件IPlugin的所有功能,并修改 [app/src/main/AndroidManifest.xml](app/src/main/AndroidManifest.xml) 中的 `<meta-data android:name="tv_box_plugin_entry_point_impl" android:value="你的插件packageName.ClassName"/>`
- [ ] [README.md](README.md)
1 change: 1 addition & 0 deletions TvBoxPlugin
Submodule TvBoxPlugin added at c78479
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
80 changes: 80 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import java.io.FileInputStream
import java.util.Properties

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

val keystorePropertiesFile: File = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists() && keystorePropertiesFile.canRead()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}

android {
namespace = "com.muedsa.tvbox.demoplugin"
compileSdk = 35

defaultConfig {
applicationId = "com.muedsa.tvbox.demoplugin"
minSdk = 24
targetSdk = 35
versionCode = 1
versionName = "0.0.1"
}

signingConfigs {
create("release") {
if (keystoreProperties.containsKey("muedsa.signingConfig.storeFile")) {
storeFile = file(keystoreProperties["muedsa.signingConfig.storeFile"] as String)
storePassword = keystoreProperties["muedsa.signingConfig.storePassword"] as String
keyAlias = keystoreProperties["muedsa.signingConfig.keyAlias"] as String
keyPassword = keystoreProperties["muedsa.signingConfig.keyPassword"] as String
} else {
val debugSigningConfig = signingConfigs.getByName("debug")
storeFile = debugSigningConfig.storeFile
storePassword = debugSigningConfig.storePassword
keyAlias = debugSigningConfig.keyAlias
keyPassword = debugSigningConfig.keyPassword
}
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

// 修改APK文件名
applicationVariants.all {
outputs.all {
if (this is com.android.build.gradle.internal.api.ApkVariantOutputImpl) {
outputFileName = "${rootProject.name}-${versionName}-${buildType.name}.apk.tbp"
}
}
}
}
dependencies {
//implementation(libs.androidx.core.ktx)
compileOnly(project(":api"))
testImplementation(project(":api"))
testImplementation(libs.junit4)
testImplementation(libs.kotlinx.coroutines.test)
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
16 changes: 16 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@android:style/Theme.DeviceDefault" >
<meta-data android:name="tv_box_plugin_key" android:value="com.muedsa.tvbox" />
<meta-data android:name="tv_box_plugin_api_version" android:value="9" />
<!-- 入口 -->
<meta-data android:name="tv_box_plugin_entry_point_impl" android:value="com.muedsa.tvbox.demoplugin.DemoPlugin"/>
</application>

</manifest>
Loading

0 comments on commit 9fe19b0

Please sign in to comment.