[
  {
    "path": ".gitignore",
    "content": "*.idea\n*.properties\n*.iml\n/*/build\n/*/facebook/build\n/.idea/workspace.xml\n/.idea/libraries\n/.idea\n/build\n.gradle\n.DS_Store\n.classpath\n.project\n.metadata/\n.settings\nbin/\ngen/\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "MaskedEditText/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "MaskedEditText/build.gradle",
    "content": "apply plugin: 'com.android.library'\napply plugin: 'kotlin-android'\n\next {\n    PUBLISH_GROUP_ID = 'io.github.vicmikhailau'\n    PUBLISH_VERSION = '5.0.3'\n    PUBLISH_ARTIFACT_ID = 'MaskedEditText'\n}\napply from: \"${rootProject.projectDir}/scripts/publish-mavencentral.gradle\"\n\nandroid {\n    compileSdk 35\n\n    defaultConfig {\n        minSdkVersion 23\n        targetSdkVersion 35\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n\n    sourceSets {\n        all {\n            it.java.srcDir \"src/$it.name/kotlin\"\n        }\n    }\n\n    kotlinOptions {\n        jvmTarget = \"17\"\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_17\n        targetCompatibility JavaVersion.VERSION_17\n    }\n\n    namespace 'com.vicmikhailau.maskededittext'\n}\n\n\next {\n    androidx_appcompat = '1.7.0'\n    androidx_core_ktx = '1.15.0'\n}\n\ndependencies {\n    api fileTree(dir: 'libs', include: ['*.jar'])\n    implementation \"androidx.appcompat:appcompat:$androidx_appcompat\"\n    implementation \"androidx.core:core-ktx:$androidx_core_ktx\"\n}\n"
  },
  {
    "path": "MaskedEditText/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/victor/Library/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "MaskedEditText/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <application android:label=\"@string/app_name\"/>\n</manifest>\n"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/IFormattedString.kt",
    "content": "package com.vicmikhailau.maskededittext\n\n\ninterface IFormattedString : CharSequence {\n    val unMaskedString: String\n}\n\n\ninternal abstract class AbstractFormattedString(val mMask: Mask, val inputString: String) : IFormattedString {\n    private var mFormattedString: String? = null\n    final override val unMaskedString: String\n\n\n    init {\n        unMaskedString = this.buildRawString(inputString)\n    }\n\n\n    internal abstract fun formatString(): String\n\n    internal abstract fun buildRawString(str: String): String\n\n\n    override val length: Int\n        get() = toString().length\n\n    override fun toString(): String {\n        return mFormattedString ?: formatString()\n    }\n\n    override fun subSequence(startIndex: Int, endIndex: Int): CharSequence {\n        return toString().subSequence(startIndex, endIndex)\n    }\n\n    override fun get(index: Int): Char {\n        return toString()[index]\n    }\n}\n\ninternal class FormattedString(mask: Mask, rawString: String) : AbstractFormattedString(mask, rawString) {\n\n    override fun buildRawString(str: String): String {\n        val builder = StringBuilder()\n        val inputLen = mMask.size().coerceAtMost(str.length)\n        for (i in 0 ..< inputLen) {\n            val ch = str[i]\n            if (!mMask.isValidPrepopulateCharacter(ch, i))\n                builder.append(ch)\n        }\n        return builder.toString()\n    }\n\n    override fun formatString(): String {\n        val builder = StringBuilder()\n\n        var strIndex = 0\n        var maskCharIndex = 0\n        var stringCharacter: Char\n\n        while (strIndex < inputString.length && maskCharIndex < mMask.size()) {\n            val maskChar = mMask[maskCharIndex]\n\n            stringCharacter = inputString[strIndex]\n\n            when {\n                maskChar.isValidCharacter(stringCharacter) -> {\n                    builder.append(maskChar.processCharacter(stringCharacter))\n                    strIndex += 1\n                    maskCharIndex += 1\n                }\n                maskChar.isPrepopulate -> {\n                    builder.append(maskChar.processCharacter(stringCharacter))\n                    maskCharIndex += 1\n                }\n                else -> strIndex += 1\n            }\n        }\n\n        return builder.toString()\n    }\n}"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/Mask.kt",
    "content": "package com.vicmikhailau.maskededittext\n\nimport java.util.*\n\n\nclass Mask() {\n    lateinit var formatString: String\n    private lateinit var mMask: List<MaskCharacter>\n    private val mFabric: MaskCharacterFabric = MaskCharacterFabric()\n    private var mPrepopulateCharacter: MutableList<MaskCharacter>? = null\n\n    constructor(fmtString: String) : this() {\n        formatString = fmtString\n        mMask = buildMask(formatString)\n    }\n\n    fun size(): Int {\n        return mMask.size\n    }\n\n    operator fun get(index: Int): MaskCharacter {\n        return mMask[index]\n    }\n\n\n    fun isValidPrepopulateCharacter(ch: Char, at: Int): Boolean {\n        return try {\n            val character = mMask[at]\n            character.isPrepopulate && character.isValidCharacter(ch)\n        } catch (e: IndexOutOfBoundsException) {\n            false\n        }\n\n    }\n\n    fun isValidPrepopulateCharacter(ch: Char): Boolean {\n        for (maskCharacter in mPrepopulateCharacter!!) {\n            if (maskCharacter.isValidCharacter(ch)) {\n                return true\n            }\n        }\n        return false\n    }\n\n\n    private fun buildMask(fmtString: String): List<MaskCharacter> {\n        val result = ArrayList<MaskCharacter>()\n        mPrepopulateCharacter = ArrayList()\n        for (ch in fmtString.toCharArray()) {\n            val maskCharacter = mFabric.buildCharacter(ch)\n            if (maskCharacter?.isPrepopulate == true) {\n                mPrepopulateCharacter?.add(maskCharacter)\n            }\n            maskCharacter?.let { result.add(it) }\n        }\n        return result\n    }\n\n\n    fun getFormattedString(value: String): IFormattedString {\n        return FormattedString(this, value)\n    }\n\n\n}\n"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/MaskCharacter.kt",
    "content": "package com.vicmikhailau.maskededittext\n\n\nabstract class MaskCharacter {\n\n    open val isPrepopulate: Boolean\n        get() = false\n\n    abstract fun isValidCharacter(ch: Char): Boolean\n\n    open fun processCharacter(ch: Char): Char {\n        return ch\n    }\n\n}\n\ninternal class DigitCharacter : MaskCharacter() {\n    override fun isValidCharacter(ch: Char): Boolean {\n        return Character.isDigit(ch)\n    }\n\n}\n\ninternal class UpperCaseCharacter : MaskCharacter() {\n    override fun isValidCharacter(ch: Char): Boolean {\n        return Character.isUpperCase(ch)\n    }\n\n    override fun processCharacter(ch: Char): Char {\n        return Character.toUpperCase(ch)\n    }\n}\n\n\ninternal class LowerCaseCharacter : MaskCharacter() {\n    override fun isValidCharacter(ch: Char): Boolean {\n        return Character.isLowerCase(ch)\n    }\n\n    override fun processCharacter(ch: Char): Char {\n        return Character.toLowerCase(ch)\n    }\n}\n\ninternal class AlphaNumericCharacter : MaskCharacter() {\n    override fun isValidCharacter(ch: Char): Boolean {\n        return Character.isLetterOrDigit(ch)\n    }\n}\n\ninternal class LetterCharacter : MaskCharacter() {\n    override fun isValidCharacter(ch: Char): Boolean {\n        return Character.isLetter(ch)\n    }\n}\n\ninternal class HexCharacter : MaskCharacter() {\n\n    override fun isValidCharacter(ch: Char): Boolean {\n        return Character.isLetterOrDigit(ch) && HEX_CHARS.indexOf(Character.toUpperCase(ch)) != -1\n    }\n\n    override fun processCharacter(ch: Char): Char {\n        return Character.toUpperCase(ch)\n    }\n\n    companion object {\n        private val HEX_CHARS = \"0123456789ABCDEF\"\n    }\n}\n\ninternal class LiteralCharacter : MaskCharacter {\n    private var character: Char? = null\n\n    override val isPrepopulate: Boolean\n        get() = character != null\n\n    constructor() {\n        character = null\n    }\n\n    constructor(ch: Char) {\n        character = ch\n    }\n\n    override fun isValidCharacter(ch: Char): Boolean {\n        return character == null || character == ch\n    }\n\n\n    override fun processCharacter(ch: Char): Char {\n        return if (character != null) character!! else ch\n    }\n}\n\n"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/MaskCharacterFabric.kt",
    "content": "package com.vicmikhailau.maskededittext\n\n\ninternal class MaskCharacterFabric {\n\n    fun buildCharacter(ch: Char): MaskCharacter? {\n        return when (ch) {\n            ANYTHING_KEY -> LiteralCharacter()\n            DIGIT_KEY -> DigitCharacter()\n            UPPERCASE_KEY -> UpperCaseCharacter()\n            LOWERCASE_KEY -> LowerCaseCharacter()\n            ALPHA_NUMERIC_KEY -> AlphaNumericCharacter()\n            CHARACTER_KEY -> LetterCharacter()\n            HEX_KEY -> HexCharacter()\n            else -> {\n                LiteralCharacter(ch)\n            }\n        }\n    }\n\n    companion object {\n        private const val ANYTHING_KEY = '*'\n        private const val DIGIT_KEY = '#'\n        private const val UPPERCASE_KEY = 'U'\n        private const val LOWERCASE_KEY = 'L'\n        private const val ALPHA_NUMERIC_KEY = 'A'\n        private const val CHARACTER_KEY = '?'\n        private const val HEX_KEY = 'H'\n    }\n}\n\n"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/MaskedEditText.kt",
    "content": "package com.vicmikhailau.maskededittext\n\nimport android.content.Context\nimport android.text.Editable\nimport android.util.AttributeSet\nimport androidx.appcompat.widget.AppCompatEditText\nimport com.vicmikhailau.maskededittext.R.*\n\nclass MaskedEditText(context: Context, attrs: AttributeSet) : AppCompatEditText(context, attrs) {\n\n    // ===========================================================\n    // Constructors\n    // ===========================================================\n\n    // ===========================================================\n    // Fields\n    // ===========================================================\n\n    private var maskedFormatter: MaskedFormatter? = null\n    var maskedWatcher: MaskedWatcher? = null\n\n    // ===========================================================\n    // Getter & Setter\n    // ===========================================================\n\n    val maskString: String?\n        get() = maskedFormatter?.maskString\n\n    val unMaskedText: String?\n        get() {\n            val currentText = text?.toString()\n            val formattedString = currentText?.let { maskedFormatter?.formatString(it) }\n            return formattedString?.unMaskedString\n        }\n\n    init {\n\n        val typedArray = context.obtainStyledAttributes(attrs, styleable.MaskedEditText)\n\n        if (typedArray.hasValue(styleable.MaskedEditText_mask)) {\n            val maskStr = typedArray.getString(styleable.MaskedEditText_mask)\n\n            if (!maskStr.isNullOrEmpty()) {\n                setMask(maskStr)\n            }\n        }\n\n        typedArray.recycle()\n    }\n\n    fun setMask(mMaskStr: String) {\n        maskedFormatter = MaskedFormatter(mMaskStr)\n\n        if (maskedWatcher != null) {\n            removeTextChangedListener(maskedWatcher)\n        }\n\n        maskedFormatter?.let { maskedWatcher = MaskedWatcher(it, this) }\n        addTextChangedListener(maskedWatcher)\n    }\n}\n\n/**\n * Add an action which will be invoked before the text changed.\n * @return the [MaskedWatcher] added to the MaskedEditText\n */\nfun MaskedEditText.doBeforeMaskedTextChanged(\n        action: (\n                text: CharSequence?,\n                start: Int,\n                count: Int,\n                after: Int\n        ) -> Unit\n) = maskedWatcher?.apply {\n    addTextChangedListener(beforeTextChanged = action)\n}\n\n/**\n * Add an action which will be invoked when the text is changing.\n * @return the [MaskedWatcher] added to the MaskedEditText\n */\nfun MaskedEditText.doOnMaskedTextChanged(\n        action: (\n                text: CharSequence?,\n                start: Int,\n                before: Int,\n                count: Int\n        ) -> Unit\n) = maskedWatcher?.apply {\n    addTextChangedListener(onTextChanged = action)\n}\n\n/**\n * Add an action which will be invoked after the text changed.\n * @return the [MaskedWatcher] added to the MaskedEditText\n */\nfun MaskedEditText.doAfterMaskedTextChanged(\n        action: (text: Editable?) -> Unit\n) = maskedWatcher?.apply {\n    addTextChangedListener(afterTextChanged = action)\n}\n\n/**\n * Add a text changed listener to this MaskedEditTest using the provided actions\n * @return the [MaskedWatcher] added to the MaskedEditText\n */\nfun MaskedEditText.addMaskedTextChangedListener(\n        beforeMaskedTextChanged: ((\n                text: CharSequence?,\n                start: Int,\n                count: Int,\n                after: Int\n        ) -> Unit)? = null,\n        onMaskedTextChanged: ((\n                text: CharSequence?,\n                start: Int,\n                before: Int,\n                count: Int\n        ) -> Unit)? = null,\n        afterMaskedTextChanged: ((text: Editable?) -> Unit)? = null\n) = maskedWatcher?.apply {\n    addTextChangedListener(\n            beforeMaskedTextChanged,\n            onMaskedTextChanged,\n            afterMaskedTextChanged\n    )\n}\n"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/MaskedFormatter.kt",
    "content": "package com.vicmikhailau.maskededittext\n\n\nclass MaskedFormatter internal constructor() {\n    internal var mMask: Mask? = null\n\n\n    val maskString: String?\n        get() = mMask?.formatString\n\n    val maskLength: Int?\n        get() = mMask?.size()\n\n    init {\n        mMask = null\n    }\n\n    constructor(fmtString: String) : this() {\n        this.setMask(fmtString)\n    }\n\n    fun setMask(fmtString: String) {\n        mMask = Mask(fmtString)\n    }\n\n\n    fun formatString(value: String): IFormattedString? {\n        return mMask?.getFormattedString(value)\n    }\n\n}\n"
  },
  {
    "path": "MaskedEditText/src/main/java/com/vicmikhailau/maskededittext/MaskedWatcher.kt",
    "content": "package com.vicmikhailau.maskededittext\n\nimport android.text.Editable\nimport android.text.TextWatcher\nimport android.widget.EditText\n\nimport java.lang.ref.WeakReference\n\nopen class MaskedWatcher(maskedFormatter: MaskedFormatter, editText: EditText) : TextWatcher {\n\n    // ===========================================================\n    // Constructors\n    // ===========================================================\n\n    // ===========================================================\n    // Fields\n    // ===========================================================\n\n    private val mMaskFormatter: MaskedFormatter = maskedFormatter\n    private val mEditText: WeakReference<EditText> = WeakReference(editText)\n    private var oldFormattedValue = \"\"\n    private var oldCursorPosition: Int = 0\n\n    // Listeners.\n    private var beforeTextChanged: ((text: CharSequence?, start: Int, count: Int, after: Int) -> Unit)? = null\n    private var onTextChanged: ((text: CharSequence?, start: Int, before: Int, count: Int) -> Unit)? = null\n    private var afterTextChanged: ((text: Editable?) -> Unit)? = null\n\n    // ===========================================================\n    // Listeners, methods for/from Interfaces\n    // ===========================================================\n\n    fun addTextChangedListener(\n            beforeTextChanged: ((\n                    text: CharSequence?,\n                    start: Int,\n                    count: Int,\n                    after: Int\n            ) -> Unit)? = null,\n            onTextChanged: ((\n                    text: CharSequence?,\n                    start: Int,\n                    before: Int,\n                    count: Int\n            ) -> Unit)? = null,\n            afterTextChanged: ((text: Editable?) -> Unit)? = null) {\n        this.beforeTextChanged = beforeTextChanged\n        this.onTextChanged = onTextChanged\n        this.afterTextChanged = afterTextChanged\n    }\n\n    private fun setFormattedText(formattedString: IFormattedString) {\n        val editText = mEditText.get() ?: return\n\n        val deltaLength = formattedString.length - oldFormattedValue.length\n\n\n        editText.removeTextChangedListener(this)\n        editText.setText(formattedString)\n        editText.addTextChangedListener(this)\n\n        var newCursorPosition = oldCursorPosition\n\n        if (deltaLength > 0) {\n            newCursorPosition += deltaLength\n        } else if (deltaLength < 0) {\n            newCursorPosition -= 1\n        } else {\n            var mask: Mask? = null\n            mMaskFormatter.mMask?.let { mask = it }\n\n            var maskLength = 0\n            mMaskFormatter.maskLength?.let { maskLength = it}\n            newCursorPosition = 1.coerceAtLeast(newCursorPosition.coerceAtMost(maskLength))\n\n\n            var isPopulate = false\n            mask?.get(newCursorPosition - 1)?.isPrepopulate?.let { isPopulate = it }\n            if (isPopulate)\n                newCursorPosition -= 1\n        }\n        newCursorPosition = 0.coerceAtLeast(newCursorPosition.coerceAtMost(formattedString.length))\n        editText.setSelection(newCursorPosition)\n    }\n\n    override fun afterTextChanged(s: Editable?) {\n        if (s == null)\n            return\n\n        var value = s.toString()\n\n        var maskLength = 0\n        mMaskFormatter.maskLength?.let { maskLength = it}\n\n        if (value.length > oldFormattedValue.length && maskLength < value.length) {\n            value = oldFormattedValue\n        }\n\n        val formattedString = mMaskFormatter.formatString(value)\n\n        formattedString?.let {\n            setFormattedText(it)\n            oldFormattedValue = it.toString()\n        }\n        afterTextChanged?.invoke(mEditText.get()?.text ?: s)\n    }\n\n    override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {\n        mEditText.get()?.selectionStart?.let { this.oldCursorPosition = it }\n        beforeTextChanged?.invoke(s, start, count, after)\n    }\n\n    override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {\n        onTextChanged?.invoke(s, start, before, count)\n    }\n}\n"
  },
  {
    "path": "MaskedEditText/src/main/res/values/attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"MaskedEditText\">\n        <attr name=\"mask\" format=\"string\" />\n    </declare-styleable>\n</resources>"
  },
  {
    "path": "MaskedEditText/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">MaskedEditText</string>\n</resources>\n"
  },
  {
    "path": "README.md",
    "content": "[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.vicmikhailau/MaskedEditText/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.vicmikhailau/MaskedEditText)\n[![GitHub license](https://img.shields.io/github/license/VicMikhailau/MaskedEditText)](https://github.com/VicMikhailau/MaskedEditText/blob/master/LICENSE)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-MaskedEditText-green.svg?style=true)](https://android-arsenal.com/details/1/3659)\n# MaskedEditText\n\nIt allows you to add a mask to EditText\n\n![GIF of its use](https://github.com/VicMikhailau/MaskedEditText/blob/master/resources/masked_edit_text.gif)\n\n# Version\n\n5.0.3\n\n# Installation\n\n**Step 1**: Add MavenCentral and Jitpack to your repositories in your *project* level `build.gradle` file:\n\n```gradle\nallprojects {\n    repositories {\n        mavenCentral()\n    }\n}\n```\n\n**Step 2**: Add the library as a dependency in your *module* level `build.gradle` file:\n\n*Groovy:*\n\n```sh\ndependencies {\n    implementation 'io.github.vicmikhailau:MaskedEditText:5.0.3'\n}\n```\n\n*Kotlin:*\n\n```sh\ndependencies {\n    implementation(\"io.github.vicmikhailau:MaskedEditText:5.0.3\")\n}\n```\n\n# Usage\n\nJust add in xml custom MaskedEditText with attribute app:mask=\"your_mask\" like below:\n\n```xml\n<com.vicmikhailau.maskededittext.MaskedEditText\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:mask=\"your_mask\" />\n```\nOr add TextChangedListener for your EditText like in following code:\n\n```\nval formatter = MaskedFormatter(\"your_mask\")\nmEditText.addTextChangedListener(MaskedWatcher(formatter, mEditText))\n```\nConnect to the MaskedWatcher for your MaskedEditText through:\n\n```\nmMaskedEditText.addMaskedTextChangedListener\nmMaskedEditText.doBeforeMaskedTextChanged\nmMaskedEditText.doOnMaskedTextChanged\nmMaskedEditText.doAfterMaskedTextChanged\n```\n\nOr use MaskedWatcher reference:\n\n```\nmaskedWatcher.addTextChangedListener\n```\n\n**For create your mask you need to use following keys:**\n```\nANYTHING KEY = *\nDIGIT KEY = #\nUPPERCASE KEY = U\nLOWERCASE KEY = L\nALPHA NUMERIC KEY = A\nCHARACTER KEY = ?\nHEX KEY = H\n```\n\nFor example: you would like create a mask for a mobile number in format **(029)777-77-77**. Just use the simple mask **\"(###)###-##-##\"**.\n\n**If you want to get text without mask just use following code:**\n - For getting unmasked text for **mEdtMaskedCustom: MaskedEditText** just use\n \n    ```\n    val unamskedString = mEdtMaskedCustom.unMaskedText\n    ```\n - For getting unmasked text for default EditText just use\n \n    ```\n    val text = mEditText.text.toString()\n    val unmaskedString = formatter.formatString(text).unMaskedString\n    ```\n\n# Kotlin dependency in pure Java project\n\nAdd in your build.gradle: ```implementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version\"```\nhttps://github.com/VicMikhailau/MaskedEditText/issues/27\n\n# Fixes and updates\n\nUnfortunately, there is no way to devote much time to the project. Please feel free to Fork the project and add Pull requests. Thanks a lot!\n\n# Change Logs\n\n### v5.0.3\n\nUpdated dependencies and targetSdk to 35.\n\n### v5.0.2\n\nUpdated dependencies and targetSdk to 34.\n\n### v5.0.1\n\nAdded convenient MaskedEditText listeners.\n\n### v5.0.0\n\nUpdated dependencies and targetSdk to 33.\n\n### v4.0.7\n\nFixed InflateException appeared in 4.0.6.\n\n### v4.0.6\n\nUpdated Gradle and libraries. Changed targetSdkVersion to 31.\n\n### v4.0.5\n\nMoved project to the MavenCentral. Changed groupId to io.github.vicmikhailau\n\n### v3.1.1\n\nUpdated Gradle and libraries.\n\n### v3.1.0\n\nUpdated Gradle and libraries.\n\n### v3.0.4\n\nFixes (Pull Request #26).\n\n### v3.0.3\n\nRemoved private attribute of the setMask function (Pull Request #25).\n\n### v3.0.2\n\nChanged asserts to safe call (Pull Request #23).\n\n### v3.0.1\n\nMoved library to androidx and kotlin.\n\n\n## Licence\nCopyright 2021 Victor Mikhailau<br />\n<br />\nLicensed under the Apache License, Version 2.0 (the \"License\");<br />\nyou may not use this file except in compliance with the License.<br />\nYou may obtain a copy of the License at<br />\n<br />\n   http://www.apache.org/licenses/LICENSE-2.0<br />\n<br />\nUnless required by applicable law or agreed to in writing, software<br />\ndistributed under the License is distributed on an \"AS IS\" BASIS,<br />\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br />\nSee the License for the specific language governing permissions and<br />\nlimitations under the License.\n\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\napply plugin: 'kotlin-android'\n\nandroid {\n    compileSdk 35\n\n    defaultConfig {\n        applicationId \"com.vicmikhailau.maskededittextsample\"\n        minSdkVersion 23\n        targetSdkVersion 35\n        versionCode 1\n        versionName \"1.0\"\n        multiDexEnabled true\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n\n    kotlinOptions {\n        jvmTarget = \"17\"\n    }\n\n    compileOptions {\n        // Flag to enable support for the new language APIs.\n        coreLibraryDesugaringEnabled true\n        sourceCompatibility JavaVersion.VERSION_17\n        targetCompatibility JavaVersion.VERSION_17\n    }\n\n    buildFeatures {\n        viewBinding true\n    }\n    namespace 'com.vicmikhailau.maskededittextsample'\n}\n\next {\n    desugar_jdk_libs = '2.1.3'\n    androidx_appcompat = '1.7.0'\n    androidx_core_ktx = '1.15.0'\n}\n\ndependencies {\n    implementation fileTree(include: ['*.jar'], dir: 'libs')\n    coreLibraryDesugaring \"com.android.tools:desugar_jdk_libs:$desugar_jdk_libs\"\n    testImplementation 'junit:junit:4.13.2'\n    implementation \"androidx.appcompat:appcompat:$androidx_appcompat\"\n    implementation project(':MaskedEditText')\n    implementation \"androidx.core:core-ktx:$androidx_core_ktx\"\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/victor/Library/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/AppTheme\">\n        <activity android:name=\".MainActivity\"\n            android:exported=\"true\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n</manifest>"
  },
  {
    "path": "app/src/main/java/com/vicmikhailau/maskededittextsample/MainActivity.kt",
    "content": "package com.vicmikhailau.maskededittextsample\n\nimport android.os.Bundle\nimport androidx.appcompat.app.AppCompatActivity\nimport com.vicmikhailau.maskededittext.MaskedFormatter\nimport com.vicmikhailau.maskededittext.MaskedWatcher\nimport com.vicmikhailau.maskededittext.addMaskedTextChangedListener\nimport com.vicmikhailau.maskededittext.doAfterMaskedTextChanged\nimport com.vicmikhailau.maskededittext.doBeforeMaskedTextChanged\nimport com.vicmikhailau.maskededittext.doOnMaskedTextChanged\nimport com.vicmikhailau.maskededittextsample.databinding.ActivityMainBinding\n\nclass MainActivity : AppCompatActivity() {\n\n    /**\n     * Use specific values for create your own mask (see example below or in xml):\n     * ANYTHING_KEY = '*'\n     * DIGIT_KEY = '#'\n     * UPPERCASE_KEY = 'U';\n     * LOWERCASE_KEY = 'L';\n     * ALPHA_NUMERIC_KEY = 'A';\n     * LITERAL_KEY = '\\'';\n     * CHARACTER_KEY = '?';\n     * HEX_KEY = 'H';\n     */\n\n    /**\n     * For getting unmasked text for MaskedEditText mEdtMaskedCustom just use mEdtMaskedCustom.getUnMaskedString().\n     * For getting unmasked text for default EditText just use formatter.formatString(text).getUnMaskedString().\n     */\n\n    // ===========================================================\n    // Constants\n    // ===========================================================\n\n    // ===========================================================\n    // Fields\n    // ===========================================================\n\n    private var formatter: MaskedFormatter? = null\n\n    private lateinit var binding: ActivityMainBinding\n\n    // ===========================================================\n    // Constructors\n    // ===========================================================\n\n    // ===========================================================\n    // Getter & Setter\n    // ===========================================================\n\n    // ===========================================================\n    // Methods for/from SuperClass\n    // ===========================================================\n\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        binding = ActivityMainBinding.inflate(layoutInflater)\n        setContentView(binding.root)\n        setMask(\"##/##/####\")\n        setListener()\n    }\n\n    fun setListener() {\n        // Sample.\n        binding.apply{\n            edtMaskedCustomSample.apply {\n                // Common.\n                addMaskedTextChangedListener(\n                        beforeMaskedTextChanged = { _: CharSequence?, _: Int, _: Int, _: Int -> },\n                        onMaskedTextChanged = { _: CharSequence?, _: Int, _: Int, _: Int -> },\n                        afterMaskedTextChanged = {}\n                )\n\n                // Separate.\n                doBeforeMaskedTextChanged { text, start, count, after ->  }\n                doOnMaskedTextChanged { text, start, before, count ->  }\n                doAfterMaskedTextChanged {  }\n            }\n        }\n    }\n\n    // ===========================================================\n    // Listeners, methods for/from Interfaces\n    // ===========================================================\n\n    // ===========================================================\n    // Methods\n    // ===========================================================\n\n    /**\n     * You cas use MaskedEditText declared in xml with attribute named mask\n     * or\n     * set mask in code for default EdiText\n     *\n     * @param mask your mask\n     */\n    private fun setMask(mask: String) {\n        formatter = MaskedFormatter(mask)\n        formatter?.let{\n            binding.edtMasked.addTextChangedListener(MaskedWatcher(it, binding.edtMasked))\n        }\n        val s = formatter?.formatString(binding.edtMasked.text.toString())?.unMaskedString\n    }\n\n    private fun getUnMaskedTextForEdtCustom() {\n        binding.edtMaskedCustom.unMaskedText\n    }\n\n    // ===========================================================\n    // Inner and Anonymous Classes\n    // ===========================================================\n}\n"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout 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    android:orientation=\"vertical\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\"\n    android:gravity=\"center\"\n    tools:context=\"com.vicmikhailau.maskededittextsample.MainActivity\">\n\n\n    <com.vicmikhailau.maskededittext.MaskedEditText\n        android:id=\"@+id/edtMaskedCustom\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginBottom=\"30dp\"\n        android:hint=\"@string/edt_masked_custom_mobile_hint\"\n        android:textColor=\"@android:color/black\"\n        android:inputType=\"phone\"\n        app:mask=\"(###)###-##-##\" />\n\n    <EditText\n        android:id=\"@+id/edtMasked\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginBottom=\"30dp\"\n        android:hint=\"@string/edt_masked_date_hint\"\n        android:inputType=\"date\"\n        android:textColor=\"@android:color/black\" />\n\n    <com.vicmikhailau.maskededittext.MaskedEditText\n        android:id=\"@+id/edtMaskedCustomSample\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:hint=\"@string/edt_masked_custom_sample_hint\"\n        android:textColor=\"@android:color/black\"\n        android:inputType=\"number\"\n        android:digits=\"0,1,2,3,4,5,6,7,8,9,.\"\n        app:mask=\"##.##.##\" />\n\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">MaskedEditTextSample</string>\n    <string name=\"edt_masked_custom_sample_hint\">12.12.12</string>\n    <string name=\"edt_masked_custom_mobile_hint\">(029)777-77-77</string>\n    <string name=\"edt_masked_date_hint\">12/12/2019</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "build.gradle.kts",
    "content": "plugins {\n    id(\"com.android.application\") version \"8.7.2\" apply false\n    id(\"com.android.library\") version \"8.7.2\" apply false\n    id(\"org.jetbrains.kotlin.android\") version \"2.0.21\" apply false\n}\n\ntasks.register(\"clean\", Delete::class) {\n    delete(rootProject.layout.buildDirectory)\n}"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:init\r\n@rem Get command-line arguments, handling Windowz variants\r\n\r\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\r\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\r\n\r\n:win9xME_args\r\n@rem Slurp the command line arguments.\r\nset CMD_LINE_ARGS=\r\nset _SKIP=2\r\n\r\n:win9xME_args_slurp\r\nif \"x%~1\" == \"x\" goto execute\r\n\r\nset CMD_LINE_ARGS=%*\r\ngoto execute\r\n\r\n:4NT_args\r\n@rem Get arguments from the 4NT Shell from JP Software\r\nset CMD_LINE_ARGS=%$\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "scripts/publish-mavencentral.gradle",
    "content": "apply plugin: 'maven-publish'\napply plugin: 'signing'\n\ntask androidSourcesJar(type: Jar) {\n    archiveClassifier.set('sources')\n    if (project.plugins.findPlugin(\"com.android.library\")) {\n        // For Android libraries\n        from android.sourceSets.main.java.srcDirs\n        from android.sourceSets.main.kotlin.srcDirs\n    } else {\n        // For pure Kotlin libraries, in case you have them\n        from sourceSets.main.java.srcDirs\n        from sourceSets.main.kotlin.srcDirs\n    }\n}\nartifacts {\n    archives androidSourcesJar\n}\n\ngroup = PUBLISH_GROUP_ID\nversion = PUBLISH_VERSION\n\next[\"signing.keyId\"] = ''\next[\"signing.password\"] = ''\next[\"signing.secretKeyRingFile\"] = ''\next[\"ossrhUsername\"] = ''\next[\"ossrhPassword\"] = ''\next[\"sonatypeStagingProfileId\"] = ''\n\nFile secretPropsFile = project.rootProject.file('local.properties')\nif (secretPropsFile.exists()) {\n    Properties p = new Properties()\n    new FileInputStream(secretPropsFile).withCloseable { is ->\n        p.load(is)\n    }\n    p.each { name, value ->\n        ext[name] = value\n    }\n} else {\n    ext[\"signing.keyId\"] = System.getenv('SIGNING_KEY_ID')\n    ext[\"signing.password\"] = System.getenv('SIGNING_PASSWORD')\n    ext[\"signing.secretKeyRingFile\"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')\n    ext[\"ossrhUsername\"] = System.getenv('OSSRH_USERNAME')\n    ext[\"ossrhPassword\"] = System.getenv('OSSRH_PASSWORD')\n    ext[\"sonatypeStagingProfileId\"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')\n}\n\npublishing {\n    publications {\n        release(MavenPublication) {\n            // The coordinates of the library, being set from variables that\n            // we'll set up later\n            groupId PUBLISH_GROUP_ID\n            artifactId PUBLISH_ARTIFACT_ID\n            version PUBLISH_VERSION\n\n            // Two artifacts, the `aar` (or `jar`) and the sources\n            if (project.plugins.findPlugin(\"com.android.library\")) {\n                artifact(\"$buildDir/outputs/aar/${project.getName()}-release.aar\")\n            } else {\n                artifact(\"$buildDir/libs/${project.getName()}-${version}.jar\")\n            }\n            artifact androidSourcesJar\n\n            // Mostly self-explanatory metadata\n            pom {\n                name = PUBLISH_ARTIFACT_ID\n                description = 'It allows you to add a mask to EditText.'\n                url = 'https://github.com/VicMikhailau/MaskedEditText'\n                licenses {\n                    license {\n                        name = 'MaskedEditText License'\n                        url = 'https://github.com/VicMikhailau/MaskedEditText/blob/master/LICENSE'\n                    }\n                }\n                developers {\n                    developer {\n                        id = 'VicMikhailau'\n                        name = 'Victor Mikhailau'\n                        email = 'vicmikhailau@gmail.com'\n                    }\n                    // Add all other devs here...\n                }\n                // Version control info - if you're using GitHub, follow the format as seen here\n                scm {\n                    connection = 'scm:git:github.com:VicMikhailau/MaskedEditText.git'\n                    developerConnection = 'scm:git:ssh://github.com:VicMikhailau/MaskedEditText.git'\n                    url = 'https://github.com:VicMikhailau/MaskedEditText/tree/main'\n                }\n            }\n        }\n    }\n    // The repository to publish to, Sonatype/MavenCentral\n    repositories {\n        maven {\n            // This is an arbitrary name, you may also use \"mavencentral\" or\n            // any other name that's descriptive for you\n            name = \"sonatype\"\n            url = \"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/\"\n            credentials {\n                username ossrhUsername\n                password ossrhPassword\n            }\n        }\n    }\n}\n\nsigning {\n    sign publishing.publications\n}"
  },
  {
    "path": "settings.gradle.kts",
    "content": "pluginManagement {\n    repositories {\n        gradlePluginPortal()\n        google()\n        mavenCentral()\n        maven { url = uri(\"https://jitpack.io\") }\n    }\n}\ndependencyResolutionManagement {\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n    repositories {\n        google()\n        mavenCentral()\n        maven { url = uri(\"https://jitpack.io\") }\n    }\n}\ninclude(\":app\", \":MaskedEditText\")"
  }
]