All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.autonomousapps.kit.android.AndroidManifest.kt Maven / Gradle / Ivy

The newest version!
// Copyright (c) 2024. Tony Robalik.
// SPDX-License-Identifier: Apache-2.0
package com.autonomousapps.kit.android

public class AndroidManifest(public val content: String) {

  override fun toString(): String = content

  public companion object {

    @JvmStatic
    public fun of(content: String): AndroidManifest = AndroidManifest(content)

    @JvmStatic
    public fun simpleApp(): AndroidManifest = AndroidManifest(
      """
      |
      |
      |
      |
      |
      |
      """.trimMargin()
    )

    @JvmStatic
    public fun app(
      application: String? = null,
      activities: List = emptyList(),
    ): AndroidManifest = AndroidManifest(
      """
      |
      |
      |
      |
      |  ${activities.joinToString(separator = "\n") { activityBlock(it) }}
      |  
      |
      """.trimMargin()
    )

    @JvmStatic
    public fun appWithoutPackage(application: String? = null): AndroidManifest {
      return AndroidManifest(
        """
        |
        |
        |
        |
        |  ${activityBlock()}
        |  
        |
        """.trimMargin()
      )
    }

    @JvmStatic
    public fun app(application: String? = null): AndroidManifest {
      return AndroidManifest(
        """
        |
        |
        |
        |
        |  ${activityBlock()}
        |  
        |
        """.trimMargin()
      )
    }

    private fun activityBlock(activityName: String = "MainActivity"): String =
      """
      |  
      |    
      |      
      |      
      |    
      |  """

    @JvmField
    public val DEFAULT_APP: AndroidManifest = app(null)

    @JvmStatic
    public fun defaultLib(packageName: String): AndroidManifest = AndroidManifest(
      """
      |
      |
      """.trimMargin()
    )
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy