vvsdevs /
AndroidDynamicLayoutLoader
πAndroid library for inflating dynamic layouts in runtime based on JSON configuration fetched from server. Useful in situations when layouts need to change without updating the app.π
52/100 healthLoading repository dataβ¦
vvsdevs / repository
π Android Dynamic Jetpack Compose is a powerful library that enables dynamic layout rendering based on JSON configurations using Jetpack Compose. This library allows developers to design and update UI elements dynamically without needing to release a new app update, making it a flexible and efficient solution for Android applications.π
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Android Remote Jetpack Compose is a revolutionary library designed for server-side driven UI development in Android applications using Jetpack Compose. It allows developers to dynamically render layouts from JSON configurations, enabling seamless updates to app interfaces without releasing new versions. This flexibility is ideal for rapidly evolving projects, offering robust support for dynamic UI design and server-side integration.
Selected from shared topics, language and repository descriptionβnot editorial ratings.
vvsdevs /
πAndroid library for inflating dynamic layouts in runtime based on JSON configuration fetched from server. Useful in situations when layouts need to change without updating the app.π
52/100 healthbirdeveloper /
FlowWell: A Modern Android App Built with Jetpack Compose π | Explore dynamic layouts, intuitive navigation, and Compose best practices in this hands-on project!
37/100 healthServer-Side Driven UI (SSDU) is the future of mobile development, allowing for centralized UI management:
Add the Jitpack repository to your root build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to your module's build.gradle file:
dependencies {
implementation ("com.github.vvsdevs:AndroidDynamicJetpackCompose:1.9.0")
//Optional
implementation("com.google.dagger:hilt-android:2.51.1")
kapt("com.google.dagger:hilt-compiler:2.51.1")
implementation("androidx.navigation:navigation-compose:2.8.2")
implementation("androidx.activity:activity-compose:1.9.2")
}
Create a configuration for your layout using the RemoteComposeConfig class:
val config = RemoteComposeConfig(
baseUrl = "https://your-server-url.com/",
uiComponentPath = "compose.json",
screenPath = "compose_screen1.json"
)
@AndroidEntryPoint
class MainActivity : ComponentActivity(), ComposeCallback {
@Inject
lateinit var mainPresenter: MainPresenter
private val config = RemoteComposeConfig(
baseUrl = "https://example.com/",
uiComponentPath = "compose.json",
screenPath = "compose_screen1.json"
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mainPresenter.initialize(config)
mainPresenter.attachView(this)
mainPresenter.loadUiComponents()
setContent { MyApp() }
}
}
@Inject
lateinit var mainPresenter: MainPresenter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mainPresenter.initialize(config)
mainPresenter.attachView(this)
mainPresenter.loadUiComponents()
setContent { MyApp() }
}
private var uiComponent by mutableStateOf<UIComponent?>(null)
private var errorMessage by mutableStateOf("")
override fun showError(message: String) {
this.errorMessage = message
Log.e("MainActivity", "Error: $message")
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
}
override fun showComponents(components: UIComponent) {
uiComponent = components
Log.d("MainActivity", "Components loaded: $components")
}
//customization
@Composable
fun MyApp() {
DynamicLayout(uiComponent, navController, mainPresenter)
}
@Composable
fun MyApp() {
val context = LocalContext.current
val navController = rememberNavController()
BackHandler(enabled = true) {
if (!navController.popBackStack()) {
(context as? ComponentActivity)?.finish()
}
}
Scaffold(
topBar = {
TopAppBar(
title = { Text("Top Bar") },
actions = {
// Add any actions if needed
}
)
},
floatingActionButton = {
FloatingActionButton(onClick = { mainPresenter.loadUiComponents() }) {
Text("+")
}
}
) { paddingValues ->
Box(modifier = Modifier.padding(paddingValues)) {
NavHost(navController, startDestination = "mainScreen") {
composable("mainScreen") {
uiComponent?.let {
DynamicLayout(it, navController, mainPresenter)
}
}
composable("navigate/{screenId}") { backStackEntry ->
val screenId = backStackEntry.arguments?.getString("screenId")
screenId?.let {
LaunchedEffect(Unit) {
mainPresenter.loadScreenById(it) { success ->
if (!success) {
Toast.makeText(
context,
"Design for $screenId not found",
Toast.LENGTH_SHORT
).show()
}
}
}
}
uiComponent?.let {
DynamicLayout(it, navController, mainPresenter)
}
}
}
}
}
}
fun handleAction(action: String, context: Context, mainPresenter: MainPresenter) {
when (action) {
"navigateToScreen" -> { /* Handle screen navigation */ }
"fetchData" -> { /* Fetch data from the server */ }
else -> { /* Default action */ }
}
}
This manual provides detailed information on how to use and configure the components available in the Android Remote Jetpack Compose library. Each component is customizable with various properties and modifiers to fit your needs.
A container that holds multiple components.
ScreenComponent objects.UIComponent objects inside the container.ModifierData for styling.Represents a screen that holds multiple components.
UIComponent objects inside the screen.ModifierData for styling.Displays a piece of text with customization options.
ModifierData.