TP-00000 | UiTron Demo App Improvements (#175)
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
|
||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
@@ -44,20 +44,20 @@ import androidx.constraintlayout.compose.ConstraintLayout
|
||||
import androidx.constraintlayout.compose.Dimension
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.demo.uitron.theme.Black191919
|
||||
import com.demo.uitron.theme.Black1C1C1C
|
||||
import com.demo.uitron.theme.Blue0276FE
|
||||
import com.demo.uitron.theme.Gray969696
|
||||
import com.demo.uitron.theme.GrayE8E8E8
|
||||
import com.demo.uitron.theme.Purple1F002A
|
||||
import com.demo.uitron.theme.Purple3C0050
|
||||
import com.demo.uitron.theme.WhiteFCFCFD
|
||||
import com.google.gson.Gson
|
||||
import com.uitron.demo.R
|
||||
import com.uitron.demo.dazzledesignsystem.db.entity.WidgetTemplate
|
||||
import com.uitron.demo.dazzledesignsystem.models.BottomSheetData
|
||||
import com.uitron.demo.dazzledesignsystem.models.BottomSheetType
|
||||
import com.uitron.demo.dazzledesignsystem.viewmodel.DazzleViewModel
|
||||
import com.uitron.demo.theme.Black191919
|
||||
import com.uitron.demo.theme.Black1C1C1C
|
||||
import com.uitron.demo.theme.Blue0276FE
|
||||
import com.uitron.demo.theme.Gray969696
|
||||
import com.uitron.demo.theme.GrayE8E8E8
|
||||
import com.uitron.demo.theme.Purple1F002A
|
||||
import com.uitron.demo.theme.Purple3C0050
|
||||
import com.uitron.demo.theme.WhiteFCFCFD
|
||||
import com.uitron.demo.theme.fontFamily
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -21,16 +21,15 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.ClipboardManager
|
||||
import androidx.compose.ui.platform.LocalClipboardManager
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.demo.uitron.theme.WhiteF7F7F7
|
||||
import com.uitron.demo.dazzledesignsystem.models.WidgetTemplateState
|
||||
import com.uitron.demo.dazzledesignsystem.viewmodel.DazzleViewModel
|
||||
import com.uitron.demo.theme.WhiteF7F7F7
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
|
||||
@@ -31,12 +31,12 @@ import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.demo.uitron.theme.GrayA8A8A8
|
||||
import com.demo.uitron.theme.GrayE3E5E5
|
||||
import com.demo.uitron.theme.WhiteF5F5F5
|
||||
import com.uitron.demo.R
|
||||
import com.uitron.demo.dazzledesignsystem.models.BottomSheetType
|
||||
import com.uitron.demo.dazzledesignsystem.viewmodel.DazzleViewModel
|
||||
import com.uitron.demo.theme.GrayA8A8A8
|
||||
import com.uitron.demo.theme.GrayE3E5E5
|
||||
import com.uitron.demo.theme.WhiteF5F5F5
|
||||
import com.uitron.demo.theme.fontFamily
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
|
||||
@@ -23,10 +23,6 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.demo.uitron.theme.Black1C1C1C
|
||||
import com.demo.uitron.theme.BlueE4EEFF
|
||||
import com.demo.uitron.theme.GrayE8E8E8
|
||||
import com.demo.uitron.theme.Purple1F002A
|
||||
import com.google.gson.Gson
|
||||
import com.navi.uitron.render.UiTronRenderer
|
||||
import com.uitron.demo.R
|
||||
@@ -34,6 +30,10 @@ import com.uitron.demo.dazzledesignsystem.db.entity.WidgetTemplate
|
||||
import com.uitron.demo.dazzledesignsystem.models.BottomSheetType
|
||||
import com.uitron.demo.dazzledesignsystem.viewmodel.DazzleViewModel
|
||||
import com.uitron.demo.stringToUiTronResponse
|
||||
import com.uitron.demo.theme.Black1C1C1C
|
||||
import com.uitron.demo.theme.BlueE4EEFF
|
||||
import com.uitron.demo.theme.GrayE8E8E8
|
||||
import com.uitron.demo.theme.Purple1F002A
|
||||
import com.uitron.demo.theme.fontFamily
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
|
||||
@@ -1,51 +1,62 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.uitron.demo.home
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.CutCornerShape
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.constraintlayout.compose.ConstraintLayout
|
||||
import androidx.constraintlayout.compose.Dimension
|
||||
import androidx.navigation.NavHostController
|
||||
import com.demo.uitron.theme.PurpleDCD1F4
|
||||
import com.demo.uitron.theme.RedEF0000
|
||||
import com.uitron.demo.navigation.DAZZLE_DESIGN_SYSTEM
|
||||
import com.uitron.demo.navigation.DESIGN_SYSTEM
|
||||
import com.uitron.demo.navigation.MOCK
|
||||
import com.uitron.demo.navigation.PLAYGROUND
|
||||
import com.uitron.demo.theme.OrangeFF9000
|
||||
import com.uitron.demo.theme.PinkCC2FD5
|
||||
import com.uitron.demo.theme.Purple5A43E3
|
||||
import com.uitron.demo.theme.fontFamily
|
||||
|
||||
@Composable
|
||||
fun HomeScreen(navHostController: NavHostController) {
|
||||
Column(modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = 42.dp),
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 42.dp),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = com.uitron.demo.R.drawable.uitron),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.height(40.dp)
|
||||
.width(40.dp),
|
||||
modifier = Modifier.height(40.dp).width(40.dp),
|
||||
colorFilter = ColorFilter.tint(color = Color.DarkGray)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
@@ -58,7 +69,7 @@ fun HomeScreen(navHostController: NavHostController) {
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = "I had hard-codings, but now I'm free. \nThere are no hard-codings on me...",
|
||||
text = "I had hard-codings, but now I'm free.\nThere are no hard-codings on me...",
|
||||
fontWeight = FontWeight(600),
|
||||
fontStyle = FontStyle.Italic,
|
||||
modifier = Modifier.padding(20.dp),
|
||||
@@ -68,117 +79,132 @@ fun HomeScreen(navHostController: NavHostController) {
|
||||
ConstraintLayout(modifier = Modifier.fillMaxSize()) {
|
||||
val startGuideline = createGuidelineFromAbsoluteLeft(.5f)
|
||||
val (playgroundRef, mockRef, designSystemRef, dazzleDesignSystemRef) = createRefs()
|
||||
|
||||
PlaygroundBubble(
|
||||
modifier =
|
||||
Modifier.constrainAs(playgroundRef) {
|
||||
start.linkTo(parent.start, 16.dp)
|
||||
top.linkTo(parent.top, 8.dp)
|
||||
end.linkTo(startGuideline, 8.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
},
|
||||
navHostController = navHostController,
|
||||
modifier = Modifier.constrainAs(playgroundRef) {
|
||||
start.linkTo(parent.start, 16.dp)
|
||||
top.linkTo(parent.top, 8.dp)
|
||||
end.linkTo(startGuideline, 16.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
})
|
||||
MockBubble(
|
||||
navHostController = navHostController,
|
||||
modifier = Modifier.constrainAs(mockRef) {
|
||||
start.linkTo(startGuideline, 16.dp)
|
||||
end.linkTo(parent.end, 16.dp)
|
||||
top.linkTo(parent.top, 8.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
})
|
||||
DesignSystemBubble(
|
||||
navHostController = navHostController,
|
||||
modifier = Modifier.constrainAs(designSystemRef) {
|
||||
start.linkTo(startGuideline, 16.dp)
|
||||
end.linkTo(parent.end, 16.dp)
|
||||
top.linkTo(mockRef.bottom, 16.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
}
|
||||
)
|
||||
DazzleDesignSystemBubble(
|
||||
|
||||
MockBubble(
|
||||
modifier =
|
||||
Modifier.constrainAs(mockRef) {
|
||||
start.linkTo(startGuideline, 8.dp)
|
||||
end.linkTo(parent.end, 16.dp)
|
||||
top.linkTo(parent.top, 8.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
},
|
||||
navHostController = navHostController,
|
||||
)
|
||||
|
||||
DesignSystemBubble(
|
||||
modifier =
|
||||
Modifier.constrainAs(designSystemRef) {
|
||||
start.linkTo(startGuideline, 8.dp)
|
||||
end.linkTo(parent.end, 16.dp)
|
||||
top.linkTo(mockRef.bottom, 16.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
},
|
||||
navHostController = navHostController,
|
||||
)
|
||||
|
||||
DazzleDesignSystemBubble(
|
||||
modifier =
|
||||
Modifier.constrainAs(dazzleDesignSystemRef) {
|
||||
start.linkTo(parent.start, 16.dp)
|
||||
end.linkTo(parent.end, 16.dp)
|
||||
top.linkTo(playgroundRef.bottom, 16.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
},
|
||||
navHostController = navHostController,
|
||||
modifier = Modifier.constrainAs(dazzleDesignSystemRef) {
|
||||
start.linkTo(startGuideline, 16.dp)
|
||||
end.linkTo(parent.end, 16.dp)
|
||||
top.linkTo(designSystemRef.bottom, 16.dp)
|
||||
width = Dimension.fillToConstraints
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DesignSystemBubble(navHostController: NavHostController, modifier: Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.height(120.dp)
|
||||
.background(color = Color.Green, shape = CircleShape)
|
||||
.shadow(shape = CircleShape, elevation = 4.dp, ambientColor = Color.Green)
|
||||
.clickable {
|
||||
navHostController.navigate(DESIGN_SYSTEM)
|
||||
}, contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "Design\nSystem",
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight(800),
|
||||
fontFamily = fontFamily
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun PlaygroundBubble(navHostController: NavHostController, modifier: Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.height(400.dp)
|
||||
.background(PurpleDCD1F4, shape = RoundedCornerShape(16.dp))
|
||||
.clickable {
|
||||
navHostController.navigate(PLAYGROUND)
|
||||
}, contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "Playground",
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight(800),
|
||||
fontFamily = fontFamily
|
||||
)
|
||||
}
|
||||
Bubble(
|
||||
modifier = modifier,
|
||||
navHostController = navHostController,
|
||||
height = 400,
|
||||
cornerRadius = 24,
|
||||
backgroundColor = PinkCC2FD5,
|
||||
navigationRoute = PLAYGROUND,
|
||||
title = "Playground"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MockBubble(navHostController: NavHostController, modifier: Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.height(200.dp)
|
||||
.background(RedEF0000, shape = RoundedCornerShape(16.dp))
|
||||
.clickable {
|
||||
navHostController.navigate(MOCK)
|
||||
}, contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "Mock \nTesting",
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight(800),
|
||||
fontFamily = fontFamily
|
||||
)
|
||||
}
|
||||
Bubble(
|
||||
modifier = modifier,
|
||||
navHostController = navHostController,
|
||||
height = 100,
|
||||
cornerRadius = 24,
|
||||
backgroundColor = Purple5A43E3,
|
||||
navigationRoute = MOCK,
|
||||
title = "Mock Testing"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DesignSystemBubble(navHostController: NavHostController, modifier: Modifier) {
|
||||
Bubble(
|
||||
modifier = modifier,
|
||||
navHostController = navHostController,
|
||||
height = 284,
|
||||
cornerRadius = 24,
|
||||
backgroundColor = OrangeFF9000,
|
||||
navigationRoute = DESIGN_SYSTEM,
|
||||
title = "Design System"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DazzleDesignSystemBubble(navHostController: NavHostController, modifier: Modifier) {
|
||||
Bubble(
|
||||
modifier = modifier,
|
||||
navHostController = navHostController,
|
||||
height = 100,
|
||||
cornerRadius = 24,
|
||||
backgroundColor = Color.Black,
|
||||
navigationRoute = DAZZLE_DESIGN_SYSTEM,
|
||||
title = "Dazzle Design System"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Bubble(
|
||||
navHostController: NavHostController,
|
||||
modifier: Modifier,
|
||||
height: Int,
|
||||
cornerRadius: Int,
|
||||
backgroundColor: Color,
|
||||
navigationRoute: String,
|
||||
title: String
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.height(150.dp)
|
||||
.background(color = Color.Cyan, shape = RoundedCornerShape(40.dp))
|
||||
.clickable {
|
||||
navHostController.navigate(DAZZLE_DESIGN_SYSTEM)
|
||||
}, contentAlignment = Alignment.Center
|
||||
modifier =
|
||||
modifier
|
||||
.height(height.dp)
|
||||
.background(color = backgroundColor, shape = RoundedCornerShape(cornerRadius.dp))
|
||||
.clickable { navHostController.navigate(navigationRoute) },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "Dazzle\nDesign\nSystem",
|
||||
modifier = Modifier.padding(16.dp),
|
||||
text = title,
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight(800),
|
||||
fontFamily = fontFamily
|
||||
fontWeight = FontWeight(700),
|
||||
fontFamily = fontFamily,
|
||||
textAlign = TextAlign.Center,
|
||||
color = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
import androidx.compose.foundation.layout.*
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -14,55 +27,44 @@ import com.navi.uitron.render.UiTronRenderer
|
||||
import com.navi.uitron.viewmodel.UiTronViewModel
|
||||
import com.uitron.demo.mockApiResponse
|
||||
|
||||
/**
|
||||
* Copyright © 2023 by Navi Technologies Private Limited
|
||||
* All rights reserved. Strictly confidential
|
||||
*/
|
||||
|
||||
@Composable
|
||||
fun MockScreen() {
|
||||
val mockValue = remember {
|
||||
mutableStateOf(
|
||||
"dobMock"
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(20.dp)
|
||||
) {
|
||||
val mockValue = remember { mutableStateOf("dobMock") }
|
||||
Column(modifier = Modifier.fillMaxSize().padding(20.dp)) {
|
||||
OutlinedTextField(
|
||||
value = mockValue.value, onValueChange = { newValue ->
|
||||
mockValue.value = newValue
|
||||
}, modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(60.dp)
|
||||
value = mockValue.value,
|
||||
onValueChange = { newValue -> mockValue.value = newValue },
|
||||
modifier = Modifier.fillMaxWidth().height(60.dp),
|
||||
colors =
|
||||
TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = Color.Black,
|
||||
unfocusedBorderColor = Color.Black
|
||||
),
|
||||
singleLine = true,
|
||||
maxLines = 1
|
||||
)
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.fillMaxSize()
|
||||
) {
|
||||
Column(modifier = Modifier.fillMaxWidth().fillMaxSize()) {
|
||||
if (mockValue.value.isEmpty().not()) {
|
||||
val context = LocalContext.current
|
||||
var errorMessage: String? = null
|
||||
val uiTronResponse: UiTronResponse? = try {
|
||||
val type = object : TypeToken<UiTronResponse>() {}.type
|
||||
mockApiResponse<UiTronResponse>(context, type, mockValue.value)
|
||||
} catch (e: Exception) {
|
||||
errorMessage = e.message
|
||||
null
|
||||
}
|
||||
val uiTronResponse: UiTronResponse? =
|
||||
try {
|
||||
val type = object : TypeToken<UiTronResponse>() {}.type
|
||||
mockApiResponse<UiTronResponse>(context, type, mockValue.value)
|
||||
} catch (e: Exception) {
|
||||
errorMessage = e.message
|
||||
null
|
||||
}
|
||||
uiTronResponse?.let {
|
||||
UiTronRenderer(uiTronResponse.data, uiTronViewModel = UiTronViewModel())
|
||||
.Render(composeViews = uiTronResponse.parentComposeView.orEmpty())
|
||||
} ?: kotlin.run {
|
||||
Text(text = "Error In Mock Config \n $errorMessage", color = Color.Red)
|
||||
}
|
||||
?: kotlin.run {
|
||||
Text(text = "Error In Mock Config \n $errorMessage", color = Color.Red)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.NavType
|
||||
@@ -6,38 +13,30 @@ import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navArgument
|
||||
import com.uitron.demo.dazzledesignsystem.ui.DazzleDesignSystemScreen
|
||||
import com.uitron.demo.home.HomeScreen
|
||||
import com.uitron.demo.navigation.*
|
||||
import com.uitron.demo.playground.PlayGroundScreen
|
||||
import com.uitron.demo.navigation.DAZZLE_DESIGN_SYSTEM
|
||||
import com.uitron.demo.navigation.DESIGN_REPO_WITH_NAV
|
||||
import com.uitron.demo.navigation.DESIGN_SYSTEM
|
||||
import com.uitron.demo.navigation.HOME
|
||||
import com.uitron.demo.navigation.MOCK
|
||||
import com.uitron.demo.navigation.PLAYGROUND
|
||||
import com.uitron.demo.playground.PlaygroundScreen
|
||||
|
||||
@Composable
|
||||
fun UiTronDemoNavGraph(navController: NavHostController) {
|
||||
NavHost(
|
||||
navController = navController, startDestination = HOME
|
||||
) {
|
||||
composable(route = HOME) {
|
||||
HomeScreen(navController)
|
||||
}
|
||||
NavHost(navController = navController, startDestination = HOME) {
|
||||
composable(route = HOME) { HomeScreen(navController) }
|
||||
|
||||
composable(route = PLAYGROUND) {
|
||||
PlayGroundScreen()
|
||||
}
|
||||
composable(route = PLAYGROUND) { PlaygroundScreen() }
|
||||
|
||||
composable(route = MOCK) {
|
||||
MockScreen()
|
||||
}
|
||||
composable(route = MOCK) { MockScreen() }
|
||||
|
||||
composable(route = DESIGN_SYSTEM) {
|
||||
DesignSystemScreen(navHostController = navController)
|
||||
}
|
||||
composable(route = DESIGN_SYSTEM) { DesignSystemScreen(navHostController = navController) }
|
||||
composable(
|
||||
route = DESIGN_REPO_WITH_NAV,
|
||||
arguments = listOf(navArgument("id") { type = NavType.StringType })
|
||||
) {
|
||||
DesignSystemRepoScreen(designComponentId = it.arguments?.get("id").toString())
|
||||
}
|
||||
composable(route = DAZZLE_DESIGN_SYSTEM) {
|
||||
DazzleDesignSystemScreen()
|
||||
}
|
||||
composable(route = DAZZLE_DESIGN_SYSTEM) { DazzleDesignSystemScreen() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.uitron.demo.playground
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -12,64 +25,47 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.navi.uitron.model.UiTronResponse
|
||||
import com.navi.uitron.render.UiTronRenderer
|
||||
import com.navi.uitron.viewmodel.UiTronViewModel
|
||||
import com.uitron.demo.stringToUiTronResponse
|
||||
import com.uitron.demo.theme.UiTronTheme
|
||||
import com.navi.uitron.viewmodel.UiTronViewModel
|
||||
import java.lang.Exception
|
||||
|
||||
/**
|
||||
* Copyright © 2021 by Navi Technologies Private Limited
|
||||
* All rights reserved. Strictly confidential
|
||||
*/
|
||||
@Composable
|
||||
fun PlayGroundScreen() {
|
||||
val fieldValue = remember {
|
||||
mutableStateOf(
|
||||
""
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(20.dp)
|
||||
) {
|
||||
fun PlaygroundScreen() {
|
||||
val fieldValue = remember { mutableStateOf("") }
|
||||
Column(modifier = Modifier.fillMaxSize().padding(20.dp)) {
|
||||
OutlinedTextField(
|
||||
value = fieldValue.value, onValueChange = { newValue ->
|
||||
fieldValue.value = newValue
|
||||
}, modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(200.dp)
|
||||
value = fieldValue.value,
|
||||
onValueChange = { newValue -> fieldValue.value = newValue },
|
||||
modifier = Modifier.fillMaxWidth().height(200.dp),
|
||||
colors =
|
||||
TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = Color.Black,
|
||||
unfocusedBorderColor = Color.Black
|
||||
)
|
||||
)
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.fillMaxSize()
|
||||
) {
|
||||
Column(modifier = Modifier.fillMaxWidth().fillMaxSize()) {
|
||||
if (fieldValue.value.isEmpty().not()) {
|
||||
var errorMessage = "Error In Config"
|
||||
val uiTronResponse: UiTronResponse? = try {
|
||||
stringToUiTronResponse(rawString = fieldValue.value)
|
||||
} catch (e: Exception) {
|
||||
errorMessage = e.toString()
|
||||
null
|
||||
}
|
||||
val uiTronResponse: UiTronResponse? =
|
||||
try {
|
||||
stringToUiTronResponse(rawString = fieldValue.value)
|
||||
} catch (e: Exception) {
|
||||
errorMessage = e.toString()
|
||||
null
|
||||
}
|
||||
uiTronResponse?.let {
|
||||
UiTronRenderer(uiTronResponse.data, uiTronViewModel = UiTronViewModel())
|
||||
.Render(composeViews = uiTronResponse.parentComposeView.orEmpty())
|
||||
} ?: kotlin.run {
|
||||
Text(text = errorMessage, color = Color.Red)
|
||||
}
|
||||
?: kotlin.run { Text(text = errorMessage, color = Color.Red) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun DefaultPreview() {
|
||||
UiTronTheme {
|
||||
PlayGroundScreen()
|
||||
}
|
||||
}
|
||||
UiTronTheme { PlaygroundScreen() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
package com.demo.uitron.theme
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.uitron.demo.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
@@ -6,19 +13,8 @@ val Purple200 = Color(0xFFBB86FC)
|
||||
val Purple500 = Color(0xFF6200EE)
|
||||
val Purple700 = Color(0xFF3700B3)
|
||||
val Teal200 = Color(0xFF03DAC5)
|
||||
val NaviRed = Color(0xFFFF5732)
|
||||
val DividerGray = Color(0x1A000000)
|
||||
val NaviBlack = Color(0xFF1A1A1A)
|
||||
val NaviGray = Color(0xFFA3A3AB)
|
||||
val Purple4B4968 = Color(0xFF4B4968)
|
||||
val Green14BC51 = Color(0xFF14BC51)
|
||||
val Blue22223D = Color(0xFF22223D)
|
||||
val Black191919 = Color(0xFF191919)
|
||||
val GrayE3E5E5 = Color(0xFFE3E5E5)
|
||||
val RedEF0000 = Color(0xFFEF0000)
|
||||
val WhiteF8F8F8 = Color(0xFFF8F8F8)
|
||||
val Black444444 = Color(0xFF444444)
|
||||
val PurpleDCD1F4 = Color(0xFFDCD1F4)
|
||||
val WhiteF7F7F7 = Color(0xFFF7F7F7)
|
||||
val Black1C1C1C = Color(0xFF1C1C1C)
|
||||
val Blue0276FE = Color(0xFF0276FE)
|
||||
@@ -30,4 +26,6 @@ val Purple1F002A = Color(0xFF1F002A)
|
||||
val BlueE4EEFF = Color(0xFFE4EEFF)
|
||||
val GrayA8A8A8 = Color(0xFFA8A8A8)
|
||||
val WhiteF5F5F5 = Color(0xFFF5F5F5)
|
||||
|
||||
val Purple5A43E3 = Color(0xFF5A43E3)
|
||||
val OrangeFF9000 = Color(0xFFFF9000)
|
||||
val PinkCC2FD5 = Color(0xFFCC2FD5)
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.uitron.demo.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
@@ -5,41 +12,34 @@ import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.demo.uitron.theme.*
|
||||
|
||||
private val DarkColorPalette = darkColors(
|
||||
primary = Purple200,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200
|
||||
)
|
||||
private val DarkColorPalette =
|
||||
darkColors(
|
||||
primary = Purple200,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200,
|
||||
)
|
||||
|
||||
private val LightColorPalette = lightColors(
|
||||
primary = Purple500,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200
|
||||
|
||||
/* Other default colors to override
|
||||
background = Color.White,
|
||||
surface = Color.White,
|
||||
onPrimary = Color.White,
|
||||
onSecondary = Color.Black,
|
||||
onBackground = Color.Black,
|
||||
onSurface = Color.Black,
|
||||
*/
|
||||
)
|
||||
private val LightColorPalette =
|
||||
lightColors(
|
||||
primary = Purple500,
|
||||
primaryVariant = Purple700,
|
||||
secondary = Teal200,
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun UiTronTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
||||
val colors = if (darkTheme) {
|
||||
DarkColorPalette
|
||||
} else {
|
||||
LightColorPalette
|
||||
}
|
||||
val colors =
|
||||
if (darkTheme) {
|
||||
DarkColorPalette
|
||||
} else {
|
||||
LightColorPalette
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colors = colors,
|
||||
typography = Typography,
|
||||
shapes = Shapes,
|
||||
content = content
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.UiTron" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<style name="Theme.UiTron" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
|
||||
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -1,6 +1,6 @@
|
||||
<resources>
|
||||
<string name="app_name">UiTron</string>
|
||||
<string name="title_activity_main">UiTron Demo Home</string>
|
||||
<string name="title_activity_main">UiTron</string>
|
||||
<string name="filter_by">FILTER BY ></string>
|
||||
<string name="clear_all">Clear All</string>
|
||||
<string name="apply_filters">Apply Filters</string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.UiTron" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<style name="Theme.UiTron" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
|
||||