Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jing332 committed Jan 14, 2024
0 parents commit 67d3227
Show file tree
Hide file tree
Showing 90 changed files with 2,832 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release



local.properties

30 changes: 30 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "ef1af02aead6fe2414f3aafa5a61087b610e1332"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332
base_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332
- platform: android
create_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332
base_revision: ef1af02aead6fe2414f3aafa5a61087b610e1332

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# alist_flutter

AList for Android

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
28 changes: 28 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
26 changes: 26 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks

/alist-lib/*
alist-main
!alist-lib/alistlib
!alist-lib/scripts

*.aar
*.exe
*.tgz
*.jar
*.zip
*.so

10 changes: 10 additions & 0 deletions android/alist-lib/scripts/clear.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

mv androidlib /tmp
mv scripts /tmp

rm -rf *

mv /tmp/androidlib ./
mv /tmp/scripts ./

13 changes: 13 additions & 0 deletions android/alist-lib/scripts/init_alist_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
TAG_NAME=$(curl -s https://api.github.com/repos/alist-org/alist/releases/latest | grep -o '"tag_name": ".*"' | cut -d'"' -f4)

URL="https://github.com/alist-org/alist/archive/refs/tags/${TAG_NAME}.tar.gz"
echo "Downloading alist ${TAG_NAME} from ${URL}"

curl -L -o "alist.tgz" $URL
tar xf "alist.tgz" --strip-components 1 -C ../

echo "Write version to local.properties"
cd ../../
touch local.properties
sed -i '/ALIST_VERSION/d' local.properties
echo "ALIST_VERSION=${TAG_NAME}" >> local.properties
5 changes: 5 additions & 0 deletions android/alist-lib/scripts/init_alist_web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
curl -L https://github.com/alist-org/alist-web/releases/latest/download/dist.tar.gz -o dist.tar.gz
tar -zxvf dist.tar.gz
rm -rf ../public/dist
mv -f dist ../public
rm -rf dist.tar.gz
37 changes: 37 additions & 0 deletions android/alist-lib/scripts/install_alist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

export dir=$PWD
function build() {
echo "Building $1 $2 ${PWD}"

export CGO_ENABLED=1
export GOOS=android
export GOARCH="$1"

FN="libalist.so"
rm -f ${FN}

go build -ldflags "-s -w" -o ${FN}

mkdir -p ${dir}/../app/libs/$2
cp -f ${FN} ${dir}/../app/libs/$2
}

#cp -f ./frp-*/conf/* ../app/src/main/assets/defaultData

build $1 $2

# function build_all() {
# rm -f $1
# build $1 "arm" "armeabi-v7a"
# build $1 "arm64" "arm64-v8a"
# build $1 "386" "x86"
# build $1 "amd64" "x86_64"
# }

# cd frp-*/cmd
# cd ./frpc
# build_all frpc

# cd ./frps
# build_all frps
111 changes: 111 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-parcelize"
id "kotlinx-serialization"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}


android {
namespace "com.github.jing332.alistflutter"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion



sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.github.jing332.alistflutter"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}


kotlinOptions {
jvmTarget = '17'
}

sourceSets {
main {
jniLibs.srcDirs = ['libs']
java.srcDirs = ['src/main/java', 'src/main/kotlin']
}
}

// kotlin {
// jvmToolchain = 17
// }

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}

debug {
ndk {
//noinspection ChromeOsAbiSupport
abiFilters "arm64-v8a"
}
}
}
}

flutter {
source '../..'
}
////获取flutter的sdk路径
//def flutterRoot = localProperties.getProperty('flutter.sdk')
//if (flutterRoot == null) {
// throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
//}
dependencies {
// compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar")

//noinspection GradleDependency
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'

implementation 'com.louiscad.splitties:splitties-systemservices:3.0.0'

implementation 'com.github.cioccarellia:ksprefs:2.4.0'

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")


}
7 changes: 7 additions & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
42 changes: 42 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<application
android:name="com.github.jing332.alistflutter.App"
android:icon="@mipmap/ic_launcher"
android:label="AList">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />

<service
android:name=".AListService"
android:exported="true"
tools:ignore="ExportedService" />
</application>
</manifest>
Loading

0 comments on commit 67d3227

Please sign in to comment.