Plugin and Desktop app for parsing layout xml into Composable code

Overview

composed-xml

Inspired by - Recompose

composed-xml is a tool for parsing Android layouts into Jetpack Compose code. It can work as both Desktop app or Intelij/Android Studio plugin.

Docs

Examples

<androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <TextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Current Number: 0"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"/>

    <Button
            android:id="@+id/btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Increase"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toEndOf="@id/text"/>

</androidx.constraintlayout.widget.ConstraintLayout>

===>

package temp

import androidx.compose.foundation.layout.ConstrainedLayoutReference
import androidx.compose.foundation.layout.ConstraintLayout
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.sp
import kotlin.Unit

@Composable
public fun Content(): Unit {
    ConstraintLayout (modifier = Modifier.fillMaxWidth().fillMaxHeight()) {
        val textRef = ConstrainedLayoutReference(Any())
        val btnRef = ConstrainedLayoutReference(Any())
        Text("Current Number: 0", modifier =
        Modifier.wrapContentWidth().wrapContentHeight().constrainAs(textRef, {
            top.linkTo(parent.top)
            start.linkTo(parent.start)
        }
        ))
        Button(onClick = {}, modifier =
        Modifier.wrapContentWidth().wrapContentHeight().constrainAs(btnRef, {
            top.linkTo(parent.top)
            start.linkTo(textRef.end)
        }
        )) {
            Text("Increase", modifier = Modifier.wrapContentWidth().wrapContentHeight())
        }
    }
}
Comments
  • Make Composable review prettier

    Make Composable review prettier

    Background

    Right now we are showing Composable review like this:

    drawing

    It would be better and more readable to highlight Kotlin keywords and change their colors so generated code is more expressive.

    Task

    We should change color of :

    • import
    • public fun
    • @Composable

    Bonus

    Change color of named parameters to blue.

    help wanted desktop app 
    opened by kacmacuna 0
  • Separate plugin from core logic

    Separate plugin from core logic

    Background

    Right now we have only one module where we write both core and plugin code.

    Problem

    In order project to be more flexible core logic code should not be dependent on plugin. So we should create two modules.

    Core - code generation stuff Plugin - intelij plugin stuff

    help wanted good first issue 
    opened by kacmacuna 0
  • Integrate FileTree in Desktop Application

    Integrate FileTree in Desktop Application

    Is your feature request related to a problem? Please describe. There is gonna be ton of layout xml files lying around so it would be great if we could have FileTree integrated in desktop application, so user could directly open their desired layout xml file and see generated code for it.

    Describe the solution you'd like I don't have clear solution rn for it but we should look into codeviewer to fully grasp the scope of this feature.

    Screenshot_4

    help wanted desktop app 
    opened by kacmacuna 0
  • Paste generated code inside of existed file

    Paste generated code inside of existed file

    Is your feature request related to a problem? Please describe. Many times when translating xml layout to composable users will want to directly copy generated code inside of existed file.

    Describe the solution you'd like When user chooses file before generating code, we should paste the code at the end of the file. We should also keep in mind to remove package name and for now imports too from generated code, so it does not cause compile errors.

    Additional context For now we can force users to import necessary libraries manually.

    help wanted plugin 
    opened by kacmacuna 1
  • Open AS when running :runIde

    Open AS when running :runIde

    Background

    Currently when running intelij-plugin:runIde intelij is opened. We want to open the app in Android Studio so we can test functionality better.

    How to do it

    Intelij-Guide Medium Article

    help wanted plugin 
    opened by kacmacuna 0
Owner
Bacho Kurtanidze
Bacho Kurtanidze
Kotlin extensions, BindingAdapters, Composable functions for Android CameraX

Setup dependencies { implementation "com.github.skgmn:cameraxx:0.6.0" } Features CameraXX provides extensions methods for CameraX to use functions

null 12 Aug 9, 2022
CodeLab for the workshop: A Composable New World

A Composable New World! Compose is here! ?? I've created a codelab where you can follow step by step the development of android application using Comp

