Skip to content

Commit

Permalink
Merge pull request #19 from Aoi-hosizora/dev.refactor
Browse files Browse the repository at this point in the history
Refactor and upgrade to v1.2.0
  • Loading branch information
Aoi-hosizora authored Nov 3, 2022
2 parents 29870f5 + 6f4408a commit e1ed262
Show file tree
Hide file tree
Showing 187 changed files with 14,772 additions and 8,642 deletions.
19 changes: 8 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

# VS Code related
.vscode/
.history/
.ionide/
.history/
*.rdb

# Flutter/Dart/Pub related
**/doc/api/
Expand All @@ -30,7 +31,6 @@
.pub-cache/
.pub/
/build/
bug/

# Web related
lib/generated_plugin_registrant.dart
Expand All @@ -41,13 +41,10 @@ app.*.symbols
# Obfuscation related
app.*.map.json

# Android related
key.properties
.project
.classpath
.settings/
settings_aar.gradle
_*.png
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
### Project ###
_*.png
4 changes: 2 additions & 2 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 6cb6eef615d757b18566709a1645140155c88f0e
channel: master
revision: 5464c5bac742001448fe4fc0597be939379f88ea
channel: stable

project_type: app
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

build:
flutter pub run build_runner build

build_delete:
flutter pub run build_runner build --delete-conflicting-outputs
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# manhuagui_flutter

+ An unofficial application for manhuagui (https://www.manhuagui.com/) written in flutter.
+ Backend see [Aoi-hosizora/manhuagui-backend](https://github.com/Aoi-hosizora/manhuagui-backend) (private).
+ An unofficial application for manhuagui (https://www.manhuagui.com/), built in flutter.
+ You can visit [Aoi-hosizora/manhuagui-backend](https://github.com/Aoi-hosizora/manhuagui-backend) for backend part, currently this repository is private.

### Dependencies

Expand All @@ -13,8 +13,7 @@

### Screenshots

|![screenshot1](./assets/screenshot1.png)|![screenshot2](./assets/screenshot2.png)|![screenshot3](./assets/screenshot3.png)|
|---|---|---|
|![screenshot4](./assets/screenshot4.png)|![screenshot5](./assets/screenshot5.png)|![screenshot6](./assets/screenshot6.png)|
|---|---|---|
|![screenshot7](./assets/screenshot7.png)|![screenshot8](./assets/screenshot8.png)|![screenshot9](./assets/screenshot9.png)|
| ![screenshot1](./assets/screenshot1.png) | ![screenshot2](./assets/screenshot2.png) | ![screenshot3](./assets/screenshot3.png) |
|------------------------------------------|------------------------------------------|------------------------------------------|
| ![screenshot4](./assets/screenshot4.png) | ![screenshot5](./assets/screenshot5.png) | ![screenshot6](./assets/screenshot6.png) |
| ![screenshot7](./assets/screenshot7.png) | ![screenshot8](./assets/screenshot8.png) | ![screenshot9](./assets/screenshot9.png) |
11 changes: 11 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
avoid_print: false
sized_box_for_whitespace: false
prefer_single_quotes: true
prefer_const_constructors: false
prefer_const_literals_to_create_immutables: true
avoid_function_literals_in_foreach_calls: false
prefer_function_declarations_over_variables: false
2 changes: 2 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ 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
39 changes: 16 additions & 23 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,37 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
compileSdkVersion 29
compileSdkVersion 33 // flutter.compileSdkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

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

defaultConfig {
applicationId "com.aoihosizora.manhuagui"
minSdkVersion 16
targetSdkVersion 29
// versionCode flutterVersionCode.toInteger()
// versionName flutterVersionName
applicationId 'com.aoihosizora.manhuagui'
versionCode 4
versionName '1.2.0'

versionCode 3
versionName "1.0.2"
minSdkVersion 19 // flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
}

signingConfigs {
Expand Down
21 changes: 13 additions & 8 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@

<application
android:label="Manhuagui"
android:name="${applicationName}"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true">

<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
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" />

<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand All @@ -33,7 +36,9 @@

</activity>

<meta-data
<!-- 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" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
package com.example.manhuagui_flutter

import android.content.Intent
import android.net.Uri
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result as MethodResult
import java.io.File

class MainActivity: FlutterActivity() {
class MainActivity: FlutterActivity(), MethodCallHandler {
companion object {
private const val CHANNEL = "com.aoihosizora.manhuagui"
private const val INSERT_MEDIA_METHOD = "insertMedia"
}

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler(this)
}

override fun onMethodCall(call: MethodCall, result: MethodResult) {
when (call.method) {
INSERT_MEDIA_METHOD -> {
// https://github.com/CarnegieTechnologies/gallery_saver/blob/master/android/src/main/kotlin/carnegietechnologies/gallery_saver/FileUtils.kt
// https://github.com/hui-z/image_gallery_saver/blob/master/android/src/main/kotlin/com/example/imagegallerysaver/ImageGallerySaverPlugin.kt
// https://developer.android.com/training/camera/photobasics#TaskGallery
val filepath = call.argument<Any>("filepath").toString() ?: ""
val intent = Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)
val f = File(filepath)
intent.data = Uri.fromFile(f)
sendBroadcast(intent)
result.success(true)
}
else -> result.notImplemented()
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <!-- <<< -->
</style>
</resources>
11 changes: 6 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

rootProject.buildDir = '../build'

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

Expand Down
1 change: 0 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
18 changes: 7 additions & 11 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
Binary file removed assets/actions.png
Binary file not shown.
32 changes: 0 additions & 32 deletions ios/.gitignore

This file was deleted.

26 changes: 0 additions & 26 deletions ios/Flutter/AppFrameworkInfo.plist

This file was deleted.

1 change: 0 additions & 1 deletion ios/Flutter/Debug.xcconfig

This file was deleted.

1 change: 0 additions & 1 deletion ios/Flutter/Release.xcconfig

This file was deleted.

Loading

0 comments on commit e1ed262

Please sign in to comment.