Skip to content

Commit 8d5e527

Browse files
committed
新增启动页,icon,替换为Koin
1 parent 5ad4727 commit 8d5e527

File tree

36 files changed

+248
-122
lines changed

36 files changed

+248
-122
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
对于具体的网络封装思路,可直接查看[【Jetpack篇】协程+Retrofit网络请求状态封装实战](https://juejin.cn/post/6958821338672955423)[【Jetpack篇】协程+Retrofit网络请求状态封装实战(2)](https://juejin.cn/post/6961055228787425288)
88

99
### 版本
10+
11+
**2021.5.12/13更新**
12+
13+
1.新增启动页,icon;
14+
2.网络请求新增局部状态管理,结合loadSir切换界面,更直观简便;
15+
3.新增Koin
16+
1017
**V1.0.0**
1118

1219
1.提交WanAndroid第一版,包括首页、个人中心、项目模块

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apply plugin: 'com.android.application'
22
apply from:'../dependencies.gradle'
3+
apply plugin: 'kotlin-android'
34

45
android {
56

@@ -12,6 +13,8 @@ android {
1213
dependencies {
1314

1415
implementation project(path: ':common')
16+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
17+
implementation 'androidx.appcompat:appcompat:1.2.0'
1518
implementation project(path: ':service')
1619
if (!singleModule.toBoolean()) {
1720
implementation project(path: ':home')

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,20 @@
1616
android:supportsRtl="true"
1717
android:theme="@style/AppTheme"
1818
tools:replace="android:icon">
19-
2019
<activity
21-
android:name=".MainActivity"
22-
android:label="@string/app_name">
20+
android:name=".SplashActivity"
21+
android:theme="@style/SplashTheme">
2322
<intent-filter>
2423
<action android:name="android.intent.action.MAIN" />
2524

2625
<category android:name="android.intent.category.LAUNCHER" />
2726
</intent-filter>
2827
</activity>
28+
<activity
29+
android:name=".MainActivity"
30+
android:label="@string/app_name">
31+
32+
</activity>
2933
</application>
3034

3135
</manifest>

app/src/main/java/com/fuusy/jetpackkt/MainApp.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,40 @@ import com.alibaba.android.arouter.launcher.ARouter
88
import com.fuusy.common.loadsir.EmptyCallback
99
import com.fuusy.common.loadsir.ErrorCallback
1010
import com.fuusy.common.loadsir.LoadingCallback
11+
import com.fuusy.home.di.moduleHome
12+
import com.fuusy.login.di.moduleLogin
13+
import com.fuusy.personal.di.modulePersonal
14+
import com.fuusy.project.di.moduleProject
1115
import com.kingja.loadsir.core.LoadSir
16+
import org.koin.android.ext.koin.androidContext
17+
import org.koin.android.ext.koin.androidLogger
18+
import org.koin.core.context.startKoin
1219

1320

1421
class MainApp : Application() {
1522

23+
private val modules = arrayListOf(
24+
moduleHome, moduleLogin, modulePersonal, moduleProject
25+
)
26+
1627
override fun onCreate() {
1728
super.onCreate()
1829
initARouter()
1930
initLoadSir()
31+
initKoin()
32+
33+
}
34+
35+
//koin
36+
private fun initKoin() {
37+
startKoin {
38+
androidLogger()
39+
androidContext(this@MainApp)
40+
modules(modules)
41+
}
2042
}
2143

44+
2245
private fun initLoadSir() {
2346
LoadSir.beginBuilder()
2447
.addCallback(ErrorCallback())
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.fuusy.jetpackkt
2+
3+
import android.content.Intent
4+
import android.os.Bundle
5+
import com.fuusy.common.base.BaseActivity
6+
import com.fuusy.jetpackkt.databinding.ActivitySplashBinding
7+
8+
class SplashActivity : BaseActivity<ActivitySplashBinding>() {
9+
10+
override fun initData(savedInstanceState: Bundle?) {
11+
val intent = Intent(this, MainActivity::class.java)
12+
startActivity(intent)
13+
finish()
14+
}
15+
16+
override fun getLayoutId(): Int = R.layout.activity_splash
17+
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layout 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+
6+
<data>
7+
8+
</data>
9+
10+
<androidx.constraintlayout.widget.ConstraintLayout
11+
android:layout_width="match_parent"
12+
android:layout_height="match_parent"
13+
tools:context=".SplashActivity">
14+
15+
</androidx.constraintlayout.widget.ConstraintLayout>
16+
</layout>
-54 KB
Loading
-54 KB
Loading

app/src/main/res/values/styles.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
<item name="android:windowBackground">@android:color/transparent</item>
1313
<item name="android:windowIsTranslucent">true</item>
1414
</style>
15+
16+
<style name="SplashTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
17+
<item name="android:windowBackground">@drawable/splash_windows_background</item>
18+
</style>
1519
</resources>

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
33
ext.kotlin_version = "1.4.10"
4+
ext.koin_version = '2.2.0-rc-3'
45
repositories {
56
google()
67
jcenter()

0 commit comments

Comments
 (0)