Carlos Mota 8 Jul 2, 2022
Plugin to integrate EventStoreDB into Ktor-Server!

Ktor Plugin EventStoreDB EventStoreDB is an open-source database technology that stores your critical data in streams of immutable events. It was buil

null 7 Sep 1, 2022
Xoxo is a simple wrapper around org.w3c.dom to parse XML using nice Kotlin APIs

Xoxo ?? Xoxo is a simple wrapper around org.w3c.dom to parse XML using nice Kotlin APIs. No more NodeList, .item(), etc... just use .children, .filter

Martin Bonnin 51 Sep 1, 2022
An Android app where you can view and examine the details of fast food divided into categories.

?? FastFood An Android application where you can view and examine the details of fast food divided into categories. ?? Tech Stack & Open-Source Librar

Muhammed Esad Cömert 3 Oct 7, 2022
A clean-aesthetically pleasing Measuring Application, which uses relevant sensors-converts raw sensor data into human readable formatted outputs-and displays accurate measurements.

Measure App A clean-aesthetically pleasing Measuring Application, which uses relevant sensors-converts raw sensor data into human readable formatted o

ACM Student Chapter, PESU ECC 1 Oct 15, 2021
Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.

JetBrains 9.8k Nov 25, 2022
A study into creating a fully automatic FRC robot

AutoFRC This is a study into creating a fully automatic FRC robot. This process relies on several key algorithms: pose estiation: using the WpiLib Dif

null 1 Jun 29, 2022
A deep learning based mobile application for the multi-class classification of pneumonia into three categories via Chest X-rays

PneumoniaClassifier A deep learning based mobile application for the multi-class classification of pneumonia into three categories via Chest X-rays. W

Timilehin Aregbesola 2 Dec 15, 2021
Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions

Kafka Processor CØSMOS-Block A Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions. Purpose The Kafka Processor CØSMOS-Block is b

OKP4 – Open Knowledge Protocol For 4 Nov 23, 2022
MiStoryView is a simple configurable library to integrate stories features into your social media android application.

MiStoryView MiStoryView is a simple configurable library to integrate stories features into your social media android application. Preview Key feature

MindInventory 35 Nov 20, 2022
A Gradle plugin providing various utility methods and common code required to set up multi-version Minecraft mods.

Essential Gradle Toolkit A Gradle plugin providing various utility methods and common code required to set up multi-version Minecraft mods via archite

Essential 29 Nov 1, 2022
A clone of hn.premii.com implemented in KMP with Web (React), iOS (Swift UI), Android and Desktop (Compose) UIs

An clone of hn.premii.com implemented in Kotlin Multiplatform with shared Android/Desktop Compose UI, SwiftUI on iOS and React for Web This example su

Tarek Belkahia 7 Feb 5, 2022
Advent of Code 2021 in Kotlin, solved by myself. Focus on code readability. With GitHub Actions all puzzles are executed and their solutions printed

Advent of Code 2021 in Kotlin Focus on Code Readability. With CI Solution Printing. Welcome to the Advent of Code1 Kotlin project created by michaeltr

Michael Troger 1 Dec 12, 2021
A simple plugin to patch the memory leak in Kotlin Gradle Plugin 1.5.0

kgp-150-leak-patcher A simple plugin to automatically patch the memory leak in Kotlin Gradle Plugin 1.5.0 in https://youtrack.jetbrains.com/issue/KT-4

Zac Sweers 40 Dec 20, 2021
Static code analysis plugin for Android project. (Checkstyle, PMD)

Android Check Static code analysis plugin for Android project. Usage Modifications in <project_dir>/build.gradle: buildscript { repositories { jce

Noveo Group 269 Nov 10, 2022
Android Kotlin Fundamentals codelab(Lesson 2: Layouts(Constraints Layout))

ColorsMyView Finished code for Android Kotlin Fundamentals codelab(Lesson 2: Layouts(Constraints Layout)) Introduction The ColorMyViews app is inspire

Animesh Roy 0 Nov 26, 2021