Skip to content

Commit 66535c6

Browse files
committed
apply spotless and add a core library
1 parent 65b6931 commit 66535c6

File tree

43 files changed

+754
-58
lines changed

Some content is hidden

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

43 files changed

+754
-58
lines changed

app/build.gradle.kts

+16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1+
/*
2+
* Copyright 2022 emo Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
import java.io.ByteArrayOutputStream
217

318
plugins {
419
id("emo.android.application")
520
id("emo.android.application.compose")
21+
id("emo.spotless")
622
}
723

824
fun runCommand(project: Project, command: String): String {
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1+
/*
2+
* Copyright 2022 emo Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package cn.qhplus.emo
218

3-
import androidx.test.platform.app.InstrumentationRegistry
419
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
20+
import androidx.test.platform.app.InstrumentationRegistry
21+
import org.junit.Assert.assertEquals
622
import org.junit.Test
723
import org.junit.runner.RunWith
824

9-
import org.junit.Assert.*
10-
1125
/**
1226
* Instrumented test, which will execute on an Android device.
1327
*
@@ -19,6 +33,6 @@ class ExampleInstrumentedTest {
1933
fun useAppContext() {
2034
// Context of the app under test.
2135
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22-
assertEquals("com.emo", appContext.packageName)
36+
assertEquals("cn.qhplus.emo", appContext.packageName)
2337
}
24-
}
38+
}

app/src/main/java/cn/qhplus/emo/EmoApp.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo
1718

1819
import android.app.Application
1920

20-
class EmoApp: Application()
21+
class EmoApp : Application()

app/src/main/java/cn/qhplus/emo/MainActivity.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo
1718

1819
import android.os.Bundle
@@ -40,4 +41,4 @@ class MainActivity : ComponentActivity() {
4041
window.setBackgroundDrawableResource(android.R.color.transparent)
4142
}
4243
}
43-
}
44+
}

app/src/main/java/cn/qhplus/emo/theme/Color.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo.theme
1718

1819
import androidx.compose.ui.graphics.Color
@@ -38,4 +39,4 @@ val Orange30 = Color(0xFF812800)
3839
val Orange40 = Color(0xFFA23F16)
3940
val Orange80 = Color(0xFFFFB599)
4041
val Orange90 = Color(0xFFFFDBCE)
41-
val Orange95 = Color(0xFFFFEDE6)
42+
val Orange95 = Color(0xFFFFEDE6)

app/src/main/java/cn/qhplus/emo/theme/Theme.kt

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo.theme
1718

1819
import android.os.Build
1920
import androidx.compose.foundation.isSystemInDarkTheme
20-
import androidx.compose.material3.*
21+
import androidx.compose.material3.MaterialTheme
22+
import androidx.compose.material3.darkColorScheme
23+
import androidx.compose.material3.dynamicDarkColorScheme
24+
import androidx.compose.material3.dynamicLightColorScheme
25+
import androidx.compose.material3.lightColorScheme
2126
import androidx.compose.runtime.Composable
2227
import androidx.compose.ui.graphics.Color
2328
import androidx.compose.ui.platform.LocalContext
@@ -41,7 +46,6 @@ private val LightColorScheme = lightColorScheme(
4146
onErrorContainer = Red10
4247
)
4348

44-
4549
private val DarkColorScheme = darkColorScheme(
4650
primary = Blue80,
4751
onPrimary = Blue20,
@@ -61,7 +65,6 @@ private val DarkColorScheme = darkColorScheme(
6165
onErrorContainer = Red90
6266
)
6367

64-
6568
@Composable
6669
fun EmoTheme(
6770
darkTheme: Boolean = isSystemInDarkTheme(),

app/src/main/java/cn/qhplus/emo/theme/Type.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo.theme
1718

1819
import androidx.compose.material3.Typography
@@ -106,4 +107,4 @@ val emoTypography = Typography(
106107
fontSize = 10.sp,
107108
lineHeight = 16.sp
108109
)
109-
)
110+
)

app/src/main/java/cn/qhplus/emo/ui/EmoApp.kt

+3-10
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo.ui
17-
import android.util.Log
1818
import androidx.compose.animation.ExperimentalAnimationApi
19-
import androidx.compose.foundation.layout.ExperimentalLayoutApi
20-
import androidx.compose.foundation.layout.consumedWindowInsets
2119
import androidx.compose.foundation.layout.fillMaxSize
22-
import androidx.compose.foundation.layout.padding
23-
import androidx.compose.material3.ExperimentalMaterial3Api
2420
import androidx.compose.material3.MaterialTheme
25-
import androidx.compose.material3.Scaffold
2621
import androidx.compose.material3.Surface
2722
import androidx.compose.material3.windowsizeclass.WindowSizeClass
2823
import androidx.compose.runtime.Composable
29-
import androidx.compose.runtime.mutableStateOf
30-
import androidx.compose.runtime.remember
3124
import androidx.compose.ui.Modifier
3225
import cn.qhplus.emo.theme.EmoTheme
3326
import com.google.accompanist.navigation.animation.AnimatedNavHost
@@ -36,7 +29,7 @@ import com.google.accompanist.navigation.animation.rememberAnimatedNavController
3629

3730
@OptIn(ExperimentalAnimationApi::class)
3831
@Composable
39-
fun EmoApp(windowSizeClass: WindowSizeClass){
32+
fun EmoApp(windowSizeClass: WindowSizeClass) {
4033
EmoTheme {
4134
Surface(
4235
color = MaterialTheme.colorScheme.background,
@@ -60,4 +53,4 @@ fun EmoApp(windowSizeClass: WindowSizeClass){
6053
}
6154
}
6255
}
63-
}
56+
}

app/src/main/java/cn/qhplus/emo/ui/HomePage.kt

+23-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,36 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package cn.qhplus.emo.ui
1718

1819
import androidx.compose.foundation.background
19-
import androidx.compose.foundation.layout.*
20+
import androidx.compose.foundation.layout.Box
21+
import androidx.compose.foundation.layout.ExperimentalLayoutApi
22+
import androidx.compose.foundation.layout.WindowInsets
23+
import androidx.compose.foundation.layout.WindowInsetsSides
24+
import androidx.compose.foundation.layout.consumedWindowInsets
25+
import androidx.compose.foundation.layout.displayCutout
26+
import androidx.compose.foundation.layout.fillMaxSize
27+
import androidx.compose.foundation.layout.only
28+
import androidx.compose.foundation.layout.padding
29+
import androidx.compose.foundation.layout.safeDrawing
30+
import androidx.compose.foundation.layout.statusBars
31+
import androidx.compose.foundation.layout.union
32+
import androidx.compose.foundation.layout.windowInsetsPadding
2033
import androidx.compose.material.icons.Icons
2134
import androidx.compose.material.icons.filled.Grid3x3
2235
import androidx.compose.material.icons.filled.Widgets
2336
import androidx.compose.material.icons.outlined.Grid3x3
2437
import androidx.compose.material.icons.outlined.Widgets
25-
import androidx.compose.material3.*
38+
import androidx.compose.material3.ExperimentalMaterial3Api
39+
import androidx.compose.material3.Icon
40+
import androidx.compose.material3.MaterialTheme
41+
import androidx.compose.material3.NavigationBar
42+
import androidx.compose.material3.NavigationBarItem
43+
import androidx.compose.material3.Scaffold
44+
import androidx.compose.material3.Surface
45+
import androidx.compose.material3.Text
2646
import androidx.compose.runtime.Composable
2747
import androidx.compose.runtime.mutableStateOf
2848
import androidx.compose.runtime.remember
@@ -64,7 +84,6 @@ val HOME_DESTINATIONS = listOf(
6484
)
6585
)
6686

67-
6887
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
6988
@Composable
7089
fun HomePage(navController: NavHostController, tab: String) {
@@ -156,4 +175,4 @@ fun UtilPage(navController: NavHostController) {
156175
) {
157176
Text(text = "Util")
158177
}
159-
}
178+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2022 emo Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package cn.qhplus.emo.ui
218

319
object RouteConst {
@@ -6,4 +22,4 @@ object RouteConst {
622
const val ROUTE_HOME_UTIL = "util"
723

824
const val PARAM_TAB = "tab"
9-
}
25+
}

app/src/main/res/drawable-night/ic_logo.xml

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 emo Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
117
<vector android:height="131.25dp" android:viewportHeight="210"
218
android:viewportWidth="440" android:width="275dp" xmlns:android="http://schemas.android.com/apk/res/android">
319
<path android:fillColor="#dddddd" android:fillType="evenOdd" android:pathData="M105,30H335C376.42,30 410,63.58 410,105C410,146.42 376.42,180 335,180H105C68.72,180 38.46,154.24 31.5,120.01L89.75,121C98.03,121.14 104.86,114.54 105,106.25C105.14,97.97 98.54,91.14 90.25,91L31.5,90.01C38.45,55.77 68.71,30 105,30ZM0,105C0,47.01 47.01,0 105,0H335C392.99,0 440,47.01 440,105C440,162.99 392.99,210 335,210H105C47.01,210 0,162.99 0,105ZM331.5,42H240V169H331.5C366.57,169 395,140.57 395,105.5C395,70.43 366.57,42 331.5,42ZM141.22,50.04C137.08,45.38 130.5,43.77 124.67,45.98C118.85,48.19 115,53.77 115,60V151C115,159.28 121.72,166 130,166C138.28,166 145,159.28 145,151V99.48L157.49,113.54C160.3,116.71 164.32,118.54 168.55,118.58C172.79,118.63 176.84,116.88 179.72,113.77L194,98.32V151C194,159.28 200.72,166 209,166C217.28,166 224,159.28 224,151V60C224,53.83 220.22,48.28 214.47,46.03C208.72,43.78 202.18,45.28 197.99,49.82L168.93,81.25L141.22,50.04Z"/>

app/src/main/res/drawable-night/launch_window_bg.xml

+15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 emo Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
217
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
318
<item android:drawable="@android:color/black"/>
419
<item android:drawable="@drawable/ic_logo" android:gravity="center"/>

app/src/main/res/drawable-v24/ic_launcher_foreground.xml

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 emo Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
117
<vector xmlns:android="http://schemas.android.com/apk/res/android"
218
android:width="108dp"
319
android:height="108dp"

app/src/main/res/drawable/ic_launcher_background.xml

+15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 emo Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
217
<vector xmlns:android="http://schemas.android.com/apk/res/android"
318
android:width="108dp"
419
android:height="108dp"

app/src/main/res/drawable/ic_logo.xml

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 emo Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
117
<vector android:height="131.25dp" android:viewportHeight="210"
218
android:viewportWidth="440" android:width="275dp" xmlns:android="http://schemas.android.com/apk/res/android">
319
<path android:fillColor="#222222" android:fillType="evenOdd" android:pathData="M105,30H335C376.42,30 410,63.58 410,105C410,146.42 376.42,180 335,180H105C68.72,180 38.46,154.24 31.5,120.01L89.75,121C98.03,121.14 104.86,114.54 105,106.25C105.14,97.97 98.54,91.14 90.25,91L31.5,90.01C38.45,55.77 68.71,30 105,30ZM0,105C0,47.01 47.01,0 105,0H335C392.99,0 440,47.01 440,105C440,162.99 392.99,210 335,210H105C47.01,210 0,162.99 0,105ZM331.5,42H240V169H331.5C366.57,169 395,140.57 395,105.5C395,70.43 366.57,42 331.5,42ZM141.22,50.04C137.08,45.38 130.5,43.77 124.67,45.98C118.85,48.19 115,53.77 115,60V151C115,159.28 121.72,166 130,166C138.28,166 145,159.28 145,151V99.48L157.49,113.54C160.3,116.71 164.32,118.54 168.55,118.58C172.79,118.63 176.84,116.88 179.72,113.77L194,98.32V151C194,159.28 200.72,166 209,166C217.28,166 224,159.28 224,151V60C224,53.83 220.22,48.28 214.47,46.03C208.72,43.78 202.18,45.28 197.99,49.82L168.93,81.25L141.22,50.04Z"/>

app/src/main/res/drawable/launch_window_bg.xml

+15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 emo Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
217
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
318
<item android:drawable="@android:color/white"/>
419
<item android:drawable="@drawable/ic_logo" android:gravity="center"/>

0 commit comments

Comments
 (0)