Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47d317bc authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Create address book/calendar: set error on TextInputLayout instead of...

Create address book/calendar: set error on TextInputLayout instead of TextInputEditText, optimize layout
parent b918b49e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -83,10 +83,10 @@ class CreateAddressBookActivity: AppCompatActivity() {

        val parent = model.homeSet
        if (parent != null) {
            binding.homeset.error = null
            binding.homesetLayout.error = null
            args.putString(CreateCollectionFragment.ARG_URL, parent.url.resolve(UUID.randomUUID().toString() + "/").toString())
        } else {
            binding.homeset.error = getString(R.string.create_collection_home_set_required)
            binding.homesetLayout.error = getString(R.string.create_collection_home_set_required)
            ok = false
        }

+4 −5
Original line number Diff line number Diff line
@@ -109,13 +109,13 @@ class CreateCalendarActivity: AppCompatActivity(), ColorPickerDialogListener {

        val parent = model.homeSet
        if (parent != null) {
            binding.homeset.error = null
            binding.homesetLayout.error = null
            args.putString(
                CreateCollectionFragment.ARG_URL,
                parent.url.resolve(UUID.randomUUID().toString() + "/").toString()
            )
        } else {
            binding.homeset.error = getString(R.string.create_collection_home_set_required)
            binding.homesetLayout.error = getString(R.string.create_collection_home_set_required)
            ok = false
        }

@@ -137,10 +137,9 @@ class CreateCalendarActivity: AppCompatActivity(), ColorPickerDialogListener {
        }

        val tzId = model.timezone.value
        if (tzId.isNullOrBlank()) {
            model.timezoneError.value = getString(R.string.create_calendar_time_zone_required)
        if (tzId.isNullOrBlank())
            ok = false
        } else {
        else {
            DateUtils.ical4jTimeZone(tzId)?.let { tz ->
                val cal = Calendar()
                cal.components += tz.vTimeZone
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:hint="@string/create_collection_display_name"
                app:error="@{model.displayNameError}"
                app:errorEnabled="true"
                app:layout_constraintHorizontal_weight="1"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent">
@@ -51,6 +50,7 @@
                android:id="@+id/description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:hint="@string/create_collection_description"
                app:helperText="@string/create_collection_optional"
@@ -66,6 +66,7 @@
                android:id="@+id/homeset_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                app:layout_constraintTop_toBottomOf="@+id/description"
                app:layout_constraintStart_toStartOf="parent"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
+3 −3
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:hint="@string/create_collection_display_name"
                app:errorEnabled="true"
                app:error="@{model.displayNameError}"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                app:layout_constraintHorizontal_weight="1"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent"
@@ -61,8 +61,10 @@
                android:id="@+id/description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:hint="@string/create_collection_description"
                app:helperText="@string/create_collection_optional"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/display_name">
                <com.google.android.material.textfield.TextInputEditText
@@ -78,7 +80,6 @@
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/description"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                android:hint="@string/create_collection_home_set">
                <AutoCompleteTextView
@@ -96,7 +97,6 @@
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/homeset_layout"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                android:hint="@string/create_calendar_time_zone"
                app:error="@{model.timezoneError}">
+0 −1
Original line number Diff line number Diff line
@@ -363,7 +363,6 @@
    <string name="create_addressbook_display_name_hint">My Address Book</string>
    <string name="create_calendar">Create calendar</string>
    <string name="create_calendar_time_zone">Time zone</string>
    <string name="create_calendar_time_zone_required">Time zone required</string>
    <string name="create_calendar_type">Possible calendar entries</string>
    <string name="create_calendar_type_vevent">Events</string>
    <string name="create_calendar_type_vtodo">Tasks</string>