[Formatting] Spotless

This commit is contained in:
Yogesh Choudhary Paliyal
2021-11-13 20:32:18 +05:30
parent 4751bc9464
commit 6d1ff039d2
12 changed files with 72 additions and 81 deletions

View File

@@ -1,13 +1,10 @@
package com.yogeshpaliyal.common
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
@@ -18,7 +15,5 @@ class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.yogeshpaliyal.common", appContext.packageName)
}
}
}

View File

@@ -1,11 +1,11 @@
package com.yogeshpaliyal.common
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
}

View File

@@ -56,13 +56,11 @@ open class AccountModel(
) {
fun getInitials() = (
title?.firstOrNull() ?: username?.firstOrNull() ?: site?.firstOrNull()
title?.firstOrNull() ?: username?.firstOrNull() ?: site?.firstOrNull()
?: notes?.firstOrNull() ?: 'K'
).toString()
).toString()
fun getOtp() = TOTPHelper.generate(password)
fun getTOtpProgress() = TOTPHelper.getProgress().toInt()
}

View File

@@ -1,8 +1,7 @@
package com.yogeshpaliyal.common
import org.junit.Test
import org.junit.Assert.*
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
@@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}

View File

@@ -1,13 +1,11 @@
package com.yogeshpaliyal.keypasscompose
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
@@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.yogeshpaliyal.keypasscompose", appContext.packageName)
}
}
}

View File

@@ -27,38 +27,40 @@ class MainActivity : ComponentActivity() {
KeyPassTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colorScheme.background) {
Material3Scaffold(bottomBar = {
Material3BottomAppBar(cutoutShape = RoundedCornerShape(50)) {
IconButton(
onClick = {
/* doSomething() */
Material3Scaffold(
bottomBar = {
Material3BottomAppBar(cutoutShape = RoundedCornerShape(50)) {
IconButton(
onClick = {
/* doSomething() */
}
) {
Icon(Icons.Filled.Menu, "")
}
) {
Icon(Icons.Filled.Menu,"")
}
Spacer(Modifier.weight(1f, true))
IconButton(
onClick = {
/* doSomething() */
Spacer(Modifier.weight(1f, true))
IconButton(
onClick = {
/* doSomething() */
}
) {
Icon(Icons.Filled.Star, "")
}
) {
Icon(Icons.Filled.Star,"")
}
}
}, floatingActionButton = {
FloatingActionButton(
onClick = {
},
contentColor = Color.White,
shape = RoundedCornerShape(50)
) {
Icon(Icons.Filled.Add,"")
}
}, floatingActionButtonPosition = FabPosition.Center,
isFloatingActionButtonDocked = true) {
},
floatingActionButton = {
FloatingActionButton(
onClick = {
},
contentColor = Color.White,
shape = RoundedCornerShape(50)
) {
Icon(Icons.Filled.Add, "")
}
},
floatingActionButtonPosition = FabPosition.Center,
isFloatingActionButtonDocked = true
) {
}
Greeting("Android")
}
@@ -78,4 +80,4 @@ fun DefaultPreview() {
KeyPassTheme {
Greeting("Android")
}
}
}

View File

@@ -5,4 +5,4 @@ import androidx.compose.ui.graphics.Color
val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
val Teal200 = Color(0xFF03DAC5)
val Teal200 = Color(0xFF03DAC5)

View File

@@ -12,7 +12,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
@Composable
fun Material3BottomAppBar(
modifier: Modifier = Modifier,
@@ -35,27 +34,29 @@ fun Material3BottomAppBar(
}
@Composable
fun Material3Scaffold(modifier: Modifier = Modifier,
scaffoldState: ScaffoldState = rememberScaffoldState(),
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) },
floatingActionButton: @Composable () -> Unit = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
isFloatingActionButtonDocked: Boolean = false,
drawerContent: @Composable (ColumnScope.() -> Unit)? = null,
drawerGesturesEnabled: Boolean = true,
drawerShape: Shape = androidx.compose.material.MaterialTheme.shapes.large,
drawerElevation: Dp = DrawerDefaults.Elevation,
drawerBackgroundColor: Color = MaterialTheme.colorScheme.surface,
drawerContentColor: Color = contentColorFor(
drawerBackgroundColor
),
drawerScrimColor: Color = DrawerDefaults.scrimColor,
backgroundColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = contentColorFor(
backgroundColor
),
content: @Composable (PaddingValues) -> Unit){
fun Material3Scaffold(
modifier: Modifier = Modifier,
scaffoldState: ScaffoldState = rememberScaffoldState(),
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) },
floatingActionButton: @Composable () -> Unit = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
isFloatingActionButtonDocked: Boolean = false,
drawerContent: @Composable (ColumnScope.() -> Unit)? = null,
drawerGesturesEnabled: Boolean = true,
drawerShape: Shape = androidx.compose.material.MaterialTheme.shapes.large,
drawerElevation: Dp = DrawerDefaults.Elevation,
drawerBackgroundColor: Color = MaterialTheme.colorScheme.surface,
drawerContentColor: Color = contentColorFor(
drawerBackgroundColor
),
drawerScrimColor: Color = DrawerDefaults.scrimColor,
backgroundColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = contentColorFor(
backgroundColor
),
content: @Composable (PaddingValues) -> Unit
) {
Scaffold(modifier, scaffoldState, topBar, bottomBar, snackbarHost, floatingActionButton, floatingActionButtonPosition, isFloatingActionButtonDocked, drawerContent, drawerGesturesEnabled, drawerShape, drawerElevation, drawerBackgroundColor, drawerContentColor, drawerScrimColor, backgroundColor, contentColor, content)
}
}

View File

@@ -1,2 +1 @@
package com.yogeshpaliyal.keypasscompose.ui.theme

View File

@@ -40,4 +40,4 @@ fun KeyPassTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composabl
typography = Typography,
content = content
)
}
}

View File

@@ -25,4 +25,4 @@ val Typography = Typography(
fontSize = 12.sp
)
*/
)
)

View File

@@ -1,8 +1,7 @@
package com.yogeshpaliyal.keypasscompose
import org.junit.Test
import org.junit.Assert.*
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
@@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}