<commit_before>package main.generators.android_modules

import main.models.AndroidModuleBlueprint
import main.writers.FileWriter

class LayoutResourcesGenerator(val fileWriter: FileWriter) {

    /**
     * generates layout resources by blueprint and other resources, returns list of layout names to refer later.
     */
    fun generate(blueprint: AndroidModuleBlueprint,
                 stringResources: StringResourceGenerationResult,
                 imageResources: List<String>): List<String> {
        /*
        var result: ArrayList<String> = ArrayList()

        val imagesDir = blueprint.resDirPath.joinPath("drawable")
        fileWriter.mkdir(imagesDir)

        for (i in 0 until blueprint.numOfImages) {


            var layoutText = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                    "<android.support.constraint.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
                    "    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n" +
                    "    xmlns:tools=\"http://schemas.android.com/tools\"\n" +
                    "    android:layout_width=\"match_parent\"\n" +
                    "    android:layout_height=\"match_parent\"\n" +
                    "    tools:context=\"app.test.myapplication.MainActivity\">\n" +
                    "\n" +
                    "    <TextView\n" +
                    "        android:layout_width=\"wrap_content\"\n" +
                    "        android:layout_height=\"wrap_content\"\n" +
                    "        android:text=\"Hello World!\"\n" +
                    "        app:layout_constraintBottom_toBottomOf=\"parent\"\n" +
                    "        app:layout_constraintLeft_toLeftOf=\"parent\"\n" +
                    "        app:layout_constraintRight_toRightOf=\"parent\"\n" +
                    "        app:layout_constraintTop_toTopOf=\"parent\" />\n" +
                    "\n" +
                    " <ImageView\n" +
                    "         android:layout_width=\"wrap_content\"\n" +
                    "         android:layout_height=\"wrap_content\"\n" +
                    "         android:src=\"@drawable/" + imageResources[i]"\n"+
            "         />" +
                    "</android.support.constraint.ConstraintLayout>"


        }*/


        return listOf()
    }
}<commit_msg>pushed layouts<commit_after>package main.generators.android_modules

import main.models.AndroidModuleBlueprint
import main.utils.joinPath
import main.writers.FileWriter

class LayoutResourcesGenerator(val fileWriter: FileWriter) {

    /**
     * generates layout resources by blueprint and other resources, returns list of layout names to refer later.
     */
    fun generate(blueprint: AndroidModuleBlueprint,
                 stringResources: List<String>,
                 imageResources: List<String>): List<String> {

        var result: ArrayList<String> = ArrayList()

        val layoutsDir = blueprint.resDirPath.joinPath("layout")
        fileWriter.mkdir(layoutsDir)

        for (i in 0 until blueprint.numOfImages) {

            var layoutText = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                    "<android.support.constraint.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
                    "    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n" +
                    "    xmlns:tools=\"http://schemas.android.com/tools\"\n" +
                    "    android:layout_width=\"match_parent\"\n" +
                    "    android:layout_height=\"match_parent\"\n" +
                    "    tools:context=\"app.test.myapplication.MainActivity\">\n" +
                    "\n" +
                    "    <TextView\n" +
                    "        android:layout_width=\"wrap_content\"\n" +
                    "        android:layout_height=\"wrap_content\"\n" +
                    "        android:text=\"Hello World!\"\n" +
                    "        app:layout_constraintBottom_toBottomOf=\"parent\"\n" +
                    "        app:layout_constraintLeft_toLeftOf=\"parent\"\n" +
                    "        app:layout_constraintRight_toRightOf=\"parent\"\n" +
                    "        app:layout_constraintTop_toTopOf=\"parent\" />\n" +
                    "\n" +
                    " <ImageView\n" +
                    "         android:layout_width=\"wrap_content\"\n" +
                    "         android:layout_height=\"wrap_content\"\n" +
                    "         android:src=\"@drawable/" + imageResources[i] + "\n"+
            "         />" +
                    "</android.support.constraint.ConstraintLayout>"
            var fileName = "activity_main$i.xml"
            fileWriter.writeToFile(layoutText, layoutsDir.joinPath(fileName))
            result.add(fileName)
        }

        return result
    }
}
{'fraction_non_alphanumeric': 0.1307991007561823, 'fraction_numerical': 0.0016349887594522788, 'mean_word_length': 1.6468361276365604, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 2, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4742895', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1255, 'n_words': 170}