-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
me-design/src/main/java/com/rocqjones/me_design/screens/GeneratedHomeScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.rocqjones.me_design.screens | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.LazyRow | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.rocqjones.me_design.ui.theme.MeSDKTheme | ||
import com.rocqjones.me_logic.models.CardInfo | ||
import com.rocqjones.me_logic.providers.SampleDataSource | ||
|
||
@Composable | ||
fun GenHomeScreen() { | ||
Column(modifier = Modifier.padding(16.dp)) { | ||
Text("Good Afternoon,", style = MaterialTheme.typography.titleSmall) | ||
Text("Jones", style = MaterialTheme.typography.titleLarge) | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
|
||
// Use LazyRow for efficient scrolling if the number of buttons can grow | ||
LazyRow( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) // Use spacedBy for consistent spacing | ||
) { | ||
items(listOf("Home", "Emergency", "GariSearch", "PataPesa", "More")) { item -> | ||
Button(onClick = { | ||
// Handle navigation based on the item clicked | ||
when (item) { | ||
"Home" -> { /* navigate to home */ } | ||
"Emergency" -> { /* navigate to emergency */ } | ||
// ... and so on | ||
} | ||
}) { | ||
Text(item) | ||
} | ||
} | ||
} | ||
|
||
Spacer(modifier = Modifier.height(16.dp)) | ||
|
||
val cardInfoList = getCardInfo() | ||
// Use LazyColumn for efficient list rendering | ||
LazyColumn(verticalArrangement = Arrangement.spacedBy(16.dp)) { | ||
items(cardInfoList) { cardInfo -> | ||
Card( | ||
modifier = Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surface), | ||
) { | ||
Column(modifier = Modifier.padding(16.dp)) { // Add padding within the card | ||
Text(cardInfo.title, style = MaterialTheme.typography.titleMedium) | ||
Text(cardInfo.description, style = MaterialTheme.typography.bodyMedium) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
// Dummy function to get card info (replace with actual data fetching) | ||
fun getCardInfo(): List<CardInfo> { | ||
return SampleDataSource.genList | ||
} | ||
|
||
@Preview( | ||
showBackground = true, | ||
widthDp = 300, | ||
heightDp = 600 | ||
) | ||
@Composable | ||
fun GreetingPreview() { | ||
MeSDKTheme { | ||
GenHomeScreen() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
me-logic/src/main/java/com/rocqjones/me_logic/models/CardInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.rocqjones.me_logic.models | ||
|
||
data class CardInfo(val title: String, val description: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
me-logic/src/main/java/com/rocqjones/me_logic/providers/SampleDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.rocqjones.me_logic.providers | ||
|
||
import com.rocqjones.me_logic.models.CardInfo | ||
|
||
object SampleDataSource { | ||
val genList = listOf( | ||
CardInfo("Tools for Compose", "Android Studio brings a lot of new features specifically for Jetpack Compose. It embraces a code-first approach while improving the developer productivity without having to choose between using design interface or code editor."), | ||
CardInfo("Iterative code development", "As a mobile developer, you're often developing your app's UI step by step rather than developing everything at once. Android Studio embraces this approach with Jetpack Compose by providing tools that don't require a full build to inspect, modify values, and verify the final result."), | ||
CardInfo("Live Edit", "Live Edit is a feature that lets you update composables in emulators and physical devices in real time. This functionality minimizes context switches between writing and building your app, letting you focus on writing code longer without interruption."), | ||
CardInfo("Make and review changes", "As you make supported changes in the editor, the virtual or physical test device updates automatically."), | ||
CardInfo("Make and review changes", "As you make supported changes in the editor, the virtual or physical test device updates automatically."), | ||
CardInfo("Make and review changes", "As you make supported changes in the editor, the virtual or physical test device updates automatically."), | ||
CardInfo("Iterative code development", "As a mobile developer, you're often developing your app's UI step by step rather than developing everything at once. Android Studio embraces this approach with Jetpack Compose by providing tools that don't require a full build to inspect, modify values, and verify the final result."), | ||
CardInfo("Tools for Compose", "Android Studio brings a lot of new features specifically for Jetpack Compose. It embraces a code-first approach while improving the developer productivity without having to choose between using design interface or code editor."), | ||
) | ||
} |