Skip to content

Commit 5391534

Browse files
committed
refactor all code
1 parent 5108a91 commit 5391534

File tree

68 files changed

+200
-174
lines changed

Some content is hidden

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

68 files changed

+200
-174
lines changed
File renamed without changes.
File renamed without changes.

AndroidApp/.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

KotlinApp/.idea/gradle.xml AndroidApp/.idea/gradle.xml

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.
File renamed without changes.

KotlinApp/app/build.gradle AndroidApp/app/build.gradle

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@ plugins {
44
}
55

66
android {
7-
namespace 'com.example.kotlinapp'
7+
namespace 'com.example.androidapp'
88
compileSdk 32
99

1010
defaultConfig {
11-
applicationId "com.example.kotlinapp"
11+
applicationId "com.example.androidapp"
1212
minSdk 21
1313
targetSdk 32
1414
versionCode 1
1515
versionName "1.0"
16-
1716
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1817
}
1918

2019
buildTypes {
21-
profile {
22-
initWith debug
23-
}
2420
release {
2521
minifyEnabled false
2622
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2723
}
24+
profile {
25+
initWith debug
26+
}
2827
}
2928
compileOptions {
3029
sourceCompatibility JavaVersion.VERSION_1_8
@@ -41,9 +40,10 @@ dependencies {
4140
implementation 'com.google.android.material:material:1.7.0'
4241
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
4342
testImplementation 'junit:junit:4.13.2'
44-
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
45-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
43+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
44+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
4645

46+
// Flutter module dependency generated with command flutter build --aar
4747
debugImplementation 'com.example.flutter_module:flutter_debug:1.0'
4848
profileImplementation 'com.example.flutter_module:flutter_profile:1.0'
4949
releaseImplementation 'com.example.flutter_module:flutter_release:1.0'
File renamed without changes.

KotlinApp/app/src/androidTest/java/com/example/kotlinapp/ExampleInstrumentedTest.kt AndroidApp/app/src/androidTest/java/com/example/androidapp/ExampleInstrumentedTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.kotlinapp
1+
package com.example.androidapp
22

33
import androidx.test.platform.app.InstrumentationRegistry
44
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
1919
fun useAppContext() {
2020
// Context of the app under test.
2121
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22-
assertEquals("com.example.kotlinapp", appContext.packageName)
22+
assertEquals("com.example.androidapp", appContext.packageName)
2323
}
2424
}

KotlinApp/app/src/main/AndroidManifest.xml AndroidApp/app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:label="@string/app_name"
1111
android:roundIcon="@mipmap/ic_launcher_round"
1212
android:supportsRtl="true"
13-
android:theme="@style/Theme.KotlinApp"
13+
android:theme="@style/Theme.AndroidApp"
1414
tools:targetApi="31">
1515
<activity
1616
android:name=".MainActivity"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.example.androidapp
2+
3+
import androidx.appcompat.app.AppCompatActivity
4+
import android.os.Bundle
5+
import android.widget.Button
6+
import io.flutter.embedding.android.FlutterActivity
7+
import io.flutter.embedding.engine.FlutterEngine
8+
import io.flutter.embedding.engine.FlutterEngineCache
9+
import io.flutter.embedding.engine.dart.DartExecutor
10+
11+
private const val FLUTTER_ENGINE_ID = "flutter_engine"
12+
13+
class MainActivity : AppCompatActivity() {
14+
lateinit var flutterEngine : FlutterEngine
15+
override fun onCreate(savedInstanceState: Bundle?) {
16+
super.onCreate(savedInstanceState)
17+
setContentView(R.layout.activity_main)
18+
19+
flutterEngine = FlutterEngine(this)
20+
21+
flutterEngine.dartExecutor.executeDartEntrypoint(
22+
DartExecutor.DartEntrypoint.createDefault()
23+
)
24+
25+
FlutterEngineCache
26+
.getInstance()
27+
.put(FLUTTER_ENGINE_ID, flutterEngine)
28+
29+
val myButton = findViewById<Button>(R.id.myButton)
30+
myButton.setOnClickListener {
31+
startActivity(
32+
FlutterActivity
33+
.withCachedEngine(FLUTTER_ENGINE_ID)
34+
.build(this)
35+
)
36+
}
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:gravity="center"
8+
tools:context=".MainActivity">
9+
10+
<Button
11+
android:id="@+id/myButton"
12+
android:layout_width="wrap_content"
13+
android:layout_height="wrap_content"
14+
android:text="OPEN FLUTTER MODULE" />
15+
16+
</LinearLayout>

KotlinApp/app/src/main/res/values-night/themes.xml AndroidApp/app/src/main/res/values-night/themes.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22
<!-- Base application theme. -->
3-
<style name="Theme.KotlinApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
3+
<style name="Theme.AndroidApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
44
<!-- Primary brand color. -->
55
<item name="colorPrimary">@color/purple_200</item>
66
<item name="colorPrimaryVariant">@color/purple_700</item>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">Android App</string>
3+
</resources>

KotlinApp/app/src/main/res/values/themes.xml AndroidApp/app/src/main/res/values/themes.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22
<!-- Base application theme. -->
3-
<style name="Theme.KotlinApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
3+
<style name="Theme.AndroidApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
44
<!-- Primary brand color. -->
55
<item name="colorPrimary">@color/purple_500</item>
66
<item name="colorPrimaryVariant">@color/purple_700</item>

KotlinApp/app/src/test/java/com/example/kotlinapp/ExampleUnitTest.kt AndroidApp/app/src/test/java/com/example/androidapp/ExampleUnitTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.kotlinapp
1+
package com.example.androidapp
22

33
import org.junit.Test
44

File renamed without changes.
File renamed without changes.

KotlinApp/gradle/wrapper/gradle-wrapper.properties AndroidApp/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Thu Dec 29 22:15:17 BRT 2022
1+
#Mon Jan 09 22:06:01 BRT 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
44
distributionPath=wrapper/dists
File renamed without changes.
File renamed without changes.

KotlinApp/settings.gradle AndroidApp/settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ dependencyResolutionManagement {
1818
}
1919
}
2020
}
21-
rootProject.name = "Kotlin App"
21+
rootProject.name = "Android App"
2222
include ':app'

KotlinApp/.idea/.name

-1
This file was deleted.

KotlinApp/app/src/main/java/com/example/kotlinapp/MainActivity.kt

-24
This file was deleted.

KotlinApp/app/src/main/res/layout/activity_main.xml

-19
This file was deleted.

KotlinApp/app/src/main/res/values/strings.xml

-3
This file was deleted.

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2b97b3f7140a732e865b9014462a60cd
1+
ddc05013c6fd5302c6ab532b9b5f4e40
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0cb7d89c01b5a8d986c605a151b62970e05e1830
1+
66fb5f87340f20b3c3ab2172d8a0100aba7ecf41

flutter_module/build/host/outputs/repo/com/example/flutter_module/flutter_debug/maven-metadata.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<versions>
88
<version>1.0</version>
99
</versions>
10-
<lastUpdated>20221228015606</lastUpdated>
10+
<lastUpdated>20230110005850</lastUpdated>
1111
</versioning>
1212
</metadata>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ce1b1c966cfcfe9d465d454644b62eb1
1+
07f53899756d20a3805a09ad59c50369
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9fff15339f204fbadcebabfd19b8fbb5d3843394
1+
5dfbe74ff07ef6db53cbb1e8dfe8281de1b99861
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9df2fd693082bbab8c810d6d51090f8d
1+
6c7462043b09dfe81d37452f24535df5
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
97c5f12bee0123d3febd6fd7733cfc0bc50b3894
1+
68f222a0e6e3c3cb66a679fa225a76e73a9f0574

flutter_module/build/host/outputs/repo/com/example/flutter_module/flutter_profile/maven-metadata.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<versions>
88
<version>1.0</version>
99
</versions>
10-
<lastUpdated>20221228015713</lastUpdated>
10+
<lastUpdated>20230110005941</lastUpdated>
1111
</versioning>
1212
</metadata>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
65d5f507f8a8065af8d709526096f1dd
1+
db9296dc511bda17e87aea72d26b1519
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e6053379d6cad691ca814fbe90079c500a585665
1+
73b70baa6c138b57d848395caf30dbd6e9c383aa
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bbcfff5ce1f662659ffae1ca6893f3b9
1+
5908e3f0e5112285f4f697aa4a4ed993
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3a8ed3d6b804b31430f4a161e6f31abb79eccdf0
1+
f9eaa9d6b65563b2fcb455bafbaff7935bfeaad7

flutter_module/build/host/outputs/repo/com/example/flutter_module/flutter_release/maven-metadata.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<versions>
88
<version>1.0</version>
99
</versions>
10-
<lastUpdated>20221228015816</lastUpdated>
10+
<lastUpdated>20230110010028</lastUpdated>
1111
</versioning>
1212
</metadata>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
95a11a8e05ecb7864292dc58d8daade5
1+
1369890faee1011a46c0b1d42e9e2172
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9ce5bcb02a0e954c9af89822c160041f2bb8a074
1+
464ae1e344a603a3d518cad889667096db535549

0 commit comments

Comments
 (0)