<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <import type="com.topjohnwu.magisk.extensions.XStringKt" />

        <variable
            name="data"
            type="com.topjohnwu.magisk.ui.settings.SettingsFragment.ManagerNameData" />

    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:orientation="vertical"
        android:paddingStart="@dimen/margin_generic"
        android:paddingTop="@dimen/margin_generic"
        android:paddingEnd="@dimen/margin_generic">

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/dialog_name_input"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/settings_app_name_hint"
            app:counterEnabled="true"
            app:counterMaxLength="14"
            app:counterOverflowTextColor="@color/colorError"
            app:error="@{data.name.length() > 14 || data.name.empty || XStringKt.isEmptyInternal(data.name) ? @string/settings_app_name_error : @string/empty}"
            app:errorEnabled="true"
            app:helperText="@string/settings_app_name_helper">

            <com.google.android.material.textfield.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@={data.name}"
                tools:text="@string/re_app_name" />

        </com.google.android.material.textfield.TextInputLayout>

    </LinearLayout>
</layout>